This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Rest of trivial decorations
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: libstdc++ at gcc dot gnu dot org, paolo dot carlini at oracle dot com
- Date: Sat, 18 Apr 2009 18:33:00 +0200
- Subject: Rest of trivial decorations
Hi,
this patch adds trivial decorations found across the library. There are couple
things I broke out but in general this should be it.
Tested on x86_64-linux, OK?
Honza
* src/condition_variable.cc (condition_variable,
condition_variable_any constructors): Mark throw()
* src/hash.cc (operator() for long double, string, and wstring): Mark
throw ().
* src/strstream.cc (strstreambuf constructors, freeze, str, pcount,
_M_setup, rdbuf, str): Mark throw ().
* src/chrono.cc (new): Mark throw ().
* include/std/system_error (system_category, generic_category): Mark
throw () and const.
* include/std/chrono (now): Mark throw ().
* include/std/condition_variable (condition_variable,
~condition_variable, condition_variable_any,
~condition_variable_any): Mark throw ().
* include/std/mutex (mutex): Mark throw ().
* include/bits/stl_list.h (swap, transfer, reverse, hook, unhook): Mark
throw.
* include/bits/functional_hash.h (operator() on size_t): Mark pure and throw ().
* include/bits/locale_facets.tcc (__verify_grouping): Mark pure.
* include/bits/locale_classes.h (_S_initialize_once,
_S_clone_c_locale): Mark throw ().
(_S_get_c_name): Mark const and throw ().
(_M_id, _M_compare, _M_transform, _M_compare, _M_transform): Mark throw ().
* include/bits/locale_facets.h (__convert_to_v explicit instances):
Mark throw ().
(_M_convert_to_wmask, _M_initialize_ctype, _S_format_float): Mark throw ().
* include/bits/ios_base.h (_M_dispose_callbacks, _M_init, imbue,
ios_base): Mark throw ()
* include/bits/locale_facets_nonio.h (_M_put): Mark throw.
* include/backward/strstream (strstreambuf constructors): Mark throw ().
(str, freeze, _M_setupf): Mark throw ().
(pcount): Mark pure and throw ().
(rdbuf): Mark const and throw ().
Index: src/condition_variable.cc
===================================================================
--- src/condition_variable.cc (revision 146318)
+++ src/condition_variable.cc (working copy)
@@ -28,7 +28,7 @@
namespace std
{
- condition_variable::condition_variable()
+ condition_variable::condition_variable() throw ()
{
#ifdef __GTHREAD_COND_INIT
__native_type __tmp = __GTHREAD_COND_INIT;
@@ -41,7 +41,7 @@
#endif
}
- condition_variable::~condition_variable()
+ condition_variable::~condition_variable() throw ()
{
// XXX no thread blocked
/* int __e = */ __gthread_cond_destroy(&_M_cond);
@@ -79,7 +79,7 @@
__throw_system_error(__e);
}
- condition_variable_any::condition_variable_any()
+ condition_variable_any::condition_variable_any() throw ()
{
#ifdef __GTHREAD_COND_INIT
__native_type __tmp = __GTHREAD_COND_INIT;
@@ -92,7 +92,7 @@
#endif
}
- condition_variable_any::~condition_variable_any()
+ condition_variable_any::~condition_variable_any() throw ()
{
__gthread_cond_destroy(&_M_cond);
}
Index: src/hash.cc
===================================================================
--- src/hash.cc (revision 146318)
+++ src/hash.cc (working copy)
@@ -44,7 +44,7 @@
// 10 bytes -> 12 bytes) and resort to frexp.
template<>
size_t
- hash<long double>::operator()(long double __val) const
+ hash<long double>::operator()(long double __val) const throw ()
{
size_t __result = 0;
@@ -72,18 +72,18 @@
#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
template<>
size_t
- hash<string>::operator()(string __s) const
+ hash<string>::operator()(string __s) const throw ()
{ return _Fnv_hash<>::hash(__s.data(), __s.length()); }
template<>
size_t
- hash<const string&>::operator()(const string& __s) const
+ hash<const string&>::operator()(const string& __s) const throw ()
{ return _Fnv_hash<>::hash(__s.data(), __s.length()); }
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
size_t
- hash<wstring>::operator()(wstring __s) const
+ hash<wstring>::operator()(wstring __s) const throw ()
{
const char* __p = reinterpret_cast<const char*>(__s.data());
return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t));
@@ -91,7 +91,7 @@
template<>
size_t
- hash<const wstring&>::operator()(const wstring& __s) const
+ hash<const wstring&>::operator()(const wstring& __s) const throw ()
{
const char* __p = reinterpret_cast<const char*>(__s.data());
return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t));
Index: src/strstream.cc
===================================================================
--- src/strstream.cc (revision 146318)
+++ src/strstream.cc (working copy)
@@ -78,33 +78,33 @@
}
}
- strstreambuf::strstreambuf(char* get, streamsize n, char* put)
+ strstreambuf::strstreambuf(char* get, streamsize n, char* put) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(get, put, n); }
- strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
+ strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
strstreambuf::strstreambuf(unsigned char* get, streamsize n,
- unsigned char* put)
+ unsigned char* put) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(false)
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); }
- strstreambuf::strstreambuf(const char* get, streamsize n)
+ strstreambuf::strstreambuf(const char* get, streamsize n) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(const_cast<char*>(get), 0, n); }
- strstreambuf::strstreambuf(const signed char* get, streamsize n)
+ strstreambuf::strstreambuf(const signed char* get, streamsize n) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); }
- strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
+ strstreambuf::strstreambuf(const unsigned char* get, streamsize n) throw ()
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false),
_M_frozen(false), _M_constant(true)
{ _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); }
@@ -116,21 +116,21 @@
}
void
- strstreambuf::freeze(bool frozenflag)
+ strstreambuf::freeze(bool frozenflag) throw ()
{
if (_M_dynamic)
_M_frozen = frozenflag;
}
char*
- strstreambuf::str()
+ strstreambuf::str() throw ()
{
freeze(true);
return eback();
}
int
- strstreambuf::pcount() const
+ strstreambuf::pcount() const throw ()
{ return pptr() ? pptr() - pbase() : 0; }
strstreambuf::int_type
@@ -315,7 +315,7 @@
}
void
- strstreambuf::_M_setup(char* get, char* put, streamsize n)
+ strstreambuf::_M_setup(char* get, char* put, streamsize n) throw ()
{
if (get)
{
@@ -350,11 +350,11 @@
istrstream::~istrstream() { }
strstreambuf*
- istrstream::rdbuf() const
+ istrstream::rdbuf() const throw ()
{ return const_cast<strstreambuf*>(&_M_buf); }
char*
- istrstream::str()
+ istrstream::str() throw ()
{ return _M_buf.str(); }
ostrstream::ostrstream()
@@ -369,19 +369,19 @@
ostrstream::~ostrstream() {}
strstreambuf*
- ostrstream::rdbuf() const
+ ostrstream::rdbuf() const throw ()
{ return const_cast<strstreambuf*>(&_M_buf); }
void
- ostrstream::freeze(bool freezeflag)
+ ostrstream::freeze(bool freezeflag) throw ()
{ _M_buf.freeze(freezeflag); }
char*
- ostrstream::str()
+ ostrstream::str() throw ()
{ return _M_buf.str(); }
int
- ostrstream::pcount() const
+ ostrstream::pcount() const throw ()
{ return _M_buf.pcount(); }
strstream::strstream()
@@ -396,19 +396,19 @@
strstream::~strstream() { }
strstreambuf*
- strstream::rdbuf() const
+ strstream::rdbuf() const throw ()
{ return const_cast<strstreambuf*>(&_M_buf); }
void
- strstream::freeze(bool freezeflag)
+ strstream::freeze(bool freezeflag) throw ()
{ _M_buf.freeze(freezeflag); }
int
- strstream::pcount() const
+ strstream::pcount() const throw ()
{ return _M_buf.pcount(); }
char*
- strstream::str()
+ strstream::str() throw ()
{ return _M_buf.str(); }
_GLIBCXX_END_NAMESPACE
Index: src/chrono.cc
===================================================================
--- src/chrono.cc (revision 146318)
+++ src/chrono.cc (working copy)
@@ -40,7 +40,7 @@
const bool system_clock::is_monotonic;
system_clock::time_point
- system_clock::now()
+ system_clock::now() throw ()
{
#ifdef _GLIBCXX_USE_CLOCK_REALTIME
timespec tp;
Index: include/std/system_error
===================================================================
--- include/std/system_error (revision 146318)
+++ include/std/system_error (working copy)
@@ -105,8 +105,8 @@
};
// DR 890.
- const error_category& system_category();
- const error_category& generic_category();
+ _GLIBCXX_CONST const error_category& system_category() throw ();
+ _GLIBCXX_CONST const error_category& generic_category() throw ();
/// error_code
// Implementation-specific error identification
Index: include/std/chrono
===================================================================
--- include/std/chrono (revision 146318)
+++ include/std/chrono (working copy)
@@ -614,7 +614,7 @@
static const bool is_monotonic = false;
static time_point
- now();
+ now() throw ();
// Map to C API
static std::time_t
Index: include/std/condition_variable
===================================================================
--- include/std/condition_variable (revision 146318)
+++ include/std/condition_variable (working copy)
@@ -60,8 +60,8 @@
public:
typedef __native_type* native_handle_type;
- condition_variable();
- ~condition_variable();
+ condition_variable() throw ();
+ ~condition_variable() throw ();
condition_variable(const condition_variable&) = delete;
condition_variable& operator=(const condition_variable&) = delete;
@@ -168,8 +168,8 @@
public:
typedef __native_type* native_handle_type;
- condition_variable_any();
- ~condition_variable_any();
+ condition_variable_any() throw ();
+ ~condition_variable_any() throw ();
condition_variable_any(const condition_variable_any&) = delete;
condition_variable_any& operator=(const condition_variable_any&) = delete;
Index: include/std/mutex
===================================================================
--- include/std/mutex (revision 146318)
+++ include/std/mutex (working copy)
@@ -395,7 +395,7 @@
{
public:
virtual const char*
- what() const throw();
+ _GLIBCXX_CONST what() const throw();
};
/// @brief Scoped lock idiom.
Index: include/bits/stl_list.h
===================================================================
--- include/bits/stl_list.h (revision 146318)
+++ 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: include/bits/functional_hash.h
===================================================================
--- include/bits/functional_hash.h (revision 146318)
+++ include/bits/functional_hash.h (working copy)
@@ -60,8 +60,8 @@
struct error_code;
template<>
- size_t
- hash<error_code>::operator()(error_code) const;
+ _GLIBCXX_PURE size_t
+ hash<error_code>::operator()(error_code) const throw ();
}
#endif // _FUNCTIONAL_HASH_H
Index: include/bits/locale_facets.tcc
===================================================================
--- include/bits/locale_facets.tcc (revision 146318)
+++ include/bits/locale_facets.tcc (working copy)
@@ -118,9 +118,9 @@
// 1,222,444 == __grouping_tmp of "\1\3\3"
// __grouping is parsed R to L
// 1,222,444 == __grouping of "\3" == "\3\3\3"
- bool
+ _GLIBCXX_PURE bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
- const string& __grouping_tmp);
+ const string& __grouping_tmp) throw ();
_GLIBCXX_BEGIN_LDBL_NAMESPACE
Index: include/bits/locale_classes.h
===================================================================
--- include/bits/locale_classes.h (revision 146318)
+++ include/bits/locale_classes.h (working copy)
@@ -312,7 +312,7 @@
_S_initialize();
static void
- _S_initialize_once();
+ _S_initialize_once() throw ();
static category
_S_normalize_category(category);
@@ -376,7 +376,7 @@
__c_locale __old = 0);
static __c_locale
- _S_clone_c_locale(__c_locale& __cloc);
+ _S_clone_c_locale(__c_locale& __cloc) throw ();
static void
_S_destroy_c_locale(__c_locale& __cloc);
@@ -386,8 +386,8 @@
static __c_locale
_S_get_c_locale();
- static const char*
- _S_get_c_name();
+ _GLIBCXX_CONST static const char*
+ _S_get_c_name() throw ();
private:
void
@@ -457,7 +457,7 @@
id() { }
size_t
- _M_id() const;
+ _M_id() const throw ();
};
@@ -759,20 +759,20 @@
// Specializations.
template<>
int
- collate<char>::_M_compare(const char*, const char*) const;
+ collate<char>::_M_compare(const char*, const char*) const throw ();
template<>
size_t
- collate<char>::_M_transform(char*, const char*, size_t) const;
+ collate<char>::_M_transform(char*, const char*, size_t) const throw ();
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
int
- collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const;
+ collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw ();
template<>
size_t
- collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const;
+ collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw ();
#endif
/// class collate_byname [22.2.4.2].
Index: include/bits/locale_facets.h
===================================================================
--- include/bits/locale_facets.h (revision 146318)
+++ include/bits/locale_facets.h (working copy)
@@ -70,17 +70,17 @@
template<>
void
__convert_to_v(const char*, float&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw ();
template<>
void
__convert_to_v(const char*, double&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw ();
template<>
void
__convert_to_v(const char*, long double&, ios_base::iostate&,
- const __c_locale&);
+ const __c_locale&) throw ();
// NB: __pad is a struct, rather than a function, so it can be
// partially-specialized.
@@ -1220,7 +1220,7 @@
protected:
__wmask_type
- _M_convert_to_wmask(const mask __m) const;
+ _M_convert_to_wmask(const mask __m) const throw ();
/// Destructor
virtual
@@ -1458,7 +1458,7 @@
// For use at construction time only.
void
- _M_initialize_ctype();
+ _M_initialize_ctype() throw ();
};
#endif //_GLIBCXX_USE_WCHAR_T
@@ -1558,7 +1558,7 @@
// num_put
// Construct and return valid scanf format for floating point types.
static void
- _S_format_float(const ios_base& __io, char* __fptr, char __mod);
+ _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw ();
};
template<typename _CharT>
Index: include/bits/ios_base.h
===================================================================
--- include/bits/ios_base.h (revision 146318)
+++ include/bits/ios_base.h (working copy)
@@ -497,7 +497,7 @@
_M_call_callbacks(event __ev) throw();
void
- _M_dispose_callbacks(void);
+ _M_dispose_callbacks(void) throw();
// 27.4.2.5 Members for iword/pword storage
struct _Words
@@ -526,7 +526,7 @@
locale _M_ios_locale;
void
- _M_init();
+ _M_init() throw ();
public:
@@ -685,7 +685,7 @@
* with imbue_event.
*/
locale
- imbue(const locale& __loc);
+ imbue(const locale& __loc) throw ();
/**
* @brief Locale access
@@ -782,7 +782,7 @@
virtual ~ios_base();
protected:
- ios_base();
+ ios_base() throw ();
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 50. Copy constructor and assignment operator of ios_base
Index: include/bits/locale_facets_nonio.h
===================================================================
--- include/bits/locale_facets_nonio.h (revision 146318)
+++ include/bits/locale_facets_nonio.h (working copy)
@@ -325,7 +325,7 @@
template<>
void
- __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;
+ __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const throw ();
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
@@ -335,7 +335,7 @@
template<>
void
__timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,
- const tm*) const;
+ const tm*) const throw ();
#endif
_GLIBCXX_END_NAMESPACE
@@ -844,8 +844,8 @@
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
- static pattern
- _S_construct_pattern(char __precedes, char __space, char __posn);
+ _GLIBCXX_CONST static pattern
+ _S_construct_pattern(char __precedes, char __space, char __posn) throw ();
};
template<typename _CharT, bool _Intl>
Index: include/backward/strstream
===================================================================
--- include/backward/strstream (revision 146318)
+++ include/backward/strstream (working copy)
@@ -66,20 +66,20 @@
explicit strstreambuf(streamsize __initial_capacity = 0);
strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
- strstreambuf(char* __get, streamsize __n, char* __put = 0);
- strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
- strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+ strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
- strstreambuf(const char* __get, streamsize __n);
- strstreambuf(const signed char* __get, streamsize __n);
- strstreambuf(const unsigned char* __get, streamsize __n);
+ strstreambuf(const char* __get, streamsize __n) throw ();
+ strstreambuf(const signed char* __get, streamsize __n) throw ();
+ strstreambuf(const unsigned char* __get, streamsize __n) throw ();
virtual ~strstreambuf();
public:
- void freeze(bool = true);
- char* str();
- int pcount() const;
+ void freeze(bool = true) throw ();
+ char* str() throw ();
+ _GLIBCXX_PURE int pcount() const throw ();
protected:
virtual int_type overflow(int_type __c = _Traits::eof());
@@ -103,7 +103,7 @@
void _M_free(char*);
// Helper function used in constructors.
- void _M_setup(char* __get, char* __put, streamsize __n);
+ void _M_setup(char* __get, char* __put, streamsize __n) throw ();
private:
// Data members.
@@ -125,8 +125,8 @@
istrstream(const char*, streamsize);
virtual ~istrstream();
- strstreambuf* rdbuf() const;
- char* str();
+ _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+ char* str() throw ();
private:
strstreambuf _M_buf;
@@ -140,10 +140,10 @@
ostrstream(char*, int, ios_base::openmode = ios_base::out);
virtual ~ostrstream();
- strstreambuf* rdbuf() const;
- void freeze(bool = true);
- char* str();
- int pcount() const;
+ _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+ void freeze(bool = true) throw();
+ char* str() throw ();
+ _GLIBCXX_PURE int pcount() const throw ();
private:
strstreambuf _M_buf;
@@ -162,10 +162,10 @@
strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
virtual ~strstream();
- strstreambuf* rdbuf() const;
- void freeze(bool = true);
- int pcount() const;
- char* str();
+ _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+ void freeze(bool = true) throw ();
+ _GLIBCXX_PURE int pcount() const throw ();
+ char* str() throw ();
private:
strstreambuf _M_buf;