This is the mail archive of the
mailing list for the GCC project.
Re: Dealing with compilers that pretend to be GCC
> Yeah, but it’s a shame that those compilers define __GNUC__ without
> supporting 100% of the GNU C extensions. ?With this approach, you would
> also need to add !defined for Clang, PGI, and probably others.
Having worked on the other side for a while -- for a vendor whose
compiler supported many but not all of GCC's extensions -- I claim
that the problem is with the many examples of code out there that
blindly test for __GNUC__ instead of testing for individual
extensions. From the other vendor's point of view, it's nearly useless
to support any of the GCC extensions if you don't also define
__GNUC__, because most code out there will simply test for that macro.
By defining the macro even if you don't support, for example, nested
functions, you can still compile 99% of the code that uses the