This is the mail archive of the 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]
Other format: [Raw text]

Re: Dealing with compilers that pretend to be GCC

Hi Ludo,

A number of compilers claim to be GCC, without actually being GCC.  This
has come to a point where they can hardly be distinguishedâuntil one
actually tries to use them.

this suggests that you shouldn't be testing for GCC, and instead should be testing for support for particular features. For example, to know if nested functions are supported you would have your configure script compile a mini program that uses nested functions.

Ciao, Duncan.

I had the following macro to determine whether plug-in support is available:

The macro is fairly elaborate.  Yet, ICC 12.0.1 and Clang 3.4 both pass
the test, because:

- They support â--versionâ;

   - They define â__GNUC__â, which defeats Autoconfâs

   - They support â-print-file-nameâ, and have â-print-file-name=pluginâ
     return GCCâs (!) plug-in header directory.  To that end, ICC simply
     runs âgcc -print-file-name=pluginâ, while Clang appears to be doing
     some guesswork.

It turns out that ICC manages to build a working GCC plug-in, so after
all, it may be âentitledâ to define â__GNUC__â, in a broad sense.

Conversely, Clang doesnât support several GNU extensions, such as nested
functions, so it quickly fails to compile code.

Based on that, I modified my feature test like this:

I donât see what can be done on âourâ side (perhaps Autoconfâs feature
test could be strengthened, but how?), but I wanted to document this
state of affairs.


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