This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to distinguish EGCS
- To: rch at troi dot baustatik dot rwth-aachen dot de
- Subject: Re: How to distinguish EGCS
- From: Zack Weinberg <zack at rabi dot columbia dot edu>
- Date: Fri, 30 Oct 1998 17:58:48 -0500
- cc: egcs at cygnus dot com
On Fri, 30 Oct 1998 11:45:01 +0100 (CET), Rostislav Chudoba wrote:
>
>When porting a code from gcc 2.7.2 to egcs I need to distinguish the
>version of the compiler to use the appropriate code. I was searching
>for a predefined macro just like __GNUG__ to insert #ifdef #else
>#endif.
>
>QUESTION:
>
>Can anyone tell me how to dump the predefined macros? And
>whether there is a special macro identifying the current compiler
>version?
You dump predefines like this:
$ gcc -E -dM -xc /dev/null
There are two macros which give the version number, __GNUC__ and
__GNUC_MINOR__. Test them like this:
#if defined __GNUC__ && (__GNUC__ > 2 || \
__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
/* gcc 2.8 or egcs */
#else
/* older gcc, or some other compiler entirely */
#endif
If you need to tell EGCS from gcc-2.8, change the 8 to 90.
zw