This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More function decorations II (pool_allocator, mt_allocator, debug, stl_list)


Hi,
this patch adds decorations to couple more files.  I guess nothing
earthshaking here.
I wonder, should not be the allocators somehow marked via malloc
attribute?  That one provide very important hint for alias analysis and
also Martin's IPA stuff.

Honza

	* src/pool_allocator.cc (_M_get_free_list, _M_get_mutex): Mark throw ()
	* src/mt_allocator.cc (_M_reclaim_block, _M_reclaim_block): Mark throw ()
	* debug.cc (_M_get_mutex, _M_attach_single, _M_detach_single,
	_M_singular, _M_can_compare _M_get_mutex, _M_message,
	_M_get_max_length): Mark throw ().
	* include/debug/formatter.h (_M_message, _M_format_word,
	_M_get_max_length): Mark throw ().
	* include/debug/safe_base.h (_M_get_mutex, _M_attach_single,
	_M_detach_single): Mark throw ().
	(_M_singular, _M_can_compare, _M_get_mutex): Mark pure and throw ().
	* include/ext/pool_allocator.h (_M_get_free_list): Mark const and
	throw ()
	(_M_get_mutex): Mark throw ().
	* include/ext/mt_allocator.h (_M_reclaim_block): Mark throw ();
	(_M_destroy_thread_key): Mark CONST and throw.
	* include/bits/stl_list.h (swap, transfer, reverse, hook, unhook): Mark
	throw ().
Index: src/pool_allocator.cc
===================================================================
--- src/pool_allocator.cc	(revision 146188)
+++ src/pool_allocator.cc	(working copy)
@@ -44,14 +44,14 @@
 
   // Definitions for __pool_alloc_base.
   __pool_alloc_base::_Obj* volatile*
-  __pool_alloc_base::_M_get_free_list(size_t __bytes)
+  __pool_alloc_base::_M_get_free_list(size_t __bytes) throw ()
   { 
     size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1);
     return _S_free_list + __i;
   }
 
   __mutex&
-  __pool_alloc_base::_M_get_mutex()
+  __pool_alloc_base::_M_get_mutex() throw ()
   { return get_palloc_mutex(); }
 
   // Allocate memory in large chunks in order to avoid fragmenting the
Index: src/mt_allocator.cc
===================================================================
--- src/mt_allocator.cc	(revision 146188)
+++ src/mt_allocator.cc	(working copy)
@@ -108,7 +108,7 @@
   }
 
   void
-  __pool<false>::_M_reclaim_block(char* __p, size_t __bytes)
+  __pool<false>::_M_reclaim_block(char* __p, size_t __bytes) throw ()
   {
     // Round up to power of 2 and figure out which bin to use.
     const size_t __which = _M_binmap[__bytes];
@@ -256,7 +256,7 @@
   }
 
   void
