Rüdiger Sonderfeld | 16 Apr 17:06 2014

[PATCH 1/2] libstdc++: Add std::align.

C++11 [ptr.align].

This should probably not be inline.  But for now this avoids any ABI

* libstdc++-v3/testsuite/20_util/align/1.cc: New file.
* libstdc++-v3/include/std/memory (align): New function.
 libstdc++-v3/include/std/memory           | 35 +++++++++++++
 libstdc++-v3/testsuite/20_util/align/1.cc | 82 +++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/20_util/align/1.cc

diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index dafec0c..f9ae7b9 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
 <at>  <at>  -83,6 +83,41  <at>  <at> 
 #    include <backward/auto_ptr.h>
 #  endif
+ *   <at> brief Fit aligned storage in buffer.
+ *
+ *  [ptr.align]
+ *
+ *  This function tries to fit __size storage with __alignment into
+ *  the buffer __ptr of size __space bytes.  If such a buffer fits
+ *  then __ptr is changed to point to the storage and __space is
(Continue reading)

Rüdiger Sonderfeld | 15 Apr 23:19 2014

[PATCH 1/3] libstdc++: Add time_get::get support.

This patch adds support for std::time_get::get and std::time_get::do_get
[locale.time.get].  Currently do_get is not virtual because this caused
segfault errors for me.

* libstdc++-v3/include/bits/locale_facets_nonio.h (time_get::get):
  (time_get::do_get):  New method (C++11).
* libstdc++-v3/include/bits/locale_facets_nonio.tcc (time_get::get):
  (time_get::do_get):  New method (C++11).
* libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc: New file.
* libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc: New file.
 libstdc++-v3/include/bits/locale_facets_nonio.h    |  73 ++++++++++++
 libstdc++-v3/include/bits/locale_facets_nonio.tcc  | 102 ++++++++++++++++
 .../testsuite/22_locale/time_get/get/char/1.cc     | 129 ++++++++++++++++++++
 .../testsuite/22_locale/time_get/get/char/2.cc     | 103 ++++++++++++++++
 .../testsuite/22_locale/time_get/get/wchar_t/1.cc  | 130 +++++++++++++++++++++
 .../testsuite/22_locale/time_get/get/wchar_t/2.cc  | 104 +++++++++++++++++
 6 files changed, 641 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/1.cc
 create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/char/2.cc
 create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/1.cc
 create mode 100644 libstdc++-v3/testsuite/22_locale/time_get/get/wchar_t/2.cc

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index 3e2cc7f..f6cfe36 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
 <at>  <at>  -540,6 +540,54  <at>  <at>  namespace std _GLIBCXX_VISIBILITY(default)
 	       ios_base::iostate& __err, tm* __tm) const
       { return this->do_get_year(__beg, __end, __io, __err, __tm); }
(Continue reading)

Jonathan Wakely | 15 Apr 21:05 2014

[patch] Fix libstdc++ tests w.r.t PR c++/60786

G++ accepts these tests but it shouldn't, and clang doesn't, so this
makes them valid C++11.

Tested x86_64-linux, committed to trunk.

commit f1517e2ae280691724472cbd0f6b31fa98f313d0
Author: Jonathan Wakely <jwakely <at> redhat.com>
Date:   Tue Apr 15 19:39:15 2014 +0100

    	PR c++/60786
    	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
    	1.cc: Fix invalid explicit instantiations with unqualified names.
    	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
    	2.cc: Likweise.
    	* testsuite/20_util/tuple/53648.cc: Likweise.
    	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
    	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc:
    	* testsuite/23_containers/unordered_map/requirements/
    	debug_container.cc: Likewise.
    	* testsuite/23_containers/unordered_map/requirements/
    	explicit_instantiation/3.cc: Likewise.
    	* testsuite/23_containers/unordered_multimap/requirements/debug.cc:
    	* testsuite/23_containers/unordered_multimap/requirements/
    	explicit_instantiation/3.cc: Likewise.
    	* testsuite/23_containers/unordered_multiset/requirements/debug.cc:
(Continue reading)

Jonathan Wakely | 15 Apr 20:29 2014

[patch] Use delegating constructors in std::shared_ptr

A minor simplification that removes a longstanding TODO note.

Tested x86_64-linux, committed to trunk.
commit 7769b63f43899b901bba08e5b2b3a6806e2195f2
Author: Jonathan Wakely <accu <at> kayari.org>
Date:   Tue Apr 15 19:00:47 2014 +0100

    	* include/bits/shared_ptr.h (shared_ptr::shared_ptr(nullptr_t)): Use
    	delegating constructor.
    	* include/bits/shared_ptr_base.h
    	(__shared_ptr::__shared_ptr(nullptr_t)): Likewise

diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h
index 081d3bd..104c869 100644
--- a/libstdc++-v3/include/bits/shared_ptr.h
+++ b/libstdc++-v3/include/bits/shared_ptr.h
 <at>  <at>  -262,8 +262,7  <at>  <at>  _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *   <at> param  __p  A null pointer constant.
        *   <at> post   use_count() == 0 && get() == nullptr
-      constexpr shared_ptr(nullptr_t __p) noexcept
-      : __shared_ptr<_Tp>(__p) { }
+      constexpr shared_ptr(nullptr_t __p) noexcept : shared_ptr() { }

       shared_ptr& operator=(const shared_ptr&) noexcept = default;

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 536df01..57398af 100644
(Continue reading)

Jonathan Wakely | 1 Apr 23:35 2014

[patch] Fix broken links in libstdc++ manual

Fix some broken links in the libstdc++ docs.

Committed to trunk

commit 201c0a880621618055a572fb1dbb4a7cc39896f4
Author: Jonathan Wakely <jwakely <at> redhat.com>
Date:   Tue Apr 1 20:45:54 2014 +0100

    	* doc/xml/manual/backwards_compatibility.xml (backwards.third.headers):
    	Update link.
    	* doc/xml/manual/policy_data_structures_biblio.xml (bibliography):
    	Fix broken links.
    	* doc/xml/manual/shared_ptr.xml (shared_ptr.impl): Likewise.
    	* doc/xml/manual/using_exceptions.xml (bibliography): Likewise.
    	* doc/xml/manual/concurrency_extensions.xml
    	(manual.ext.concurrency.impl.atomic_fallbacks): Likewise.
    	* doc/html/*: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml b/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml
index 3cb7bac..89c7cc6 100644
--- a/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml
+++ b/libstdc++-v3/doc/xml/manual/backwards_compatibility.xml
 <at>  <at>  -614,8 +614,8  <at>  <at>  libstdc++-v3.
    <para>For those of you new to ISO C++ (welcome, time travelers!), no,
       that isn't a typo. Yes, the headers really have new names.
-      Marshall Cline's C++ FAQ Lite has a good explanation in <link
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.4">item
(Continue reading)

Jonathan Wakely | 31 Mar 20:17 2014

Re: std::rethrow_exception is broken

On 29/03/14 19:55 +0100, Daniel Krügler wrote:
>2014-03-28 13:37 GMT+01:00 Jonathan Wakely <jwakely <at> redhat.com>:
>> On 27/03/14 23:00 +0100, Daniel Krügler wrote:
>>> I'm in favour for changing it, what about something like
>>> "layout mismatch"
>>> ?
>> How about this?
>> "__cxa_dependent_exception::termHandler layout must be consistent with
>Yes, this seems even better to me.

This improves the static assertion messages, as suggested by François
and Daniel.

Tested x86_64-linux, committed to trunk.

commit f92ce7260937614a7897d9890c022812794f793b
Author: Jonathan Wakely <jwakely <at> redhat.com>
Date:   Wed Mar 12 21:36:53 2014 +0000

    2014-03-12  Lars Gullik Bj??nnes  <larsbj <at> gullik.org>
    	    Jonathan Wakely  <jwakely <at> redhat.com>

    	PR libstdc++/60270
(Continue reading)

Ed Smith-Rowland | 29 Mar 19:54 2014

Make string_view operations involving CharT* *not* noexcept and consistent beween string_view and string_view.tcc.


In string_view I botched the noexcept specification of operations like 
find and friends with CharT* arguments.

I'm a little surprised the inconsistency between string_view and 
string_view.tcc didn't error.  In fact, in one repo thats a little 
behind trunk it does.  I'll continue to look after that issue separately.

Built and tested clean on x86_64-linux.  OK?


2014-03-29  Ed Smith-Rowland  <3dw4rd <at> verizon.net>

	Make string_view operations involving CharT* *not* noexcept
	and consistent beween string_view and string_view.tcc.
	string_view (find(const _CharT*, size_type)): Remove noexcept.
	(rfind(const _CharT*, size_type)): Ditto.
	(find_first_of(const _CharT*, size_type)): Ditto.
	(find_last_of(const _CharT*, size_type)): Ditto.
	(find_first_not_of(const _CharT*, size_type)): Ditto.
	(find_last_not_of(const _CharT*, size_type)): Ditto.
	string_view.tcc (find(const _CharT*, size_type, size_type)):
	Remove noexcept.
	(rfind(const _CharT*, size_type, size_type)): Ditto.
(Continue reading)

Jonathan Wakely | 28 Mar 13:37 2014

Re: std::rethrow_exception is broken

On 27/03/14 23:00 +0100, Daniel Krügler wrote:
>2014-03-27 22:58 GMT+01:00 Jonathan Wakely <jwakely <at> redhat.com>:
>> I could reword it to avoid the word correct, I suppose.
>I'm in favour for changing it, what about something like
>"layout mismatch"

How about this?

"__cxa_dependent_exception::termHandler layout must be consistent with __cxa_exception::termHandler"

Egon Kocjan | 27 Mar 15:02 2014

Building gcc 4.8.2 and libstdc++ with --disable-shared --with-pic


I've been using a toolchain with gcc 4.2.4 with configure flags 
--disable-shared --with-pic, which works nicely. But now that I've 
upgraded to gcc 4.8.2, the configure flags --disable-shared --with-pic 
do not seem to work anymore - the result is non-pic libstdc++.a. This is 
a workaround, that I'm using at the moment to get pic libstdc++.a:

--- gcc-4.8.2/libstdc++-v3/configure.orig    2014-03-27 
14:23:18.037130000 +0100
+++ gcc-4.8.2/libstdc++-v3/configure    2014-03-27 14:26:03.977130000 +0100
 <at>  <at>  -14924,8 +14924,8  <at>  <at> 

-  glibcxx_lt_pic_flag=
-  glibcxx_compiler_pic_flag=
+  glibcxx_lt_pic_flag="-prefer-pic"
+  glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"

Am I doing something wrong or is this a bug in libstdc++ configure?


Jakub Jelinek | 24 Mar 20:20 2014

[PATCH] Update libstdc++ baseline_symbols.txt for {i?86,x86_64,s390,s390x,ppc,ppc64}-linux


This patch updates baseline_symbols.txt to what I've grabbed from trunk
builds as of today on various targets.  Verified the additions are the
same (just sizes of some objects double from 32-bit to 64-bit targets).
In addition to that, it removes the TLS lines that are intentionally
filtered away from all the other baseline_symbols.txt (the point is to
not get abi_check errors if somebody configures without tls).

Ok for trunk?

2014-03-24  Jakub Jelinek  <jakub <at> redhat.com>

	* config/abi/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/powerpc64-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/s390-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/s390x-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/i486-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/x86_64-linux-gnu/32/baseline_symbols.txt: Likewise.
	* config/abi/x86_64-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/powerpc-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/i386-linux-gnu/baseline_symbols.txt: Likewise.
	* config/abi/hppa-linux-gnu/baseline_symbols.txt: Remove TLS entries.

--- libstdc++-v3/config/abi/powerpc64-linux-gnu/32/baseline_symbols.txt.jj	2013-06-01 10:28:23.000000000 +0200
+++ libstdc++-v3/config/abi/powerpc64-linux-gnu/32/baseline_symbols.txt	2014-03-24 20:07:36.915562627 +0100
 <at>  <at>  -403,6 +403,7  <at>  <at>  FUNC:_ZNKSt15basic_streambufIwSt11char_t
 FUNC:_ZNKSt15basic_streambufIwSt11char_traitsIwEE6getlocEv <at>  <at> GLIBCXX_3.4
 FUNC:_ZNKSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strEv <at>  <at> GLIBCXX_3.4
 FUNC:_ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv <at>  <at> GLIBCXX_3.4
(Continue reading)

Jonathan Wakely | 24 Mar 20:19 2014

std::rethrow_exception is broken

There is a lot of code in libsupc++/eh_* that relies on
__cxa_exception and __cxa_dependent_exception having similar layouts,
so tricks like this work:

static inline void*
__gxx_caught_object(_Unwind_Exception* eo)
  // Bad as it looks, this actually works for dependent exceptions too.
  __cxa_exception* header = __get_exception_header_from_ue (eo);
  return header->adjustedPtr;

The idea is that although the eo might be a pointer to the
unwindHeader member  of either __cxa_exception or
__cxa_dependent_exception, the adjustedPtr member will be always be at
the same location relative to the unwindHeader member, so it Just

Except it doesn't.

offsetof(__cxa_exception, unwindHeader) == 80
offsetof(__cxa_dependent_exception, unwindHeader) == 80
offsetof(__cxa_exception, adjustedPtr) == 72
offsetof(__cxa_dependent_exception, adjustedPtr) == 64

This is the cause of PR 60612, and means we need to fix a lot of code
by explicitly checking the exception class (see attached patch for a
partial fix doing that in two places) or we need to change the layout
of __cxa_dependent_exception (and then add some tests to verify the
assumptions implicit in the code!)
(Continue reading)