summaryrefslogtreecommitdiff
path: root/apps/examples/nsh
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-21 09:32:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-21 09:32:57 -0600
commitaaaacf612dc228a31282c0c1c015f116eb309cd8 (patch)
tree43b7b643f99ef133d1315e7affd193cfaeff2fae /apps/examples/nsh
parent650a85488872f2a2ca28969d9545b05fe99880db (diff)
downloadnuttx-aaaacf612dc228a31282c0c1c015f116eb309cd8.tar.gz
nuttx-aaaacf612dc228a31282c0c1c015f116eb309cd8.tar.bz2
nuttx-aaaacf612dc228a31282c0c1c015f116eb309cd8.zip
Straighten out issues about who calls C++ initializers with CXXTEST or HELLOXX are built as NSH applications; Add an ofstream test to CXXTEST suggested by Michael; Update many defconfig fiels to that they set configurations to handle C++ constructors just as before these configuration changes
Diffstat (limited to 'apps/examples/nsh')
-rw-r--r--apps/examples/nsh/Kconfig12
-rw-r--r--apps/examples/nsh/nsh_main.c16
2 files changed, 24 insertions, 4 deletions
diff --git a/apps/examples/nsh/Kconfig b/apps/examples/nsh/Kconfig
index 309aa925e..bbb5ece01 100644
--- a/apps/examples/nsh/Kconfig
+++ b/apps/examples/nsh/Kconfig
@@ -12,4 +12,16 @@ config EXAMPLES_NSH
Enable the NuttShell (NSH) example
if EXAMPLES_NSH
+
+config EXAMPLES_NSH_CXXINITIALIZE
+ bool "C++ Initialization"
+ default n
+ depends on HAVE_CXX && HAVE_CXXINITIALIZE
+ ---help---
+ If HAVE_CXX and HAVE_CXXINITIALIZE are slected, then this NSH
+ example can be configured to initialize C++ constructors when it
+ is started. NSH does not use C++ and, by default, assumes that
+ constructors are initialized elsewhere. However, you can force
+ NSH to initialize constructors by setting this option.
+
endif
diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c
index d9bfc2018..92aa58696 100644
--- a/apps/examples/nsh/nsh_main.c
+++ b/apps/examples/nsh/nsh_main.c
@@ -46,11 +46,13 @@
#include <errno.h>
#include <nuttx/arch.h>
+
#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN)
-#include <nuttx/binfmt/builtin.h>
+# include <nuttx/binfmt/builtin.h>
#endif
+
#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB)
-#include <nuttx/binfmt/symtab.h>
+# include <nuttx/binfmt/symtab.h>
#endif
#include <apps/nsh.h>
@@ -59,6 +61,12 @@
* Pre-processor Definitions
****************************************************************************/
+/* C++ initialization requires CXX initializer support */
+
+#if !defined(CONFIG_HAVE_CXX) || !defined(CONFIG_HAVE_CXXINITIALIZE)
+# undef CONFIG_EXAMPLES_NSH_CXXINITIALIZE
+#endif
+
/* The NSH telnet console requires networking support (and TCP/IP) */
#ifndef CONFIG_NET
@@ -115,11 +123,11 @@ int nsh_main(int argc, char *argv[])
/* Call all C++ static constructors */
-#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
+#if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
up_cxxinitialize();
#endif
- /* Make sure that we are using our symbol take */
+ /* Make sure that we are using our symbol table */
#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB)
exec_setsymtab(CONFIG_EXECFUNCS_SYMTAB, 0);