This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to distinguish EGCS


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]