public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Clean up libstdc++ includes slightly.
@ 2015-09-03 21:12 Jonathan Wakely
  2015-09-03 22:41 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2015-09-03 21:12 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

This adjusts some missing or redundant includes, and replaces "throw
bad_alloc()" (which won't work with -fno-exceptions) with a call to
__throw_bad_alloc().

Tested powerpc64e-linux, committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 2623 bytes --]

commit ca17448c303cfd58191c64abe42a750c9590aa14
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Sep 3 21:02:41 2015 +0100

    Clean up libstdc++ includes slightly.
    
    	* include/bits/shared_ptr_base.h: Add required header.
    	* include/std/condition_variable: Likewise.
    	* include/std/mutex: Remove unused header.
    	* include/std/shared_mutex: Remove redundant header.
    	(shared_mutex::shared_mutex()): Replace throw with __throw_bad_alloc.

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 820edcb..f2f577b 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -49,6 +49,7 @@
 #ifndef _SHARED_PTR_BASE_H
 #define _SHARED_PTR_BASE_H 1
 
+#include <typeinfo>
 #include <bits/allocated_ptr.h>
 #include <ext/aligned_buffer.h>
 
@@ -67,8 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class bad_weak_ptr : public std::exception
   {
   public:
-    virtual char const*
-    what() const noexcept;
+    virtual char const* what() const noexcept;
 
     virtual ~bad_weak_ptr() noexcept;    
   };
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index f7da017..fbed043 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -42,6 +42,7 @@
 #include <bits/allocator.h>
 #include <bits/unique_ptr.h>
 #include <bits/shared_ptr.h>
+#include <bits/cxxabi_forced.h>
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 790508c..fbf1740 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -44,7 +44,6 @@
 #include <bits/functexcept.h>
 #include <bits/gthr.h>
 #include <bits/move.h> // for std::swap
-#include <bits/cxxabi_forced.h>
 
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index ae5f199..69107cc 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -36,7 +36,6 @@
 #else
 
 #include <bits/c++config.h>
-#include <mutex>
 #include <condition_variable>
 #include <bits/functexcept.h>
 
@@ -80,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       int __ret = pthread_rwlock_init(&_M_rwlock, NULL);
       if (__ret == ENOMEM)
-	throw bad_alloc();
+	__throw_bad_alloc();
       else if (__ret == EAGAIN)
 	__throw_system_error(int(errc::resource_unavailable_try_again));
       else if (__ret == EPERM)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Clean up libstdc++ includes slightly.
  2015-09-03 21:12 [patch] Clean up libstdc++ includes slightly Jonathan Wakely
@ 2015-09-03 22:41 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2015-09-03 22:41 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 64 bytes --]

I'm committing the __throw_bad_alloc() part on the branch too.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 779 bytes --]

commit 02221ce47cade82036c7d78ed79e5fe536fdfcfd
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Sep 3 23:01:02 2015 +0100

    	* include/std/shared_mutex (shared_timed_mutex::shared_timed_mutex):
    	Replace throw with __throw_bad_alloc.

diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index b72a822..7b216a5 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -74,7 +74,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       int __ret = pthread_rwlock_init(&_M_rwlock, NULL);
       if (__ret == ENOMEM)
-	throw bad_alloc();
+	__throw_bad_alloc();
       else if (__ret == EAGAIN)
 	__throw_system_error(int(errc::resource_unavailable_try_again));
       else if (__ret == EPERM)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-03 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-03 21:12 [patch] Clean up libstdc++ includes slightly Jonathan Wakely
2015-09-03 22:41 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).