mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
Enable -Wwrite-strings when compiling IDF's own C files
This commit is contained in:
parent
f7b7b4ef59
commit
33480d1a2c
14
Kconfig
14
Kconfig
@ -148,6 +148,20 @@ config STACK_CHECK
|
|||||||
help
|
help
|
||||||
Stack smashing protection.
|
Stack smashing protection.
|
||||||
|
|
||||||
|
config WARN_WRITE_STRINGS
|
||||||
|
bool "Enable -Wwrite-strings warning flag"
|
||||||
|
default "n"
|
||||||
|
help
|
||||||
|
Adds -Wwrite-strings flag for the C/C++ compilers.
|
||||||
|
|
||||||
|
For C, this gives string constants the type "const char[]" so that
|
||||||
|
copying the address of one into a non-"const" "char *" pointer
|
||||||
|
produces a warning. This warning helps to find at compile time code
|
||||||
|
that tries to write into a string constant.
|
||||||
|
|
||||||
|
For C++, this warns about the deprecated conversion from string
|
||||||
|
literals to "char *".
|
||||||
|
|
||||||
endmenu # Compiler Options
|
endmenu # Compiler Options
|
||||||
|
|
||||||
menu "Component config"
|
menu "Component config"
|
||||||
|
@ -267,6 +267,10 @@ COMMON_WARNING_FLAGS = -Wall -Werror=all \
|
|||||||
-Wextra \
|
-Wextra \
|
||||||
-Wno-unused-parameter -Wno-sign-compare
|
-Wno-unused-parameter -Wno-sign-compare
|
||||||
|
|
||||||
|
ifdef CONFIG_WARN_WRITE_STRINGS
|
||||||
|
COMMON_WARNING_FLAGS += -Wwrite-strings
|
||||||
|
endif #CONFIG_WARN_WRITE_STRINGS
|
||||||
|
|
||||||
# Flags which control code generation and dependency generation, both for C and C++
|
# Flags which control code generation and dependency generation, both for C and C++
|
||||||
COMMON_FLAGS = \
|
COMMON_FLAGS = \
|
||||||
-ffunction-sections -fdata-sections \
|
-ffunction-sections -fdata-sections \
|
||||||
|
@ -26,3 +26,4 @@ CONFIG_STACK_CHECK=y
|
|||||||
CONFIG_SUPPORT_STATIC_ALLOCATION=y
|
CONFIG_SUPPORT_STATIC_ALLOCATION=y
|
||||||
CONFIG_ESP_TIMER_PROFILING=y
|
CONFIG_ESP_TIMER_PROFILING=y
|
||||||
CONFIG_ADC2_DISABLE_DAC=n
|
CONFIG_ADC2_DISABLE_DAC=n
|
||||||
|
CONFIG_WARN_WRITE_STRINGS=y
|
||||||
|
Loading…
Reference in New Issue
Block a user