You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/07/13 18:08:23 UTC

[incubator-nuttx] branch master updated: libxx: Unify uClibc++ and libc++ config

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 6abd03d  libxx: Unify uClibc++ and libc++ config
6abd03d is described below

commit 6abd03d53ff9164fb17ea4aca701a49fbbf751c0
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 28 23:03:57 2020 +0800

    libxx: Unify uClibc++ and libc++ config
    
    code just need check CONFIG_CXX_EXCEPTION/CONFIG_CXX_LIBSUPCXX now,
    instead uClibc++/libc++ specific config
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I3b00a5a6701b8bf1c70de89f2d924592ca3e38b0
---
 .../imxrt1050-evk/configs/libcxxtest/Make.defs     |  2 +-
 .../imxrt1060-evk/configs/libcxxtest/Make.defs     |  2 +-
 .../lpc43xx/bambino-200e/configs/netnsh/Make.defs  |  2 +-
 boards/arm/stm32/stm32f4discovery/README.txt       |  6 ++--
 .../stm32f4discovery/configs/cxxtest/Make.defs     |  2 +-
 .../stm32f4discovery/configs/testlibcxx/Make.defs  |  2 +-
 boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs |  2 +-
 boards/sim/sim/sim/README.txt                      |  2 +-
 boards/sim/sim/sim/configs/cxxtest/Make.defs       |  2 +-
 boards/sim/sim/sim/configs/cxxtest/defconfig       |  2 +-
 libs/libxx/Kconfig                                 | 39 ++++------------------
 libs/libxx/Makefile                                | 18 +++-------
 libs/libxx/cxx.defs                                | 24 +++++++++++++
 13 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs
