From 83aa319d730bbdb9b983647397926e8b04c68857 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 1 Nov 2012 22:54:55 +0000 Subject: uClibc++ updates git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5295 42af7a65-404d-4744-a932-0658087f49c3 --- misc/uClibc++/include/uClibc++/basic_definitions | 22 ++------ misc/uClibc++/include/uClibc++/exception | 65 ++++++++++++++---------- misc/uClibc++/include/uClibc++/list | 15 +++--- 3 files changed, 48 insertions(+), 54 deletions(-) (limited to 'misc/uClibc++/include') diff --git a/misc/uClibc++/include/uClibc++/basic_definitions b/misc/uClibc++/include/uClibc++/basic_definitions index 4f833ee94..ff2b29054 100644 --- a/misc/uClibc++/include/uClibc++/basic_definitions +++ b/misc/uClibc++/include/uClibc++/basic_definitions @@ -35,34 +35,20 @@ # define _UCXXLOCAL #endif -#ifdef __GCC__ -# define __UCLIBCXX_NORETURN __attribute__ ((__noreturn__)) -#else -# define __UCLIBCXX_NORETURN -#endif - #ifdef __UCLIBCXX_HAS_TLS__ # define __UCLIBCXX_TLS __thread #else # define __UCLIBCXX_TLS #endif +// Testing purposes - -//Testing purposes #define __STRING_MAX_UNITS 65535 -namespace std{ - typedef signed long int streamsize; +namespace std +{ + typedef signed long int streamsize; } #pragma GCC visibility pop - -#endif - - -#ifdef __DODEBUG__ - #define UCLIBCXX_DEBUG 1 -#else - #define UCLIBCXX_DEBUG 0 #endif diff --git a/misc/uClibc++/include/uClibc++/exception b/misc/uClibc++/include/uClibc++/exception index bdf393e6c..6d91207b8 100644 --- a/misc/uClibc++/include/uClibc++/exception +++ b/misc/uClibc++/include/uClibc++/exception @@ -1,5 +1,5 @@ // Exception Handling support header for -*- C++ -*- - +// // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation // @@ -19,7 +19,7 @@ // along with GNU CC; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - +// // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile @@ -39,7 +39,8 @@ #include -extern "C++" { +extern "C++" +{ namespace std { @@ -51,43 +52,62 @@ namespace std * your own %exception classes, or use a different hierarchy, or to * throw non-class data (e.g., fundamental types). */ + class exception { public: exception() throw() { } virtual ~exception() throw(); + /** Returns a C-style character string describing the general cause - * of the current error. */ + * of the current error. + */ + virtual const char* what() const throw(); }; /** If an %exception is thrown which is not listed in a function's - * %exception specification, one of these may be thrown. */ + * %exception specification, one of these may be thrown. + */ + class bad_exception : public exception { 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(); }; - /// 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) (); + // If you write a replacement %terminate handler, it must be of this type. + + typedef CODE void (*terminate_handler)(void); + + // If you write a replacement %unexpected handler, it must be of this type. + + typedef CODE void (*unexpected_handler)(void); + + // Takes a new handler function as an argument, returns the old function. - /// 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. */ - void terminate() __UCLIBCXX_NORETURN; + * abandoned for any reason. + */ + + void terminate() noreturn_function; + + // Takes a new handler function as an argument, returns the old function. - /// 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() __UCLIBCXX_NORETURN; + * violates the function's %exception specification. + */ + + void unexpected() noreturn_function; /** [18.6.4]/1: "Returns true after completing evaluation of a * throw-expression until either completing initialization of the @@ -99,21 +119,10 @@ namespace std * 2: "When @c uncaught_exception() is true, throwing an %exception can * result in a call of @c terminate() (15.5.1)." */ + bool uncaught_exception() throw(); -} // namespace std -namespace __gnu_cxx -{ - /** A replacement for the standard terminate_handler which prints more - information about the terminating exception (if any) on stderr. Call - @code - std::set_terminate (__gnu_cxx::__verbose_terminate_handler) - @endcode - to use. For more info, see - http://gcc.gnu.org/onlinedocs/libstdc++/19_diagnostics/howto.html#4 - */ - void __verbose_terminate_handler (); -} // namespace __gnu_cxx +} // namespace std } // extern "C++" diff --git a/misc/uClibc++/include/uClibc++/list b/misc/uClibc++/include/uClibc++/list index de8edadd6..2fe182c66 100644 --- a/misc/uClibc++/include/uClibc++/list +++ b/misc/uClibc++/include/uClibc++/list @@ -282,17 +282,16 @@ namespace std{ pop_front(); } delete list_start->val; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB list_start->val = 0; #endif delete list_start; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB list_start = 0; list_end = 0; #endif } - template void list::swap_nodes(node * x, node * y){ T * v = x->val; x->val = y->val; @@ -398,7 +397,7 @@ namespace std{ if(elements > 0){ list_start = list_start->next; delete list_start->previous->val; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB list_start->previous->val = 0; list_start->previous->next = 0; list_start->previous->previous = 0; @@ -438,13 +437,13 @@ namespace std{ list_end->previous = temp->previous; } delete temp->val; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB temp->val = 0; temp->next = 0; temp->previous = 0; #endif delete temp; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB temp = 0; #endif --elements; @@ -503,13 +502,13 @@ namespace std{ ++position; } delete temp->val; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB temp->next = 0; temp->previous = 0; temp->val = 0; #endif delete temp; -#if UCLIBCXX_DEBUG +#ifdef CONFIG_DEBUG_LIB temp = 0; #endif --elements; -- cgit v1.2.3