summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-03 13:02:31 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-03 13:02:31 +0000
commit4dbeffdd45e8c8f21d626e498b0e6971b76132fa (patch)
treea020ff768421c953e5bd2b4e1510e37561a296de /misc
parent8e7c3d9a4676c5ec1b6b3e9f243af474420ea9fb (diff)
downloadpx4-nuttx-4dbeffdd45e8c8f21d626e498b0e6971b76132fa.tar.gz
px4-nuttx-4dbeffdd45e8c8f21d626e498b0e6971b76132fa.tar.bz2
px4-nuttx-4dbeffdd45e8c8f21d626e498b0e6971b76132fa.zip
uClibc++ updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5302 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/uClibc++/README.txt70
-rw-r--r--misc/uClibc++/include/uClibc++/basic_definitions37
-rw-r--r--misc/uClibc++/include/uClibc++/func_exception49
-rw-r--r--misc/uClibc++/libxx/uClibc++/new_opv.cxx77
4 files changed, 157 insertions, 76 deletions
diff --git a/misc/uClibc++/README.txt b/misc/uClibc++/README.txt
index 6fedcb67f..751f23587 100755
--- a/misc/uClibc++/README.txt
+++ b/misc/uClibc++/README.txt
@@ -6,9 +6,20 @@ originates from http://cxx.uclibc.org/ and has been adapted for NuttX by the
RGMP team (http://rgmp.sourceforge.net/wiki/index.php/Main_Page).
uClibc++ resides in the misc/ directory rather than in the main NuttX source
-tree due to licensing issues: NuttX is licensed under the permissiv
- modified BSD License; uClibc, on the other hand, islicensed under the
- stricter GNU LGPL Version 3 license.
+tree due to licensing issues: NuttX is licensed under the permissive
+modified BSD License; uClibc, on the other hand, is licensed under the
+stricter GNU LGPL Version 3 license.
+
+Contents:
+^^^^^^^^^
+
+ o Installation of uClibc++
+ o Dependencies
+ o NuttX Configuration File Changes
+ o Make.defs File Changes
+ o Building NuttX with uClibc++
+ o Callbacks
+ o RGMP
Installation of uClibc++
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +61,6 @@ enabled. The following must be defined in your NuttX configuration file.
There are many ways to provide math library support (see nuttx/README.txt).
If you choose to use the NuttX math library, that is enabled as follows:
-
CONFIG_LIBM=y
The math libraries depend on the float.h header file that is normally
@@ -59,6 +69,10 @@ can be installed by setting:
CONFIG_ARCH_FLOAT_H=y
+Exception support can be enabled with:
+
+ CONFIG_UCLIBCXX_EXCEPTION=y
+
Make.defs File Changes
^^^^^^^^^^^^^^^^^^^^^^
@@ -74,9 +88,25 @@ And, of course, you no long need to suppress exceptions or run-time typing:
-ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti
+ARCHCPUFLAGSXX = -fno-builtin
+If exceptions are disabled via CONFIG_UCLIBCXX_EXCEPTION=n, then -fno-exceptions
+is still required. This logic would handle both cases:
-I create the nuttx/configs/rgmp/x86/cxxtest/Make.def, add the two libs to EXTRA_LIBS to be linked
-to NUTTX. The code.
+ ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y)
+ ARCHCPUFLAGSXX = -fno-builtin
+ else
+ ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions
+ endif
+
+To get the required libraries into to the NuttX build, it is necessary to add
+them to EXTRA_LIBS and to EXTRA_LIBPATHS.
+
+ LIBSUPXX = ${shell $(CC) --print-file-name=libsupc++.a}
+ EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}"
+ EXTRA_LIBS = -lsupc++
+
+NOTE: This assumes that support for these options has been incorporated into
+arch/<architecture>/src/Makefile. As of this writing that is true only for
+the ARM and simulation platforms.
Building NuttX with uClibc++
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -101,6 +131,34 @@ build, add the uClibc++ subdirectory to the dependency list, and add the
uClibc++ subdirectory to the VPATH. That should, in principle, be all it
takes.
+Callbacks
+^^^^^^^^^
+
+The runtime will call this function if exception handling must be abandoned
+for any reason.
+
+ void std::terminate(void) throw();
+
+NOTE: If exception handling is disabled via CONFIG_UCLIBCXX_EXCEPTION, then
+this function is always called when an exception would have been thrown.
+
+By default, std::terminate() just calls abort(), but that can be changed
+with std:terminate(). std::set_terminated takes a new handler function
+as an argument and returns the old handler:
+
+ typedef CODE void (*terminate_handler)(void);
+ terminate_handler std::set_terminate(std::terminate_handler func) throw();
+
+The runtime will call this function if an exception is thrown which violates
+the function's %exception specification:
+
+ void std::unexpected(void) throw()
+
+This handler defaults to std::terminate but can be re-directed with:
+
+ typedef CODE void (*unexpected_handler)(void);
+ unexpected_handler set_unexpected(unexpected_handler) throw();
+
RGMP
^^^^
diff --git a/misc/uClibc++/include/uClibc++/basic_definitions b/misc/uClibc++/include/uClibc++/basic_definitions
index ff2b29054..dc4d53121 100644
--- a/misc/uClibc++/include/uClibc++/basic_definitions
+++ b/misc/uClibc++/include/uClibc++/basic_definitions
@@ -1,26 +1,31 @@
-/* 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
-*/
+/* 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
+ */
#ifndef __BASIC_DEFINITIONS
#define __BASIC_DEFINITIONS 1
+// NuttX Configuration
+
#include <nuttx/config.h>
#include <nuttx/compiler.h>
+// Deprecated
+
#include <system_configuration.h>
#pragma GCC visibility push(default)
diff --git a/misc/uClibc++/include/uClibc++/func_exception b/misc/uClibc++/include/uClibc++/func_exception
index 1b7bdd8c5..ecf446e6e 100644
--- a/misc/uClibc++/include/uClibc++/func_exception
+++ b/misc/uClibc++/include/uClibc++/func_exception
@@ -1,38 +1,37 @@
-/* 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
+/* 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 <basic_definitions>
#include <exception>
-
#ifndef HEADER_IMPLEMENTATION_FUNC_EXCEPTION
#define HEADER_IMPLEMENTATION_FUNC_EXCEPTION
#pragma GCC visibility push(default)
-namespace std{
-
- _UCXXEXPORT void __throw_bad_alloc();
- _UCXXEXPORT void __throw_out_of_range(const char * message = 0);
- _UCXXEXPORT void __throw_overflow_error(const char * message = 0);
- _UCXXEXPORT void __throw_length_error(const char * message = 0);
- _UCXXEXPORT void __throw_invalid_argument(const char * message = 0);
+namespace std
+{
+ _UCXXEXPORT void __throw_bad_alloc();
+ _UCXXEXPORT void __throw_out_of_range(const char *message = 0);
+ _UCXXEXPORT void __throw_overflow_error(const char *message = 0);
+ _UCXXEXPORT void __throw_length_error(const char *message = 0);
+ _UCXXEXPORT void __throw_invalid_argument(const char *message = 0);
}
#pragma GCC visibility pop
diff --git a/misc/uClibc++/libxx/uClibc++/new_opv.cxx b/misc/uClibc++/libxx/uClibc++/new_opv.cxx
index ef416e07b..312d5adb3 100644
--- a/misc/uClibc++/libxx/uClibc++/new_opv.cxx
+++ b/misc/uClibc++/libxx/uClibc++/new_opv.cxx
@@ -1,35 +1,54 @@
-/* Copyright (C) 2004 Garrett A. Kajmowicz
+/* 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.
+#include <new>
+#include <cstdlib>
- 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.
+#include <basic_definitions>
- 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.
+#ifdef CONFIG_UCLIBCXX_EXCEPTION
+# include <func_exception>
+#else
+# include <exception>
+#endif
- 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
-*/
+_UCXXEXPORT void *operator new[](std::size_t numBytes) throw(std::bad_alloc)
+{
+ // C++ stardard 5.3.4.8 requires that a valid pointer be returned for
+ // a call to new(0). Thus:
-#include <new>
-#include <cstdlib>
-#include <func_exception>
-
-_UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc){
- //C++ stardard 5.3.4.8 requires that a valid pointer be returned for
- //a call to new(0). Thus:
- if(numBytes == 0){
- numBytes = 1;
- }
- void * p = malloc(numBytes);
- if(p == 0){
- std::__throw_bad_alloc();
- }
- return p;
+ if (numBytes == 0)
+ {
+ numBytes = 1;
+ }
+
+ // Allocate the memory
+
+ void *p = malloc(numBytes);
+ if (p == 0)
+ {
+#ifdef CONFIG_UCLIBCXX_EXCEPTION
+ std::__throw_bad_alloc();
+#else
+ std::terminate();
+#endif
+ }
+
+ return p;
}