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

Re: openjdk-7 for kfreebsd



On 14/11/2013 12:53, Steven Chamberlain wrote:
> -#ifdef __linux__
> +#if defined(__linux__) || defined(__GLIBC__)
> 
> We have dozens of these for example - that kind of ifdef is ambiguous as
> to whether it expects "the Linux kernel" or just "a Linux-like userland"
> which is true also of GNU/kFreeBSD, GNU/Hurd and potentially other glibc
> ports.

If you want to check for a Glibc feature (regardless of which kernel
we're using), the following is enough:

#ifdef __GLIBC__

However note that what usually happens is that other libraries which are
used on Linux and are similar to Glibc implement the same features and
will want to match this #ifdef too. Thus removing the "__linux__"
although it might be strictly correct may cause a regression.

I usually just avoid causing the regression by leaving the __linux__ in,
even if the feature we're checking has nothing to do with kernel.

-- 
Robert Millan


Reply to: