From b217de70e5ff90e2913ce1d2c98300743bb880dd Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Tue, 30 Jun 2020 20:57:45 +0800 Subject: [PATCH] apps: Remove all stuff related to CONFIG_xxx_CXXINITIALIZE since it is moved to the central place in nuttx side instead Signed-off-by: Xiang Xiao Change-Id: I544d6110f1ca6460f7c82f970870aa9b1e7ab3dd --- examples/README.txt | 5 -- examples/elf/Kconfig | 10 --- examples/elf/elf_main.c | 8 -- examples/elf/tests/helloxx/Makefile | 8 +- examples/helloxx/Kconfig | 14 --- examples/helloxx/helloxx_main.cxx | 16 ---- examples/nxterm/nxterm_main.c | 22 ++--- graphics/nxwm/src/nxwm_main.cxx | 10 --- graphics/twm4nx/src/twm4nx_main.cxx | 7 -- include/platform/cxxinitialize.h | 84 ----------------- platform/Kconfig | 1 - platform/Makefile | 3 - platform/gnu/Kconfig | 13 --- platform/gnu/Make.defs | 51 ----------- platform/gnu/gnu_cxxinitialize.c | 134 ---------------------------- system/nsh/Kconfig | 11 --- system/nsh/README.txt | 10 --- system/nsh/nsh_main.c | 14 --- testing/README.txt | 5 -- testing/cxxtest/Kconfig | 14 --- testing/cxxtest/README.txt | 5 -- testing/cxxtest/cxxtest_main.cxx | 22 ----- 22 files changed, 13 insertions(+), 454 deletions(-) delete mode 100644 include/platform/cxxinitialize.h delete mode 100644 platform/gnu/Kconfig delete mode 100644 platform/gnu/Make.defs delete mode 100644 platform/gnu/gnu_cxxinitialize.c diff --git a/examples/README.txt b/examples/README.txt index 23f4cfbcb..de4c75926 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -542,11 +542,6 @@ examples/helloxx "built-in" that can be executed from the NSH command line. CONFIG_EXAMPLES_HELLOXX_NOSTACKCONST - Set if the system does not support construction of objects on the stack. - CONFIG_EXAMPLES_HELLOXX_CXXINITIALIZE - 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 performed elsewhere. Also needed: diff --git a/examples/elf/Kconfig b/examples/elf/Kconfig index 1dd424600..8bb752b61 100644 --- a/examples/elf/Kconfig +++ b/examples/elf/Kconfig @@ -120,16 +120,6 @@ config EXAMPLES_ELF_LIBC program greatly increasing the total code size. This option is primarily intended only for testing. -config EXAMPLES_ELF_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 performed elsewhere. - config EXAMPLES_ELF_UCLIBCXX bool "uClibc++ is installed" default n diff --git a/examples/elf/elf_main.c b/examples/elf/elf_main.c index bdeba4f82..b35308b21 100644 --- a/examples/elf/elf_main.c +++ b/examples/elf/elf_main.c @@ -41,8 +41,6 @@ #include #include -#include "platform/cxxinitialize.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -208,12 +206,6 @@ int main(int argc, FAR char *argv[]) int ret; int i; -#if defined(CONFIG_EXAMPLES_ELF_CXXINITIALIZE) - /* Call all C++ static constructors */ - - up_cxxinitialize(); -#endif - /* Initialize the memory monitor */ mm_initmonitor(); diff --git a/examples/elf/tests/helloxx/Makefile b/examples/elf/tests/helloxx/Makefile index 4fea478d1..6212963eb 100644 --- a/examples/elf/tests/helloxx/Makefile +++ b/examples/elf/tests/helloxx/Makefile @@ -63,7 +63,7 @@ BIN1 = hello++1 ALL_BIN = $(FSIMG_DIR)/$(BIN1) BIN2 = hello++2 ALL_BIN += $(FSIMG_DIR)/$(BIN2) -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) +ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y) BIN3 = hello++3 ALL_BIN += $(FSIMG_DIR)/$(BIN3) ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y) @@ -80,7 +80,7 @@ OBJS1 = $(SRCS1:.c=$(OBJEXT)) SRCS2 = $(BIN2).c OBJS2 = $(SRCS2:.c=$(OBJEXT)) -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) +ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y) SRCS3 = $(BIN3).c OBJS3 = $(SRCS3:.c=$(OBJEXT)) ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y) @@ -125,7 +125,7 @@ $(BIN2): $(OBJS2) # BIN3 is equivalent to BIN2 except that is uses static initializers -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) +ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y) $(BIN3): $(OBJS3) @echo "LD: $<" $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) @@ -158,7 +158,7 @@ ifneq ($(CONFIG_DEBUG_SYMBOLS),y) $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN2) endif -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) +ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y) $(FSIMG_DIR)/$(BIN3): $(BIN3) $(Q) mkdir -p $(FSIMG_DIR) $(Q) install $(BIN3) $(FSIMG_DIR)/$(BIN3) diff --git a/examples/helloxx/Kconfig b/examples/helloxx/Kconfig index 78432547b..630c93b1b 100644 --- a/examples/helloxx/Kconfig +++ b/examples/helloxx/Kconfig @@ -9,17 +9,3 @@ config EXAMPLES_HELLOXX depends on HAVE_CXX ---help--- 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 performed elsewhere. - -endif diff --git a/examples/helloxx/helloxx_main.cxx b/examples/helloxx/helloxx_main.cxx index 6eda33f19..2edae8181 100644 --- a/examples/helloxx/helloxx_main.cxx +++ b/examples/helloxx/helloxx_main.cxx @@ -42,19 +42,10 @@ #include #include -#include - -#include "platform/cxxinitialize.h" - //*************************************************************************** // 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 @@ -129,13 +120,6 @@ extern "C" { int main(int argc, FAR char *argv[]) { - // If C++ initialization for static constructors is supported, then do - // that first - -#ifdef CONFIG_EXAMPLES_HELLOXX_CXXINITIALIZE - up_cxxinitialize(); -#endif - // Exercise an explicitly instantiated C++ object CHelloWorld *pHelloWorld = new CHelloWorld; diff --git a/examples/nxterm/nxterm_main.c b/examples/nxterm/nxterm_main.c index 038463007..9f608489f 100644 --- a/examples/nxterm/nxterm_main.c +++ b/examples/nxterm/nxterm_main.c @@ -63,7 +63,6 @@ #include #include -#include "platform/cxxinitialize.h" #include "nshlib/nshlib.h" #include "nxterm_internal.h" @@ -117,7 +116,8 @@ static int nxterm_initialize(void) ret = boardctl(BOARDIOC_NX_START, 0); if (ret < 0) { - printf("nxterm_initialize: Failed to start the NX server: %d\n", errno); + printf("nxterm_initialize: Failed to start the NX server: %d\n", + errno); return ERROR; } @@ -145,9 +145,9 @@ static int nxterm_initialize(void) } #endif - /* Start a separate thread to listen for server events. This is probably - * the least efficient way to do this, but it makes this example flow more - * smoothly. + /* Start a separate thread to listen for server events. This is + * probably the least efficient way to do this, but it makes this + * example flow more smoothly. */ pthread_attr_init(&attr); @@ -230,12 +230,6 @@ int main(int argc, FAR char *argv[]) printf("nxterm_main: Started\n"); memset(&g_nxterm_vars, 0, sizeof(struct nxterm_state_s)); - /* Call all C++ static constructors */ - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - up_cxxinitialize(); -#endif - /* NSH Initialization *****************************************************/ /* Initialize the NSH library */ @@ -312,8 +306,10 @@ int main(int argc, FAR char *argv[]) /* Determine the size and position of the window */ - g_nxterm_vars.wndo.wsize.w = g_nxterm_vars.xres / 2 + g_nxterm_vars.xres / 4; - g_nxterm_vars.wndo.wsize.h = g_nxterm_vars.yres / 2 + g_nxterm_vars.yres / 4; + g_nxterm_vars.wndo.wsize.w = g_nxterm_vars.xres / 2 + + g_nxterm_vars.xres / 4; + g_nxterm_vars.wndo.wsize.h = g_nxterm_vars.yres / 2 + + g_nxterm_vars.yres / 4; g_nxterm_vars.wpos.x = g_nxterm_vars.xres / 8; g_nxterm_vars.wpos.y = g_nxterm_vars.yres / 8; diff --git a/graphics/nxwm/src/nxwm_main.cxx b/graphics/nxwm/src/nxwm_main.cxx index f4cf73b2e..8543c6e29 100644 --- a/graphics/nxwm/src/nxwm_main.cxx +++ b/graphics/nxwm/src/nxwm_main.cxx @@ -49,10 +49,6 @@ # include "platform/configdata.h" #endif -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) -# include "platform/cxxinitialize.h" -#endif - #include "graphics/nxwm/ctaskbar.hxx" #include "graphics/nxwm/cstartwindow.hxx" @@ -502,12 +498,6 @@ static bool createMediaPlayer(void) int main(int argc, char *argv[]) { -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - // Call all C++ static constructors - - up_cxxinitialize(); -#endif - #if defined(CONFIG_LIB_BOARDCTL) && !defined(CONFIG_BOARD_LATE_INITIALIZE) // Should we perform board-specific initialization? There are two ways // that board initialization can occur: 1) automatically via diff --git a/graphics/twm4nx/src/twm4nx_main.cxx b/graphics/twm4nx/src/twm4nx_main.cxx index ae41de9fc..ef7772b0c 100644 --- a/graphics/twm4nx/src/twm4nx_main.cxx +++ b/graphics/twm4nx/src/twm4nx_main.cxx @@ -46,7 +46,6 @@ #include -#include "platform/cxxinitialize.h" #include "netutils/netinit.h" #include "graphics/twm4nx/twm4nx_config.hxx" @@ -143,12 +142,6 @@ int main(int argc, FAR char *argv[]) UNUSED(ret); -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - // Call all C++ static constructors - - up_cxxinitialize(); -#endif - /* Create an instance of CTwm4Nx and initialize it */ FAR CTwm4Nx *twm4nx = new CTwm4Nx(display); diff --git a/include/platform/cxxinitialize.h b/include/platform/cxxinitialize.h deleted file mode 100644 index 37ca83e76..000000000 --- a/include/platform/cxxinitialize.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - * apps/include/platform/cxxinitialize.h - * - * Copyright (C) 2017 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef __APPS_INCLUDE_PLATFORM_CXXINITIALIZE_H -#define __APPS_INCLUDE_PLATFORM_CXXINITIALIZE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else - -#define EXTERN extern -#endif - -/**************************************************************************** - * Name: up_cxxinitialize - * - * Description: - * If C++ and C++ static constructors are supported, then this function - * must be provided by board-specific logic in order to perform - * initialization of the static C++ class instances. - * - * This function should then be called in the application-specific - * logic in order to perform the C++ initialization. NOTE that no - * component of the core NuttX RTOS logic is involved; This function - * definition only provides the 'contract' between application - * specific C++ code and platform-specific toolchain support - * - ****************************************************************************/ - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) -void up_cxxinitialize(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __APPS_INCLUDE_PLATFORM_CXXINITIALIZE_H */ diff --git a/platform/Kconfig b/platform/Kconfig index c3baac940..844dcc939 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -16,7 +16,6 @@ config PLATFORM_CONFIGDATA volatile storage can be used: A file, EEPROM, hardcoded values in FLASH, etc. -source "$APPSDIR/platform/gnu/Kconfig" source "$APPSDIR/platform/board/Kconfig" endmenu # Platform-specific Support diff --git a/platform/Makefile b/platform/Makefile index 35732a8cd..a0d2a9a3d 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -39,7 +39,6 @@ CONFIG_ARCH_BOARD ?= dummy # Directories -GNUDIR = gnu PLATFORMDIR = board DUMMYDIR = $(APPDIR)/platform/dummy @@ -54,11 +53,9 @@ VPATH += board ROOTDEPPATH += --obj-path bin ROOTDEPPATH += --obj-suffix $(OBJEXT) ROOTDEPPATH += --dep-path $(PLATFORMDIR) -ROOTDEPPATH += --dep-path $(GNUDIR) # Binaries --include $(GNUDIR)$(DELIM)Make.defs -include $(PLATFORMDIR)$(DELIM)Make.defs # Build context setup diff --git a/platform/gnu/Kconfig b/platform/gnu/Kconfig deleted file mode 100644 index 43bccac0b..000000000 --- a/platform/gnu/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -config HAVE_CXXINITIALIZE - bool "Have C++ initialization" - default n - depends on HAVE_CXX - ---help--- - The platform-specific logic includes support for initialization - of static C++ instances for this architecture and for the selected - toolchain (via up_cxxinitialize()). diff --git a/platform/gnu/Make.defs b/platform/gnu/Make.defs deleted file mode 100644 index 65d7b0fff..000000000 --- a/platform/gnu/Make.defs +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################ -# apps/platform/gnu/Make.defs -# -# Copyright (C) 2017 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# Check for a GNU toolchain - -ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) - -# Add GNU specific sources to ASRCS and CSRCS - -ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y) -CSRCS += gnu_cxxinitialize.c -endif - -# Add the gnu/ sub-directory to the build - -VPATH += :gnu -DEPPATH += --dep-path gnu - -endif # CONFIG_ARCH_TOOLCHAIN_GNU diff --git a/platform/gnu/gnu_cxxinitialize.c b/platform/gnu/gnu_cxxinitialize.c deleted file mode 100644 index 35993e9dd..000000000 --- a/platform/gnu/gnu_cxxinitialize.c +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** - * apps/platform/gnu/gnu_cxxinitialize.c - * - * Copyright (C) 2017 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#include "platform/cxxinitialize.h" - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Debug ********************************************************************/ -/* Non-standard debug that may be enabled just for testing the static - * constructors. - */ - -#ifdef CONFIG_DEBUG_CXX -# define cxxinfo _info -#else -# define cxxinfo(x...) -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ -/* This type defines one entry in initialization array */ - -typedef void (*initializer_t)(void); - -/**************************************************************************** - * External References - ****************************************************************************/ -/* _sinit and _einit are symbols exported by the linker script that mark the - * beginning and the end of the C++ initialization section. - */ - -extern initializer_t _sinit; -extern initializer_t _einit; - -/* _stext and _etext are symbols exported by the linker script that mark the - * beginning and the end of text. - */ - -extern uint32_t _stext; -extern uint32_t _etext; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_cxxinitialize - * - * Description: - * If C++ and C++ static constructors are supported, then this function - * must be provided by board-specific logic in order to perform - * initialization of the static C++ class instances. - * - * This function should then be called in the application-specific - * user_start logic in order to perform the C++ initialization. NOTE - * that no component of the core NuttX RTOS logic is involved; this - * function definition only provides the 'contract' between application - * specific C++ code and platform-specific toolchain support. - * - ****************************************************************************/ - -void up_cxxinitialize(void) -{ - initializer_t *initp; - - cxxinfo("_sinit: %p _einit: %p _stext: %p _etext: %p\n", - &_sinit, &_einit, &_stext, &_etext); - - /* Visit each entry in the initialization table */ - - for (initp = &_sinit; initp != &_einit; initp++) - { - initializer_t initializer = *initp; - cxxinfo("initp: %p initializer: %p\n", initp, initializer); - - /* Make sure that the address is non-NULL and lies in the text region - * defined by the linker script. Some toolchains may put NULL values - * or counts in the initialization table. - */ - - if ((void *)initializer > (void *)&_stext && - (void *)initializer < (void *)&_etext) - { - cxxinfo("Calling %p\n", initializer); - initializer(); - } - } -} - -#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */ diff --git a/system/nsh/Kconfig b/system/nsh/Kconfig index e92a29733..2b274473a 100644 --- a/system/nsh/Kconfig +++ b/system/nsh/Kconfig @@ -76,15 +76,4 @@ config SYSTEM_NSH_PROGNAME This is the name of the program that will be used when the NSH ELF program is installed. -config SYSTEM_NSH_CXXINITIALIZE - bool "C++ Initialization" - default n - depends on HAVE_CXX && HAVE_CXXINITIALIZE - ---help--- - If HAVE_CXX and HAVE_CXXINITIALIZE are selected, 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/system/nsh/README.txt b/system/nsh/README.txt index 1a49ed8d3..81bbc23d5 100644 --- a/system/nsh/README.txt +++ b/system/nsh/README.txt @@ -43,13 +43,3 @@ README CONFIG_STDIO_BUFFER_SIZE - Some value >= 64 CONFIG_STDIO_LINEBUFFER=y - - C++ Support - ----------- - If CONFIG_HAVE_CXX=y and CONFIG_HAVE_CXXINITIALIZE=y, 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: - - CONFIG_SYSTEM_NSH_CXXINITIALIZE=y diff --git a/system/nsh/nsh_main.c b/system/nsh/nsh_main.c index 9571bbde0..8aaf0a218 100644 --- a/system/nsh/nsh_main.c +++ b/system/nsh/nsh_main.c @@ -50,8 +50,6 @@ # include #endif -#include "platform/cxxinitialize.h" - #include "nshlib/nshlib.h" /**************************************************************************** @@ -80,12 +78,6 @@ # undef CONFIG_SYSTEM_NSH_SYMTAB #endif -/* C++ initialization requires CXX initializer support */ - -#if !defined(CONFIG_HAVE_CXX) || !defined(CONFIG_HAVE_CXXINITIALIZE) -# undef CONFIG_SYSTEM_NSH_CXXINITIALIZE -#endif - /* The NSH telnet console requires networking support (and TCP/IP) */ #ifndef CONFIG_NET @@ -137,12 +129,6 @@ int main(int argc, FAR char *argv[]) sched_setparam(0, ¶m); } -#if defined(CONFIG_SYSTEM_NSH_CXXINITIALIZE) - /* Call all C++ static constructors */ - - up_cxxinitialize(); -#endif - #if defined(CONFIG_SYSTEM_NSH_SYMTAB) /* Make sure that we are using our symbol table */ diff --git a/testing/README.txt b/testing/README.txt index 32ab3453c..4bcc647d5 100644 --- a/testing/README.txt +++ b/testing/README.txt @@ -28,11 +28,6 @@ testing/cxxtest Example Configuration Options ----------------------------- CONFIG_TESTING_CXXTEST=y - Eanbles the example - CONFIG_TESTING_CXXTEST_CXXINITIALIZE=y - 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 performed elsewhere. Other Required Configuration Settings ------------------------------------- diff --git a/testing/cxxtest/Kconfig b/testing/cxxtest/Kconfig index 9951ca1a6..056e126e6 100644 --- a/testing/cxxtest/Kconfig +++ b/testing/cxxtest/Kconfig @@ -9,17 +9,3 @@ config TESTING_CXXTEST depends on HAVE_CXX ---help--- Enable the C++ test program - -if TESTING_CXXTEST - -config TESTING_CXXTEST_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 performed elsewhere. - -endif diff --git a/testing/cxxtest/README.txt b/testing/cxxtest/README.txt index 2b55501f0..189a14e5b 100644 --- a/testing/cxxtest/README.txt +++ b/testing/cxxtest/README.txt @@ -16,11 +16,6 @@ README Example Configuration Options ----------------------------- CONFIG_TESTING_CXXTEST=y - Eanbles the example - CONFIG_TESTING_CXXTEST_CXXINITIALIZE=y - 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 performed elsewhere. Other Required Configuration Settings ------------------------------------- diff --git a/testing/cxxtest/cxxtest_main.cxx b/testing/cxxtest/cxxtest_main.cxx index 3e0db8ae2..60037f80d 100644 --- a/testing/cxxtest/cxxtest_main.cxx +++ b/testing/cxxtest/cxxtest_main.cxx @@ -47,23 +47,8 @@ #include #include -#include - -#include "platform/cxxinitialize.h" - using namespace std; -//*************************************************************************** -// Definitions -//*************************************************************************** -// Configuration ************************************************************ -// C++ initialization requires CXX initializer support - -#if !defined(CONFIG_HAVE_CXX) || !defined(CONFIG_HAVE_CXXINITIALIZE) -# warning Support for static initializers is NOT enabled -# undef CONFIG_TESTING_CXXTEST_CXXINITIALIZE -#endif - //*************************************************************************** // Private Classes //*************************************************************************** @@ -247,13 +232,6 @@ extern "C" { int main(int argc, char *argv[]) { - // If C++ initialization for static constructors is supported, then do - // that first - -#ifdef CONFIG_TESTING_CXXTEST_CXXINITIALIZE - up_cxxinitialize(); -#endif - test_ofstream(); test_iostream(); test_stl();