Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Feb 2013 15:31:19 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Dimitry Andric <dim@FreeBSD.org>
Cc:        toolchain@FreeBSD.org, freebsd-hackers <freebsd-hackers@FreeBSD.org>
Subject:   Re: base gcc and _GLIBCXX_USE_C99
Message-ID:  <510BC3A7.5040405@FreeBSD.org>
In-Reply-To: <510BBE48.4070101@FreeBSD.org>
References:  <5106953E.2020907@FreeBSD.org> <510BBCAD.3070705@FreeBSD.org> <510BBE48.4070101@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?510BC3A7.5040405>