mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
Docs/add warning if data structure not change
This commit is contained in:
@@ -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.
|
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
|
Removing ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS`` Build Option
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
|
@@ -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`` 警告。下文展示了触发这些警告的代码,并介绍了如何抑制这些警告。
|
如果编译器不能准确判断内存或字符串的大小,使用 memory/string copy/compare 函数的用户会遇到某种 ``-Wstringop`` 警告。下文展示了触发这些警告的代码,并介绍了如何抑制这些警告。
|
||||||
|
|
||||||
@@ -120,6 +120,16 @@ Xtensa 编译器中的 ``int32_t`` 和 ``uint32_t``
|
|||||||
|
|
||||||
通常,``int32_t`` 和 ``int`` 为不同的类型。同样,``uint32_t`` 和 ``unsigned int`` 也为不同的类型。
|
通常,``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``
|
移除构建选项 ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS``
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user