This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: ISO C99 support in <math.h> for C++98
- From: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- To: newlib at sourceware dot org
- Date: Tue, 22 Mar 2016 10:42:46 -0500
- Subject: Re: ISO C99 support in <math.h> for C++98
- Authentication-results: sourceware.org; auth=none
- References: <56F15C3B dot 5000407 at arm dot com>
On 2016-03-22 09:52, Andre Vieira (lists) wrote:
On arm and aarch64 the libstdc++ test
26_numerics/headers/cmath/c99_classification_macros_c++98.cc has been
failing with (among others) the following errors:
[snip]
Since the only code my gcc-5 and trunk builds share is newlib I suspect
it might be caused by it. I had a look at cmath and found that the
macros mentioned above are undef'd if the condition
_GLIBCXX_USE_C99_MATH holds true. This is defined as
_GLIBCXX98_USE_C99_MATH if -std=gnu++98 is passed and in my latest
builds _GLIBCXX98_USE_C99_MATH is no longer being defined in
c++config.h. This define is set by gcc's configure step 'Checking for
ISO C99 support in <math.h> for C++98' which used to succeed but now fails.
I did get a bit lost after locating the code to check this in
gcc/libstdc++/acinclude.m4 as it seems it tries to compile a file with
all the functions (macros in C99), that are undef'd in cmath if
_GLIBCXX_USE_C99_MATH, which isn't happening... So apparently during
configuration it seems include math.h does not define this set of
functions, so _GLIBCXX98_USE_C99_MATH is never defined and thus the
macros for these functions are never undef'ed in cmath, where all of a
sudden they seem to be defined.
Does anyone have an idea whats going on here? I wanted to try with
earlier commits of newlib to maybe identify what change was responsible
for this new behavior, but I am failing to build due to the
configuration scripts needing regeneration and I wasn't able to
regenerate them. I tried a sequence of commands that used to work in the
past but they no longer do :(
We also had issues enabling C99-in-C++ on Cygwin (which is based on
newlib), which required a few patches:
https://github.com/cygwinports/gcc/blob/master/0023-glibcxx-use-c99.patch
https://github.com/cygwinports/gcc/blob/master/0026-g%2B%2B-gnu-source.patch
It is on my to-do list to get this working on newlib targets once we
have a snapshot with the new feature test macros.
--
Yaakov