summaryrefslogtreecommitdiff
path: root/misc/uClibc++/libxx
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++/libxx
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++/libxx')
-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
3 files changed, 96 insertions, 24 deletions
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()
{
-
}
}