ISO C99 support in <math.h> for C++98

Andre Vieira (lists) Andre.SimoesDiasVieira@arm.com
Tue Mar 22 14:52:00 GMT 2016


Hello,

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:

src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:38:16:
error: macro "isgreater" requires 2 arguments, but only 1 given
src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:40:21:
error: macro "isgreaterequal" requires 2 arguments, but only 1 given
src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:42:13:
error: macro "isless" requires 2 arguments, but only 1 given
src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:44:18:
error: macro "islessequal" requires 2 arguments, but only 1 given
src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:46:20:
error: macro "islessgreater" requires 2 arguments, but only 1 given
src/gcc/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:48:18:
error: macro "isunordered" requires 2 arguments, but only 1 given

This started to happen around the same time for both gcc-5 and trunk.
The failure for gcc-5 is with
26_numerics/headers/cmath/c99_classification_macros_c++{,0x}.cc.

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 :(

Cheers,
Andre



More information about the Newlib mailing list