This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Forgot to include the patch. On Fri, Sep 18, 2015 at 11:17 AM, Jennifer Yao <jenny.hyphen.fa@gmail.com> wrote: > A number of functions in libstdc++ are guarded by the _GLIBCXX_USE_C99 > preprocessor macro, which is only defined on systems that pass all of > the checks for a large set of C99 functions. Consequently, on systems > which lack any of the required C99 facilities (e.g. Cygwin, which > lacks some C99 complex math functions), the numeric conversion > functions (std::stoi(), std::stol(), std::to_string(), etc.) are not > definedâa rather silly outcome, as none of the numeric conversion > functions are implemented using C99 math functions. > > This patch enables numeric conversion functions on the aforementioned > systems by splitting the checks for C99 support and defining several > new macros (_GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and > _GLIBCXX_USE_C99_WCHAR), which replace the use of _GLIBCXX_USE_C99 in > #if conditionals where appropriate. > > Tested on x86_64-pc-cygwin. > > Note: Several of the testcases that are newly enabled by the patch > fail on Cygwin due to defects in newlib (e.g. strtof() and wcstof() do > not set errno, strtold() and wcstold() do not handle trailing > non-numeric characters in input strings correctly, etc.). Also, at > least one testcase may fail due to PR 66530 > <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66530> (to circumvent, > install the build tree or add the directory containing the built DLL > and import library to PATH). > > libstdc++-v3/ChangeLog: > > 2015-09-18 Jennifer Yao <jenny.hyphen.fa@gmail.com> > > PR libstdc++/58393 > PR libstdc++/61580 > * acinclude.m4 (GLIBCXX_ENABLE_C99, GLIBCXX_CHECK_C99_TR1): Use -std=c++0x > instead of -std=c++98 in CXXFLAGS. Cache the results of checking for complex > math and wide character functions. Define preprocessor macros > _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR. > Reformat to improve readability. > * config.h.in: Regenerate. > * config/locale/dragonfly/c_locale.h (std::__convert_from_v): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * config/locale/generic/c_locale.h (std::__convert_from_v): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * config/locale/gnu/c_locale.h (std::__convert_from_v): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * config/os/bsd/dragonfly/os_defines.h: Define _GLIBCXX_USE_C99_STDIO, > _GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR. > * configure: Regenerate. > * include/bits/basic_string.h: Change and add preprocessor #if conditionals > so that numeric conversion functions are defined when > _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, or _GLIBCXX_USE_C99_WCHAR > are defined, instead of _GLIBCXX_USE_C99. > * include/bits/locale_facets.tcc (std::num_put::_M_insert_float): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * include/bits/locale_facets_nonio.tcc (std::money_put::do_put): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * include/c_compatibility/math.h: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_MATH. > * include/c_compatibility/wchar.h: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_WCHAR. > * include/c_global/cstdio: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDIO. > * include/c_global/cstdlib: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDLIB. > * include/c_global/cwchar: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_WCHAR. > * include/c_std/cstdio: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDIO. > * include/c_std/cstdlib: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDLIB. > * include/c_std/cwchar: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_WCHAR. > * include/ext/vstring.h: Change and add preprocessor #if conditionals > so that numeric conversion functions are defined when > _GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, or _GLIBCXX_USE_C99_WCHAR > are defined, instead of _GLIBCXX_USE_C99. > * include/tr1/cstdio: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDIO. > * include/tr1/cstdlib: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDLIB. > * include/tr1/cwchar: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_WCHAR. > * include/tr1/stdlib.h: Replace _GLIBCXX_USE_C99 with > _GLIBCXX_USE_C99_STDLIB. > * src/c++11/debug.cc (__gnu_debug::_Error_formatter::_M_format_word): > Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * src/c++98/locale_facets.cc (std::__num_base::_S_format_float): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * testsuite/18_support/exception_ptr/60612-terminate.cc: Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. > * testsuite/18_support/exception_ptr/60612-unexpected.cc: Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc > (test01): Replace _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR. > * testsuite/26_numerics/headers/cstdlib/13943.cc: Replace _GLIBCXX_USE_C99 > with _GLIBCXX_USE_C99_STDLIB. > * testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc (test01): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. > * testsuite/lib/libstdc++.exp (check_v3_target_string_conversions): Change > preprocessor #if conditional so that it uses _GLIBCXX_USE_C99_STDIO, > _GLIBCXX_USE_C99_STDLIB, and _GLIBCXX_USE_C99_WCHAR instead of > _GLIBCXX_USE_C99. > * testsuite/tr1/8_c_compatibility/cmath/templates.cc: Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_MATH. > * testsuite/tr1/8_c_compatibility/cstdio/functions.cc (test01): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDIO. > * testsuite/tr1/8_c_compatibility/cstdlib/functions.cc (test01): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. > * testsuite/tr1/8_c_compatibility/cstdlib/types_std_tr1.cc (test01): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_STDLIB. > * testsuite/tr1/8_c_compatibility/cwchar/functions.cc (test01): Replace > _GLIBCXX_USE_C99 with _GLIBCXX_USE_C99_WCHAR.
Attachment:
libstdc++-numeric-conversions.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |