https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70379
Bug ID: 70379
Summary: c99_classification_macros_c++98.cc failing with newlib
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: andre.simoesdiasvieira at arm dot com
Target Milestone: ---
26_numerics/headers/cmath/c99_classification_macros_c++98.cc fails for newlib
on arm-none-eabi with the following errors (clipped the error messages to only
include a few):
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 new failure is due to a change that has been made to newlib where
-std=c++98 no longer includes the C99 math functions from math.h whereas
gnu++98 still does. This leads to _GLIBCXX98_USE_C99_MATH not being declared at
configuration time, since this is set by testing a compilation with -std=c++98.
This macro is the macro used in cmath to know whether the C99 math functions
are present, if so it needs to undefine the ones that are macros. This test
uses -std=gnu++98, which will have these macros defined and
_GLIBCXX98_USE_C99_MATH not set which leads us to the errors above.
This is now also an issue with at least gcc-5.