[Mesa-dev] [PATCH] mesa: Use the proper feature test macros for strtod_l and strtof[_l].

Jeremy Huddleston jeremyhu at apple.com
Fri May 11 11:20:48 PDT 2012


On May 11, 2012, at 08:58, Bryan Henderson <bryanh at giraffe-data.com> wrote:

>> Android does not have strtod_l. Yet, the old co de successfully compiled
>> because Android does not define _GNU_SOURCE.
> 
> Just to make sure we're all on the same page: NOBODY defines _GNU_SOURCE.
> At least they shouldn't.

Tell that to the config files.  It was added to darwin's config file, presumably because we supported the functionality it enabled.

mesa/configs $ grep _GNU_SOURCE *
darwin:DEFINES =  -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
darwin:# -D_GNU_SOURCE          - for src/mesa/main ...
linux:	-D_BSD_SOURCE -D_GNU_SOURCE \
linux-dri:	-D_BSD_SOURCE -D_GNU_SOURCE \
linux-dri-xcb:	-D_BSD_SOURCE -D_GNU_SOURCE \
linux-egl:	-D_BSD_SOURCE -D_GNU_SOURCE \
linux-indirect:	-D_BSD_SOURCE -D_GNU_SOURCE \
linux-osmesa:CFLAGS = -g -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS

> Used correctly, _GNU_SOURCE is something that gets
> defined by a #define in the source file which wants to declare itself as
> coded for nonstandard GNU features of libc.
> 
> And so I have to ask about <xlocale.h>.  The original code says to include
> that if both _GNU_SOURCE and __APPLE__ are defined, which I presume is never.

Nope.  It's that way in configs/darwin.

> The current patch says to include it if both __GLIBC__ and __APPLE__ are
> defined, which again appears to be never.  I don't know what <xlocale.h> is;
> who needs it?


xlocale.h defines the extended locale support, like strtod_l and strtof_l.  The fact that it's done just for __APPLE__ is wrong because this is how the functionality is provided on recent FreeBSD (http://svnweb.freebsd.org/base/head/include/xlocale.h?revision=232498&view=markup).



More information about the mesa-dev mailing list