From ac3a5bbc62949aeb061c01360632b3b8f5fafefa Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 12 May 2023 21:36:56 +0100 Subject: libstdc++: Stop using TR1 macros in and As with the two commits before this, the _GLIBCXX_USE_C99_CTYPE_TR1 and _GLIBCXX_USE_C99_FENV_TR1 macros are misleading when they are also used for and , not only for TR1 headers. It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define the C99 features for C++11 but not for C++98. Add separate configure checks for the and features using -std=c++11 for the checks. Use the new macros defined by those checks in the C++11-specific parts of , , and . libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_USE_C99): Check for isblank in C++11 mode and define _GLIBCXX_USE_C99_CTYPE. Check for functions in C++11 mode and define _GLIBCXX_USE_C99_FENV. * config.h.in: Regenerate. * configure: Regenerate. * include/c_compatibility/fenv.h: Check _GLIBCXX_USE_C99_FENV instead of _GLIBCXX_USE_C99_FENV_TR1. * include/c_global/cfenv: Likewise. * include/c_global/cctype: Check _GLIBCXX_USE_C99_CTYPE instead of _GLIBCXX_USE_C99_CTYPE_TR1. --- libstdc++-v3/acinclude.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'libstdc++-v3/acinclude.m4') diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 0c01b52..988c532 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1476,6 +1476,52 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ fi fi + # Check for the existence of functions. + AC_CACHE_CHECK([for ISO C99 support for C++11 in ], + glibcxx_cv_c99_ctype, [ + AC_TRY_COMPILE([#include ], + [int ch; + int ret; + ret = isblank(ch); + ],[glibcxx_cv_c99_ctype=yes], + [glibcxx_cv_c99_ctype=no]) + ]) + if test x"$glibcxx_cv_c99_ctype" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_CTYPE, 1, + [Define if C99 functions in should be imported in + in namespace std for C++11.]) + fi + + # Check for the existence of functions. + AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) + ac_c99_fenv=no; + if test x"$ac_has_fenv_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support for C++11 in ]) + AC_TRY_COMPILE([#include ], + [int except, mode; + fexcept_t* pflag; + fenv_t* penv; + int ret; + ret = feclearexcept(except); + ret = fegetexceptflag(pflag, except); + ret = feraiseexcept(except); + ret = fesetexceptflag(pflag, except); + ret = fetestexcept(except); + ret = fegetround(); + ret = fesetround(mode); + ret = fegetenv(penv); + ret = feholdexcept(penv); + ret = fesetenv(penv); + ret = feupdateenv(penv); + ],[ac_c99_fenv=yes], [ac_c99_fenv=no]) + AC_MSG_RESULT($ac_c99_fenv) + fi + if test x"$ac_c99_fenv" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_FENV, 1, + [Define if C99 functions in should be imported in + in namespace std for C++11.]) + fi + gcc_no_link="$ac_save_gcc_no_link" LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" -- cgit v1.1