Merge branch 'feature/enable_unused-but-set-variable_errors' into 'master'

change: re-enable -Werror=unused-but-set-variable

See merge request espressif/esp-idf!50725
This commit is contained in:
Alexey Lapshin
2026-07-16 15:31:20 +04:00
25 changed files with 113 additions and 50 deletions
@@ -7,6 +7,10 @@ set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_csi)
# TODO IDF-15784: remove
# esp_cam_sensor upstream sets locals without reading them; silence -Wunused-but-set-variable
idf_component_get_property(esp_cam_sensor_lib espressif__esp_cam_sensor COMPONENT_LIB)
target_compile_options(${esp_cam_sensor_lib} PRIVATE -Wno-unused-but-set-variable)
message(STATUS "Checking camera registers are not read-write by half-word")
include($ENV{IDF_PATH}/tools/ci/check_register_rw_half_word.cmake)
+1 -1
View File
@@ -602,7 +602,7 @@ static void check_and_destroy_final_default(void)
{
_lock_acquire_recursive(&s_retention.lock);
assert(s_retention.highpri == SLEEP_RETENTION_REGDMA_LINK_LOWEST_PRIORITY);
uint32_t created_modules = 0;
uint32_t __attribute__((unused)) created_modules = 0;
for (int i = 0; i < SLEEP_RETENTION_MODULE_BITMAP_SZ; i++) {
created_modules |= s_retention.created_modules.bitmap[i];
}
@@ -562,17 +562,6 @@ typedef uint64_t benchmark_tick_t; /* unit: microseconds */
#define benchmark_print_units(type, x) printf("%s us: %lu\n", type, (unsigned long)(x))
#endif
#define N 4096
const uint32_t ro_tbl[N] = { 2 };
uint32_t scan_tbl(const volatile uint32_t *p, size_t n)
{
uint32_t sum = 0;
for (size_t i = 0; i < n; i++) {
sum += p[i];
}
return sum;
}
void test_posix_timers_clock_performance(clockid_t clock_id)
{
const int MEASUREMENTS = 5000;
@@ -584,14 +573,10 @@ void test_posix_timers_clock_performance(clockid_t clock_id)
benchmark_tick_t delta;
benchmark_tick_t delta_sum = 0;
for (int i = 0; i < PHASE_COUNT; i++) {
volatile uint32_t table_sum = 0;
if (i == PHASE_COUNT / 2) {
printf("With table scan...\n");
}
for (int j = 0; j < MEASUREMENTS; j++) {
if (i >= PHASE_COUNT / 2) {
table_sum += scan_tbl(ro_tbl, N);
}
start = get_start();
clock_settime(clock_id, &ts);
end = get_end();
+9
View File
@@ -208,6 +208,15 @@ if(CONFIG_LWIP_ENABLE)
-Wno-array-parameter
)
# TODO IDF-15784: remove
# vars only used in LWIP_ASSERT / debug; unused when asserts disabled
set_source_files_properties(
lwip/src/core/netif.c
lwip/src/core/ipv4/ip4_napt.c
PROPERTIES COMPILE_FLAGS
-Wno-unused-but-set-variable
)
if(CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC)
set_source_files_properties(
lwip/src/core/ipv4/ip4_addr.c
+8
View File
@@ -395,6 +395,14 @@ if(CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_SOFTAP)
endif()
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
# TODO IDF-15784: remove
# variables can be unused, need to patch submodule
set_source_files_properties(
esp_supplicant/src/esp_common.c
PROPERTIES COMPILE_FLAGS
-Wno-unused-but-set-variable
)
if(CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC)
set(eloop_analyzer_flags
-Wno-analyzer-out-of-bounds