diff options
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 45 | ||||
-rw-r--r-- | libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt | 1 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.tcc | 25 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/char_traits.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/std/utility | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc | 30 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc | 30 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc | 37 |
10 files changed, 172 insertions, 11 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index de8f0dab995..60a81cc0941 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,48 @@ +2018-06-22 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2018-04-18 David Malcolm <dmalcolm@redhat.com> + + PR jit/85384 + * configure: Regenerate. + +2018-06-22 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2018-06-22 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/86138 + * include/bits/basic_string.tcc: + [__cplusplus > 201402 && !_GLIBCXX_USE_CXX11_ABI] + (basic_string<char>::_Rep::_S_empty_rep_storage) + (basic_string<wchar_t>::_Rep::_S_empty_rep_storage): Add explicit + instantiation declarations. + [__cplusplus > 201402] (operator>>, operator<<, getline): Re-enable + explicit instantiation declarations. + * testsuite/21_strings/basic_string/cons/char/86138.cc: New. + * testsuite/21_strings/basic_string/cons/wchar_t/86138.cc: New. + +2018-06-21 Jonathan Wakely <jwakely@redhat.com> + + * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update. + +2018-06-19 Jonathan Wakely <jwakely@redhat.com> + + * include/std/utility: Remove unused <exception> header. + +2018-06-15 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/86169 + * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI] + (basic_string::data()): Unshare string. + * testsuite/21_strings/basic_string/operations/data/char/86169.cc: + New. + +2018-06-15 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Only + define for C++17 and above. + 2018-05-17 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/85812 diff --git a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt index a31597e906f..06c61236f34 100644 --- a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt @@ -4004,6 +4004,7 @@ OBJECT:0:GLIBCXX_3.4.20 OBJECT:0:GLIBCXX_3.4.21 OBJECT:0:GLIBCXX_3.4.22 OBJECT:0:GLIBCXX_3.4.23 +OBJECT:0:GLIBCXX_3.4.24 OBJECT:0:GLIBCXX_3.4.3 OBJECT:0:GLIBCXX_3.4.4 OBJECT:0:GLIBCXX_3.4.5 diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9e56113b872..bc624207ce6 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -81697,7 +81697,7 @@ $as_echo "$gxx_include_dir" >&6; } # Check whether --with-gcc-major-version-only was given. if test "${with_gcc_major_version_only+set}" = set; then : withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then - get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'" + get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'" fi fi diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 7df39685ad3..674fe0963eb 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -5130,7 +5130,10 @@ _GLIBCXX_END_NAMESPACE_CXX11 */ _CharT* data() noexcept - { return _M_data(); } + { + _M_leak(); + return _M_data(); + } #endif /** diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 41b7fa196b0..d185a54aaf0 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -1597,8 +1597,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. -#if _GLIBCXX_EXTERN_TEMPLATE > 0 && __cplusplus <= 201402L +#if _GLIBCXX_EXTERN_TEMPLATE > 0 + // The explicit instantiations definitions in src/c++11/string-inst.cc + // are compiled as C++14, so the new C++17 members aren't instantiated. + // Until those definitions are compiled as C++17 suppress the declaration, + // so C++17 code will implicitly instantiate std::string and std::wstring + // as needed. +# if __cplusplus <= 201402L extern template class basic_string<char>; +# elif ! _GLIBCXX_USE_CXX11_ABI + // Still need to prevent implicit instantiation of the COW empty rep, + // to ensure the definition in libstdc++.so is unique (PR 86138). + extern template basic_string<char>::size_type + basic_string<char>::_Rep::_S_empty_rep_storage[]; +# endif + extern template basic_istream<char>& operator>>(basic_istream<char>&, string&); @@ -1613,7 +1626,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION getline(basic_istream<char>&, string&); #ifdef _GLIBCXX_USE_WCHAR_T +# if __cplusplus <= 201402L extern template class basic_string<wchar_t>; +# elif ! _GLIBCXX_USE_CXX11_ABI + extern template basic_string<wchar_t>::size_type + basic_string<wchar_t>::_Rep::_S_empty_rep_storage[]; +# endif + extern template basic_istream<wchar_t>& operator>>(basic_istream<wchar_t>&, wstring&); @@ -1626,8 +1645,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION extern template basic_istream<wchar_t>& getline(basic_istream<wchar_t>&, wstring&); -#endif -#endif +#endif // _GLIBCXX_USE_WCHAR_T +#endif // _GLIBCXX_EXTERN_TEMPLATE > 0 _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 3ecc30e46cb..791608ad3db 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -143,8 +143,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } }; -#define __cpp_lib_constexpr_char_traits 201611 - template<typename _CharT> _GLIBCXX14_CONSTEXPR int char_traits<_CharT>:: @@ -217,6 +215,8 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201402 +#define __cpp_lib_constexpr_char_traits 201611 + /** * @brief Determine whether the characters of a NULL-terminated * string are known at compile time. diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 978acb747e9..847e5184c5b 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -75,10 +75,6 @@ #include <bits/move.h> #include <initializer_list> -#if __cplusplus > 201402L -#include <exception> -#endif - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc new file mode 100644 index 00000000000..a85fd9c82c9 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++1z } } +// { dg-final { scan-assembler-not "_ZNSs4_Rep20_S_empty_rep_storageE:" } } + +#undef _GLIBCXX_USE_CXX11_ABI +#define _GLIBCXX_USE_CXX11_ABI 0 +#include <string> + +void +test01(std::string* s) +{ + s->~basic_string(); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc new file mode 100644 index 00000000000..d77922976d0 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2018 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++1z } } +// { dg-final { scan-assembler-not "_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE:" } } + +#undef _GLIBCXX_USE_CXX11_ABI +#define _GLIBCXX_USE_CXX11_ABI 0 +#include <string> + +void +test01(std::wstring* s) +{ + s->~basic_string(); +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc new file mode 100644 index 00000000000..a8b0ff4aa3f --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc @@ -0,0 +1,37 @@ +// Copyright (C) 2018 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++17" } +// { dg-do run { target c++1z } } + +// PR libstdc++/86169 + +#ifndef _GLIBCXX_USE_CXX11_ABI +# define _GLIBCXX_USE_CXX11_ABI 0 +#endif + +#include <string> +#include <testsuite_hooks.h> + +int main() +{ + const std::string s0{"hello world"}; + std::string s1 {s0}; + char* p = s1.data(); + *p = ' '; + VERIFY(s0.compare("hello world") == 0); +} |