diff mbox

New std::string implementation

Message ID 20141128165532.GR5191@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Nov. 28, 2014, 4:55 p.m. UTC
On 28/11/14 15:24 +0000, Jonathan Wakely wrote:
>Tested x86_64-linux with:
>
>  --target_board=unix\{-m32,\}\{,-D_GLIBCXX_USE_CXX11_ABI=0\}
>
>Also tested on powerpc64-linux (where this patch doesn't actually
>bootstrap due to PR 63573, there's a patch in the PR that's needed)
>and i686-linux.

Oh how silly, the attached patch is needed for powerpc. I had fixed
this once, but must have lost the change on the compile farm machine I
was using and then not committed the fix in my local repo. The
attached patch also includes the PR63573 fix which isn't committed
yet.

I've committed the libstdc++ parts (but not the PR fix)  to my repo
now, so it won't get lost again.

Comments

Jonathan Wakely Dec. 19, 2014, 6:23 p.m. UTC | #1
The powerpc64 ICE is fixed, so I'm committing the std::string ABI
transition patch.

This replaces our venerable Copy-on-Write std::string with a
C++11-conforming* Small-String Optimized std::__cxx11::string.

(* It's not quite 100% conforming, as it's missing some allocator
features.  Of course. Always with the allocators. But that's only a
small fix to make next week.)

Since the last version of this patch Jason has added support for
attribute((abi_tag)) on namespaces, so the new types can be defined in
an inline namespace that has the tag, rather than co-existing in
namespace std with the un-tagged types. This makes overloading and
exporting symbols a bit more straightforward as the different linkage
names can be expressed with a fully-qualified name without needing the
attribute.

I've also added regex templates to the new __cxx11 namespace, as they
depend on std::string.

There are now two new configure options, --disable-libstdcxx-dual-abi
and --with-default-libstdcxx-abi. The former disables all support for
the new __cxx11 ABI pieces. The latter is only relevant when the dual
ABI is enabled and can be used to make the old definitions the
default ones you get without defining the _GLIBCXX_USE_CXX11_ABI
macro.

As described previously, the locale facets that depend on the
std::string ABI exist twice as "twinned facets" and if users replace
a twinned facet the library generates a shim to replace its twin.

Also as described previously, the types in <stdexcept> continue to use
the COW string, to ensure nothrow copying and ABI stability.

The Python pretty printer problems I was seeing with the new string
turned out to be a GDB bug (17728).

Target maintainers will see a *lot* of new exports at the latest
symbol version if they generate a new baseline-symbols.txt file. I
suggest waiting and doing that nearer the end of stage 3 in case there
are any fixes needed after this change.

Bootstrapped and tested in various configurations on x86_64-linux and
powerpc64-linux.

Committed to trunk!

Phew.
Rainer Orth Jan. 6, 2015, 9:52 a.m. UTC | #2
Jonathan Wakely <jwakely@redhat.com> writes:

> The powerpc64 ICE is fixed, so I'm committing the std::string ABI
> transition patch.
>
> This replaces our venerable Copy-on-Write std::string with a
> C++11-conforming* Small-String Optimized std::__cxx11::string.
>
> (* It's not quite 100% conforming, as it's missing some allocator
> features.  Of course. Always with the allocators. But that's only a
> small fix to make next week.)
[...]
> Target maintainers will see a *lot* of new exports at the latest
> symbol version if they generate a new baseline-symbols.txt file. I
> suggest waiting and doing that nearer the end of stage 3 in case there
> are any fixes needed after this change.
>
> Bootstrapped and tested in various configurations on x86_64-linux and
> powerpc64-linux.

Unfortunately, this patch broke Solaris bootstrap with /bin/ld:
libstdc++.so fails to link with

ld: fatal: libstdc++-symbols.ver-sun: 5383: symbol 'std::locale::name[abi:cxx11]() const': symbol version conflict

l.5383 has

    ##_ZNKSt6locale4nameB5cxx11Ev (glob)
    _ZNKSt6locale4nameB5cxx11Ev;

i.e.

    # std::locale::name() returning new std::string

in GLIBCXX_3.4.21 vs.

      ##std::locale::[A-Zn-z]* (cxx)
      _ZNKSt6locale4nameB5cxx11Ev;

in GLIBCXX_3.4.

	Rainer
diff mbox

Patch

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index d4864ae..dd8142e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1617,8 +1617,12 @@  remap_gimple_stmt (gimple stmt, copy_body_data *id)
 
       /* Clear flags that need revisiting.  */
       if (gcall *call_stmt = dyn_cast <gcall *> (copy))
-	if (gimple_call_tail_p (call_stmt))
-	  gimple_call_set_tail (call_stmt, false);
+	{
+	  if (gimple_call_tail_p (call_stmt))
+	    gimple_call_set_tail (call_stmt, false);
+	  if (gimple_call_from_thunk_p (call_stmt))
+	    gimple_call_set_from_thunk (call_stmt, false);
+	}
 
       /* Remap the region numbers for __builtin_eh_{pointer,filter},
 	 RESX and EH_DISPATCH.  */
diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index e8f9e67..77838b0 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -2216,8 +2216,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
 	     double&) const;
 
       // XXX GLIBCXX_ABI Deprecated
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
       virtual iter_type
       __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
 	       double&) const;
@@ -2231,8 +2230,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
       do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const;
 
       // XXX GLIBCXX_ABI Deprecated
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
       virtual iter_type
       do_get(iter_type, iter_type, ios_base&, ios_base::iostate&,
 	     long double&) const;
@@ -2501,8 +2499,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
       do_put(iter_type, ios_base&, char_type, double) const;
 
       // XXX GLIBCXX_ABI Deprecated
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
       virtual iter_type
       __do_put(iter_type, ios_base&, char_type, double) const;
 #else
@@ -2514,8 +2511,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
       do_put(iter_type, ios_base&, char_type, const void*) const;
 
       // XXX GLIBCXX_ABI Deprecated
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
       virtual iter_type
       do_put(iter_type, ios_base&, char_type, long double) const;
 #endif
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 23e87d0..306d3a6 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -712,8 +712,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
       return __beg;
     }
 
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
   template<typename _CharT, typename _InIter>
     _InIter
     num_get<_CharT, _InIter>::
@@ -1156,8 +1155,7 @@  _GLIBCXX_BEGIN_NAMESPACE_LDBL
     do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
     { return _M_insert_float(__s, __io, __fill, char(), __v); }
 
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-      && _GLIBCXX_USE_CXX11_ABI == 0
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
   template<typename _CharT, typename _OutIter>
     _OutIter
     num_put<_CharT, _OutIter>::