This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Dealing with compilers that pretend to be GCC
Hi,
Marc Glisse <marc.glisse@inria.fr> skribis:
> On Tue, 31 Jan 2012, Ludovic CourtÃs wrote:
>
>> Hi,
>>
>> Chris Lattner <clattner@apple.com> skribis:
>>
>>> On Jan 30, 2012, at 7:56 AM, Ludovic CourtÃs wrote:
>>>
>>>> Hello,
>>>>
>>>> Chris Lattner <clattner@apple.com> skribis:
>>>>
>>>>> If fact, some do:
>>>>> http://clang.llvm.org/docs/LanguageExtensions.html#feature_check
>>>>
>>>> That seems like a very useful approach to solve the problem.
>>>>
>>>> The docs say that â__has_builtinâ & co. are macros. What do they expand to?
>>>
>>> 0 or 1.
>>
>> I understand. To put it another way, how are they defined?
>
> Compiler magic, like __LINE__ for instance? I am still not sure what
> you are asking...
>
> Interestingly enough:
> $ cat q.c
> __has_builtin
> $ clang -E q.c
> <segfault>
Yes, thatâs what I was asking.
It makes me think that the old CPP predicates (info "(gcc) Obsolete
Features") would be more appropriate than compiler magic, with the
caveat that theyâre presumably not widely supported.
Thanks,
Ludoâ.