try detecting it via -Wsign-conversion

cleanup opts

try something
This commit is contained in:
Viktor Szakats 2026-03-03 04:18:31 +01:00
parent e39b490946
commit 87787ed050
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View file

@ -130,12 +130,13 @@ if(PICKY_COMPILER)
-Wmissing-field-initializers # clang 2.7 gcc 4.1
-Wmissing-noreturn # clang 2.7 gcc 4.1
-Wno-padded # clang 2.9 gcc 4.1 # Not used: We cannot change public structs
-Wno-sign-conversion # clang 2.9 gcc 4.3
-Wno-switch-default # clang 2.7 gcc 4.1 # Not used: Annoying to fix or silence
-Wno-switch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case
-Wno-system-headers # clang 1.0 gcc 3.0
-Wold-style-definition # clang 2.7 gcc 3.4
-Wredundant-decls # clang 2.7 gcc 4.1
-Wsign-conversion # clang 2.9 gcc 4.3
-Wno-error=sign-conversion
-Wstrict-prototypes # clang 1.0 gcc 3.3
-Wtype-limits # clang 2.7 gcc 4.3
-Wunreachable-code # clang 2.7 gcc 4.1
@ -331,6 +332,7 @@ if(PICKY_COMPILER)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
list(APPEND _picky_enable
-Warith-conversion # gcc 10.0
-Wno-error=arith-conversion # gcc 10.0 # extra hits with -Wsign-conversion
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.2 g++ 11.0
)
endif()

View file

@ -851,7 +851,8 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
dnl Only clang 2.9 or later
if test "$compiler_num" -ge "209"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-conversion])
tmp_CFLAGS="$tmp_CFLAGS -Wno-error=sign-conversion"
tmp_CFLAGS="$tmp_CFLAGS -Wno-padded" # Not used because we cannot change public structs
tmp_CFLAGS="$tmp_CFLAGS -Wno-used-but-marked-unused" # for typecheck-gcc.h with clang 14+, dependency headers
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow])
@ -1099,7 +1100,8 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-parameter-type empty-body])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [clobbered ignored-qualifiers])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conversion])
tmp_CFLAGS="$tmp_CFLAGS -Wno-sign-conversion"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-conversion])
tmp_CFLAGS="$tmp_CFLAGS -Wno-error=sign-conversion"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [vla])
dnl required for -Warray-bounds, included in -Wall
tmp_CFLAGS="$tmp_CFLAGS -ftree-vrp"
@ -1159,6 +1161,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])
tmp_CFLAGS="$tmp_CFLAGS -Wno-error=arith-conversion" # extra hits with -Wsign-conversion
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [enum-conversion])
fi