Don't interfere with a program's definition of __attribute__.
authorIan Beckwith <ianb@erislabs.net>
Wed, 16 Feb 2011 23:48:26 +0000 (23:48 +0000)
committerIan Beckwith <ianb@erislabs.net>
Wed, 16 Feb 2011 23:48:26 +0000 (23:48 +0000)
* lib/argp.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(argp_error, __argp_error, argp_failure, __argp_failure): Use it.
* lib/argp-fmtstream.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(__argp_fmtstream_printf, argp_fmtstream_printf): Use it.
* lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ only for
GCC 3 or newer.
* lib/error.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(error, error_at_line): Use it.
* lib/hash.h (__attribute__): Remove definition.
(ATTRIBUTE_WUR): Update definition. Define always.
* lib/openat.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/sigpipe-die.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/vasnprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(asnprintf, vasnprintf): Use it.
* lib/xalloc.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
(ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE): Define always.
* lib/xmemdup0.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/xprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(xprintf, xvprintf, xfprintf, xvfprintf): Use it.
* lib/xstrtol.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/xvasprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(xasprintf, xvasprintf): Use it.
* tests/test-argmatch.c (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* tests/test-exclude.c (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
Reported by Paul Eggert.
(cherry picked from commit f6a5a124d0cb326acd4dfa9ce3276baa26734b16)

16 files changed:
ChangeLog
lib/argp-fmtstream.h
lib/argp-help.c
lib/argp.h
lib/error.h
lib/hash.h
lib/openat.h
lib/sigpipe-die.h
lib/vasnprintf.h
lib/xalloc.h
lib/xmemdup0.h
lib/xprintf.h
lib/xstrtol.h
lib/xvasprintf.h
tests/test-argmatch.c
tests/test-exclude.c

index a4a9ce4..fd08dfe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,47 @@
 2011-02-13  Bruno Haible  <bruno@clisp.org>
 
+       Don't interfere with a program's definition of __attribute__.
+       * lib/argp.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (argp_error, __argp_error, argp_failure, __argp_failure): Use it.
+       * lib/argp-fmtstream.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (__argp_fmtstream_printf, argp_fmtstream_printf): Use it.
+       * lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ only for
+       GCC 3 or newer.
+       * lib/error.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (error, error_at_line): Use it.
+       * lib/hash.h (__attribute__): Remove definition.
+       (ATTRIBUTE_WUR): Update definition. Define always.
+       * lib/openat.h (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       * lib/sigpipe-die.h (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       * lib/vasnprintf.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (asnprintf, vasnprintf): Use it.
+       * lib/xalloc.h (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE): Define always.
+       * lib/xmemdup0.h (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       * lib/xprintf.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (xprintf, xvprintf, xfprintf, xvfprintf): Use it.
+       * lib/xstrtol.h (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       * lib/xvasprintf.h (__attribute__): Remove definition.
+       (_GL_ATTRIBUTE_FORMAT): New macro.
+       (xasprintf, xvasprintf): Use it.
+       * tests/test-argmatch.c (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       * tests/test-exclude.c (__attribute__): Remove definition.
+       (ATTRIBUTE_NORETURN): Update definition. Define always.
+       Reported by Paul Eggert.
+
+2011-02-13  Bruno Haible  <bruno@clisp.org>
+
        mbrtowc: Work around native Windows bug.
        * m4/mbrtowc.m4 (gl_MBRTOWC_RETVAL): Detect native Windows bug. Use the
        guess when no suitable locale for testing was found.
index 1642b0f..f664254 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 #if    (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
@@ -128,10 +128,10 @@ extern void argp_fmtstream_free (argp_fmtstream_t __fs);
 
 extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
                                         const char *__fmt, ...)
-     __attribute__ ((__format__ (printf, 2, 3)));
+     _GL_ATTRIBUTE_FORMAT ((printf, 2, 3));
 extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
                                       const char *__fmt, ...)
-     __attribute__ ((__format__ (printf, 2, 3)));
+     _GL_ATTRIBUTE_FORMAT ((printf, 2, 3));
 
 #if _LIBC || !defined __OPTIMIZE__
 extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
index 99f4a65..48c37a9 100644 (file)
@@ -570,7 +570,9 @@ hol_entry_short_iterate (const struct hol_entry *entry,
 }
 
 static inline int
+#if __GNUC__ >= 3
 __attribute__ ((always_inline))
+#endif
 hol_entry_long_iterate (const struct hol_entry *entry,
                         int (*func)(const struct argp_option *opt,
                                     const struct argp_option *real,
index dfb88d7..c0483ab 100644 (file)
 # define __NTH(fct) fct __THROW
 #endif
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 /* GCC 2.95 and later have "__restrict"; C99 compilers have
@@ -530,10 +530,10 @@ extern void __argp_usage (const struct argp_state *__state);
    message, then exit (1).  */
 extern void argp_error (const struct argp_state *__restrict __state,
                         const char *__restrict __fmt, ...)
-     __attribute__ ((__format__ (__printf__, 2, 3)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3));
 extern void __argp_error (const struct argp_state *__restrict __state,
                           const char *__restrict __fmt, ...)
-     __attribute__ ((__format__ (__printf__, 2, 3)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3));
 
 /* Similar to the standard gnu error-reporting function error(), but will
    respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
@@ -546,11 +546,11 @@ extern void __argp_error (const struct argp_state *__restrict __state,
 extern void argp_failure (const struct argp_state *__restrict __state,
                           int __status, int __errnum,
                           const char *__restrict __fmt, ...)
-     __attribute__ ((__format__ (__printf__, 4, 5)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5));
 extern void __argp_failure (const struct argp_state *__restrict __state,
                             int __status, int __errnum,
                             const char *__restrict __fmt, ...)
-     __attribute__ ((__format__ (__printf__, 4, 5)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5));
 
 #if _LIBC || !defined __USE_EXTERN_INLINES
 /* Returns true if the option OPT is a valid short option.  */
index 9a2a566..80f81bc 100644 (file)
 #ifndef _ERROR_H
 #define _ERROR_H 1
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 #ifdef __cplusplus
@@ -40,11 +40,11 @@ extern "C" {
    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
 
 extern void error (int __status, int __errnum, const char *__format, ...)
-     __attribute__ ((__format__ (__printf__, 3, 4)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
 
 extern void error_at_line (int __status, int __errnum, const char *__fname,
                            unsigned int __lineno, const char *__format, ...)
-     __attribute__ ((__format__ (__printf__, 5, 6)));
+     _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6));
 
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this
index 9c2f5b7..19671f6 100644 (file)
 # include <stdio.h>
 # include <stdbool.h>
 
-/* The warn_unused_result attribute appeared first in gcc-3.4.0 */
-# ifndef __attribute__
-#  if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-#   define __attribute__(x)
-#  endif
-# endif
-
-# ifndef ATTRIBUTE_WUR
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The warn_unused_result attribute appeared first in gcc-3.4.0.  */
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
 #  define ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__))
+# else
+#  define ATTRIBUTE_WUR /* empty */
 # endif
 
 typedef size_t (*Hash_hasher) (const void *, size_t);
index dd0bb01..9cf7e0f 100644 (file)
 #include <unistd.h>
 #include <stdbool.h>
 
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#  define __attribute__(x) /* empty */
-# endif
-#endif
-
-#ifndef ATTRIBUTE_NORETURN
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#else
+# define ATTRIBUTE_NORETURN /* empty */
 #endif
 
 #if !HAVE_OPENAT
index e725c16..4cbd920 100644 (file)
@@ -47,14 +47,10 @@ extern "C" {
 #endif
 
 
-# ifndef __attribute__
-#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#   define __attribute__(x)
-#  endif
-# endif
-
-# ifndef ATTRIBUTE_NORETURN
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 #  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+#  define ATTRIBUTE_NORETURN /* empty */
 # endif
 
 /* Emit an error message indicating a SIGPIPE signal, and terminate the
index 3d00df9..0ab7d19 100644 (file)
 /* Get size_t.  */
 #include <stddef.h>
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 #ifdef __cplusplus
@@ -69,9 +69,9 @@ extern "C" {
 # define vasnprintf rpl_vasnprintf
 #endif
 extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
+       _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
 extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
+       _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0));
 
 #ifdef __cplusplus
 }
index aaec116..30823b7 100644 (file)
@@ -26,30 +26,22 @@ extern "C" {
 # endif
 
 
-# ifndef __attribute__
-#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#   define __attribute__(x)
-#  endif
-# endif
-
-# ifndef ATTRIBUTE_NORETURN
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 #  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+#  define ATTRIBUTE_NORETURN /* empty */
 # endif
 
-# ifndef ATTRIBUTE_MALLOC
-#  if __GNUC__ >= 3
-#   define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-#  else
-#   define ATTRIBUTE_MALLOC
-#  endif
+# if __GNUC__ >= 3
+#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define ATTRIBUTE_MALLOC
 # endif
 
-# ifndef ATTRIBUTE_ALLOC_SIZE
-#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#   define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#  else
-#   define ATTRIBUTE_ALLOC_SIZE(args)
-#  endif
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#  define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
+# else
+#  define ATTRIBUTE_ALLOC_SIZE(args)
 # endif
 
 /* This function is always triggered when memory is exhausted.
index 8b50072..ff118a6 100644 (file)
 extern "C" {
 # endif
 
-# ifndef __attribute__
-#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#   define __attribute__(x)
-#  endif
-# endif
-
-# ifndef ATTRIBUTE_NORETURN
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 #  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+#  define ATTRIBUTE_NORETURN /* empty */
 # endif
 
 /* This function is always triggered when memory is exhausted.
index 9dd0443..ca48ce7 100644 (file)
 #include <stdarg.h>
 #include <stdio.h>
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 extern int xprintf (char const *restrict format, ...)
-  __attribute__ ((__format__ (__printf__, 1, 2)));
+  _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
 extern int xvprintf (char const *restrict format, va_list args)
-  __attribute__ ((__format__ (__printf__, 1, 0)));
+  _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 0));
 extern int xfprintf (FILE *restrict stream, char const *restrict format, ...)
-  __attribute__ ((__format__ (__printf__, 2, 3)));
+  _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3));
 extern int xvfprintf (FILE *restrict stream, char const *restrict format,
                       va_list args)
-  __attribute__ ((__format__ (__printf__, 2, 0)));
+  _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 0));
 
 #endif
index 530afc9..f91d864 100644 (file)
@@ -51,14 +51,10 @@ _DECLARE_XSTRTOL (xstrtoll, long long int)
 _DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
 #endif
 
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#  define __attribute__(x)
-# endif
-#endif
-
-#ifndef ATTRIBUTE_NORETURN
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#else
+# define ATTRIBUTE_NORETURN /* empty */
 #endif
 
 /* Report an error for an invalid integer in an option argument.
index 1ac3342..197c9ea 100644 (file)
 /* Get va_list.  */
 #include <stdarg.h>
 
-#ifndef __attribute__
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
    The __-protected variants of the attributes 'format' and 'printf' are
    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
-   We enable __attribute__ only if these are supported too, because
+   We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
    gnulib and libintl do '#define printf __printf__' when they override
    the 'printf' function.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __attribute__(Spec)   /* empty */
-# endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
 
 #ifdef __cplusplus
@@ -44,9 +44,9 @@ extern "C" {
      - [EILSEQ] error during conversion between wide and multibyte characters,
    return NULL.  */
 extern char *xasprintf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
+       _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
 extern char *xvasprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
+       _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 0));
 
 #ifdef __cplusplus
 }
index 4ec5fec..57ec0d5 100644 (file)
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#  define __attribute__(x) /* empty */
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+#  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+#  define ATTRIBUTE_NORETURN /* empty */
 # endif
-#endif
-
-#ifndef ATTRIBUTE_NORETURN
-# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#endif
 
 ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
index eed4b28..bab4676 100644 (file)
@@ -63,16 +63,13 @@ ARGMATCH_VERIFY (exclude_keywords, exclude_flags);
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#  define __attribute__(x) /* empty */
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+#  define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+# else
+#  define ATTRIBUTE_NORETURN /* empty */
 # endif
 #endif
 
-#ifndef ATTRIBUTE_NORETURN
-# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#endif
-
 ARGMATCH_DIE_DECL ATTRIBUTE_NORETURN;
 ARGMATCH_DIE_DECL { exit (1); }
 #endif