[cfe-dev] [PATCH]: add support for FreeBSD

Chris Lattner clattner at apple.com
Tue Oct 14 22:51:20 PDT 2008

On Oct 14, 2008, at 12:20 AM, Roman Divacky wrote:

>>> +  Define(Defs, "__FreeBSD_cc_version", "800001");
>>> right?
>>> the problem is that the second number is defined only in an internal
>>> freebsd
>>> header file or can be obtained via "gcc -E -dM dummy_file.c", the
>>> __FreeBSD_cc_version
>>> does not correspond to anything in uname.
>> Ok, but what *is* that number and how does it get used?  For example,
>> we always currently hardcode these values:
>>  DefineBuiltinMacro(Buf, "__GNUC_MINOR__=2");
>>  DefineBuiltinMacro(Buf, "__GNUC_PATCHLEVEL__=1");
>>  DefineBuiltinMacro(Buf, "__GNUC__=4");
>> this is us claiming to be 4.2.1.  In my mind, this is ok because code
>> checking these is really almost always doing a feature check on some
>> thing that 4.2.1 supports, and we plan to eventually support most of
>> these.
>> Is __FreeBSD_cc_version like this?  When does it change?  What other
>> values has it been over time?  Is it always just '__FreeBSD__ +
>> "00001"'?
> I think you are right.... the __FreeBSD_cc_version is used to denote
> what gcc is used on a given FreeBSD. I believe we can easily pretend
> it's always X00001 where X is the FreeBSD major number. do you like  
> this
> patch? I could not test it but it should be ok...

The patch looks great to me, can you please resend as an attachment?   
It is coming through inline and I can't copy/paste it successfully,  


More information about the cfe-dev mailing list