mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-28 16:46:31 +03:00
fix(build): fix Clang 21 build warnings/errors
This commit is contained in:
@@ -155,6 +155,9 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
# warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
|
||||
list(APPEND compile_options "-Wno-single-bit-bitfield-constant-conversion")
|
||||
endif()
|
||||
# warning: initializer overrides prior initialization of this subobject
|
||||
# in esp32c61 pmu_param.c when static unions are initialized (e.g. in pmu_hp_system_analog_param_default)
|
||||
list(APPEND compile_options "-Wno-initializer-overrides")
|
||||
endif()
|
||||
# More warnings may exist in unit tests and example projects.
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ int tc_hmac_set_key(TCHmacState_t ctx, const uint8_t *key,
|
||||
return TC_CRYPTO_FAIL;
|
||||
}
|
||||
|
||||
const uint8_t dummy_key[key_size];
|
||||
uint8_t dummy_key[key_size];
|
||||
struct tc_hmac_state_struct dummy_state;
|
||||
|
||||
if (key_size <= TC_SHA256_BLOCK_SIZE) {
|
||||
@@ -76,6 +76,7 @@ int tc_hmac_set_key(TCHmacState_t ctx, const uint8_t *key,
|
||||
* consumed in this process.
|
||||
*/
|
||||
(void)tc_sha256_init(&dummy_state.hash_state);
|
||||
_set(dummy_key, 0, sizeof(dummy_key));
|
||||
(void)tc_sha256_update(&dummy_state.hash_state,
|
||||
dummy_key,
|
||||
key_size);
|
||||
|
||||
@@ -542,6 +542,7 @@ static inline bool gpio_ll_is_digital_io_hold(gpio_dev_t *hw, uint32_t gpio_num)
|
||||
return !!(LP_SYS.hp_gpio_o_hold_ctrl1.hp_gpio_0_hold_ctrl1 & (bit_mask >> (32 + SOC_RTCIO_PIN_COUNT)));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -186,12 +186,6 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/include/soc/${target}")
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_ESP32P4_SELECTS_REV_LESS_V3 AND CONFIG_IDF_TARGET_ESP32P4)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # TODO: LLVM-478 IDF-14338
|
||||
message(FATAL_ERROR "ESP32-P4 rev. 3.0 or higher is not supported in Clang-based toolchain")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${target} STREQUAL "esp32p4")
|
||||
# for mipi_csi_share_hw_ctrl.c
|
||||
list(APPEND priv_requires esp_hal_cam)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
static DRAM_ATTR smp_retention_state_t s_smp_retention_state[portNUM_PROCESSORS];
|
||||
static DRAM_ATTR _Atomic(smp_retention_state_t) s_smp_retention_state[portNUM_PROCESSORS];
|
||||
#endif
|
||||
|
||||
static bool s_fpu_saved[portNUM_PROCESSORS];
|
||||
|
||||
@@ -74,7 +74,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id)
|
||||
}
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state)
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state)
|
||||
{
|
||||
for (uint8_t core_id = 0; core_id < portNUM_PROCESSORS; ++core_id) {
|
||||
if (sleep_cpu_retention_ptr->retent.critical_frame[core_id] == NULL) {
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct {
|
||||
} sleep_cpu_retention_t;
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state);
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state);
|
||||
#else
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr);
|
||||
#endif
|
||||
|
||||
@@ -143,7 +143,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id)
|
||||
}
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state)
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state)
|
||||
{
|
||||
static DRAM_ATTR uint8_t rv_core_critical_regs[RV_SLEEP_CTX_FRMSZ * portNUM_PROCESSORS] __attribute__((aligned(4)));
|
||||
static DRAM_ATTR uint8_t rv_core_non_critical_regs[sizeof(RvCoreNonCriticalSleepFrame)* portNUM_PROCESSORS] __attribute__((aligned(4)));
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
.macro REG_CLR_BIT addr, value
|
||||
li a0, \addr
|
||||
/* Since all our parameters will be constants, we can pre-calculate it at assemble time */
|
||||
li a1, ~\value
|
||||
li a1, \value
|
||||
not a1, a1
|
||||
lw a2, (a0)
|
||||
and a2, a2, a1
|
||||
sw a2, (a0)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
static SPM_DRAM_ATTR smp_retention_state_t s_smp_retention_state[portNUM_PROCESSORS];
|
||||
static SPM_DRAM_ATTR _Atomic(smp_retention_state_t) s_smp_retention_state[portNUM_PROCESSORS];
|
||||
#endif
|
||||
|
||||
static bool s_fpu_saved[portNUM_PROCESSORS];
|
||||
|
||||
@@ -51,7 +51,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id)
|
||||
}
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state)
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state)
|
||||
{
|
||||
for (uint8_t core_id = 0; core_id < portNUM_PROCESSORS; ++core_id) {
|
||||
if (sleep_cpu_retention_ptr->retent.critical_frame[core_id] == NULL) {
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
} sleep_cpu_retention_t;
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state);
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state);
|
||||
#else
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr);
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id)
|
||||
}
|
||||
|
||||
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state)
|
||||
esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state)
|
||||
{
|
||||
static DRAM_ATTR uint8_t rv_core_critical_regs[RV_SLEEP_CTX_FRMSZ * portNUM_PROCESSORS] __attribute__((aligned(4)));
|
||||
static DRAM_ATTR uint8_t rv_core_non_critical_regs[sizeof(RvCoreNonCriticalSleepFrame)* portNUM_PROCESSORS] __attribute__((aligned(4)));
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
ALIGNED_SYMBOL(4, __eh_frame_hdr)
|
||||
ALIGNED_SYMBOL(4, __eh_frame_hdr_start)
|
||||
|
||||
KEEP (*(.eh_frame_hdr))
|
||||
|
||||
@@ -160,6 +161,7 @@
|
||||
.eh_frame :
|
||||
{
|
||||
ALIGNED_SYMBOL(4, __eh_frame)
|
||||
ALIGNED_SYMBOL(4, __eh_frame_start)
|
||||
|
||||
KEEP (*(.eh_frame))
|
||||
|
||||
|
||||
@@ -122,11 +122,9 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
|
||||
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()
|
||||
set_source_files_properties(regulatory/esp_wifi_regulatory.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
-Wno-unterminated-string-initialization)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SPIRAM)
|
||||
|
||||
@@ -259,10 +259,11 @@ if(${IDF_TARGET} STREQUAL "linux")
|
||||
set(mbedtls_target_sources ${mbedtls_target_sources} "${COMPONENT_DIR}/port/net_sockets.c")
|
||||
endif()
|
||||
|
||||
# While updating to MbedTLS release/v3.4.0, building mbedtls/library/psa_crypto.c
|
||||
# clang produces an unreachable-code warning.
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(tfpsacrypto PRIVATE "-Wno-unreachable-code")
|
||||
# while building mbedtls/library/x509_crt.c
|
||||
# clang 21 produces an uninitialized-const-pointer warning
|
||||
target_compile_options(mbedx509 PRIVATE "-Wno-uninitialized-const-pointer")
|
||||
endif()
|
||||
|
||||
# net_sockets.c should only be compiled if BSD socket functions are available.
|
||||
|
||||
@@ -46,3 +46,4 @@ warning: unknown kconfig symbol 'ETHERNET_MDC_GPIO' assigned to '23' in .*/examp
|
||||
warning: unknown kconfig symbol 'ETHERNET_MDIO_GPIO' assigned to '18' in .*/examples/protocols/esp_http_client/sdkconfig.ci.*
|
||||
warning: unknown kconfig symbol 'ETHERNET_PHY_RST_GPIO' assigned to '5' in .*/examples/protocols/esp_http_client/sdkconfig.ci.*
|
||||
warning: unknown kconfig symbol 'ETHERNET_PHY_ADDR' assigned to '1' in .*/examples/protocols/esp_http_client/sdkconfig.ci.*
|
||||
warning: \S+ changed binding to STB_WEAK
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
hint: "'esp_secure_boot_verify_rsa_signature_block()' has been made private and is no longer available."
|
||||
|
||||
-
|
||||
re: "error: implicit declaration of function '{}'"
|
||||
re: "error: (implicit declaration of function|use of undeclared identifier) '{}'"
|
||||
hint: '{0}.h header file is not included by esp_system.h anymore. It shall then be manually included with #include "{0}.h"'
|
||||
variables:
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user