bug-gnubg
[Top][All Lists]
Advanced

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

Re: [Bug-gnubg] bad __attribute__ handling breaks w/newer standards, new


From: Russ Allbery
Subject: Re: [Bug-gnubg] bad __attribute__ handling breaks w/newer standards, newer gcc, & glibc and causes infinite loop
Date: Tue, 06 Oct 2015 13:00:50 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Mike Frysinger <address@hidden> writes:

> we got a report about gnubg hanging on startup when built w/gcc-5:
>       https://bugs.gentoo.org/551896
> but when built w/older versions (<=gcc-4.9), everything worked great.

> there seems to be a similar report here from a few months ago:
>       https://lists.gnu.org/archive/html/bug-gnubg/2015-07/msg00011.html

> this is because of bad code in gnubg itself:
> http://cvs.savannah.gnu.org/viewvc/gnubg/gnubg/common.h?revision=1.31&view=markup
> #if !_GNU_SOURCE && !defined (__attribute__)
> /*! \brief GNU C specific attributes, e.g. unused
>  * // */
> #define __attribute__(X)
> #endif

[...]

> (2) common.h should be changed from checking for _GNU_SOURCE to __GNUC__ since
>     the attribute is tied to the GNU C compiler.  or maybe test whether the 
>     syntax __attribute__ works regardless of other defines.

In case it helps, the pattern I use in all of my code, and which I've
never had trouble with, is:

/*
 * __attribute__ is available in gcc 2.5 and later, but only with gcc 2.7
 * could you use the __format__ form of the attributes, which is what we use
 * (to avoid confusion with other macros).
 */
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#  define __attribute__(spec)   /* empty */
# endif
#endif

This also works with the Intel compiler and with Clang, in my experience.

-- 
Russ Allbery (address@hidden)              <http://www.eyrie.org/~eagle/>



reply via email to

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