mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(build): set -Wunused-but-set-variable=1 for GNU compiler to maintain backward compatibility
This commit is contained in:
@@ -17,8 +17,17 @@ DEBUG_SHELL=${DEBUG_SHELL:-"0"}
|
||||
# (Depends on default options '-Wno-error=XXX' used in the IDF build system)
|
||||
|
||||
if [ "$IDF_TOOLCHAIN" != "clang" ]; then
|
||||
PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
|
||||
PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-function"
|
||||
export PEDANTIC_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
|
||||
# TODO IDF-15784
|
||||
case "$CI_JOB_NAME" in
|
||||
test_pytest_linux|test_sockets_on_host|test_transport_on_host|test_pytest_macos)
|
||||
export PEDANTIC_CFLAGS="${PEDANTIC_CFLAGS} -Werror=unused-but-set-variable"
|
||||
;;
|
||||
*)
|
||||
export PEDANTIC_CFLAGS="${PEDANTIC_CFLAGS} -Werror=unused-but-set-variable=1"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
export PEDANTIC_CFLAGS="-Werror"
|
||||
fi
|
||||
|
||||
@@ -236,6 +236,12 @@ function(__init_project_configuration)
|
||||
list(APPEND c_compile_options "-Wno-old-style-declaration")
|
||||
endif()
|
||||
|
||||
# TODO IDF-15784: remove in IDF v7.0 ?
|
||||
check_c_compiler_flag("-Wunused-but-set-variable=1" compiler_supports_wunused_but_set_variable_eq_1)
|
||||
if(compiler_supports_wunused_but_set_variable_eq_1)
|
||||
list(APPEND compile_options "-Wunused-but-set-variable=1")
|
||||
endif()
|
||||
|
||||
# Clang finds some warnings in IDF code which GCC doesn't.
|
||||
# All these warnings should be fixed before Clang is presented
|
||||
# as a toolchain choice for users.
|
||||
|
||||
Reference in New Issue
Block a user