summaryrefslogtreecommitdiff
path: root/apps/examples/helloxx
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/helloxx
parent650a85488872f2a2ca28969d9545b05fe99880db (diff)
downloadpx4-nuttx-aaaacf612dc228a31282c0c1c015f116eb309cd8.tar.gz
px4-nuttx-aaaacf612dc228a31282c0c1c015f116eb309cd8.tar.bz2
px4-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/helloxx')
-rw-r--r--apps/examples/helloxx/Kconfig11
-rw-r--r--apps/examples/helloxx/helloxx_main.cxx9
2 files changed, 19 insertions, 1 deletions
diff --git a/apps/examples/helloxx/Kconfig b/apps/examples/helloxx/Kconfig
index 336389d24..d7c22cdc9 100644
--- a/apps/examples/helloxx/Kconfig
+++ b/apps/examples/helloxx/Kconfig
@@ -10,4 +10,15 @@ config EXAMPLES_HELLOXX
Enable the \"Hello, World!\" C++ example
if EXAMPLES_HELLOXX
+
+config EXAMPLES_HELLOXX_CXXINITIALIZE
+ bool "C++ Initialization"
+ default y
+ depends on HAVE_CXX && HAVE_CXXINITIALIZE
+ ---help---
+ By default, if CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE are
+ defined, then this example will call the NuttX function to
+ initialize static C++ constructors. This option may be disabled,
+ however, if that static initialization was preformed elsewhere.
+
endif
diff --git a/apps/examples/helloxx/helloxx_main.cxx b/apps/examples/helloxx/helloxx_main.cxx
index eeca52263..27a4e2695 100644
--- a/apps/examples/helloxx/helloxx_main.cxx
+++ b/apps/examples/helloxx/helloxx_main.cxx
@@ -48,6 +48,13 @@
//***************************************************************************
// Definitions
//***************************************************************************
+// Configuration ************************************************************
+// C++ initialization requires CXX initializer support
+
+#if !defined(CONFIG_HAVE_CXX) || !defined(CONFIG_HAVE_CXXINITIALIZE)
+# undef CONFIG_EXAMPLES_HELLOXX_CXXINITIALIZE
+#endif
+
// Debug ********************************************************************
// Non-standard debug that may be enabled just for testing the constructors
@@ -135,7 +142,7 @@ extern "C"
// If C++ initialization for static constructors is supported, then do
// that first
-#ifdef CONFIG_HAVE_CXXINITIALIZE
+#ifdef CONFIG_EXAMPLES_HELLOXX_CXXINITIALIZE
up_cxxinitialize();
#endif