Skip to content

Commit e9a973c

Browse files
MarcelRaadvszakats
authored andcommitted
build: exclude clang prereleases from compiler warning options
Starting with clang 18, stable clang releases start with minor version 1. Exclude pre-releases with minor version 0 from the compiler warning options for that major version. This fixes the build with Android NDK r29, which uses a prerelease version of clang 21 that doesn't know the new options yet. Closes curl#19566
1 parent 1b48c61 commit e9a973c

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

CMake/PickyWarnings.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,20 @@ if(PICKY_COMPILER)
232232
-Wcast-function-type-strict # clang 16.0 appleclang 16.0
233233
)
234234
endif()
235-
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.0)
235+
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.1)
236236
list(APPEND _picky_enable
237-
-Warray-compare # clang 20.0 gcc 12.0 appleclang ?
238-
-Wc++-hidden-decl # clang 21.0 appleclang ?
239-
-Wno-implicit-void-ptr-cast # clang 21.0 appleclang ?
240-
-Wtentative-definition-compat # clang 21.0 appleclang ?
237+
-Warray-compare # clang 20.1 gcc 12.0 appleclang ?
238+
-Wc++-hidden-decl # clang 21.1 appleclang ?
239+
-Wno-implicit-void-ptr-cast # clang 21.1 appleclang ?
240+
-Wtentative-definition-compat # clang 21.1 appleclang ?
241241
)
242242
if(WIN32)
243243
list(APPEND _picky_enable
244-
-Wno-c++-keyword # clang 21.0 appleclang ? # `wchar_t` triggers it on Windows
244+
-Wno-c++-keyword # clang 21.1 appleclang ? # `wchar_t` triggers it on Windows
245245
)
246246
else()
247247
list(APPEND _picky_enable
248-
-Wc++-keyword # clang 21.0 appleclang ?
248+
-Wc++-keyword # clang 21.1 appleclang ?
249249
)
250250
endif()
251251
endif()

m4/curl-compilers.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,11 +937,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
937937
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type-strict]) # with Apple clang it requires 16.0 or above
938938
fi
939939
dnl clang 20 or later
940-
if test "$compiler_num" -ge "2000"; then
940+
if test "$compiler_num" -ge "2001"; then
941941
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [array-compare])
942942
fi
943943
dnl clang 21 or later
944-
if test "$compiler_num" -ge "2100"; then
944+
if test "$compiler_num" -ge "2101"; then
945945
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-hidden-decl])
946946
tmp_CFLAGS="$tmp_CFLAGS -Wno-implicit-void-ptr-cast"
947947
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [tentative-definition-compat])

0 commit comments

Comments
 (0)