This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Feature request - a macro defined for GCC
- From: Andrew Haley <aph at redhat dot com>
- To: x z <hzmonte at hotmail dot com>
- Cc: gcc at gnu dot org
- Date: Tue, 01 Jul 2008 11:50:36 +0100
- Subject: Re: Feature request - a macro defined for GCC
- References: <BLU125-W17EAD8591F0443962FC5E5A09E0@phx.gbl> <BLU125-W344BFBA01CF733DBD08F3FA09E0@phx.gbl>
x z wrote:
> I would like to see that GCC define a macro in the case it is being
> used to compile a program. Currently there is a __GNUC__ macro
> defined by the GNU C preprocessor CPP. That does not suit the need.
> As the CPP Manual says: __GNUC__ is "defined by all GNU compilers
> that use the C preprocessor". It seems to imply that any (non-GNU)
> compiler that uses the GNU C preprocessor would also have __GNUC__
> defined. According to their respective manuals, Intel C++ Compiler
> and Portable C Compiler also pre-define __GNUC__, possibly because
> they use the GNU CPP.
They don't use GNU CPP.
> Therefore, the fact that __GNUC__ is defined does not necessarily
> mean the GCC compiler proper is being used.
I don't think you've thought about this thoroughly.
Any compiler that is not GNU C but defines __GNUC__ is lying to its
users. If we define __REAL_GNUC__ they'll just define that as well.
Andrew.