From f37f5fb81c7f1a4f9589af2be8f4dc32f43d9d91 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 22 Dec 2014 16:41:39 +0000 Subject: [PATCH] re PR libstdc++/37522 (Incorrect vswprintf prototype breaks __to_xstring) PR libstdc++/37522 * include/bits/basic_string.h (stod, stof, stoi, stol, stold, stoll, stoul, stoull, to_string): Only use _GLIBCXX_HAVE_BROKEN_VSWPRINTF to guard definition of to_wstring. * testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc: Do not use dg-require-string-conversions. * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/ stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/ to_string.cc: Likewise. From-SVN: r219019 --- libstdc++-v3/ChangeLog | 27 ++++++++++++++++++++++ libstdc++-v3/include/bits/basic_string.h | 5 ++-- .../numeric_conversions/char/dr1261.cc | 1 - .../basic_string/numeric_conversions/char/stod.cc | 1 - .../basic_string/numeric_conversions/char/stof.cc | 1 - .../basic_string/numeric_conversions/char/stoi.cc | 1 - .../basic_string/numeric_conversions/char/stol.cc | 1 - .../basic_string/numeric_conversions/char/stold.cc | 1 - .../basic_string/numeric_conversions/char/stoll.cc | 1 - .../basic_string/numeric_conversions/char/stoul.cc | 1 - .../numeric_conversions/char/stoull.cc | 1 - .../numeric_conversions/char/to_string.cc | 1 - 12 files changed, 30 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4fe8283..29acd97 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,30 @@ +2014-12-22 Jonathan Wakely + + PR libstdc++/37522 + * include/bits/basic_string.h (stod, stof, stoi, stol, stold, stoll, + stoul, stoull, to_string): Only use _GLIBCXX_HAVE_BROKEN_VSWPRINTF + to guard definition of to_wstring. + * testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc: + Do not use dg-require-string-conversions. + * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: + Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/ + stoull.cc: Likewise. + * testsuite/21_strings/basic_string/numeric_conversions/char/ + to_string.cc: Likewise. + 2014-12-22 Ville Voutilainen PR libstdc++/60271 diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 7729384..6423c59 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -5240,8 +5240,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) #include @@ -5392,6 +5391,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 stold(const wstring& __str, size_t* __idx = 0) { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } +#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF // DR 1261. inline wstring to_wstring(int __val) @@ -5453,6 +5453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return __gnu_cxx::__to_xstring(&std::vswprintf, __n, L"%Lf", __val); } +#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF #endif _GLIBCXX_END_NAMESPACE_CXX11 diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc index b9de1cd..e7fea9e 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/dr1261.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2009-11-11 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc index 5e3060c..fa9dedb 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc index 607f97b..16b9fc2 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc index 6c0fb98..1032e6e 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc index 9cdb4b0..df6ad78 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc index 039534c..e201780 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc index dce8fdf..b5ced9f 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc index 9cc2609..29c462b 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc index 8a04e07..3900431 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/to_string.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/to_string.cc index 516e602..4f7f75a 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/to_string.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/to_string.cc @@ -1,5 +1,4 @@ // { dg-options "-std=gnu++11" } -// { dg-require-string-conversions "" } // 2008-06-15 Paolo Carlini -- 2.7.4