Hi there,

On Wed, 09 Dec 2015, 10:54:15 +0100, Willy TARREAU wrote:
> On Wed, Dec 09, 2015 at 09:52:22AM +0000, David CARLIER wrote:
> > Hi Willy,
> > 
> > Not in my knowledge, I have not tested in any old OS version though
> > just current Debian Stable and Alpine Linux (which uses musl's libc).
> > That should be alright to backport it to 1.5 but not vital as such.
> 
> OK then I'll keep it only in 1.7 for now (principle of least surprize)
> and will backport it if people encounter issues on older versions and
> ask for it.

FWIW, David's patch is completely right. __USE_* features shouldn't be
defined manually, but should be inherited from their proper definition
by #include'ing <features.h>, with glibc at least.

It has always been my understanding, that _GNU_SOURCE_ should be defined
to be able to use a variety of extensions including ISO Standard C,
Extensions to ISO C89 from ISO C99, Extensions to ISO C99 from ISO C11,
... /usr/include/features.h says the following:

/* These are defined by the user (or the compiler)
   to specify the desired environment:

   ...
   _GNU_SOURCE          All of the above, plus GNU extensions.

Further down it is described that there are lots of __USE_* defines,
including __USE_GNU, which are all #undef'ined at the beginning of that
file and then get defined based on the user-controllable defines like
_GNU_SOURCE_ or _POSIX_SOURCE_. This means defining __USE_GNU on the
command line may stop to work in a source file which somehow #include's
features.h, because it decides to #undef __USE_GNU and later on not
define it.

Similar feature dependencies and rules also exist (at least existed for
a long period) in AIX, HP-UX, and Solaris - don't remember if that file
is still also called <features.h>, though.

To cut a long story short, the __USE_* defines should not be used
directly, but rather _GNU_SOURCE_ etc. instead. Detailed documentation
can be found in the glibc info file in section "1.3.4 Feature Test
Macros".

> Thanks!
> Willy

HTH, cheers.

l8er
manfred

Attachment: pgpPBPFEIuPJf.pgp
Description: PGP signature

Reply via email to