diff --git a/CMakeLists.txt b/CMakeLists.txt index 190d4c5ffb..2c27ab870d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,15 @@ if(CONFIG_COMPILER_DISABLE_GCC14_WARNINGS) list(APPEND compile_options "-Wno-calloc-transposed-args") endif() +if(CONFIG_COMPILER_DISABLE_GCC15_WARNINGS) + list(APPEND c_compile_options "-Wno-unterminated-string-initialization") + list(APPEND c_compile_options "-Wno-header-guard") + list(APPEND cxx_compile_options "-Wno-self-move") + list(APPEND cxx_compile_options "-Wno-template-body") + list(APPEND cxx_compile_options "-Wno-dangling-reference") + list(APPEND cxx_compile_options "-Wno-defaulted-function-deleted") +endif() + if(CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS) if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang") idf_build_replace_option_from_property(COMPILE_OPTIONS "-Werror" "-Werror=all") diff --git a/Kconfig b/Kconfig index 329d7d8e99..dd690c14b3 100644 --- a/Kconfig +++ b/Kconfig @@ -610,6 +610,13 @@ mainmenu "Espressif IoT Development Framework Configuration" Enable this option if use GCC 14 or newer, and want to disable warnings which don't appear with GCC 13. + config COMPILER_DISABLE_GCC15_WARNINGS + bool "Disable new warnings introduced in GCC 15" + default "n" + help + Enable this option if use GCC 15 or newer, and want to disable warnings which don't appear with + GCC 14. + config COMPILER_DUMP_RTL_FILES bool "Dump RTL files during compilation" help diff --git a/docs/en/migration-guides/release-6.x/6.0/index.rst b/docs/en/migration-guides/release-6.x/6.0/index.rst index cb0cbec001..19ce2244e8 100644 --- a/docs/en/migration-guides/release-6.x/6.0/index.rst +++ b/docs/en/migration-guides/release-6.x/6.0/index.rst @@ -11,3 +11,4 @@ Migration from 5.5 to 6.0 security tools system + toolchain diff --git a/docs/en/migration-guides/release-6.x/6.0/toolchain.rst b/docs/en/migration-guides/release-6.x/6.0/toolchain.rst new file mode 100644 index 0000000000..41713e4f36 --- /dev/null +++ b/docs/en/migration-guides/release-6.x/6.0/toolchain.rst @@ -0,0 +1,110 @@ +Toolchain +********* + +:link_to_translation:`zh_CN:[中文]` + +GCC Version +=========== + +The previous GCC version 14.2.0 has been upgraded to 15.1.0 across all chip targets. Upgrading to ESP-IDF v6.0 requires porting code to GCC 15.1.0. Refer to the official `GCC 15 porting guide `_ + +Warnings +======== + +The upgrade to GCC 15.1.0 has resulted in the addition of new warnings, or enhancements to existing warnings. The full details of all GCC warnings can be found in `GCC Warning Options `_. Users are advised to double-check their code, then fix the warnings if possible. Unfortunately, depending on the warning and the complexity of the user's code, some warnings will be false positives that require non-trivial fixes. In such cases, users can choose to suppress the warning in multiple ways. This section outlines some common warnings that users are likely to encounter and ways to fix them. + +To suprress all new warnings enable :ref:`CONFIG_COMPILER_DISABLE_GCC15_WARNINGS` config option. + +``-Wno-unterminated-string-initialization`` +------------------------------------------- + +Warn about character arrays initialized as unterminated character sequences with a string literal, unless the declaration being initialized has the nonstring attribute. + +.. code-block:: c + + #include "esp_attr.h" + + char arr[3] = "foo"; /* Warning. */ + NONSTRING_ATTR char arr2[3] = "bar"; /* No warning. */ + +``-Wno-header-guard`` +--------------------- + +Warn if a header file has a typo in its include guard. When #ifndef and #define use different names. + +.. code-block:: c + + #ifndef WHEADER_GUARD_2 + #define WHEADERGUARD2 /* Warning. Must be changed to WHEADER_GUARD_2. */ + /* ... */ + #endif + +``-Wno-self-move (C++ only)`` +----------------------------- + +Warns when a value is moved to itself with std::move. Such a std::move typically has no effect. + +.. code-block:: cpp + + struct T { + /* ... */ + }; + void fn() + { + T t; + /* ... */ + t = std::move (t); /* Warning. The line can be removed. */ + } + + +``-Wno-template-body (C++ only)`` +--------------------------------- + +Disable diagnosing errors when parsing a template, and instead issue an error only upon instantiation of the template. + +.. code-block:: cpp + + template + void f() { + const int n = 42; + ++n; /* read-only variable 'n' */ + } + +``-Wno-dangling-reference (C++ only)`` +-------------------------------------- + +Warn when a reference is bound to a temporary whose lifetime has ended. + +.. code-block:: cpp + + int n = 1; + const int& r = std::max(n - 1, n + 1); /* r is dangling. */ + +``-Wno-defaulted-function-deleted (C++ only)`` +---------------------------------------------- + +Warn when an explicitly defaulted function is deleted by the compiler. That can occur when the function’s declared type does not match the type of the function that would have been implicitly declared. + +.. code-block:: cpp + + template + struct C { + C(); + C(const C&&) = default; /* Implicitly deleted. */ + }; + +Picolibc +======== + +When building with :ref:`CONFIG_LIBC_PICOLIBC` enabled, the following adaptation is required. + +``sys/signal.h header removed`` +------------------------------- + +The header ```` is no longer available in Picolibc. +To ensure compatibility and improve portability across libc implementations, replace it with the standard C header ````. + +.. code-block:: c + + #include /* fatal error: sys/signal.h: No such file or directory */ + #include /* Ok: standard and portable */ diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst index 5e5c9e2ae0..b47defe315 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/index.rst @@ -11,3 +11,4 @@ security tools system + toolchain diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/toolchain.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/toolchain.rst new file mode 100644 index 0000000000..e04a9f42b6 --- /dev/null +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/toolchain.rst @@ -0,0 +1 @@ +.. include:: ../../../../en/migration-guides/release-6.x/6.0/toolchain.rst