diff options
author | Marcel Raad <Marcel.Raad@teamviewer.com> | 2022-01-05 16:59:27 +0100 |
---|---|---|
committer | Marcel Raad <Marcel.Raad@teamviewer.com> | 2022-01-13 16:23:03 +0100 |
commit | 813c984962e3ed6e42defa1ea10b8e842851acdd (patch) | |
tree | 39de7874f5f3e773143089be6a1e28efded6d422 | |
parent | c07a71e74f3d0ec8ff940bc56ed8cfb06884532e (diff) | |
download | curl-813c984962e3ed6e42defa1ea10b8e842851acdd.tar.gz |
build: fix -Wenum-conversion handling
Don't enable that warning when warnings are disabled.
Also add it to CMake.
Closes https://github.com/curl/curl/pull/8271
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | m4/curl-compilers.m4 | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 125b0a02b..25758b236 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OF if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) if(PICKY_COMPILER) - foreach(_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wfloat-equal -Wsign-compare -Wundef -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wvla -Wdouble-promotion) + foreach(_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wfloat-equal -Wsign-compare -Wundef -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wvla -Wdouble-promotion -Wenum-conversion) # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new # test result in. string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname) diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index 988abdb8a..586964f3b 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -1042,6 +1042,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ fi fi # + dnl Only gcc 10 or later + if test "$compiler_num" -ge "1000"; then + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion]) + fi + # fi # dnl Do not issue warnings for code in system include paths. @@ -1062,10 +1067,6 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ fi fi fi - dnl Only gcc 10 or later - if test "$compiler_num" -ge "1000"; then - CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion]) - fi ;; # HP_UX_C) |