bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lib/randread.c port to pedantic GCC (either C89 or C99)


From: Paul Eggert
Subject: lib/randread.c port to pedantic GCC (either C89 or C99)
Date: Wed, 22 Nov 2006 16:01:30 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

When I wrote randread.c I forgot to put an #ifndef __attribute__ around
the #define __attribute__, as all other files do.  Sorry about that.

The bug crops up with pedantic GCC only.

Here's a patch:

2006-11-22  Paul Eggert  <address@hidden>

        * randread.c (__attribute__): Don't define if __attribute__ is
        already defined.  Otherwise, the code won't conform to C99, since
        the macro arg is spelled differently by some include file, and the
        compilation fails with pedantic GCC.

diff --git a/lib/randread.c b/lib/randread.c
index b761fa5..5462d44 100644
--- a/lib/randread.c
+++ b/lib/randread.c
@@ -44,8 +44,10 @@ #ifndef MIN
 # define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif

-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
-# define __attribute__(x)
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
+#  define __attribute__(x)
+# endif
 #endif

 #ifndef ATTRIBUTE_UNUSED




reply via email to

[Prev in Thread] Current Thread [Next in Thread]