From 5eed8a11ceccb2a71aa95349c6a7eebf2b973677 Mon Sep 17 00:00:00 2001 From: redi Date: Wed, 22 Aug 2018 22:54:33 +0000 Subject: [PATCH] PR libstdc++/87061 remove pmr type aliases for COW strings The pmr aliases for basic_string and match_results are incompatible with the gcc4-compatible ABI because the Copy-On-Write basic_string class doesn't support C++11 allocators. PR libstdc++/87061 * include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI] (experimental::pmr::match_results, experimental::pmr::cmatch) (experimental::pmr::smatch, experimental::pmr::wcmatch) (experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI, because COW strings don't support C++11 allocator model. * include/experimental/string [!_GLIBCXX_USE_CXX11_ABI] (experimental::pmr::basic_string, experimental::pmr::string) (experimental::pmr::u16string, experimental::pmr::u32string) (experimental::pmr::wstring): Likewise. * include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results) (pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise. * include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string) (pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require cxx11-abi. * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263791 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 18 ++++++++++++++++++ libstdc++-v3/include/experimental/regex | 3 ++- libstdc++-v3/include/experimental/string | 2 ++ libstdc++-v3/include/std/regex | 2 +- libstdc++-v3/include/std/string | 2 +- .../21_strings/basic_string/types/pmr_typedefs.cc | 1 + .../testsuite/28_regex/match_results/pmr_typedefs.cc | 1 + 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index dfe3a52443a..e703ffb5143 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,23 @@ 2018-08-22 Jonathan Wakely + PR libstdc++/87061 + * include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI] + (experimental::pmr::match_results, experimental::pmr::cmatch) + (experimental::pmr::smatch, experimental::pmr::wcmatch) + (experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI, + because COW strings don't support C++11 allocator model. + * include/experimental/string [!_GLIBCXX_USE_CXX11_ABI] + (experimental::pmr::basic_string, experimental::pmr::string) + (experimental::pmr::u16string, experimental::pmr::u32string) + (experimental::pmr::wstring): Likewise. + * include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results) + (pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise. + * include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string) + (pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise. + * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require + cxx11-abi. + * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. + PR libstdc++/78448 * include/bits/deque.tcc (deque::_M_range_initialize): Use _S_check_init_len to check size. diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex index eb2af151245..633b396b312 100644 --- a/libstdc++-v3/include/experimental/regex +++ b/libstdc++-v3/include/experimental/regex @@ -44,6 +44,7 @@ namespace experimental { inline namespace fundamentals_v2 { +#if _GLIBCXX_USE_CXX11_ABI namespace pmr { template @@ -57,7 +58,7 @@ namespace pmr typedef match_results wsmatch; } // namespace pmr - +#endif } // namespace fundamentals_v2 } // namespace experimental _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string index f101255d641..5a96bf78d73 100644 --- a/libstdc++-v3/include/experimental/string +++ b/libstdc++-v3/include/experimental/string @@ -62,6 +62,7 @@ inline namespace fundamentals_v2 __cont.end()); } +#if _GLIBCXX_USE_CXX11_ABI namespace pmr { // basic_string using polymorphic allocator in namespace pmr @@ -77,6 +78,7 @@ inline namespace fundamentals_v2 typedef basic_string wstring; } // namespace pmr +#endif } // namespace fundamentals_v2 } // namespace experimental diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index f0dfa3f68ab..fd155658353 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -62,7 +62,7 @@ #include #include -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI #include namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index d3cc03aa179..dd60df2ba6e 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -52,7 +52,7 @@ #include #include -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc index d20fc42901e..23956673792 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc @@ -17,6 +17,7 @@ // { dg-options "-std=gnu++17" } // { dg-do compile { target c++17 } } +// { dg-require-effective-target cxx11-abi } #include #include diff --git a/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc index 23aef39caf3..d97fcfeb75e 100644 --- a/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc @@ -17,6 +17,7 @@ // { dg-options "-std=gnu++17" } // { dg-do compile { target c++17 } } +// { dg-require-effective-target cxx11-abi } #include #include -- 2.11.4.GIT