This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][BZ #16907] Do not disable __attribute__ when you include argp.h


Hi,

As written in bug report:

"
When <argp.h> is included first and thus __attribute__ is not defined,
with -std=c90, c99 or c11, the __attribute__ is redefined as empty due
to the following code:
This might break headers included later, for example it breaks
-D_FORTIFY_SOURCE=2 by not defining strcpy() correctly [1]. Besides some
reformating, this code is more than 10 years old, and I don't know if
there is still a reason to redefine __attribute__ that way.
"

So is there any reason to keep fragments of code below? As we use
__attribute__ in stdio.h without checking gcc version I doubt that
compiling with gcc would work. I did not checked that though.



	* argp/argp-fmtstream.h: Do not define __attribute__.
	* argp/argp.h: Likewise.


diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h
index 1ed2834..f3f82df 100644
--- a/argp/argp-fmtstream.h
+++ b/argp/argp-fmtstream.h
@@ -29,21 +29,6 @@
 #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
-#endif
-
 #if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
 /* line_wrap_stream is available, so use that.  */
 #define ARGP_FMTSTREAM_USE_LINEWRAP
diff --git a/argp/argp.h b/argp/argp.h
index 0868228..c1072a3 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -35,21 +35,6 @@
 # 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
-#endif
-
 /* GCC 2.95 and later have "__restrict"; C99 compilers have
    "restrict", and "configure" may have defined "restrict".  */
 #ifndef __restrict


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]