@@ -35,19 +34,16 @@
# define __NTH(fct) fct __THROW
#endif
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
- defined __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
- defined __STRICT_ANSI__
-# define __format__ format
-# define __printf__ printf
-# endif
+/* 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 _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 _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
@@ -496,19 +519,19 @@
FILE *__restrict __stream,
unsigned int __flags);
/* Possibly output the standard usage message for ARGP to stderr and exit. */
extern void argp_usage (const struct argp_state *__state);
extern void __argp_usage (const struct argp_state *__state);
/* If appropriate, print the printf string FMT and following args, preceded
by the program name and `:', to stderr, and followed by a `Try ... --help'
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
@@ -521,12 +546,12 @@
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,
7int __status, int __errnum,
const char *__restrict __fmt, ...)
- __attribute__ ((__format__ (__printf__, 4, 5)));
+ _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5));
/* Returns true if the option OPT is a valid short option. */
extern int _option_is_short (const struct argp_option *__opt) __THROW;
extern int __option_is_short (const struct argp_option *__opt) __THROW;
@@ -29,22 +28,19 @@
#include <string.h>
#include <unistd.h>
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
- defined __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
- defined __STRICT_ANSI__
-# define __format__ format
-# define __printf__ printf
-# endif
+/* 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 _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 _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
#if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
/* line_wrap_stream is available, so use that. */
#define ARGP_FMTSTREAM_USE_LINEWRAP
#endif
@@ -132,9 +128,9 @@
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));
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);