From 66465ad7d7440cced7c2685508890749dd7c6be5 Mon Sep 17 00:00:00 2001 From: muhaidong Date: Fri, 23 Dec 2022 09:51:39 +0800 Subject: [PATCH] esp_wifi: Remove -Wno-format compile option for FTM example, iperf example, roaming example --- examples/wifi/ftm/main/CMakeLists.txt | 1 - examples/wifi/ftm/main/ftm_main.c | 6 +++--- examples/wifi/iperf/main/CMakeLists.txt | 2 -- examples/wifi/iperf/main/cmd_wifi.c | 5 ++++- examples/wifi/roaming/main/CMakeLists.txt | 1 - examples/wifi/roaming/main/roaming_example.c | 5 +++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/wifi/ftm/main/CMakeLists.txt b/examples/wifi/ftm/main/CMakeLists.txt index e9647443a9bb..3fa327c699d3 100644 --- a/examples/wifi/ftm/main/CMakeLists.txt +++ b/examples/wifi/ftm/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "ftm_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/wifi/ftm/main/ftm_main.c b/examples/wifi/ftm/main/ftm_main.c index 5fde04f41037..1647fa40b404 100644 --- a/examples/wifi/ftm/main/ftm_main.c +++ b/examples/wifi/ftm/main/ftm_main.c @@ -9,8 +9,8 @@ #include #include +#include #include -#include #include "nvs_flash.h" #include "cmd_system.h" #include "argtable3/argtable3.h" @@ -170,7 +170,7 @@ static void ftm_process_report(void) log_ptr += sprintf(log_ptr, "%6d|", s_ftm_report[i].dlog_token); } if (g_report_lvl & BIT1) { - log_ptr += sprintf(log_ptr, "%7u |", s_ftm_report[i].rtt); + log_ptr += sprintf(log_ptr, "%7" PRIu32 " |", s_ftm_report[i].rtt); } if (g_report_lvl & BIT2) { log_ptr += sprintf(log_ptr, "%14llu |%14llu |%14llu |%14llu |", s_ftm_report[i].t1, @@ -491,7 +491,7 @@ static int wifi_cmd_ftm(int argc, char **argv) free(s_ftm_report); s_ftm_report = NULL; s_ftm_report_num_entries = 0; - ESP_LOGI(TAG_STA, "Estimated RTT - %d nSec, Estimated Distance - %d.%02d meters", + ESP_LOGI(TAG_STA, "Estimated RTT - %" PRId32 " nSec, Estimated Distance - %" PRId32 ".%02" PRId32 " meters", s_rtt_est, s_dist_est / 100, s_dist_est % 100); } else { /* Failure case */ diff --git a/examples/wifi/iperf/main/CMakeLists.txt b/examples/wifi/iperf/main/CMakeLists.txt index 738f0e83c31c..ab497c35d2e5 100644 --- a/examples/wifi/iperf/main/CMakeLists.txt +++ b/examples/wifi/iperf/main/CMakeLists.txt @@ -1,5 +1,3 @@ idf_component_register(SRCS "cmd_wifi.c" "iperf_example_main.c" INCLUDE_DIRS ".") - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/wifi/iperf/main/cmd_wifi.c b/examples/wifi/iperf/main/cmd_wifi.c index 7d4d4854bdb6..69593faa6fc8 100644 --- a/examples/wifi/iperf/main/cmd_wifi.c +++ b/examples/wifi/iperf/main/cmd_wifi.c @@ -9,6 +9,7 @@ #include #include +#include #include "esp_log.h" #include "esp_console.h" #include "argtable3/argtable3.h" @@ -420,7 +421,9 @@ static int wifi_cmd_iperf(int argc, char **argv) } - ESP_LOGI(TAG, "mode=%s-%s sip=%d.%d.%d.%d:%d, dip=%d.%d.%d.%d:%d, interval=%d, time=%d", + ESP_LOGI(TAG, "mode=%s-%s sip=%" PRId32 ".%" PRId32 ".%" PRId32 ".%" PRId32 ":%d,\ + dip=%" PRId32 ".%" PRId32 ".%" PRId32 ".%" PRId32 ":%d,\ + interval=%" PRId32 ", time=%" PRId32 "", cfg.flag & IPERF_FLAG_TCP ? "tcp" : "udp", cfg.flag & IPERF_FLAG_SERVER ? "server" : "client", cfg.source_ip4 & 0xFF, (cfg.source_ip4 >> 8) & 0xFF, (cfg.source_ip4 >> 16) & 0xFF, diff --git a/examples/wifi/roaming/main/CMakeLists.txt b/examples/wifi/roaming/main/CMakeLists.txt index f682be52397b..c3c5d418daed 100644 --- a/examples/wifi/roaming/main/CMakeLists.txt +++ b/examples/wifi/roaming/main/CMakeLists.txt @@ -1,4 +1,3 @@ # Embed CA, certificate & key directly into binary idf_component_register(SRCS "roaming_example.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/wifi/roaming/main/roaming_example.c b/examples/wifi/roaming/main/roaming_example.c index 9f17e4229c7c..9b61dbc284bb 100644 --- a/examples/wifi/roaming/main/roaming_example.c +++ b/examples/wifi/roaming/main/roaming_example.c @@ -1,4 +1,5 @@ #include +#include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -172,7 +173,7 @@ static char * get_btm_neighbor_list(uint8_t *report, size_t report_len) } ESP_LOGI(TAG, "RMM neigbor report bssid=" MACSTR - " info=0x%x op_class=%u chan=%u phy_type=%u%s%s%s%s", + " info=0x%" PRIx32 " op_class=%u chan=%u phy_type=%u%s%s%s%s", MAC2STR(nr), WPA_GET_LE32(nr + ETH_ALEN), nr[ETH_ALEN + 4], nr[ETH_ALEN + 5], nr[ETH_ALEN + 6], @@ -186,7 +187,7 @@ static char * get_btm_neighbor_list(uint8_t *report, size_t report_len) /* , */ len += snprintf(buf + len, MAX_NEIGHBOR_LEN - len, ","); /* bssid info */ - len += snprintf(buf + len, MAX_NEIGHBOR_LEN - len, "0x%04x", WPA_GET_LE32(nr + ETH_ALEN)); + len += snprintf(buf + len, MAX_NEIGHBOR_LEN - len, "0x%04" PRIx32 "", WPA_GET_LE32(nr + ETH_ALEN)); len += snprintf(buf + len, MAX_NEIGHBOR_LEN - len, ","); /* operating class */ len += snprintf(buf + len, MAX_NEIGHBOR_LEN - len, "%u", nr[ETH_ALEN + 4]);