diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2007-06-26 11:01:15 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2007-06-26 11:01:15 +0000 |
commit | 949d9ae181520a37c81fb8e4e4ff2d9241d09812 (patch) | |
tree | c08f612197e36b298606bc1f8799f4950b34b0ad /libstdc++-v3/libsupc++ | |
parent | 12c7b51e3e3e27a31c7b0aabf93610024967339a (diff) | |
download | gcc-949d9ae181520a37c81fb8e4e4ff2d9241d09812.tar.gz |
throw_allocator.h: Fixes for -fno-exceptions.
2007-06-26 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/throw_allocator.h: Fixes for -fno-exceptions.
* testsuite/util/testsuite_shared.cc: Same.
* testsuite/util/io/illegal_input_error.hpp: Same.
* testsuite/util/io/verified_cmd_line_input.cc: Same.
* libsupc++/typeinfo (type_info): Correct comment formatting,
clarify member access and public interface.
* libsupc++/exception: Less compressed comments.
* libsupc++/new: Same.
From-SVN: r126016
Diffstat (limited to 'libstdc++-v3/libsupc++')
-rw-r--r-- | libstdc++-v3/libsupc++/exception | 6 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new | 8 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/typeinfo | 46 |
3 files changed, 37 insertions, 23 deletions
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index 2046300581c..a7e2db78dd1 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -58,6 +58,7 @@ namespace std public: exception() throw() { } virtual ~exception() throw(); + /** Returns a C-style character string describing the general cause * of the current error. */ virtual const char* what() const throw(); @@ -69,26 +70,31 @@ namespace std { public: bad_exception() throw() { } + // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_exception() throw(); + // See comment in eh_exception.cc. virtual const char* what() const throw(); }; /// If you write a replacement %terminate handler, it must be of this type. typedef void (*terminate_handler) (); + /// If you write a replacement %unexpected handler, it must be of this type. typedef void (*unexpected_handler) (); /// Takes a new handler function as an argument, returns the old function. terminate_handler set_terminate(terminate_handler) throw(); + /** The runtime will call this function if %exception handling must be * abandoned for any reason. It can also be called by the user. */ void terminate() __attribute__ ((__noreturn__)); /// Takes a new handler function as an argument, returns the old function. unexpected_handler set_unexpected(unexpected_handler) throw(); + /** The runtime will call this function if an %exception is thrown which * violates the function's %exception specification. */ void unexpected() __attribute__ ((__noreturn__)); diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 26898bfc6fc..a821783b14a 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -59,19 +59,25 @@ namespace std { public: bad_alloc() throw() { } + // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_alloc() throw(); + // See comment in eh_exception.cc. virtual const char* what() const throw(); }; struct nothrow_t { }; + extern const nothrow_t nothrow; + /** If you write your own error handler to be called by @c new, it must * be of this type. */ typedef void (*new_handler)(); - /// Takes a replacement handler as the argument, returns the previous handler. + + /// Takes a replacement handler as the argument, returns the + /// previous handler. new_handler set_new_handler(new_handler) throw(); } // namespace std diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo index 3abf0dfc17a..cfcbbcc0896 100644 --- a/libstdc++-v3/libsupc++/typeinfo +++ b/libstdc++-v3/libsupc++/typeinfo @@ -93,25 +93,12 @@ namespace std class type_info { public: - /** Destructor. Being the first non-inline virtual function, this + /** Destructor first. Being the first non-inline virtual function, this * controls in which translation unit the vtable is emitted. The * compiler makes use of that information to know where to emit * the runtime-mandated type_info structures in the new-abi. */ virtual ~type_info(); - private: - /// Assigning type_info is not supported. Made private. - type_info& operator=(const type_info&); - type_info(const type_info&); - - protected: - const char *__name; - - protected: - explicit type_info(const char *__n): __name(__n) { } - - public: - // the public interface /** Returns an @e implementation-defined byte string; this is not * portable between compilers! */ const char* name() const @@ -119,6 +106,7 @@ namespace std #if !__GXX_TYPEINFO_EQUALITY_INLINE bool before(const type_info& __arg) const; + // In old abi, or when weak symbols are not supported, there can // be multiple instances of a type_info object for one // type. Uniqueness must use the _name value, not object address. @@ -133,19 +121,13 @@ namespace std // and therefore address comparisons are sufficient. bool before(const type_info& __arg) const { return __name < __arg.__name; } + bool operator==(const type_info& __arg) const { return __name == __arg.__name; } #endif bool operator!=(const type_info& __arg) const { return !operator==(__arg); } - // the internal interface - public: - // return true if this is a pointer type of some kind - virtual bool __is_pointer_p() const; - // return true if this is a function type - virtual bool __is_function_p() const; - // Try and catch a thrown type. Store an adjusted pointer to the // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then // THR_OBJ points to the thrown object. If THR_TYPE is a pointer @@ -155,9 +137,25 @@ namespace std virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, unsigned __outer) const; - // internally used during catch matching + // Internally used during catch matching virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const; + + // Return true if this is a pointer type of some kind + virtual bool __is_pointer_p() const; + + // Return true if this is a function type + virtual bool __is_function_p() const; + + protected: + const char *__name; + + explicit type_info(const char *__n): __name(__n) { } + + private: + /// Assigning type_info is not supported. + type_info& operator=(const type_info&); + type_info(const type_info&); }; /** @@ -169,9 +167,11 @@ namespace std { public: bad_cast() throw() { } + // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_cast() throw(); + // See comment in eh_exception.cc. virtual const char* what() const throw(); }; @@ -181,9 +181,11 @@ namespace std { public: bad_typeid () throw() { } + // This declaration is not useless: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 virtual ~bad_typeid() throw(); + // See comment in eh_exception.cc. virtual const char* what() const throw(); }; |