Skip to content

Commit

Permalink
Merge branch 'docs/add_warning_if_data_structure_not_change' into 'ma…
Browse files Browse the repository at this point in the history
…ster'

Docs/add warning if data structure not change

Closes DOC-3559

See merge request espressif/esp-idf!19884
  • Loading branch information
suda-morris committed Sep 2, 2022
2 parents 15ec31e + 6ba4da8 commit f9be661
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/en/migration-guides/release-5.x/gcc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------------------------------------------
Expand Down
14 changes: 12 additions & 2 deletions docs/zh_CN/migration-guides/release-5.x/gcc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`` 警告。下文展示了触发这些警告的代码,并介绍了如何抑制这些警告。

Expand Down Expand Up @@ -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``
----------------------------------------------------------
Expand Down

0 comments on commit f9be661

Please sign in to comment.