Merge branch 'bugfix/cmake_compiler_warn_write_string_v4.2' into 'release/v4.2'

Build: Fix CMake to pass -Wwrite-string compiler flag if enabled (v4.2)

See merge request espressif/esp-idf!14427
This commit is contained in:
David Čermák 2021-08-18 16:02:28 +00:00
commit 16be7d056d
3 changed files with 6 additions and 2 deletions

View File

@ -74,6 +74,10 @@ if(CONFIG_COMPILER_DISABLE_GCC8_WARNINGS)
"-Wno-int-in-bool-context") "-Wno-int-in-bool-context")
endif() endif()
if(CONFIG_COMPILER_WARN_WRITE_STRINGS)
list(APPEND compile_options "-Wwrite-strings")
endif()
if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE) if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
list(APPEND compile_definitions "-DNDEBUG") list(APPEND compile_definitions "-DNDEBUG")
endif() endif()

View File

@ -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(); mem_type_prot_t mem_type = esp_memprot_get_intr_memtype();
esp_memprot_get_fault_status( mem_type, &fault_addr, &op_type, &op_subtype ); 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 ) { if ( op_type == 0 ) {
operation_type = (mem_type == MEMPROT_IRAM0 && op_subtype == 0) ? "Instruction fetch" : "Read"; operation_type = (mem_type == MEMPROT_IRAM0 && op_subtype == 0) ? "Instruction fetch" : "Read";
} }

View File

@ -111,7 +111,7 @@ idf_component_register(SRCS "${srcs}" "${tls_src}"
PRIV_INCLUDE_DIRS src PRIV_INCLUDE_DIRS src
PRIV_REQUIRES mbedtls esp_timer) 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 target_compile_definitions(${COMPONENT_LIB} PRIVATE
__ets__ __ets__
ESP_SUPPLICANT ESP_SUPPLICANT