]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: enable -Warith-conversion
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Wed, 5 Jan 2022 16:20:16 +0000 (17:20 +0100)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 13 Jan 2022 15:23:07 +0000 (16:23 +0100)
This makes the behavior consistent between GCC 10 and earlier versions.

Closes https://github.com/curl/curl/pull/8271

CMakeLists.txt
m4/curl-compilers.m4

index 25758b2366a02700a0b2e515c56c1fdc1c0179d2..a7e7928358d2c981ad7514ac0c3a3ccb1d5fa623 100644 (file)
@@ -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 -Wenum-conversion)
+    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 -Warith-conversion)
       # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new
       # test result in.
       string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname)
index 586964f3b2ec546c85c91ec3a042fa5943ece8ca..f490076530c64c2d1f6216086713d1e49788a867 100644 (file)
@@ -1044,6 +1044,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
           #
           dnl Only gcc 10 or later
           if test "$compiler_num" -ge "1000"; then
+            CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [arith-conversion])
             CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion])
           fi
           #