mgs> Well, here's a first stab. It shuts up all the not used warnings.
mgs> It probably needs a better check than HASATTRIBUTE, perhaps to see
mgs> if that specific attribute (unused) is available.
mgs> +#ifdef HASATTRIBUTE
mgs> +#define dNOOP extern int Perl___notused __attribute__ ((unused))
mgs> +#else
mgs> #define dNOOP extern int Perl___notused
mgs> +#endif
Note that the FSF folks very carefully considered how to implement
attributes, etc. so that they could be easily managed via the
preprocessor. This is why the format seems odd (double parens, for
example).
Adding "HASATTRIBUTE", etc. is not the way to do it :)
What you want to do is add something like this to some globally
available header file:
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(x)
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
After this, you can simply use the __attribute__ (()) stuff as you
please and it will be resolved to the empty string by the preprocessor
when compiled by compilers that don't support it. There is no need for
any sort of configure check, HAS_FOO macro, etc.
HTH...
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist