base gcc and _GLIBCXX_USE_C99
Andriy Gapon
avg at FreeBSD.org
Fri Feb 1 13:31:22 UTC 2013
on 01/02/2013 15:08 Dimitry Andric said the following:
> On 2013-02-01 14:01, Andriy Gapon wrote:
>> on 28/01/2013 17:11 Andriy Gapon said the following:
>>> I wonder why the following is the case for the base gcc.
>>> /usr/include/c++/4.2/bits/c++config.h:
>>>
>>> /* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
>>> <stdio.h>, and <stdlib.h> can be used or exposed. */
>>> /* #undef _GLIBCXX_USE_C99 */
>>>
>>> Because of this undef there is no e.g. std::strtoll().
>>> Ditto for other things in stdlib.h.
>
> Maybe this support can't be enabled, because we don't expose all the
> required functions yet? Or maybe it is just something that was
> committed years ago, and then forgotten.
>
> If we are sure that all the C99 functions libstdc++ requires are now
> available and working, I see no problem in turning on _GLIBCXX_USE_C99.
Having looked into the source code of a recent GCC I get an impression that this
is a silliness on GCC's part (plus incompleteness of FreeBSD C99 support, it seems).
cstdlib would provide e.g. std::strtoull only when _GLIBCXX_USE_C99 is defined.
Now looking at libstdc++-v3/acinclude.m4 we can see that there is a dedicated
check "for ISO C99 support in <stdlib.h>". That check sets variable
glibcxx_cv_c99_stdlib.
But, _GLIBCXX_USE_C99 is set only if all of glibcxx_cv_c99_math,
glibcxx_cv_c99_complex, glibcxx_cv_c99_stdio, glibcxx_cv_c99_stdlib and
glibcxx_cv_c99_wchar are set.
So if glibcxx_cv_c99_stdlib is yes, but something like glibcxx_cv_c99_complex is
no, then no std::strtoull for me.
Not sure why GCC couldn't have a dedicated macro "_GLIBCXX_USE_C99_STDLIB" like
e.g. _GLIBCXX_USE_C99_MATH that it does have.
--
Andriy Gapon
More information about the freebsd-toolchain
mailing list