index e00c4d3..bb3a31d 100644
--- a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs
+++ b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs
@@ -83,7 +83,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCFLAGS = -fno-builtin
-ifeq ($(CONFIG_LIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs
index c58f7d5..4cd50d9 100644
--- a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs
+++ b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs
@@ -83,7 +83,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCFLAGS = -fno-builtin
-ifeq ($(CONFIG_LIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs
index 724e68e..a12e39f 100644
--- a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs
+++ b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs
@@ -90,7 +90,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCFLAGS = -fno-builtin
-ifeq ($(CONFIG_LIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/arm/stm32/stm32f4discovery/README.txt b/boards/arm/stm32/stm32f4discovery/README.txt
index 328a1bd..18dfb7d 100644
--- a/boards/arm/stm32/stm32f4discovery/README.txt
+++ b/boards/arm/stm32/stm32f4discovery/README.txt
@@ -1357,7 +1357,7 @@ Configuration Sub-directories
 
        arm-none-eabi-ar.exe rcs libsupc++.a vterminate.o
 
-  3. Exceptions are enabled and workking (CONFIG_UCLIBCXX_EXCEPTION=y)
+  3. Exceptions are enabled and workking (CONFIG_CXX_EXCEPTION=y)
 
   elf:
   ---
@@ -1393,8 +1393,8 @@ Configuration Sub-directories
        CONFIG_HAVE_CXXINITIALIZE=y
 
        CONFIG_UCLIBCXX=y
-       CONFIG_UCLIBCXX_EXCEPTION=y
-       CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
+       CONFIG_CXX_EXCEPTION=y
+       CONFIG_CXX_LIBSUPCXX=y
        CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32
 
        CONFIG_EXAMPLES_ELF_CXX=y
diff --git a/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs b/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs
index 954f5e6..a10f3bf 100644
--- a/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs
+++ b/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs
@@ -62,7 +62,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCFLAGS = -fno-builtin
-ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs
index dfeaffa..a1a5109 100644
--- a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs
+++ b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs
@@ -81,7 +81,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCFLAGS = -fno-builtin
-ifeq ($(CONFIG_LIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs
index 867c0e1..5f58ee0 100644
--- a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs
+++ b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs
@@ -80,7 +80,7 @@ ifeq ($(CONFIG_LIBCXX),y)
   CXXFLAGS += -std=c++14 -D__NuttX__ -D__GLIBCXX__ -DMB_LEN_MAX=8 -DHAVE_DEPENDENT_EH_ABI=0 \
     -fno-builtin -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_STD_VER=14
 
-  ifneq ($(CONFIG_LIBCXX_EXCEPTION),y)
+  ifneq ($(CONFIG_CXX_EXCEPTION),y)
     CXXFLAGS += -fno-exceptions -fno-rtti -fcheck-new -D_LIBCPP_NO_EXCEPTIONS
   endif
 
diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt
index b1793d1..8ee4e9e 100644
--- a/boards/sim/sim/sim/README.txt
+++ b/boards/sim/sim/sim/README.txt
@@ -561,7 +561,7 @@ cxxtest
      on how to install uClibc++
 
   2. At present (2012/11/02), exceptions are disabled in this example
-     (CONFIG_UCLIBCXX_EXCEPTION=n).  It is probably not necessary to disable
+     (CONFIG_CXX_EXCEPTION=n).  It is probably not necessary to disable
      exceptions.
 
   3. Unfortunately, this example will not run now.
diff --git a/boards/sim/sim/sim/configs/cxxtest/Make.defs b/boards/sim/sim/sim/configs/cxxtest/Make.defs
index 3a967ce..e6d5258 100644
--- a/boards/sim/sim/sim/configs/cxxtest/Make.defs
+++ b/boards/sim/sim/sim/configs/cxxtest/Make.defs
@@ -32,7 +32,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
 endif
 
 ARCHCPUFLAGS = -fno-builtin
-ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y)
+ifeq ($(CONFIG_CXX_EXCEPTION),y)
   ARCHCPUFLAGSXX = -fno-builtin
 else
   ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new
diff --git a/boards/sim/sim/sim/configs/cxxtest/defconfig b/boards/sim/sim/sim/configs/cxxtest/defconfig
index 48325b9..217551a 100644
--- a/boards/sim/sim/sim/configs/cxxtest/defconfig
+++ b/boards/sim/sim/sim/configs/cxxtest/defconfig
@@ -5,7 +5,7 @@
 # You can then do "make savedefconfig" to generate a new defconfig file that includes your
 # modifications.
 #
-# CONFIG_UCLIBCXX_EXCEPTION is not set
+# CONFIG_CXX_EXCEPTION is not set
 CONFIG_ARCH="sim"
 CONFIG_ARCH_BOARD="sim"
 CONFIG_ARCH_BOARD_SIM=y
diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig
index 2079617..0d84e23 100644
--- a/libs/libxx/Kconfig
+++ b/libs/libxx/Kconfig
@@ -31,10 +31,15 @@ config HAVE_CXXINITIALIZE
 		toolchain (via up_cxxinitialize()).
 
 config CXX_EXCEPTION
-	bool
+	bool "Enable Exception Support"
+	default LIBCXX || UCLIBCXX
 
 config CXX_LIBSUPCXX
-	bool
+	bool "Have libsupc++ (required)"
+	default LIBCXX || UCLIBCXX
+	---help---
+		Select if your toolchain provides libsupc++.  This option is required
+		at present because the built-in libsupc++ support is incomplete.
 
 comment "LLVM C++ Library (libcxx)"
 
@@ -49,23 +54,6 @@ config LIBCXX
 		be built by selecting this option.  See the README.txt file in the
 		libcxx package for information on installing libcxx.
 
-if LIBCXX
-
-config LIBCXX_EXCEPTION
-	bool "Enable Exception Support"
-	default y
-	select CXX_EXCEPTION
-
-config LIBCXX_HAVE_LIBSUPCXX
-	bool "Have libsupc++ (required)"
-	default y
-	select CXX_LIBSUPCXX
-	---help---
-		Select if your toolchain provides libsupc++.  This option is required
-		at present because the built-in libsupc++ support is incomplete.
-
-endif
-
 comment "uClibc++ Standard C++ Library"
 
 config UCLIBCXX
@@ -78,22 +66,9 @@ config UCLIBCXX
 
 if UCLIBCXX
 
-config UCLIBCXX_EXCEPTION
-	bool "Enable Exception Support"
-	default y
-	select CXX_EXCEPTION
-
 config UCLIBCXX_IOSTREAM_BUFSIZE
 	int "IO Stream Buffer Size"
 	default 32
 
-config UCLIBCXX_HAVE_LIBSUPCXX
-	bool "Have libsupc++ (required)"
-	default y
-	select CXX_LIBSUPCXX
-	---help---
-		Select if your toolchain provides libsupc++.  This option is required
-		at present because the built-in libsupc++ support is incomplete.
-
 endif
 endif
diff --git a/libs/libxx/Makefile b/libs/libxx/Makefile
index 423e659..03d11a1 100644
--- a/libs/libxx/Makefile
+++ b/libs/libxx/Makefile
@@ -35,17 +35,7 @@
 
 include $(TOPDIR)/Make.defs
 
-CXXSRCS  = libxx_cxapurevirtual.cxx libxx_eabi_atexit.cxx libxx_cxa_atexit.cxx
-CXXSRCS += libxx_cxa_guard.cxx
-
-# Some of the libs/libxx/ files are not need if uClibc++ or libcxx is installed
-# because uClibx++ or libcxx will replace them
-
-ifeq (,$(findstring y,$(CONFIG_UCLIBCXX) $(CONFIG_LIBCXX)))
-CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx
-CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
-CXXSRCS += libxx_stdthrow.cxx
-endif
+CXXSRCS = libxx_cxa_atexit.cxx libxx_eabi_atexit.cxx
 
 # Include the uClibc++ Make.defs file if selected.  If it is included,
 # the uClibc++/Make.defs file will add its files to the source file list,
@@ -59,10 +49,10 @@ endif
 
 ifeq ($(CONFIG_UCLIBCXX),y)
 include uClibc++/Make.defs
-endif
-
-ifeq ($(CONFIG_LIBCXX),y)
+else ifeq ($(CONFIG_LIBCXX),y)
 include libcxx/Make.defs
+else
+include cxx.defs
 endif
 
 # Object Files
diff --git a/libs/libxx/cxx.defs b/libs/libxx/cxx.defs
new file mode 100644
index 0000000..547b61c
--- /dev/null
+++ b/libs/libxx/cxx.defs
@@ -0,0 +1,24 @@
+############################################################################
+# libs/libxx/cxx.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+###########################################################################
+
+CXXSRCS += libxx_cxa_guard.cxx libxx_cxapurevirtual.cxx
+CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx
+CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx
+CXXSRCS += libxx_stdthrow.cxx