[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GCC Preprocessor directives for GNU/Hurd?

On Thu, Dec 17, 2015 at 10:03 PM, Svante Signell
<svante.signell@gmail.com> wrote:
> On Thu, 2015-12-17 at 21:05 +0900, Roger Shimizu wrote:
>> > For GNU/Hurd the preprocessor directive is __GNU__
>> Thanks for your reply!
>> I guess like Linux and kFreeBSD, __GLIBC__ is also set in Debian Hurd, right?
>> BTW. Please CC me when replying. I'd appreciate that!
> No, __GLIBC__ is not set by default for Hurd, only when <features.h> is
> included:
> touch test.h
> <empty>
> gcc -E -dM ./test.h|grep _GNU_
> #define __GNU__ 1
> gcc -E -dM ./test.h|grep _GLIBC_
> <empty>
> cat test.h
> #include <features.h>
> gcc -E -dM ./test.h|grep __GLIBC__
> #define __GLIBC__ 2

Thanks for the detailed way to verify those!

I confirmed for __GLIBC__, it's the same situation under GNU/Linux,
which default is "No", but turn to "Yes" after include <features.h>.
Since basic function like <stdio.h> or <string.h>, etc. also include
<features.h>, it's safe for most common application to treat __GLIBC__
as "Yes" for Linux and Hurd.


Reply to: