From 6ba4da8b6b5b31420bcd0f502d30a688ec471de8 Mon Sep 17 00:00:00 2001 From: Zhang Xiao Yan Date: Fri, 2 Sep 2022 17:45:07 +0800 Subject: [PATCH] Docs/add warning if data structure not change --- docs/en/migration-guides/release-5.x/gcc.rst | 10 ++++++++++ docs/zh_CN/migration-guides/release-5.x/gcc.rst | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/en/migration-guides/release-5.x/gcc.rst b/docs/en/migration-guides/release-5.x/gcc.rst index 7e02212ab389..bef17c2f444a 100644 --- a/docs/en/migration-guides/release-5.x/gcc.rst +++ b/docs/en/migration-guides/release-5.x/gcc.rst @@ -120,6 +120,16 @@ In other cases, it should be noted that enums have the ``int`` type. In common, ``int32_t`` and ``int``, as well as ``uint32_t`` and ``unsigned int``, are different types. +If users do not make the aforementioned updates to format strings in their applications, the following error will be reported during compilation: + +.. code-block:: none + + /Users/name/esp/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include/esp_diagnostics.h:238:29: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] + 238 | esp_diag_log_event(tag, "EV (%u) %s: " format, esp_log_timestamp(), tag, ##__VA_ARGS__); \ + | ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ + | | + | uint32_t {aka long unsigned int} + uint32_t {aka long unsigned int} Removing ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS`` Build Option ------------------------------------------------------------------ diff --git a/docs/zh_CN/migration-guides/release-5.x/gcc.rst b/docs/zh_CN/migration-guides/release-5.x/gcc.rst index 898f44ed6c2f..c8e712d9183a 100644 --- a/docs/zh_CN/migration-guides/release-5.x/gcc.rst +++ b/docs/zh_CN/migration-guides/release-5.x/gcc.rst @@ -23,8 +23,8 @@ ESP-IDF 之前使用的 GCC 版本为 8.4.0,现已针对所有芯片目标升 建议用户在抑制警告之前仔细确认该警告是否确实为误报。 -``-Wstringop-overflow``、``-Wstringop-overread``、``-Wstringop-truncation`` 和 ``-Warray-bounds`` --------------------------------------------------------------------------------------------------- +``-Wstringop-overflow``、 ``-Wstringop-overread``、 ``-Wstringop-truncation`` 和 ``-Warray-bounds`` +------------------------------------------------------------------------------------------------------------------ 如果编译器不能准确判断内存或字符串的大小,使用 memory/string copy/compare 函数的用户会遇到某种 ``-Wstringop`` 警告。下文展示了触发这些警告的代码,并介绍了如何抑制这些警告。 @@ -120,6 +120,16 @@ Xtensa 编译器中的 ``int32_t`` 和 ``uint32_t`` 通常,``int32_t`` 和 ``int`` 为不同的类型。同样,``uint32_t`` 和 ``unsigned int`` 也为不同的类型。 +如果用户在其应用中没有对格式化字符串进行上述更新,程序会报错,如下所示: + +.. code-block:: none + + /Users/name/esp/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include/esp_diagnostics.h:238:29: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] + 238 | esp_diag_log_event(tag, "EV (%u) %s: " format, esp_log_timestamp(), tag, ##__VA_ARGS__); \ + | ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ + | | + | uint32_t {aka long unsigned int} + uint32_t {aka long unsigned int} 移除构建选项 ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS`` ----------------------------------------------------------