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: Michael Petch
Subject: Re: [Bug-gnubg] bad __attribute__ handling breaks w/newer standards, newer gcc, & glibc and causes infinite loop
Date: Wed, 7 Oct 2015 15:30:01 -0600
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


On 2015-10-06 14:00, Russ Allbery wrote:
> /*
>  * __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

Hi Guys,

Thanks for the information. Russ, I was considering doing this the way
Bison seems to deal with __attribute__ . The generated code looks like:

#ifndef YY_ATTRIBUTE
# if (defined __GNUC__                                               \
      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
#  define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif

Based on this I was considering something like:

#ifndef __attribute__
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define __attribute__(Spec) /* empty */
# endif
#endif


It seems to also handle Sun compilers as well. Anyone have any
objections to the latter solution?

-- 
Michael Petch
GNU Backgammon Maintainer / Developer
OpenPGP FingerPrint=D81C 6A0D 987E 7DA5 3219 6715 466A 2ACE 5CAE 3304



reply via email to

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