X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fargp.h;h=c0483ab8bf30a5468f9a826ec110ede720f5ee68;hb=6b66ce308dae8448f02da645a9fd8fb992349f06;hp=cc9dc0715132f56b0ea68da29cf182a305aa408f;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/lib/argp.h b/lib/argp.h index cc9dc0715..c0483ab8b 100644 --- a/lib/argp.h +++ b/lib/argp.h @@ -1,5 +1,5 @@ /* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-1999, 2003-2010 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2003-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -34,17 +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) -# 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) || __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 @@ -531,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 @@ -547,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. */