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]

Re: [PATCH] Fix build warnings in regex.c, bug-regex20.c,bug-regex33.c


On Mon, Feb 25, 2013 at 11:03:44PM -0800, Paul Eggert wrote:
> On 02/25/2013 09:13 PM, Siddhesh Poyarekar wrote:
> > -#ifdef __GNUC__
> > -# define __attribute(arg) __attribute__ (arg)
> > -#else
> > -# define __attribute(arg)
> > -#endif
> 
> When merging this into gnulib I noticed the above change will
> cause problems outside libc, since later code assumes that
> __attribute__((xxx)) will work and this isn't true with non-GCC
> compilers, or with ancient GCC.  Could you please replace the above
> code with the following, instead of deleting it?
> 
>  #if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)
>  # define __attribute__(arg)
>  #endif
> 
> That's what I did here, in the merge to gnulib:
> 

I had removed it with the understanding that the file is not
installed; I didn't think of the file being *used* outside as is.  The
check above doesn't seem right though; maybe it should be like below
instead to define __attribute__ if the compiler is not gcc or is a gcc
version less than 3.

Siddhesh

	* posix/regex_internal.h [!__GNUC__ || __GNUC__ < 3]:
	Define __attribute__.

diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index 0521f74..014f908 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -121,6 +121,10 @@
 # define attribute_hidden
 #endif /* not _LIBC */
 
+#if !defined __GNUC__ || __GNUC__ < 3
+# define __attribute__(arg)
+#endif
+
 extern const char __re_error_msgid[] attribute_hidden;
 extern const size_t __re_error_msgid_idx[] attribute_hidden;
 


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