This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: A macro to test for gcc's version number
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Patch: A macro to test for gcc's version number
- From: Andreas Jaeger <aj at suse dot de>
- Date: 10 Oct 1999 12:49:10 +0200
- Cc: egcs-patches at egcs dot cygnus dot com
- References: <199910091404.KAA08704@caip.rutgers.edu>
>>>>> Kaveh R Ghazi writes:
> We do this often enough that it should be a macro in ansidecl.h:
>> #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
> becomes:
>> #if HAVE_GCC_VERSION(2,7)
> I'm not 100% happy with the name I chose, its kind of wordy. Anyone
> like one of these or can suggest something better?
> IS_GCC(2,7)
> MIN_GCC_VERS(2,7)
> HAVE_GCC(2,7)
Just for your information: glibc has the same problems with the
gcc version information. glibc 2.2 will use the following construct:
/* Convenience macros to test the versions of glibc and gcc.
Use them like this:
#if __GNUC_PREREQ (2,8)
... code requiring gcc 2.8 or later ...
#endif
Note - they won't work for gcc1 or glibc1, since the _MINOR macros
were not defined then. */
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __GNUC_PREREQ(maj, min) 0
#endif
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.rhein-neckar.de