[cfe-dev] [PATCH]: add support for FreeBSD
Chris Lattner
clattner at apple.com
Sun Oct 12 10:28:30 PDT 2008
On Oct 11, 2008, at 2:08 AM, Roman Divacky wrote:
>> I'm confused about why that would be useful. Worst case you could
>> parse the output of 'system("uname -a")' or something, no?
>> Presumably
>> uname is implemented in terms of some library/system call, and that
>> could just be used instead?
>
> there's some confusion here...
>
> we are talking about:
> + Define(Defs, "__FreeBSD__", "8");
As Daniel pointed out, this one can be obtained from a dynamic check.
>
> + 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"'?
-Chris
More information about the cfe-dev
mailing list