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

_______________________________________________
Bug-gnubg mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnubg

Reply via email to