From 91e37a491b610fe05469fcc2342ac9be653cf06f Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 26 Dec 2003 21:30:06 +0000 Subject: [PATCH] Introduced NONRET macro pciutils.h, common.c, setpci.c: Introduced a NONRET macro encapsulating the GCC specific __attribute__((noreturn)) and killed the hack with redefining __attribute__ on non-GCC compilers. git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-10 --- ChangeLog | 4 ++++ common.c | 4 ++-- pciutils.h | 8 +++++--- setpci.c | 4 +--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17ab108..0a7a204 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2003-12-26 Martin Mares + * pciutils.h, common.c, setpci.c: Introduced a NONRET macro encapsulating + the GCC specific __attribute__((noreturn)) and killed the hack with + redefining __attribute__ on non-GCC compilers. + * Makefile: Added missing dependencies. Parallel builds work now. Problem reported by Andreas Haumer , but I chose a different fix. diff --git a/common.c b/common.c index 5b938dd..846b1e6 100644 --- a/common.c +++ b/common.c @@ -1,7 +1,7 @@ /* * Linux PCI Utilities -- Common Functions * - * Copyright (c) 1997--1999 Martin Mares + * Copyright (c) 1997--2003 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -14,7 +14,7 @@ #include "pciutils.h" -void __attribute__((noreturn)) +void NONRET die(char *msg, ...) { va_list args; diff --git a/pciutils.h b/pciutils.h index 0997df7..9631358 100644 --- a/pciutils.h +++ b/pciutils.h @@ -1,7 +1,7 @@ /* * Linux PCI Utilities -- Declarations * - * Copyright (c) 1997--1999 Martin Mares + * Copyright (c) 1997--2003 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -11,11 +11,13 @@ #define PCIUTILS_VERSION PCILIB_VERSION #if !defined(__GNUC__) -#define __attribute__(x) +#define NONRET #define inline +#else +#define NONRET __attribute__((noreturn)) #endif -void __attribute__((noreturn)) die(char *msg, ...); +void die(char *msg, ...) NONRET; void *xmalloc(unsigned int howmuch); int parse_generic_option(int i, struct pci_access *pacc, char *optarg); diff --git a/setpci.c b/setpci.c index a341507..8ee6f3a 100644 --- a/setpci.c +++ b/setpci.c @@ -249,9 +249,7 @@ static const struct reg_name pci_reg_names[] = { { 0x00, 0, NULL } }; -static void usage(void) __attribute__((noreturn)); - -static void +static void NONRET usage(void) { fprintf(stderr, -- 2.39.5