This is the mail archive of the
mailing list for the GCC project.
Re: Dealing with compilers that pretend to be GCC
Cary Coutant <firstname.lastname@example.org> skribis:
>> 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
Thanks, I see.
I think the problem is that __GNUC__ is (ab)used to refer to the GNU C
language (any version), whereas itâs initially meant to refer to the
Maybe CPP assertions could be revived to test for single language