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

Bryan Henderson bryanh at giraffe-data.com
Fri May 11 13:47:37 PDT 2012


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

I guess there are a number of things this sentence could mean.  Based on the
juxtaposition of -D_GNU_SOURCE with -D_BSD_SOURCE and -D_DARWIN_C_SOURCE, this
suggests that the Darwin C library responds to _GNU_SOURCE being defined by
providing all those GNU-specific facilities.  Do you know?  Is the Darwin C
library supposed to provide a superset of the GNU C library?

Some people do like to put the definition of these source type declarations on
the compile command (-D) instead of in the source file itself (#define).  I
tend to think it's because they don't understand what the macro is for, but it
could also be because it's more convenient in some ways.

But another reason -D_GNU_SOURCE is in the Darwin config file might be that
someone noticed its incorrect use in strtod.c and exploited it.

Whatever the reason, "if _GNU_SOURCE" evidently cannot just be replaced with
"if __GLIBC__", but has to be "if __GLIBC__ or __APPLE__" and if there are
another other platforms that do -D_GNU_SOURCE but aren't using either the GNU
or Apple C libraries, those have to be added in there too to avoid a
regression.

-- 
Bryan Henderson                                   San Jose, California


More information about the mesa-dev mailing list