mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:11:45 +03:00
build: adjust minimum version for some clang picky warnings
Enable 3 warnings earlier with autotools, update comments for the rest. Ref: https://godbolt.org/ Closes #20665
This commit is contained in:
parent
139307865a
commit
25512ab34e
2 changed files with 10 additions and 10 deletions
|
|
@ -117,7 +117,7 @@ if(PICKY_COMPILER)
|
|||
-Waddress # clang 2.7 gcc 4.3
|
||||
-Wattributes # clang 2.7 gcc 4.1
|
||||
-Wcast-align # clang 1.0 gcc 4.2
|
||||
-Wcast-qual # clang 3.0 gcc 3.4.6
|
||||
-Wcast-qual # clang 2.7 gcc 3.4.6
|
||||
-Wdeclaration-after-statement # clang 1.0 gcc 3.4
|
||||
-Wdiv-by-zero # clang 2.7 gcc 4.1
|
||||
-Wempty-body # clang 2.7 gcc 4.3
|
||||
|
|
@ -147,10 +147,10 @@ if(PICKY_COMPILER)
|
|||
list(APPEND _picky_enable
|
||||
${_picky_common_old}
|
||||
-Wconditional-uninitialized # clang 3.0
|
||||
-Wno-used-but-marked-unused # clang 3.0 # Triggered by typecheck-gcc.h with clang 14+, dependency headers
|
||||
-Wno-used-but-marked-unused # clang 2.9 # Triggered by typecheck-gcc.h with clang 14+, dependency headers
|
||||
-Wshift-sign-overflow # clang 2.9
|
||||
-Wshorten-64-to-32 # clang 1.0
|
||||
-Wformat=2 # clang 3.0 gcc 4.8
|
||||
-Wformat=2 # clang 2.7 gcc 4.8
|
||||
)
|
||||
if(NOT MSVC)
|
||||
list(APPEND _picky_enable
|
||||
|
|
@ -294,23 +294,23 @@ if(PICKY_COMPILER)
|
|||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
|
||||
list(APPEND _picky_enable
|
||||
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.1
|
||||
-Wformat=2 # clang 3.0 gcc 4.8
|
||||
-Wformat=2 # clang 2.7 gcc 4.8
|
||||
-Wtrampolines # gcc 4.6
|
||||
)
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0)
|
||||
list(APPEND _picky_enable
|
||||
-Warray-bounds=2 # clang 3.0 gcc 5.0 (clang default: -Warray-bounds)
|
||||
-Warray-bounds=2 # clang 2.9 gcc 5.0 (clang default: -Warray-bounds)
|
||||
-Wno-format-signedness # clang 19.1 gcc 5.1 appleclang 17.0
|
||||
)
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
|
||||
list(APPEND _picky_enable
|
||||
-Wduplicated-cond # gcc 6.0
|
||||
-Wnull-dereference # clang 3.0 gcc 6.0 (clang default)
|
||||
-Wnull-dereference # clang 2.9 gcc 6.0 (clang default)
|
||||
-fdelete-null-pointer-checks
|
||||
-Wshift-negative-value # clang 3.7 gcc 6.0 (clang default)
|
||||
-Wshift-overflow=2 # clang 3.0 gcc 6.0 (clang default: -Wshift-overflow)
|
||||
-Wshift-overflow=2 # clang 2.9 gcc 6.0 (clang default: -Wshift-overflow)
|
||||
-Wunused-const-variable # clang 3.4 gcc 6.0 appleclang 5.1
|
||||
)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -828,9 +828,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [address])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [attributes])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [bad-function-cast])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conversion])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [div-by-zero format-security])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [empty-body])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-switch-default"
|
||||
|
|
@ -853,16 +855,14 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||
if test "$compiler_num" -ge "209"; then
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-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" # Triggered by typecheck-gcc.h with clang 14+, dependency headers
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow])
|
||||
fi
|
||||
#
|
||||
dnl Only clang 3.0 or later
|
||||
if test "$compiler_num" -ge "300"; then
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [conditional-uninitialized])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [language-extension-token])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-used-but-marked-unused" # Triggered by typecheck-gcc.h with clang 14+, dependency headers
|
||||
fi
|
||||
dnl Only clang 3.1 or later
|
||||
if test "$compiler_num" -ge "301"; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue