public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@rabi.columbia.edu>
To: rch@troi.baustatik.rwth-aachen.de
Cc: egcs@cygnus.com
Subject: Re: How to distinguish EGCS
Date: Fri, 30 Oct 1998 14:59:00 -0000	[thread overview]
Message-ID: <199810302258.RAA07711@rabi.phys.columbia.edu> (raw)
In-Reply-To: <13881.38744.364911.4291@troi.baustatik.rwth-aachen.de>

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

  parent reply	other threads:[~1998-10-30 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-30  3:25 Rostislav Chudoba
1998-10-30 13:42 ` Jeffrey A Law
1998-10-30 14:59 ` Zack Weinberg [this message]
1998-10-30 15:21 Jan Reimers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199810302258.RAA07711@rabi.phys.columbia.edu \
    --to=zack@rabi.columbia.edu \
    --cc=egcs@cygnus.com \
    --cc=rch@troi.baustatik.rwth-aachen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).