summaryrefslogtreecommitdiff
path: root/misc/uClibc++
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-01 22:54:55 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-01 22:54:55 +0000
commit83aa319d730bbdb9b983647397926e8b04c68857 (patch)
treee548f94731325b836b2539589277c4ff2607def2 /misc/uClibc++
parent54e44586a06ba973a1e12365a9f292dc40a5f539 (diff)
downloadnuttx-83aa319d730bbdb9b983647397926e8b04c68857.tar.gz
nuttx-83aa319d730bbdb9b983647397926e8b04c68857.tar.bz2
nuttx-83aa319d730bbdb9b983647397926e8b04c68857.zip
uClibc++ updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5295 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc/uClibc++')
-rw-r--r--misc/uClibc++/include/uClibc++/basic_definitions22
-rw-r--r--misc/uClibc++/include/uClibc++/exception65
-rw-r--r--misc/uClibc++/include/uClibc++/list15
-rw-r--r--misc/uClibc++/libxx/uClibc++/Make.defs2
-rw-r--r--misc/uClibc++/libxx/uClibc++/eh_terminate.cxx75
-rw-r--r--misc/uClibc++/libxx/uClibc++/exception.cxx43
6 files changed, 144 insertions, 78 deletions
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 <basic_definitions>
-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<class T, class Allocator> void list<T, Allocator>::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;
diff --git a/misc/uClibc++/libxx/uClibc++/Make.defs b/misc/uClibc++/libxx/uClibc++/Make.defs
index a4e7a02f7..cf69adebe 100644
--- a/misc/uClibc++/libxx/uClibc++/Make.defs
+++ b/misc/uClibc++/libxx/uClibc++/Make.defs
@@ -37,7 +37,7 @@
CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx
CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx
-CXXSRCS += deque.cxx eh_alloc.cxx eh_globals.cxx exception.cxx
+CXXSRCS += deque.cxx eh_alloc.cxx eh_globals.cxx eh_terminate.cxx exception.cxx
CXXSRCS += fstream.cxx func_exception.cxx iomanip.cxx ios.cxx
CXXSRCS += iostream.cxx istream.cxx iterator.cxx limits.cxx list.cxx
CXXSRCS += locale.cxx map.cxx new_handler.cxx new_op.cxx new_opnt.cxx
diff --git a/misc/uClibc++/libxx/uClibc++/eh_terminate.cxx b/misc/uClibc++/libxx/uClibc++/eh_terminate.cxx
new file mode 100644
index 000000000..f64be60d9
--- /dev/null
+++ b/misc/uClibc++/libxx/uClibc++/eh_terminate.cxx
@@ -0,0 +1,75 @@
+/* Copyright (C) 2004 Garrett A. Kajmowicz
+ *
+ * This file is part of the uClibc++ Library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <cstdlib>
+#include <exception>
+
+#ifdef CONFIG_UCLIBCXX_EXCEPTION
+
+namespace std
+{
+ _UCXXEXPORT static terminate_handler __terminate_handler = abort;
+ _UCXXEXPORT static unexpected_handler __unexpected_handler = terminate;
+
+ // Takes a new handler function as an argument, returns the old function.
+
+ _UCXXEXPORT terminate_handler set_terminate(terminate_handler func) throw()
+ {
+ terminate_handler old = __terminate_handler;
+ __terminate_handler = func;
+ return old;
+ }
+
+ /** The runtime will call this function if %exception handling must be
+ * abandoned for any reason.
+ */
+
+ _UCXXEXPORT void terminate(void) throw()
+ {
+ if (__terminate_handler)
+ {
+ __terminate_handler();
+ }
+
+ abort();
+ }
+
+ _UCXXEXPORT terminate_handler set_unexpected(unexpected_handler func) throw()
+ {
+ unexpected_handler old = __unexpected_handler;
+ __unexpected_handler = func;
+ return old;
+ }
+
+ /** The runtime will call this function if an %exception is thrown which
+ * violates the function's %exception specification.
+ */
+
+ _UCXXEXPORT void unexpected(void) throw()
+ {
+ if (__unexpected_handler)
+ {
+ __unexpected_handler();
+ }
+
+ terminate();
+ }
+}
+
+#endif
diff --git a/misc/uClibc++/libxx/uClibc++/exception.cxx b/misc/uClibc++/libxx/uClibc++/exception.cxx
index 6d487a116..81d016003 100644
--- a/misc/uClibc++/libxx/uClibc++/exception.cxx
+++ b/misc/uClibc++/libxx/uClibc++/exception.cxx
@@ -1,22 +1,21 @@
/* Copyright (C) 2004 Garrett A. Kajmowicz
-
- This file is part of the uClibc++ Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*/
+ *
+ * This file is part of the uClibc++ Library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include <exception>
@@ -31,22 +30,20 @@ namespace std
{
_UCXXEXPORT static char * __std_exception_what_value = "exception";
- //We are providing our own versions to be sneaky
-
+ // We are providing our own versions to be sneaky
_UCXXEXPORT exception::~exception() throw()
{
- //Empty function
+ // Empty function
}
- _UCXXEXPORT const char* exception::what() const throw()
+ _UCXXEXPORT const char *exception::what() const throw()
{
return __std_exception_what_value;
}
_UCXXEXPORT bad_exception::~bad_exception() throw()
{
-
}
}