Adopted from the upstream patch found at Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393 git commit: bdb62e6a5583c7e41c438d1c29789aee41f8d519 X-Gentoo-bug: 577238 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=577238 Signed-off-by: Anthony G. Basile diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index adc7d44..e7fc5f0 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -713,6 +713,44 @@ /* Version number of package */ #undef VERSION +/* Define if C99 functions in should be used in for + C++11. Using compiler builtins for these functions requires corresponding + C99 library functions to be present. */ +#undef _GLIBCXX11_USE_C99_COMPLEX + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#undef _GLIBCXX11_USE_C99_MATH + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#undef _GLIBCXX11_USE_C99_STDIO + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#undef _GLIBCXX11_USE_C99_STDLIB + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#undef _GLIBCXX11_USE_C99_WCHAR + +/* Define if C99 functions in should be used in for + C++98. Using compiler builtins for these functions requires corresponding + C99 library functions to be present. */ +#undef _GLIBCXX98_USE_C99_COMPLEX + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#undef _GLIBCXX98_USE_C99_MATH + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#undef _GLIBCXX98_USE_C99_STDIO + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#undef _GLIBCXX98_USE_C99_WCHAR + /* Define if the compiler supports C++11 atomics. */ #undef _GLIBCXX_ATOMIC_BUILTINS @@ -772,11 +810,6 @@ , and can be used or exposed. */ #undef _GLIBCXX_USE_C99 -/* Define if C99 functions in should be used in . Using - compiler builtins for these functions requires corresponding C99 library - functions to be present. */ -#undef _GLIBCXX_USE_C99_COMPLEX - /* Define if C99 functions in should be used in . Using compiler builtins for these functions requires corresponding C99 library functions to be present. */ @@ -798,10 +831,6 @@ in namespace std::tr1. */ #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 -/* Define if C99 functions or macros in should be imported in - in namespace std. */ -#undef _GLIBCXX_USE_C99_MATH - /* Define if C99 functions or macros in should be imported in in namespace std::tr1. */ #undef _GLIBCXX_USE_C99_MATH_TR1 diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h index e934ffc..e029f52 100644 --- a/libstdc++-v3/config/locale/generic/c_locale.h +++ b/libstdc++-v3/config/locale/generic/c_locale.h @@ -70,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __builtin_va_list __args; __builtin_va_start(__args, __fmt); -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); #else const int __ret = __builtin_vsprintf(__out, __fmt, __args); diff --git a/libstdc++-v3/config/locale/gnu/c_locale.h b/libstdc++-v3/config/locale/gnu/c_locale.h index ac6b176..b1f0160 100644 --- a/libstdc++-v3/config/locale/gnu/c_locale.h +++ b/libstdc++-v3/config/locale/gnu/c_locale.h @@ -88,7 +88,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __builtin_va_list __args; __builtin_va_start(__args, __fmt); -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); #else const int __ret = __builtin_vsprintf(__out, __fmt, __args); diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 16e09f0..958c925 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -16611,9 +16611,9 @@ fi fi # Check for the existence of functions used if C99 is enabled. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in " >&5 -$as_echo_n "checking for ISO C99 support in ... " >&6; } - if test "${glibcxx_cv_c99_math+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++98" >&5 +$as_echo_n "checking for ISO C99 support in for C++98... " >&6; } + if test "${glibcxx_cv_c99_math_cxx98+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -16645,9 +16645,9 @@ i = fpclassify(d1); } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_c99_math=yes + glibcxx_cv_c99_math_cxx98=yes else - glibcxx_cv_c99_math=no + glibcxx_cv_c99_math_cxx98=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16681,9 +16681,9 @@ i = fpclassify(d1); } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - glibcxx_cv_c99_math=yes + glibcxx_cv_c99_math_cxx98=yes else - glibcxx_cv_c99_math=no + glibcxx_cv_c99_math_cxx98=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -16691,11 +16691,11 @@ fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_math" >&5 -$as_echo "$glibcxx_cv_c99_math" >&6; } - if test x"$glibcxx_cv_c99_math" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_math_cxx98" >&5 +$as_echo "$glibcxx_cv_c99_math_cxx98" >&6; } + if test x"$glibcxx_cv_c99_math_cxx98" = x"yes"; then -$as_echo "#define _GLIBCXX_USE_C99_MATH 1" >>confdefs.h +$as_echo "#define _GLIBCXX98_USE_C99_MATH 1" >>confdefs.h fi @@ -16731,11 +16731,14 @@ fi done - glibcxx_cv_c99_complex=no; - if test x"$ac_has_complex_h" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in " >&5 -$as_echo_n "checking for ISO C99 support in ... " >&6; } - if test x$gcc_no_link = xyes; then + if test x"$ac_has_complex_h" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++98" >&5 +$as_echo_n "checking for ISO C99 support in for C++98... " >&6; } + if test "${glibcxx_cv_c99_complex_cxx98+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test x$gcc_no_link = xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -16796,9 +16799,601 @@ f = cabsf(tmpf); } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_c99_complex=yes + glibcxx_cv_c99_complex_cxx98=yes else - glibcxx_cv_c99_complex=no + glibcxx_cv_c99_complex_cxx98=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + typedef __complex__ float float_type; + typedef __complex__ double double_type; + typedef __complex__ long double ld_type; + volatile float_type tmpf; + volatile double_type tmpd; + volatile ld_type tmpld; + volatile float f; + volatile double d; + volatile long double ld; +int +main () +{ +f = cabsf(tmpf); + f = cargf(tmpf); + tmpf = ccosf(tmpf); + tmpf = ccoshf(tmpf); + tmpf = cexpf(tmpf); + tmpf = clogf(tmpf); + tmpf = csinf(tmpf); + tmpf = csinhf(tmpf); + tmpf = csqrtf(tmpf); + tmpf = ctanf(tmpf); + tmpf = ctanhf(tmpf); + tmpf = cpowf(tmpf, tmpf); + tmpf = cprojf(tmpf); + d = cabs(tmpd); + d = carg(tmpd); + tmpd = ccos(tmpd); + tmpd = ccosh(tmpd); + tmpd = cexp(tmpd); + tmpd = clog(tmpd); + tmpd = csin(tmpd); + tmpd = csinh(tmpd); + tmpd = csqrt(tmpd); + tmpd = ctan(tmpd); + tmpd = ctanh(tmpd); + tmpd = cpow(tmpd, tmpd); + tmpd = cproj(tmpd); + ld = cabsl(tmpld); + ld = cargl(tmpld); + tmpld = ccosl(tmpld); + tmpld = ccoshl(tmpld); + tmpld = cexpl(tmpld); + tmpld = clogl(tmpld); + tmpld = csinl(tmpld); + tmpld = csinhl(tmpld); + tmpld = csqrtl(tmpld); + tmpld = ctanl(tmpld); + tmpld = ctanhl(tmpld); + tmpld = cpowl(tmpld, tmpld); + tmpld = cprojl(tmpld); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_c99_complex_cxx98=yes +else + glibcxx_cv_c99_complex_cxx98=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_complex_cxx98" >&5 +$as_echo "$glibcxx_cv_c99_complex_cxx98" >&6; } + if test x"$glibcxx_cv_c99_complex_cxx98" = x"yes"; then + +$as_echo "#define _GLIBCXX98_USE_C99_COMPLEX 1" >>confdefs.h + + fi + + # Check for the existence in of vscanf, et. al. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++98" >&5 +$as_echo_n "checking for ISO C99 support in for C++98... " >&6; } + if test "${glibcxx_cv_c99_stdio_cxx98+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + void foo(char* fmt, ...) + { + va_list args; va_start(args, fmt); + vfscanf(stderr, "%i", args); + vscanf("%i", args); + vsnprintf(fmt, 0, "%i", args); + vsscanf(fmt, "%i", args); + snprintf(fmt, 0, "%i"); + } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_c99_stdio_cxx98=yes +else + glibcxx_cv_c99_stdio_cxx98=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + void foo(char* fmt, ...) + { + va_list args; va_start(args, fmt); + vfscanf(stderr, "%i", args); + vscanf("%i", args); + vsnprintf(fmt, 0, "%i", args); + vsscanf(fmt, "%i", args); + snprintf(fmt, 0, "%i"); + } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_c99_stdio_cxx98=yes +else + glibcxx_cv_c99_stdio_cxx98=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_stdio_cxx98" >&5 +$as_echo "$glibcxx_cv_c99_stdio_cxx98" >&6; } + if test x"$glibcxx_cv_c99_stdio_cxx98" = x"yes"; then + +$as_echo "#define _GLIBCXX98_USE_C99_STDIO 1" >>confdefs.h + + fi + + # Check for the existence in of wcstold, etc. + if test x"$ac_has_wchar_h" = xyes && + test x"$ac_has_wctype_h" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++98" >&5 +$as_echo_n "checking for ISO C99 support in for C++98... " >&6; } + if test "${glibcxx_cv_c99_wchar_cxx98+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + namespace test + { + using ::wcstold; + using ::wcstoll; + using ::wcstoull; + } + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_c99_wchar_cxx98=yes +else + glibcxx_cv_c99_wchar_cxx98=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + + # Checks for wide character functions that may not be present. + # Injection of these is wrapped with guard macros. + # NB: only put functions here, instead of immediately above, if + # absolutely necessary. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + namespace test { using ::vfwscanf; } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_VFWSCANF 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + namespace test { using ::vswscanf; } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_VSWSCANF 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + namespace test { using ::vwscanf; } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_VWSCANF 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + namespace test { using ::wcstof; } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_WCSTOF 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +wint_t t; int i = iswblank(t); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_ISWBLANK 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_wchar_cxx98" >&5 +$as_echo "$glibcxx_cv_c99_wchar_cxx98" >&6; } + if test x"$glibcxx_cv_c99_wchar_cxx98" = x"yes"; then + +$as_echo "#define _GLIBCXX98_USE_C99_WCHAR 1" >>confdefs.h + + fi + fi + + # Option parsed, now set things appropriately. + if test x"$glibcxx_cv_c99_math_cxx98" = x"no" || + test x"$glibcxx_cv_c99_complex_cxx98" = x"no" || + test x"$glibcxx_cv_c99_stdio_cxx98" = x"no" || + test x"$glibcxx_cv_c99_stdlib_cxx98" = x"no" || + test x"$glibcxx_cv_c99_wchar_cxx98" = x"no"; then + enable_c99=no; + else + +$as_echo "#define _GLIBCXX_USE_C99 1" >>confdefs.h + + fi + + gcc_no_link="$ac_save_gcc_no_link" + LIBS="$ac_save_LIBS" + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + # Use -std=c++11 and test again for C99 library feature in C++11 mode. + # For the reasons given above we use -std=c++11 not -std=gnu++11. + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++11" + ac_save_LIBS="$LIBS" + ac_save_gcc_no_link="$gcc_no_link" + + if test x$gcc_no_link != xyes; then + # Use -fno-exceptions to that the C driver can link these tests without + # hitting undefined references to personality routines. + CXXFLAGS="$CXXFLAGS -fno-exceptions" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin in -lm" >&5 +$as_echo_n "checking for sin in -lm... " >&6; } +if test "${ac_cv_lib_m_sin+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sin (); +int +main () +{ +return sin (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_m_sin=yes +else + ac_cv_lib_m_sin=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin" >&5 +$as_echo "$ac_cv_lib_m_sin" >&6; } +if test "x$ac_cv_lib_m_sin" = x""yes; then : + LIBS="$LIBS -lm" +else + + # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK + gcc_no_link=yes + +fi + + fi + + # Check for the existence of functions used if C99 is enabled. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++11" >&5 +$as_echo_n "checking for ISO C99 support in for C++11... " >&6; } + if test "${glibcxx_cv_c99_math_cxx11+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + volatile double d1, d2; + volatile int i; +int +main () +{ +i = fpclassify(d1); + i = isfinite(d1); + i = isinf(d1); + i = isnan(d1); + i = isnormal(d1); + i = signbit(d1); + i = isgreater(d1, d2); + i = isgreaterequal(d1, d2); + i = isless(d1, d2); + i = islessequal(d1, d2); + i = islessgreater(d1, d2); + i = islessgreater(d1, d2); + i = isunordered(d1, d2); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_c99_math_cxx11=yes +else + glibcxx_cv_c99_math_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + volatile double d1, d2; + volatile int i; +int +main () +{ +i = fpclassify(d1); + i = isfinite(d1); + i = isinf(d1); + i = isnan(d1); + i = isnormal(d1); + i = signbit(d1); + i = isgreater(d1, d2); + i = isgreaterequal(d1, d2); + i = isless(d1, d2); + i = islessequal(d1, d2); + i = islessgreater(d1, d2); + i = islessgreater(d1, d2); + i = isunordered(d1, d2); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_c99_math_cxx11=yes +else + glibcxx_cv_c99_math_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_math_cxx11" >&5 +$as_echo "$glibcxx_cv_c99_math_cxx11" >&6; } + if test x"$glibcxx_cv_c99_math_cxx11" = x"yes"; then + +$as_echo "#define _GLIBCXX11_USE_C99_MATH 1" >>confdefs.h + + fi + + # Check for the existence of complex math functions. + # This is necessary even though libstdc++ uses the builtin versions + # of these functions, because if the builtin cannot be used, a reference + # to the library function is emitted. + for ac_header in tgmath.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "tgmath.h" "ac_cv_header_tgmath_h" "$ac_includes_default" +if test "x$ac_cv_header_tgmath_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TGMATH_H 1 +_ACEOF + ac_has_tgmath_h=yes +else + ac_has_tgmath_h=no +fi + +done + + for ac_header in complex.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "complex.h" "ac_cv_header_complex_h" "$ac_includes_default" +if test "x$ac_cv_header_complex_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_COMPLEX_H 1 +_ACEOF + ac_has_complex_h=yes +else + ac_has_complex_h=no +fi + +done + + if test x"$ac_has_complex_h" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++11" >&5 +$as_echo_n "checking for ISO C99 support in for C++11... " >&6; } + if test "${glibcxx_cv_c99_complex_cxx11+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + typedef __complex__ float float_type; + typedef __complex__ double double_type; + typedef __complex__ long double ld_type; + volatile float_type tmpf; + volatile double_type tmpd; + volatile ld_type tmpld; + volatile float f; + volatile double d; + volatile long double ld; +int +main () +{ +f = cabsf(tmpf); + f = cargf(tmpf); + tmpf = ccosf(tmpf); + tmpf = ccoshf(tmpf); + tmpf = cexpf(tmpf); + tmpf = clogf(tmpf); + tmpf = csinf(tmpf); + tmpf = csinhf(tmpf); + tmpf = csqrtf(tmpf); + tmpf = ctanf(tmpf); + tmpf = ctanhf(tmpf); + tmpf = cpowf(tmpf, tmpf); + tmpf = cprojf(tmpf); + d = cabs(tmpd); + d = carg(tmpd); + tmpd = ccos(tmpd); + tmpd = ccosh(tmpd); + tmpd = cexp(tmpd); + tmpd = clog(tmpd); + tmpd = csin(tmpd); + tmpd = csinh(tmpd); + tmpd = csqrt(tmpd); + tmpd = ctan(tmpd); + tmpd = ctanh(tmpd); + tmpd = cpow(tmpd, tmpd); + tmpd = cproj(tmpd); + ld = cabsl(tmpld); + ld = cargl(tmpld); + tmpld = ccosl(tmpld); + tmpld = ccoshl(tmpld); + tmpld = cexpl(tmpld); + tmpld = clogl(tmpld); + tmpld = csinl(tmpld); + tmpld = csinhl(tmpld); + tmpld = csqrtl(tmpld); + tmpld = ctanl(tmpld); + tmpld = ctanhl(tmpld); + tmpld = cpowl(tmpld, tmpld); + tmpld = cprojl(tmpld); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_c99_complex_cxx11=yes +else + glibcxx_cv_c99_complex_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16865,26 +17460,29 @@ f = cabsf(tmpf); } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - glibcxx_cv_c99_complex=yes + glibcxx_cv_c99_complex_cxx11=yes else - glibcxx_cv_c99_complex=no + glibcxx_cv_c99_complex_cxx11=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_complex" >&5 -$as_echo "$glibcxx_cv_c99_complex" >&6; } - if test x"$glibcxx_cv_c99_complex" = x"yes"; then -$as_echo "#define _GLIBCXX_USE_C99_COMPLEX 1" >>confdefs.h +fi - fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_complex_cxx11" >&5 +$as_echo "$glibcxx_cv_c99_complex_cxx11" >&6; } + if test x"$glibcxx_cv_c99_complex_cxx11" = x"yes"; then + +$as_echo "#define _GLIBCXX11_USE_C99_COMPLEX 1" >>confdefs.h + + fi # Check for the existence in of vscanf, et. al. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in " >&5 -$as_echo_n "checking for ISO C99 support in ... " >&6; } - if test "${glibcxx_cv_c99_stdio+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++11" >&5 +$as_echo_n "checking for ISO C99 support in for C++11... " >&6; } + if test "${glibcxx_cv_c99_stdio_cxx11+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -16910,9 +17508,9 @@ snprintf("12", 0, "%i"); } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_c99_stdio=yes + glibcxx_cv_c99_stdio_cxx11=yes else - glibcxx_cv_c99_stdio=no + glibcxx_cv_c99_stdio_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16940,9 +17538,9 @@ snprintf("12", 0, "%i"); } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - glibcxx_cv_c99_stdio=yes + glibcxx_cv_c99_stdio_cxx11=yes else - glibcxx_cv_c99_stdio=no + glibcxx_cv_c99_stdio_cxx11=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -16950,13 +17548,18 @@ fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_stdio" >&5 -$as_echo "$glibcxx_cv_c99_stdio" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_stdio_cxx11" >&5 +$as_echo "$glibcxx_cv_c99_stdio_cxx11" >&6; } + if test x"$glibcxx_cv_c99_stdio_cxx11" = x"yes"; then + +$as_echo "#define _GLIBCXX11_USE_C99_STDIO 1" >>confdefs.h + + fi # Check for the existence in of lldiv_t, et. al. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in " >&5 -$as_echo_n "checking for ISO C99 support in ... " >&6; } - if test "${glibcxx_cv_c99_stdlib+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++11" >&5 +$as_echo_n "checking for ISO C99 support in for C++11... " >&6; } + if test "${glibcxx_cv_c99_stdlib_cxx11+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -16988,9 +17591,9 @@ char* tmp; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_c99_stdlib=yes + glibcxx_cv_c99_stdlib_cxx11=yes else - glibcxx_cv_c99_stdlib=no + glibcxx_cv_c99_stdlib_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -17024,9 +17627,9 @@ char* tmp; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - glibcxx_cv_c99_stdlib=yes + glibcxx_cv_c99_stdlib_cxx11=yes else - glibcxx_cv_c99_stdlib=no + glibcxx_cv_c99_stdlib_cxx11=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -17034,16 +17637,24 @@ fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_stdlib" >&5 -$as_echo "$glibcxx_cv_c99_stdlib" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_stdlib_cxx11" >&5 +$as_echo "$glibcxx_cv_c99_stdlib_cxx11" >&6; } + if test x"$glibcxx_cv_c99_stdlib_cxx11" = x"yes"; then - # Check for the existence in of wcstold, etc. - glibcxx_cv_c99_wchar=no; - if test x"$ac_has_wchar_h" = xyes && - test x"$ac_has_wctype_h" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in " >&5 -$as_echo_n "checking for ISO C99 support in ... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +$as_echo "#define _GLIBCXX11_USE_C99_STDLIB 1" >>confdefs.h + + fi + + # Check for the existence in of wcstold, etc. + if test x"$ac_has_wchar_h" = xyes && + test x"$ac_has_wctype_h" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 support in for C++11" >&5 +$as_echo_n "checking for ISO C99 support in for C++11... " >&6; } + if test "${glibcxx_cv_c99_wchar_cxx11+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include namespace test @@ -17062,12 +17673,15 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_c99_wchar=yes + glibcxx_cv_c99_wchar_cxx11=yes else - glibcxx_cv_c99_wchar=no + glibcxx_cv_c99_wchar_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + # Checks for wide character functions that may not be present. # Injection of these is wrapped with guard macros. # NB: only put functions here, instead of immediately above, if @@ -17166,22 +17780,14 @@ $as_echo "#define HAVE_ISWBLANK 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_wchar" >&5 -$as_echo "$glibcxx_cv_c99_wchar" >&6; } - fi - - # Option parsed, now set things appropriately. - if test x"$glibcxx_cv_c99_math" = x"no" || - test x"$glibcxx_cv_c99_complex" = x"no" || - test x"$glibcxx_cv_c99_stdio" = x"no" || - test x"$glibcxx_cv_c99_stdlib" = x"no" || - test x"$glibcxx_cv_c99_wchar" = x"no"; then - enable_c99=no; - else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_wchar_cxx11" >&5 +$as_echo "$glibcxx_cv_c99_wchar_cxx11" >&6; } + if test x"$glibcxx_cv_c99_wchar_cxx11" = x"yes"; then -$as_echo "#define _GLIBCXX_USE_C99 1" >>confdefs.h +$as_echo "#define _GLIBCXX11_USE_C99_WCHAR 1" >>confdefs.h fi +fi gcc_no_link="$ac_save_gcc_no_link" LIBS="$ac_save_LIBS" diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index a629390..f782a81 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -2844,7 +2844,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) +#if __cplusplus >= 201103L #include @@ -2852,6 +2852,7 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION +#if _GLIBCXX_USE_C99_STDLIB // 21.4 Numeric Conversions [string.conversions]. inline int stoi(const string& __str, size_t* __idx = 0, int __base = 10) @@ -2890,7 +2891,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline long double stold(const string& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } +#endif // _GLIBCXX_USE_C99_STDLIB +#if _GLIBCXX_USE_C99_STDIO // NB: (v)snprintf vs sprintf. // DR 1261. @@ -2954,8 +2957,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, "%Lf", __val); } +#endif // _GLIBCXX_USE_C99_STDIO -#ifdef _GLIBCXX_USE_WCHAR_T +#if defined(_GLIBCXX_USE_WCHAR_T) && defined(_GLIBCXX_USE_C99_WCHAR) inline int stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), @@ -3057,12 +3061,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION L"%Lf", __val); } #endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF -#endif +#endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#endif /* C++11 && _GLIBCXX_USE_C99 ... */ +#endif /* C++11 */ #if __cplusplus >= 201103L diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index ff6afc8..0639984 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -466,4 +466,40 @@ namespace std #undef min #undef max +// N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally +// so they should be tested with #if not with #ifdef. +#if __cplusplus >= 201103L +# ifndef _GLIBCXX_USE_C99_MATH +# define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH +# endif +# ifndef _GLIBCXX_USE_C99_COMPLEX +# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX +# endif +# ifndef _GLIBCXX_USE_C99_STDIO +# define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO +# endif +# ifndef _GLIBCXX_USE_C99_STDLIB +# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB +# endif +# ifndef _GLIBCXX_USE_C99_WCHAR +# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR +# endif +#else +# ifndef _GLIBCXX_USE_C99_MATH +# define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH +# endif +# ifndef _GLIBCXX_USE_C99_COMPLEX +# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX +# endif +# ifndef _GLIBCXX_USE_C99_STDIO +# define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO +# endif +# ifndef _GLIBCXX_USE_C99_STDLIB +# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB +# endif +# ifndef _GLIBCXX_USE_C99_WCHAR +# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR +# endif +#endif + // End of prewritten config; the settings discovered at configure time follow. diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index cf12a08..3e8a2cf 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -954,13 +954,13 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL } // The following code uses vsnprintf (or vsprintf(), when - // _GLIBCXX_USE_C99 is not defined) to convert floating point values - // for insertion into a stream. An optimization would be to replace - // them with code that works directly on a wide buffer and then use - // __pad to do the padding. It would be good to replace them anyway - // to gain back the efficiency that C++ provides by knowing up front - // the type of the values to insert. Also, sprintf is dangerous - // since may lead to accidental buffer overruns. This + // _GLIBCXX_USE_C99_STDIO is not defined) to convert floating point + // values for insertion into a stream. An optimization would be to + // replace them with code that works directly on a wide buffer and + // then use __pad to do the padding. It would be good to replace + // them anyway to gain back the efficiency that C++ provides by + // knowing up front the type of the values to insert. Also, sprintf + // is dangerous since may lead to accidental buffer overruns. This // implementation follows the C++ standard fairly directly as // outlined in 22.2.2.2 [lib.locale.num.put] template @@ -987,7 +987,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL char __fbuf[16]; __num_base::_S_format_float(__io, __fbuf, __mod); -#ifdef _GLIBCXX_USE_C99 +#ifdef _GLIBCXX_USE_C99_STDIO // First try a buffer perhaps big enough (most probably sufficient // for non-ios_base::fixed outputs) int __cs_size = __max_digits * 3; diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc index 41d944d..7643931 100644 --- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc +++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc @@ -572,7 +572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL { const locale __loc = __io.getloc(); const ctype<_CharT>& __ctype = use_facet >(__loc); -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO // First try a buffer perhaps big enough. int __cs_size = 64; char* __cs = static_cast(__builtin_alloca(__cs_size)); @@ -745,7 +745,7 @@ _GLIBCXX_END_NAMESPACE_LDBL case 'S': // Seconds. [tm_sec] // [00, 60] in C99 (one leap-second), [00, 61] in C89. -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99 __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2, #else __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2, diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h index c6d59ba..7847800 100644 --- a/libstdc++-v3/include/c_compatibility/math.h +++ b/libstdc++-v3/include/c_compatibility/math.h @@ -56,7 +56,7 @@ using std::fabs; using std::floor; using std::fmod; -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_MATH using std::fpclassify; using std::isfinite; using std::isinf; diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h index fed87f1..eb7b7be 100644 --- a/libstdc++-v3/include/c_compatibility/wchar.h +++ b/libstdc++-v3/include/c_compatibility/wchar.h @@ -103,7 +103,7 @@ using std::wmemmove; using std::wmemset; using std::wcsftime; -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR using std::wcstold; using std::wcstoll; using std::wcstoull; diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio index 6043b3d..2265ae1 100644 --- a/libstdc++-v3/include/c_global/cstdio +++ b/libstdc++-v3/include/c_global/cstdio @@ -146,7 +146,7 @@ namespace std using ::vsprintf; } // namespace -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO #undef snprintf #undef vfscanf @@ -189,6 +189,6 @@ namespace std using ::__gnu_cxx::vsscanf; } // namespace std -#endif // _GLIBCXX_USE_C99 +#endif // _GLIBCXX_USE_C99_STDIO #endif diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib index e98a726..0873c36 100644 --- a/libstdc++-v3/include/c_global/cstdlib +++ b/libstdc++-v3/include/c_global/cstdlib @@ -182,7 +182,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB #undef _Exit #undef llabs @@ -253,7 +253,7 @@ namespace std using ::__gnu_cxx::strtold; } // namespace std -#endif // _GLIBCXX_USE_C99 +#endif // _GLIBCXX_USE_C99_STDLIB #endif // !_GLIBCXX_HOSTED diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar index c2ff50d..5eb84d8 100644 --- a/libstdc++-v3/include/c_global/cwchar +++ b/libstdc++-v3/include/c_global/cwchar @@ -232,7 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR #undef wcstold #undef wcstoll @@ -289,7 +289,7 @@ namespace std using std::vwscanf; #endif -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR using std::wcstold; using std::wcstoll; using std::wcstoull; diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio index 9434da6..c846999 100644 --- a/libstdc++-v3/include/c_std/cstdio +++ b/libstdc++-v3/include/c_std/cstdio @@ -144,7 +144,7 @@ namespace std using ::vsprintf; } // namespace std -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO #undef snprintf #undef vfscanf diff --git a/libstdc++-v3/include/c_std/cstdlib b/libstdc++-v3/include/c_std/cstdlib index 7f0d9b2..9676ea9 100644 --- a/libstdc++-v3/include/c_std/cstdlib +++ b/libstdc++-v3/include/c_std/cstdlib @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB #undef _Exit #undef llabs @@ -251,7 +251,7 @@ namespace std using ::__gnu_cxx::strtold; } // namespace std -#endif // _GLIBCXX_USE_C99 +#endif // _GLIBCXX_USE_C99_STDLIB #endif // !_GLIBCXX_HOSTED diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar index c6f1f23..90d7ff6 100644 --- a/libstdc++-v3/include/c_std/cwchar +++ b/libstdc++-v3/include/c_std/cwchar @@ -228,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR #undef wcstold #undef wcstoll diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index 749d370..3f3e7a3 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -2680,7 +2680,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) +#if __cplusplus >= 201103L #include @@ -2688,6 +2688,7 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION +#if _GLIBCXX_USE_C99_STDLIB // 21.4 Numeric Conversions [string.conversions]. inline int stoi(const __vstring& __str, std::size_t* __idx = 0, int __base = 10) @@ -2726,7 +2727,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline long double stold(const __vstring& __str, std::size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } +#endif // _GLIBCXX_USE_C99_STDLIB +#if _GLIBCXX_USE_C99_STDIO // NB: (v)snprintf vs sprintf. // DR 1261. @@ -2789,8 +2792,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n, "%Lf", __val); } +#endif // _GLIBCXX_USE_C99_STDIO -#ifdef _GLIBCXX_USE_WCHAR_T +#if defined(_GLIBCXX_USE_WCHAR_T) && defined(_GLIBCXX_USE_C99_WCHAR) inline int stoi(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10) { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), @@ -2890,8 +2894,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n, L"%Lf", __val); } -#endif -#endif +#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF +#endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 941e6b7..f0cf272 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -987,7 +987,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION complex<_Tp> pow(const complex<_Tp>& __x, const _Tp& __y) { -#ifndef _GLIBCXX_USE_C99_COMPLEX +#if ! _GLIBCXX_USE_C99_COMPLEX if (__x == _Tp()) return _Tp(); #endif @@ -1823,7 +1823,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION arg(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; -#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) +#if (_GLIBCXX11_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L) : __type(); #else diff --git a/libstdc++-v3/include/tr1/cstdio b/libstdc++-v3/include/tr1/cstdio index b320ffd..28cdbe4 100644 --- a/libstdc++-v3/include/tr1/cstdio +++ b/libstdc++-v3/include/tr1/cstdio @@ -33,7 +33,7 @@ #include -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib index fa4d93e..e1c071d 100644 --- a/libstdc++-v3/include/tr1/cstdlib +++ b/libstdc++-v3/include/tr1/cstdlib @@ -35,7 +35,7 @@ #if _GLIBCXX_HOSTED -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB namespace std _GLIBCXX_VISIBILITY(default) { @@ -65,7 +65,7 @@ namespace tr1 } } -#endif // _GLIBCXX_USE_C99 +#endif // _GLIBCXX_USE_C99_STDLIB #endif // _GLIBCXX_HOSTED diff --git a/libstdc++-v3/include/tr1/cwchar b/libstdc++-v3/include/tr1/cwchar index 4482574..3d70468 100644 --- a/libstdc++-v3/include/tr1/cwchar +++ b/libstdc++-v3/include/tr1/cwchar @@ -52,7 +52,7 @@ namespace tr1 using std::vwscanf; #endif -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR using std::wcstold; using std::wcstoll; using std::wcstoull; diff --git a/libstdc++-v3/include/tr1/stdlib.h b/libstdc++-v3/include/tr1/stdlib.h index c50c363..0dd538c 100644 --- a/libstdc++-v3/include/tr1/stdlib.h +++ b/libstdc++-v3/include/tr1/stdlib.h @@ -33,7 +33,7 @@ #if _GLIBCXX_HOSTED -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB using std::tr1::atoll; using std::tr1::strtoll; diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-terminate.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-terminate.cc index 19f8fd2..3593eb4 100644 --- a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-terminate.cc +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-terminate.cc @@ -23,7 +23,7 @@ #include #include -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB void terminate() { _Exit(0); } void f() noexcept @@ -39,7 +39,7 @@ void f() noexcept int main() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB f(); #endif return 0; diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc index 708f748..5f3b069 100644 --- a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc @@ -23,7 +23,7 @@ #include #include -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB void unexpected() { _Exit(0); } void f() throw() @@ -39,7 +39,7 @@ void f() throw() int main() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB f(); #endif } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc index 1aa237a..75f2752 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc index cb39995..4a57464 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc index 9813d33..655d5d0 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc index a111754..7dc50c3 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc index a49b1f0..c3fbdc0 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc index b25155b..8ff6218 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc index 5eb55ca..d695824 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc index 6fb7082..0b9a1e7 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc @@ -29,7 +29,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = false; using namespace std; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc index 8b94ed0..44969d4 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc @@ -27,7 +27,7 @@ void test01() { -#ifdef _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR bool test __attribute__((unused)) = true; using namespace std; diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc index 3ff3afc..2069abd 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc @@ -19,7 +19,7 @@ #include #include -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB // libstdc++/13943 void test01() { @@ -36,7 +36,7 @@ void test01() int main() { -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB test01(); #endif return 0; diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc index 7617232..16aa126 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc @@ -24,10 +24,10 @@ void test01() { -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB typedef std::lldiv_t my_lldiv_t; - + #endif } diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 79eec1c..bb7b541 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1581,7 +1581,7 @@ proc check_v3_target_string_conversions { } { set f [open $src "w"] puts $f "#include " - puts $f "#if !defined(_GLIBCXX_USE_C99) || defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)" + puts $f "#if !(_GLIBCXX_USE_C99_STDIO && _GLIBCXX_USE_C99_STDLIB && _GLIBCXX_USE_C99_WCHAR) || defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)" puts $f "# error No string conversions" puts $f "#endif" close $f diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc index cd7c58e..ba399e4 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/templates.cc @@ -23,7 +23,7 @@ #include -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_MATH #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC template diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc index 3758958..4a47f80 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc @@ -30,7 +30,7 @@ void test01(int dummy, ...) std::va_list ap; va_start(ap, dummy); -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDIO char* s = 0; const char* cs = 0; diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc index 4d225da..84a14f3 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc @@ -27,7 +27,7 @@ void test01() { -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB long long i = 0; const char* s = 0; diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc index e5f06ab..88bfcfc 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc @@ -27,10 +27,10 @@ void test01() { -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_STDLIB typedef std::tr1::lldiv_t my_lldiv_t; - + #endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc index b504f21..a00072f 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc @@ -67,7 +67,7 @@ void test01(int dummy, ...) ret3 = ret3; // Suppress unused warning. #endif -#if _GLIBCXX_USE_C99 +#if _GLIBCXX_USE_C99_WCHAR const wchar_t* nptr2 = 0; wchar_t** endptr2 = 0;