From fcf1419626c9f37d7583581199088a7248c52e37 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 3 Jun 2021 12:58:44 +0200 Subject: [PATCH 1/3] Build: Fix CMake to pass -Wwrite-string compiler flag if enabled --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91c1399341..0d03e87290 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,10 @@ if(CONFIG_COMPILER_DISABLE_GCC8_WARNINGS) "-Wno-int-in-bool-context") endif() +if(CONFIG_COMPILER_WARN_WRITE_STRINGS) + list(APPEND compile_options "-Wwrite-strings") +endif() + if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE) list(APPEND compile_definitions "-DNDEBUG") endif() From 9b23491339f6b864b8c1426ea2c642f0a034b3ac Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 4 Jun 2021 13:23:24 +0200 Subject: [PATCH 2/3] wpa_supplicant: Temporarily disable write-string warning Since some assignment of a string literal to `char *` variables were added and not caught by the CI. --- components/wpa_supplicant/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index b5bc98216c..a4ff1cce4d 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -111,7 +111,7 @@ idf_component_register(SRCS "${srcs}" "${tls_src}" PRIV_INCLUDE_DIRS src PRIV_REQUIRES mbedtls esp_timer) -target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing) +target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing -Wno-write-strings) target_compile_definitions(${COMPONENT_LIB} PRIVATE __ets__ ESP_SUPPLICANT From 1c590502092dfe43fad31692465f529f5aac8238 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 18 Aug 2021 13:22:56 +0200 Subject: [PATCH 3/3] panic/memprot: Fix minor const string correction on panic print --- components/esp_system/port/panic_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_system/port/panic_handler.c b/components/esp_system/port/panic_handler.c index 06f694f0d5..b828f0fc27 100644 --- a/components/esp_system/port/panic_handler.c +++ b/components/esp_system/port/panic_handler.c @@ -372,7 +372,7 @@ static inline void print_memprot_err_details(const void *f) mem_type_prot_t mem_type = esp_memprot_get_intr_memtype(); esp_memprot_get_fault_status( mem_type, &fault_addr, &op_type, &op_subtype ); - char *operation_type = "Write"; + const char *operation_type = "Write"; if ( op_type == 0 ) { operation_type = (mem_type == MEMPROT_IRAM0 && op_subtype == 0) ? "Instruction fetch" : "Read"; }