From c5000c83d250896fffbddd7a3991384ea0fc286d Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Wed, 24 Apr 2019 15:02:25 +0200 Subject: [PATCH] Rename Kconfig options (root) --- CMakeLists.txt | 16 +++---- Kconfig | 46 +++++++++---------- .../asio/port/include/esp_asio_config.h | 4 +- components/asio/port/include/esp_exception.h | 4 +- components/cxx/CMakeLists.txt | 2 +- components/cxx/component.mk | 2 +- components/cxx/cxx_exception_stubs.cpp | 4 +- components/cxx/test/test_cxx.cpp | 6 +-- components/esp32/Kconfig | 2 +- components/esp32/cpu_start.c | 6 +-- components/esp32/test/test_stack_check.c | 2 +- .../esp32/test/test_stack_check_cxx.cpp | 2 +- components/esp_common/include/esp_err.h | 2 +- components/esp_common/src/stack_check.c | 2 +- components/freertos/Kconfig | 2 +- components/heap/multi_heap_platform.h | 4 +- components/newlib/platform_include/assert.h | 2 +- docs/en/api-guides/error-handling.rst | 4 +- docs/en/api-guides/fatal-errors.rst | 2 +- docs/zh_CN/api-guides/error-handling.rst | 4 +- examples/system/cpp_exceptions/README.md | 4 +- .../system/cpp_exceptions/sdkconfig.defaults | 4 +- make/project.mk | 18 ++++---- sdkconfig.rename | 25 ++++++++-- tools/check_kconfigs.py | 6 +-- tools/ldgen/samples/sdkconfig | 24 +++++----- tools/unit-test-app/configs/release | 4 +- tools/unit-test-app/sdkconfig.defaults | 6 +-- 28 files changed, 113 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 139dce9c65..a844c05769 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,19 +18,19 @@ endif() list(APPEND compile_definitions "-DGCC_NOT_5_2_0=${GCC_NOT_5_2_0}") -if(CONFIG_OPTIMIZATION_LEVEL_RELEASE) +if(CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE) list(APPEND compile_options "-Os") else() list(APPEND compile_options "-Og") endif() -if(CONFIG_CXX_EXCEPTIONS) +if(CONFIG_COMPILER_CXX_EXCEPTIONS) list(APPEND cxx_compile_options "-fexceptions") else() list(APPEND cxx_compile_options "-fno-exceptions") endif() -if(CONFIG_DISABLE_GCC8_WARNINGS) +if(CONFIG_COMPILER_DISABLE_GCC8_WARNINGS) list(APPEND compile_options "-Wno-parentheses" "-Wno-sizeof-pointer-memaccess" "-Wno-clobbered") @@ -50,15 +50,15 @@ if(CONFIG_DISABLE_GCC8_WARNINGS) endif() endif() -if(CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED) +if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE) list(APPEND compile_definitions "NDEBUG") endif() -if(CONFIG_STACK_CHECK_NORM) +if(CONFIG_COMPILER_STACK_CHECK_MODE_NORM) list(APPEND compile_options "-fstack-protector") -elseif(CONFIG_STACK_CHECK_STRONG) +elseif(CONFIG_COMPILER_STACK_CHECK_MODE_STRONG) list(APPEND compile_options "-fstack-protector-strong") -elseif(CONFIG_STACK_CHECK_ALL) +elseif(CONFIG_COMPILER_STACK_CHECK_MODE_ALL) list(APPEND compile_options "-fstack-protector-all") endif() @@ -117,4 +117,4 @@ foreach(build_component ${build_components}) endif() endforeach() endif() -endforeach() \ No newline at end of file +endforeach() diff --git a/Kconfig b/Kconfig index 874bb6e9a6..dd61783abc 100644 --- a/Kconfig +++ b/Kconfig @@ -60,9 +60,9 @@ mainmenu "Espressif IoT Development Framework Configuration" menu "Compiler options" - choice OPTIMIZATION_COMPILER + choice COMPILER_OPTIMIZATION prompt "Optimization Level" - default OPTIMIZATION_LEVEL_DEBUG + default COMPILER_OPTIMIZATION_LEVEL_DEBUG help This option sets compiler optimization level (gcc -O argument). @@ -76,15 +76,15 @@ mainmenu "Espressif IoT Development Framework Configuration" in project makefile, before including $(IDF_PATH)/make/project.mk. Note that custom optimization levels may be unsupported. - config OPTIMIZATION_LEVEL_DEBUG + config COMPILER_OPTIMIZATION_LEVEL_DEBUG bool "Debug (-Og)" - config OPTIMIZATION_LEVEL_RELEASE + config COMPILER_OPTIMIZATION_LEVEL_RELEASE bool "Release (-Os)" endchoice - choice OPTIMIZATION_ASSERTION_LEVEL + choice COMPILER_OPTIMIZATION_ASSERTION_LEVEL prompt "Assertion level" - default OPTIMIZATION_ASSERTIONS_ENABLED + default COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE help Assertions can be: @@ -96,20 +96,20 @@ mainmenu "Espressif IoT Development Framework Configuration" - Disabled entirely (not recommended for most configurations.) -DNDEBUG is added to CPPFLAGS in this case. - config OPTIMIZATION_ASSERTIONS_ENABLED + config COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE prompt "Enabled" bool help Enable assertions. Assertion content and line number will be printed on failure. - config OPTIMIZATION_ASSERTIONS_SILENT + config COMPILER_OPTIMIZATION_ASSERTIONS_SILENT prompt "Silent (saves code size)" bool help Enable silent assertions. Failed assertions will abort(), user needs to use the aborting address to find the line number with the failed assertion. - config OPTIMIZATION_ASSERTIONS_DISABLED + config COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE prompt "Disabled (sets -DNDEBUG)" bool help @@ -117,7 +117,7 @@ mainmenu "Espressif IoT Development Framework Configuration" endchoice # assertions - menuconfig CXX_EXCEPTIONS + menuconfig COMPILER_CXX_EXCEPTIONS bool "Enable C++ exceptions" default n help @@ -129,17 +129,17 @@ mainmenu "Espressif IoT Development Framework Configuration" Enabling this option currently adds an additional ~500 bytes of heap overhead when an exception is thrown in user code for the first time. - config CXX_EXCEPTIONS_EMG_POOL_SIZE + config COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE int "Emergency Pool Size" default 0 - depends on CXX_EXCEPTIONS + depends on COMPILER_CXX_EXCEPTIONS help Size (in bytes) of the emergency memory pool for C++ exceptions. This pool will be used to allocate memory for thrown exceptions when there is not enough memory on the heap. - choice STACK_CHECK_MODE + choice COMPILER_STACK_CHECK_MODE prompt "Stack smashing protection mode" - default STACK_CHECK_NONE + default COMPILER_STACK_CHECK_MODE_NONE help Stack smashing protection mode. Emit extra code to check for buffer overflows, such as stack smashing attacks. This is done by adding a guard variable to functions with vulnerable objects. @@ -162,23 +162,23 @@ mainmenu "Espressif IoT Development Framework Configuration" - coverage: NORMAL < STRONG < OVERALL - config STACK_CHECK_NONE + config COMPILER_STACK_CHECK_MODE_NONE bool "None" - config STACK_CHECK_NORM + config COMPILER_STACK_CHECK_MODE_NORM bool "Normal" - config STACK_CHECK_STRONG + config COMPILER_STACK_CHECK_MODE_STRONG bool "Strong" - config STACK_CHECK_ALL + config COMPILER_STACK_CHECK_MODE_ALL bool "Overall" endchoice - config STACK_CHECK + config COMPILER_STACK_CHECK bool - default !STACK_CHECK_NONE + default !COMPILER_STACK_CHECK_MODE_NONE help Stack smashing protection. - config WARN_WRITE_STRINGS + config COMPILER_WARN_WRITE_STRINGS bool "Enable -Wwrite-strings warning flag" default "n" help @@ -192,7 +192,7 @@ mainmenu "Espressif IoT Development Framework Configuration" For C++, this warns about the deprecated conversion from string literals to ``char *``. - config DISABLE_GCC8_WARNINGS + config COMPILER_DISABLE_GCC8_WARNINGS bool "Disable new warnings introduced in GCC 6 - 8" default "n" help @@ -223,4 +223,4 @@ mainmenu "Espressif IoT Development Framework Configuration" You can still include these headers in a legacy way until it is totally deprecated by enable this option. - endmenu #Compatibility options \ No newline at end of file + endmenu #Compatibility options diff --git a/components/asio/port/include/esp_asio_config.h b/components/asio/port/include/esp_asio_config.h index accccad0da..f8617fcc99 100644 --- a/components/asio/port/include/esp_asio_config.h +++ b/components/asio/port/include/esp_asio_config.h @@ -18,9 +18,9 @@ // Enabling exceptions only when they are enabled in menuconfig // # include -# ifndef CONFIG_CXX_EXCEPTIONS +# ifndef CONFIG_COMPILER_CXX_EXCEPTIONS # define ASIO_NO_EXCEPTIONS -# endif // CONFIG_CXX_EXCEPTIONS +# endif // CONFIG_COMPILER_CXX_EXCEPTIONS // // LWIP compatifility inet and address macros/functions diff --git a/components/asio/port/include/esp_exception.h b/components/asio/port/include/esp_exception.h index 3c5c043755..a4a3160131 100644 --- a/components/asio/port/include/esp_exception.h +++ b/components/asio/port/include/esp_exception.h @@ -18,7 +18,7 @@ // // This exception stub is enabled only if exceptions are disabled in menuconfig // -#if !defined(CONFIG_CXX_EXCEPTIONS) && defined (ASIO_NO_EXCEPTIONS) +#if !defined(CONFIG_COMPILER_CXX_EXCEPTIONS) && defined (ASIO_NO_EXCEPTIONS) #include "esp_log.h" @@ -34,6 +34,6 @@ void throw_exception(const Exception& e) abort(); } }} -#endif // CONFIG_CXX_EXCEPTIONS==1 && defined (ASIO_NO_EXCEPTIONS) +#endif // CONFIG_COMPILER_CXX_EXCEPTIONS==1 && defined (ASIO_NO_EXCEPTIONS) #endif // _ESP_EXCEPTION_H_ diff --git a/components/cxx/CMakeLists.txt b/components/cxx/CMakeLists.txt index 0d9b14f134..cb5609d2a9 100644 --- a/components/cxx/CMakeLists.txt +++ b/components/cxx/CMakeLists.txt @@ -5,6 +5,6 @@ register_component() target_link_libraries(${COMPONENT_LIB} stdc++) target_link_libraries(${COMPONENT_LIB} "-u __cxa_guard_dummy") -if(NOT CONFIG_CXX_EXCEPTIONS) +if(NOT CONFIG_COMPILER_CXX_EXCEPTIONS) target_link_libraries(${COMPONENT_LIB} "-u __cxx_fatal_exception") endif() diff --git a/components/cxx/component.mk b/components/cxx/component.mk index 7d819675a8..a5d6e55ccf 100644 --- a/components/cxx/component.mk +++ b/components/cxx/component.mk @@ -2,7 +2,7 @@ # is taken from cxx_guards.o instead of libstdc++.a COMPONENT_ADD_LDFLAGS += -u __cxa_guard_dummy -ifndef CONFIG_CXX_EXCEPTIONS +ifndef CONFIG_COMPILER_CXX_EXCEPTIONS # If exceptions are disabled, ensure our fatal exception # hooks are preferentially linked over libstdc++ which # has full exception support diff --git a/components/cxx/cxx_exception_stubs.cpp b/components/cxx/cxx_exception_stubs.cpp index f09f946ddc..858ed0bfc8 100644 --- a/components/cxx/cxx_exception_stubs.cpp +++ b/components/cxx/cxx_exception_stubs.cpp @@ -4,7 +4,7 @@ #include #include -#ifndef CONFIG_CXX_EXCEPTIONS +#ifndef CONFIG_COMPILER_CXX_EXCEPTIONS const char *FATAL_EXCEPTION = "Fatal C++ exception: "; @@ -81,4 +81,4 @@ extern "C" void __cxa_call_terminate(void) __attribute__((alias("__cxx_fatal_exc bool std::uncaught_exception() __attribute__((alias("__cxx_fatal_exception_bool"))); -#endif // CONFIG_CXX_EXCEPTIONS +#endif // CONFIG_COMPILER_CXX_EXCEPTIONS diff --git a/components/cxx/test/test_cxx.cpp b/components/cxx/test/test_cxx.cpp index 3ba121ca5f..0f5cce3318 100644 --- a/components/cxx/test/test_cxx.cpp +++ b/components/cxx/test/test_cxx.cpp @@ -196,7 +196,7 @@ TEST_CASE("before scheduler has started, static initializers work correctly", "[ TEST_ASSERT_EQUAL(2, StaticInitTestBeforeScheduler::order); } -#ifdef CONFIG_CXX_EXCEPTIONS +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS TEST_CASE("c++ exceptions work", "[cxx]") { @@ -259,7 +259,7 @@ TEST_CASE("c++ exceptions emergency pool", "[cxx] [ignore]") thrown_value = e; printf("Got exception %d\n", thrown_value); } -#if CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE > 0 +#if CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE > 0 // free all memory while (pprev) { p = (void **)(*pprev); @@ -274,7 +274,7 @@ TEST_CASE("c++ exceptions emergency pool", "[cxx] [ignore]") #endif } -#else // !CONFIG_CXX_EXCEPTIONS +#else // !CONFIG_COMPILER_CXX_EXCEPTIONS TEST_CASE("std::out_of_range exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]") { diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index d9de4fd303..b22c73940d 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -570,7 +570,7 @@ menu "ESP32-specific" config ESP32_DEBUG_STUBS_ENABLE bool "OpenOCD debug stubs" - default OPTIMIZATION_LEVEL_DEBUG + default COMPILER_OPTIMIZATION_LEVEL_DEBUG depends on !ESP32_TRAX help Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging, diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index d7fe6141f0..ed701a1a73 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -454,16 +454,16 @@ void start_cpu1_default(void) } #endif //!CONFIG_FREERTOS_UNICORE -#ifdef CONFIG_CXX_EXCEPTIONS +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS size_t __cxx_eh_arena_size_get() { - return CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE; + return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE; } #endif static void do_global_ctors(void) { -#ifdef CONFIG_CXX_EXCEPTIONS +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS static struct object ob; __register_frame_info( __eh_frame, &ob ); #endif diff --git a/components/esp32/test/test_stack_check.c b/components/esp32/test/test_stack_check.c index 5dc9062c54..0fa6c7bfed 100644 --- a/components/esp32/test/test_stack_check.c +++ b/components/esp32/test/test_stack_check.c @@ -1,6 +1,6 @@ #include "unity.h" -#if CONFIG_STACK_CHECK +#if CONFIG_COMPILER_STACK_CHECK static void recur_and_smash() { diff --git a/components/esp32/test/test_stack_check_cxx.cpp b/components/esp32/test/test_stack_check_cxx.cpp index 5c2c489e74..cb6e5a7701 100644 --- a/components/esp32/test/test_stack_check_cxx.cpp +++ b/components/esp32/test/test_stack_check_cxx.cpp @@ -1,6 +1,6 @@ #include "unity.h" -#if CONFIG_STACK_CHECK +#if CONFIG_COMPILER_STACK_CHECK static void recur_and_smash_cxx() { diff --git a/components/esp_common/include/esp_err.h b/components/esp_common/include/esp_err.h index 794f32e1eb..c46ae38372 100644 --- a/components/esp_common/include/esp_err.h +++ b/components/esp_common/include/esp_err.h @@ -105,7 +105,7 @@ void _esp_error_check_failed_without_abort(esp_err_t rc, const char *file, int l esp_err_t __err_rc = (x); \ (void) sizeof(__err_rc); \ } while(0) -#elif defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT) +#elif defined(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT) #define ESP_ERROR_CHECK(x) do { \ esp_err_t __err_rc = (x); \ if (__err_rc != ESP_OK) { \ diff --git a/components/esp_common/src/stack_check.c b/components/esp_common/src/stack_check.c index f79b50a6c9..d22102a471 100644 --- a/components/esp_common/src/stack_check.c +++ b/components/esp_common/src/stack_check.c @@ -15,7 +15,7 @@ #include "sdkconfig.h" #include "esp_system.h" -#if CONFIG_STACK_CHECK +#if CONFIG_COMPILER_STACK_CHECK #define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL #include "esp_log.h" diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 777ca7b604..343fc89ac6 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -410,7 +410,7 @@ menu "FreeRTOS" config FREERTOS_TASK_FUNCTION_WRAPPER bool "Enclose all task functions in a wrapper function" - depends on OPTIMIZATION_LEVEL_DEBUG + depends on COMPILER_OPTIMIZATION_LEVEL_DEBUG default y help If enabled, all FreeRTOS task functions will be enclosed in a wrapper function. diff --git a/components/heap/multi_heap_platform.h b/components/heap/multi_heap_platform.h index 7ff1f00ae0..a3a0acc67b 100644 --- a/components/heap/multi_heap_platform.h +++ b/components/heap/multi_heap_platform.h @@ -48,9 +48,9 @@ inline static void multi_heap_assert(bool condition, const char *format, int lin */ #ifndef NDEBUG if(!condition) { -#ifndef CONFIG_OPTIMIZATION_ASSERTIONS_SILENT +#ifndef CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT ets_printf(format, line, address); -#endif // CONFIG_OPTIMIZATION_ASSERTIONS_SILENT +#endif // CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT abort(); } #else // NDEBUG diff --git a/components/newlib/platform_include/assert.h b/components/newlib/platform_include/assert.h index afbea986ed..3568727212 100644 --- a/components/newlib/platform_include/assert.h +++ b/components/newlib/platform_include/assert.h @@ -22,7 +22,7 @@ #include_next -#if defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG) +#if defined(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG) #undef assert #define assert(__e) ((__e) ? (void)0 : abort()) #endif diff --git a/docs/en/api-guides/error-handling.rst b/docs/en/api-guides/error-handling.rst index 8c470d2bce..d465a414c5 100644 --- a/docs/en/api-guides/error-handling.rst +++ b/docs/en/api-guides/error-handling.rst @@ -114,9 +114,9 @@ Error handling patterns C++ Exceptions -------------- -Support for C++ Exceptions in ESP-IDF is disabled by default, but can be enabled using :ref:`CONFIG_CXX_EXCEPTIONS` option. +Support for C++ Exceptions in ESP-IDF is disabled by default, but can be enabled using :ref:`CONFIG_COMPILER_CXX_EXCEPTIONS` option. -Enabling exception handling normally increases application binary size by a few kB. Additionally it may be necessary to reserve some amount of RAM for exception emergency pool. Memory from this pool will be used if it is not possible to allocate exception object from the heap. Amount of memory in the emergency pool can be set using :ref:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` variable. +Enabling exception handling normally increases application binary size by a few kB. Additionally it may be necessary to reserve some amount of RAM for exception emergency pool. Memory from this pool will be used if it is not possible to allocate exception object from the heap. Amount of memory in the emergency pool can be set using :ref:`CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE` variable. If an exception is thrown, but there is no ``catch`` block, the program will be terminated by ``abort`` function, and backtrace will be printed. See :doc:`Fatal Errors ` for more information about backtraces. diff --git a/docs/en/api-guides/fatal-errors.rst b/docs/en/api-guides/fatal-errors.rst index 3cea89c88f..06883edb5a 100644 --- a/docs/en/api-guides/fatal-errors.rst +++ b/docs/en/api-guides/fatal-errors.rst @@ -283,7 +283,7 @@ Consult :doc:`Heap Memory Debugging <../api-reference/system/heap_debug>` docume Stack Smashing ^^^^^^^^^^^^^^ -Stack smashing protection (based on GCC ``-fstack-protector*`` flags) can be enabled in ESP-IDF using :ref:`CONFIG_STACK_CHECK_MODE` option. If stack smashing is detected, message similar to the following will be printed:: +Stack smashing protection (based on GCC ``-fstack-protector*`` flags) can be enabled in ESP-IDF using :ref:`CONFIG_COMPILER_STACK_CHECK_MODE` option. If stack smashing is detected, message similar to the following will be printed:: Stack smashing protect failure! diff --git a/docs/zh_CN/api-guides/error-handling.rst b/docs/zh_CN/api-guides/error-handling.rst index 40ac8c1dbc..025d3695a8 100644 --- a/docs/zh_CN/api-guides/error-handling.rst +++ b/docs/zh_CN/api-guides/error-handling.rst @@ -126,8 +126,8 @@ ESP-IDF 中大多数函数会返回 :cpp:type:`esp_err_t` 类型的错误码, C++ 异常 -------- -默认情况下,ESP-IDF 会禁用对 C++ 异常的支持,但是可以通过 :ref:`CONFIG_CXX_EXCEPTIONS` 选项启用。 +默认情况下,ESP-IDF 会禁用对 C++ 异常的支持,但是可以通过 :ref:`CONFIG_COMPILER_CXX_EXCEPTIONS` 选项启用。 -通常情况下,启用异常处理会让应用程序的二进制文件增加几 kB。此外,启用该功能时还应为异常事故池预留一定内存。当应用程序无法从堆中分配异常对象时,就可以使用这个池中的内存。该内存池的大小可以通过 :ref:`CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE` 来设定。 +通常情况下,启用异常处理会让应用程序的二进制文件增加几 kB。此外,启用该功能时还应为异常事故池预留一定内存。当应用程序无法从堆中分配异常对象时,就可以使用这个池中的内存。该内存池的大小可以通过 :ref:`CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE` 来设定。 如果 C++ 程序抛出了异常,但是程序中并没有 ``catch`` 代码块来捕获该异常,那么程序的运行就会被 ``abort`` 函数中止,然后打印回溯信息。有关回溯的更多信息,请参阅 :doc:`不可恢复错误 ` 。 diff --git a/examples/system/cpp_exceptions/README.md b/examples/system/cpp_exceptions/README.md index 0ff49f3520..2056379edf 100644 --- a/examples/system/cpp_exceptions/README.md +++ b/examples/system/cpp_exceptions/README.md @@ -4,9 +4,9 @@ This example demonstrates usage of C++ exceptions in ESP-IDF. -By default, C++ exceptions support is disabled in ESP-IDF. It can be enabled using `CONFIG_CXX_EXCEPTIONS` configuration option. +By default, C++ exceptions support is disabled in ESP-IDF. It can be enabled using `CONFIG_COMPILER_CXX_EXCEPTIONS` configuration option. -In this example, `sdkconfig.defaults` file sets `CONFIG_CXX_EXCEPTIONS` option. This enables both compile time support (`-fexceptions` compiler flag) and run-time support for C++ exception handling. +In this example, `sdkconfig.defaults` file sets `CONFIG_COMPILER_CXX_EXCEPTIONS` option. This enables both compile time support (`-fexceptions` compiler flag) and run-time support for C++ exception handling. Example source code declares a class which can throw exception from the constructor, depending on the argument. It illustrates that exceptions can be thrown and caught using standard C++ facilities. diff --git a/examples/system/cpp_exceptions/sdkconfig.defaults b/examples/system/cpp_exceptions/sdkconfig.defaults index e9d7fca37b..a365ac6589 100644 --- a/examples/system/cpp_exceptions/sdkconfig.defaults +++ b/examples/system/cpp_exceptions/sdkconfig.defaults @@ -1,3 +1,3 @@ # Enable C++ exceptions and set emergency pool size for exception objects -CONFIG_CXX_EXCEPTIONS=y -CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE=1024 +CONFIG_COMPILER_CXX_EXCEPTIONS=y +CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=1024 diff --git a/make/project.mk b/make/project.mk index 2f1def70d2..449badb202 100644 --- a/make/project.mk +++ b/make/project.mk @@ -375,7 +375,7 @@ COMMON_WARNING_FLAGS = -Wall -Werror=all \ -Wextra \ -Wno-unused-parameter -Wno-sign-compare -ifdef CONFIG_DISABLE_GCC8_WARNINGS +ifdef CONFIG_COMPILER_DISABLE_GCC8_WARNINGS COMMON_WARNING_FLAGS += -Wno-parentheses \ -Wno-sizeof-pointer-memaccess \ -Wno-clobbered \ @@ -391,9 +391,9 @@ COMMON_WARNING_FLAGS += -Wno-parentheses \ -Wno-int-in-bool-context endif -ifdef CONFIG_WARN_WRITE_STRINGS +ifdef CONFIG_COMPILER_WARN_WRITE_STRINGS COMMON_WARNING_FLAGS += -Wwrite-strings -endif #CONFIG_WARN_WRITE_STRINGS +endif #CONFIG_COMPILER_WARN_WRITE_STRINGS # Flags which control code generation and dependency generation, both for C and C++ COMMON_FLAGS = \ @@ -405,25 +405,25 @@ COMMON_FLAGS = \ ifndef IS_BOOTLOADER_BUILD # stack protection (only one option can be selected in menuconfig) -ifdef CONFIG_STACK_CHECK_NORM +ifdef CONFIG_COMPILER_STACK_CHECK_MODE_NORM COMMON_FLAGS += -fstack-protector endif -ifdef CONFIG_STACK_CHECK_STRONG +ifdef CONFIG_COMPILER_STACK_CHECK_MODE_STRONG COMMON_FLAGS += -fstack-protector-strong endif -ifdef CONFIG_STACK_CHECK_ALL +ifdef CONFIG_COMPILER_STACK_CHECK_MODE_ALL COMMON_FLAGS += -fstack-protector-all endif endif # Optimization flags are set based on menuconfig choice -ifdef CONFIG_OPTIMIZATION_LEVEL_RELEASE +ifdef CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE OPTIMIZATION_FLAGS = -Os else OPTIMIZATION_FLAGS = -Og endif -ifdef CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED +ifdef CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE CPPFLAGS += -DNDEBUG endif @@ -459,7 +459,7 @@ CXXFLAGS := $(strip \ $(CXXFLAGS) \ $(EXTRA_CXXFLAGS)) -ifdef CONFIG_CXX_EXCEPTIONS +ifdef CONFIG_COMPILER_CXX_EXCEPTIONS CXXFLAGS += -fexceptions else CXXFLAGS += -fno-exceptions diff --git a/sdkconfig.rename b/sdkconfig.rename index c2f45861c6..6ff0f57476 100644 --- a/sdkconfig.rename +++ b/sdkconfig.rename @@ -2,6 +2,25 @@ # CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION # SDK tool configuration -CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX -CONFIG_PYTHON CONFIG_SDK_PYTHON -CONFIG_MAKE_WARN_UNDEFINED_VARIABLES CONFIG_SDK_MAKE_WARN_UNDEFINED_VARIABLES +CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX +CONFIG_PYTHON CONFIG_SDK_PYTHON +CONFIG_MAKE_WARN_UNDEFINED_VARIABLES CONFIG_SDK_MAKE_WARN_UNDEFINED_VARIABLES + +# Compiler options +CONFIG_OPTIMIZATION_COMPILER CONFIG_COMPILER_OPTIMIZATION +CONFIG_OPTIMIZATION_LEVEL_DEBUG CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG +CONFIG_OPTIMIZATION_LEVEL_RELEASE CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE +CONFIG_OPTIMIZATION_ASSERTION_LEVEL CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL +CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE +CONFIG_OPTIMIZATION_ASSERTIONS_SILENT CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT +CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE +CONFIG_CXX_EXCEPTIONS CONFIG_COMPILER_CXX_EXCEPTIONS +CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE +CONFIG_STACK_CHECK_MODE CONFIG_COMPILER_STACK_CHECK_MODE +CONFIG_STACK_CHECK_NONE CONFIG_COMPILER_STACK_CHECK_MODE_NONE +CONFIG_STACK_CHECK_NORM CONFIG_COMPILER_STACK_CHECK_MODE_NORM +CONFIG_STACK_CHECK_STRONG CONFIG_COMPILER_STACK_CHECK_MODE_STRONG +CONFIG_STACK_CHECK_ALL CONFIG_COMPILER_STACK_CHECK_MODE_ALL +CONFIG_STACK_CHECK CONFIG_COMPILER_STACK_CHECK +CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS +CONFIG_DISABLE_GCC8_WARNINGS CONFIG_COMPILER_DISABLE_GCC8_WARNINGS diff --git a/tools/check_kconfigs.py b/tools/check_kconfigs.py index 843502cb10..05f0168cd1 100755 --- a/tools/check_kconfigs.py +++ b/tools/check_kconfigs.py @@ -41,11 +41,9 @@ IGNORE_DIRS = ( SPACES_PER_INDENT = 4 -# TODO decrease the value (after the names have been refactored) -CONFIG_NAME_MAX_LENGTH = 60 +CONFIG_NAME_MAX_LENGTH = 40 -# TODO increase prefix length (after the names have been refactored) -CONFIG_NAME_MIN_PREFIX_LENGTH = 0 +CONFIG_NAME_MIN_PREFIX_LENGTH = 4 # The checker will not fail if it encounters this string (it can be used for temporarily resolve conflicts) RE_NOERROR = re.compile(r'\s+#\s+NOERROR\s+$') diff --git a/tools/ldgen/samples/sdkconfig b/tools/ldgen/samples/sdkconfig index 4c3c94b973..d5b44b6a44 100644 --- a/tools/ldgen/samples/sdkconfig +++ b/tools/ldgen/samples/sdkconfig @@ -84,18 +84,18 @@ CONFIG_PARTITION_TABLE_MD5=y # # Compiler options # -CONFIG_OPTIMIZATION_LEVEL_DEBUG=y -CONFIG_OPTIMIZATION_LEVEL_RELEASE= -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -CONFIG_OPTIMIZATION_ASSERTIONS_SILENT= -CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED= -CONFIG_CXX_EXCEPTIONS= -CONFIG_STACK_CHECK_NONE=y -CONFIG_STACK_CHECK_NORM= -CONFIG_STACK_CHECK_STRONG= -CONFIG_STACK_CHECK_ALL= -CONFIG_STACK_CHECK= -CONFIG_WARN_WRITE_STRINGS= +CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE= +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT= +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE= +CONFIG_COMPILER_CXX_EXCEPTIONS= +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +CONFIG_COMPILER_STACK_CHECK_MODE_NORM= +CONFIG_COMPILER_STACK_CHECK_MODE_STRONG= +CONFIG_COMPILER_STACK_CHECK_MODE_ALL= +CONFIG_COMPILER_STACK_CHECK= +CONFIG_COMPILER_WARN_WRITE_STRINGS= # # Component config diff --git a/tools/unit-test-app/configs/release b/tools/unit-test-app/configs/release index 86fbc9a49e..d58d949976 100644 --- a/tools/unit-test-app/configs/release +++ b/tools/unit-test-app/configs/release @@ -1,3 +1,3 @@ TEST_EXCLUDE_COMPONENTS=bt app_update -CONFIG_OPTIMIZATION_LEVEL_RELEASE=y -CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=y \ No newline at end of file +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/sdkconfig.defaults b/tools/unit-test-app/sdkconfig.defaults index afaf11031b..4efe0e2644 100644 --- a/tools/unit-test-app/sdkconfig.defaults +++ b/tools/unit-test-app/sdkconfig.defaults @@ -21,12 +21,12 @@ CONFIG_ULP_COPROC_ENABLED=y CONFIG_TASK_WDT=n CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS=y CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7 -CONFIG_STACK_CHECK_STRONG=y -CONFIG_STACK_CHECK=y +CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y +CONFIG_COMPILER_STACK_CHECK=y CONFIG_SUPPORT_STATIC_ALLOCATION=y CONFIG_ESP_TIMER_PROFILING=y CONFIG_ADC2_DISABLE_DAC=n -CONFIG_WARN_WRITE_STRINGS=y +CONFIG_COMPILER_WARN_WRITE_STRINGS=y CONFIG_SPI_MASTER_IN_IRAM=y CONFIG_EFUSE_VIRTUAL=y CONFIG_SPIRAM_BANKSWITCH_ENABLE=n