diff --git a/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c b/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c index f2668e2e04..e237c8363c 100644 --- a/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c +++ b/components/bt/host/bluedroid/btc/profile/std/a2dp/bta_av_co.c @@ -22,6 +22,7 @@ * BTC. * ******************************************************************************/ +#include "esp_attr.h" #include "string.h" #include "common/bt_target.h" #include "stack/a2d_api.h" @@ -66,7 +67,7 @@ #define BTA_AV_CO_SBC_MAX_BITPOOL 53 /* SCMS-T protect info */ -const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = "\x02\x02\x00"; +const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = { 2, 2, 0 }; /* SBC SRC codec capabilities */ const tA2D_SBC_CIE bta_av_co_sbc_caps = { diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index 3ada7d5a8b..bd122e39c9 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -161,6 +161,13 @@ extern "C" { // Forces to not inline function #define NOINLINE_ATTR __attribute__((noinline)) +#if !defined(__clang__) && __GNUC__ >= 15 +// Marks a character array as not null-terminated to avoid string-related optimizations or warnings +#define NONSTRING_ATTR __attribute__ ((nonstring)) +#else +#define NONSTRING_ATTR +#endif + // This allows using enum as flags in C++ // Format: FLAG_ATTR(flag_enum_t) #ifdef __cplusplus diff --git a/components/esp_driver_uart/include/driver/uart_wakeup.h b/components/esp_driver_uart/include/driver/uart_wakeup.h index 4ac3665da0..2fab94f0af 100644 --- a/components/esp_driver_uart/include/driver/uart_wakeup.h +++ b/components/esp_driver_uart/include/driver/uart_wakeup.h @@ -7,6 +7,7 @@ #pragma once #include "esp_err.h" +#include "esp_attr.h" #include "soc/soc_caps.h" #include "hal/uart_types.h" @@ -45,7 +46,7 @@ typedef struct { '*' represents any symbol. The end character cannot be '*'. Example: "he**o" matches hello, heyyo. */ - char wake_chars_seq[SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN]; + NONSTRING_ATTR char wake_chars_seq[SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN]; #endif } uart_wakeup_cfg_t; diff --git a/components/esp_phy/esp32/include/phy_init_data.h b/components/esp_phy/esp32/include/phy_init_data.h index 146a08af16..655eaac249 100644 --- a/components/esp_phy/esp32/include/phy_init_data.h +++ b/components/esp_phy/esp32/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -50,7 +51,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32c2/include/phy_init_data.h b/components/esp_phy/esp32c2/include/phy_init_data.h index 322b9bec8e..ea404dbd88 100644 --- a/components/esp_phy/esp32c2/include/phy_init_data.h +++ b/components/esp_phy/esp32c2/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -51,7 +52,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32c3/include/phy_init_data.h b/components/esp_phy/esp32c3/include/phy_init_data.h index 322b9bec8e..ea404dbd88 100644 --- a/components/esp_phy/esp32c3/include/phy_init_data.h +++ b/components/esp_phy/esp32c3/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -51,7 +52,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32c5/include/phy_init_data.h b/components/esp_phy/esp32c5/include/phy_init_data.h index 8a0eb24016..c3c126ac66 100644 --- a/components/esp_phy/esp32c5/include/phy_init_data.h +++ b/components/esp_phy/esp32c5/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include +#include "esp_attr.h" #include "esp_phy_init.h" #include "sdkconfig.h" @@ -52,7 +53,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32c6/include/phy_init_data.h b/components/esp_phy/esp32c6/include/phy_init_data.h index 322b9bec8e..ea404dbd88 100644 --- a/components/esp_phy/esp32c6/include/phy_init_data.h +++ b/components/esp_phy/esp32c6/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -51,7 +52,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32c61/include/phy_init_data.h b/components/esp_phy/esp32c61/include/phy_init_data.h index 8a0eb24016..5eba276504 100644 --- a/components/esp_phy/esp32c61/include/phy_init_data.h +++ b/components/esp_phy/esp32c61/include/phy_init_data.h @@ -8,6 +8,7 @@ #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -52,7 +53,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32s2/include/phy_init_data.h b/components/esp_phy/esp32s2/include/phy_init_data.h index 322b9bec8e..ea404dbd88 100644 --- a/components/esp_phy/esp32s2/include/phy_init_data.h +++ b/components/esp_phy/esp32s2/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -51,7 +52,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_phy/esp32s3/include/phy_init_data.h b/components/esp_phy/esp32s3/include/phy_init_data.h index 322b9bec8e..ea404dbd88 100644 --- a/components/esp_phy/esp32s3/include/phy_init_data.h +++ b/components/esp_phy/esp32s3/include/phy_init_data.h @@ -7,6 +7,7 @@ #ifndef PHY_INIT_DATA_H #define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ #include "esp_phy_init.h" +#include "esp_attr.h" #include "sdkconfig.h" #ifdef __cplusplus @@ -51,7 +52,7 @@ typedef struct { * @brief Country corresponds to PHY init data type structure */ typedef struct { - char cc[PHY_COUNTRY_CODE_LEN]; + NONSTRING_ATTR char cc[PHY_COUNTRY_CODE_LEN]; uint8_t type; } phy_country_to_bin_type_t; #endif diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 2cd6ec22e2..99984c96e2 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -97,6 +97,12 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED) target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob}) endforeach() endif() + # TODO IDF-13365: remove the following lines + if(CMAKE_C_COMPILER_ID MATCHES "GNU") + set_source_files_properties(regulatory/esp_wifi_regulatory.c + PROPERTIES COMPILE_FLAGS + -Wno-unterminated-string-initialization) + endif() endif() if(CONFIG_SPIRAM) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index d293735204..3a45a310a0 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -362,6 +362,7 @@ PREDEFINED = \ IDF_DEPRECATED(X)= \ IRAM_ATTR= \ FORCE_INLINE_ATTR= \ + NONSTRING_ATTR= \ configSUPPORT_DYNAMIC_ALLOCATION=1 \ configSUPPORT_STATIC_ALLOCATION=1 \ configQUEUE_REGISTRY_SIZE=1 \