-  __pool<true>::_M_reclaim_block(char* __p, size_t __bytes)
+  __pool<true>::_M_reclaim_block(char* __p, size_t __bytes) throw ()
   {
     // Round up to power of 2 and figure out which bin to use.
     const size_t __which = _M_binmap[__bytes];
@@ -649,7 +649,7 @@
 
   // XXX GLIBCXX_ABI Deprecated
   void 
-  __pool<true>::_M_destroy_thread_key(void*) { }
+  __pool<true>::_M_destroy_thread_key(void*) throw () { }
 
   // XXX GLIBCXX_ABI Deprecated
   void
Index: src/debug.cc
===================================================================
--- src/debug.cc	(revision 146188)
+++ src/debug.cc	(working copy)
@@ -185,7 +185,7 @@
 
   __gnu_cxx::__mutex&
   _Safe_sequence_base::
-  _M_get_mutex()
+  _M_get_mutex() throw ()
   { return get_safe_base_mutex(); }
 
   void
@@ -198,7 +198,7 @@
   
   void
   _Safe_iterator_base::
-  _M_attach_single(_Safe_sequence_base* __seq, bool __constant)
+  _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ()
   {
     _M_detach_single();
     
@@ -235,7 +235,7 @@
 
   void
   _Safe_iterator_base::
-  _M_detach_single()
+  _M_detach_single() throw ()
   {
     if (_M_sequence)
       {
@@ -259,12 +259,12 @@
 
   bool
   _Safe_iterator_base::
-  _M_singular() const
+  _M_singular() const throw ()
   { return !_M_sequence || _M_version != _M_sequence->_M_version; }
     
   bool
   _Safe_iterator_base::
-  _M_can_compare(const _Safe_iterator_base& __x) const
+  _M_can_compare(const _Safe_iterator_base& __x) const throw ()
   {
     return (!_M_singular() 
 	    && !__x._M_singular() && _M_sequence == __x._M_sequence);
@@ -272,7 +272,7 @@
 
   __gnu_cxx::__mutex&
   _Safe_iterator_base::
-  _M_get_mutex()
+  _M_get_mutex() throw ()
   { return get_safe_base_mutex(); }
 
   void
@@ -471,7 +471,7 @@
   }
 
   const _Error_formatter&
-  _Error_formatter::_M_message(_Debug_msg_id __id) const
+  _Error_formatter::_M_message(_Debug_msg_id __id) const throw ()
   { return this->_M_message(_S_debug_messages[__id]); }
   
   void
@@ -531,7 +531,7 @@
     void
     _Error_formatter::_M_format_word(char* __buf, 
 				     int __n __attribute__ ((__unused__)), 
-				     const char* __fmt, _Tp __s) const
+				     const char* __fmt, _Tp __s) const throw ()
     {
 #ifdef _GLIBCXX_USE_C99
       std::snprintf(__buf, __n, __fmt, __s);
@@ -674,7 +674,7 @@
   }
 
   void
-  _Error_formatter::_M_get_max_length() const
+  _Error_formatter::_M_get_max_length() const throw ()
   {
     const char* __nptr = std::getenv("GLIBCXX_DEBUG_MESSAGE_LENGTH");
     if (__nptr)
Index: include/debug/formatter.h
===================================================================
--- include/debug/formatter.h	(revision 146188)
+++ include/debug/formatter.h	(working copy)
@@ -345,9 +346,9 @@
     { _M_text = __text; return *this; }
 
     const _Error_formatter&
-    _M_message(_Debug_msg_id __id) const;
+    _M_message(_Debug_msg_id __id) const throw ();
 
-    void
+    _GLIBCXX_NORETURN void
     _M_error() const;
 
   private:
@@ -358,7 +359,7 @@
 
     template<typename _Tp>
       void
-      _M_format_word(char*, int, const char*, _Tp) const;
+      _M_format_word(char*, int, const char*, _Tp) const throw ();
 
     void
     _M_print_word(const char* __word) const;
@@ -367,7 +368,7 @@
     _M_print_string(const char* __string) const;
 
     void
-    _M_get_max_length() const;
+    _M_get_max_length() const throw ();
 
     enum { __max_parameters = 9 };
 
Index: include/debug/safe_base.h
===================================================================
--- include/debug/safe_base.h	(revision 146188)
+++ include/debug/safe_base.h	(working copy)
@@ -105,7 +105,7 @@
     ~_Safe_iterator_base() { this->_M_detach(); }
 
     /** For use in _Safe_iterator. */
-    __gnu_cxx::__mutex& _M_get_mutex();
+    __gnu_cxx::__mutex& _M_get_mutex() throw ();
 
   public:
     /** Attaches this iterator to the given sequence, detaching it
@@ -116,7 +116,7 @@
     void _M_attach(_Safe_sequence_base* __seq, bool __constant);
 
     /** Likewise, but not thread-safe. */
-    void _M_attach_single(_Safe_sequence_base* __seq, bool __constant);
+    void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ();
 
     /** Detach the iterator for whatever sequence it is attached to,
      *	if any.
@@ -124,19 +124,19 @@
     void _M_detach();
 
     /** Likewise, but not thread-safe. */
-    void _M_detach_single();
+    void _M_detach_single() throw ();
 
     /** Determines if we are attached to the given sequence. */
     bool _M_attached_to(const _Safe_sequence_base* __seq) const
     { return _M_sequence == __seq; }
 
     /** Is this iterator singular? */
-    bool _M_singular() const;
+    _GLIBCXX_PURE bool _M_singular() const throw ();
 
     /** Can we compare this iterator to the given iterator @p __x?
 	Returns true if both iterators are nonsingular and reference
 	the same sequence. */
-    bool _M_can_compare(const _Safe_iterator_base& __x) const;
+    _GLIBCXX_PURE bool _M_can_compare(const _Safe_iterator_base& __x) const throw ();
   };
 
   /**
@@ -207,7 +207,7 @@
     _M_swap(_Safe_sequence_base& __x);
 
     /** For use in _Safe_sequence. */
-    __gnu_cxx::__mutex& _M_get_mutex();
+    __gnu_cxx::__mutex& _M_get_mutex() throw ();
 
   public:
     /** Invalidates all iterators. */
Index: include/ext/pool_allocator.h
===================================================================
--- include/ext/pool_allocator.h	(revision 146188)
+++ include/ext/pool_allocator.h	(working copy)
@@ -96,11 +96,11 @@
       _M_round_up(size_t __bytes)
       { return ((__bytes + (size_t)_S_align - 1) & ~((size_t)_S_align - 1)); }
       
-      _Obj* volatile*
-      _M_get_free_list(size_t __bytes);
+      _GLIBCXX_CONST _Obj* volatile*
+      _M_get_free_list(size_t __bytes) throw ();
     
       __mutex&
-      _M_get_mutex();
+      _M_get_mutex() throw ();
 
       // Returns an object of size __n, and optionally adds to size __n
       // free list.
Index: include/ext/mt_allocator.h
===================================================================
--- include/ext/mt_allocator.h	(revision 146188)
+++ include/ext/mt_allocator.h	(working copy)
@@ -221,7 +221,7 @@
       _M_reserve_block(size_t __bytes, const size_t __thread_id);
     
       void
-      _M_reclaim_block(char* __p, size_t __bytes);
+      _M_reclaim_block(char* __p, size_t __bytes) throw ();
     
       size_t 
       _M_get_thread_id() { return 0; }
@@ -332,7 +332,7 @@
       _M_reserve_block(size_t __bytes, const size_t __thread_id);
     
       void
-      _M_reclaim_block(char* __p, size_t __bytes);
+      _M_reclaim_block(char* __p, size_t __bytes) throw ();
     
       const _Bin_record&
       _M_get_bin(size_t __which)
Index: include/bits/stl_list.h
===================================================================
--- include/bits/stl_list.h	(revision 146188)
+++ include/bits/stl_list.h	(working copy)
@@ -74,20 +74,20 @@
     _List_node_base* _M_prev;
 
     static void
-    swap(_List_node_base& __x, _List_node_base& __y);
+    swap(_List_node_base& __x, _List_node_base& __y) throw ();
 
     void
     transfer(_List_node_base * const __first,
-	     _List_node_base * const __last);
+	     _List_node_base * const __last) throw ();
 
     void
-    reverse();
+    reverse() throw ();
 
     void
-    hook(_List_node_base * const __position);
+    hook(_List_node_base * const __position) throw ();
 
     void
-    unhook();
+    unhook() throw ();
   };
 
   /// An actual node in the %list.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]