Skip to content

Commit 2f62289

Browse files
authored
Support building against clang 18 (#102529)
This is a targeted backport from a few other PRs that makes it possible to build dotnet/runtme's 6.0 branch on Fedora 40 which includes clang 18. - dotnet/arcade#14572 - #94782 - #99811
1 parent f71677a commit 2f62289

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

eng/native/configurecompiler.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ if (CLR_CMAKE_HOST_UNIX)
376376
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
377377
add_compile_options(-Wno-cast-function-type-strict)
378378
add_compile_options(-Wno-incompatible-function-pointer-types-strict)
379+
380+
# clang 18.1 supressions
381+
add_compile_options(-Wno-switch-default)
379382
else()
380383
add_compile_options(-Wno-unknown-pragmas)
381384
add_compile_options(-Wno-uninitialized)

eng/native/init-compiler.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if [[ -z "$CLR_CC" ]]; then
4646
# Set default versions
4747
if [[ -z "$majorVersion" ]]; then
4848
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
49-
if [[ "$compiler" == "clang" ]]; then versions=( 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
49+
if [[ "$compiler" == "clang" ]]; then versions=( 18 17 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
5050
elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi
5151

5252
for version in "${versions[@]}"; do

src/coreclr/pal/src/include/pal/palinternal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ function_name() to call the system's implementation
430430
#undef va_list
431431
#undef va_start
432432
#undef va_end
433+
#undef va_arg
433434
#undef va_copy
434435
#undef stdin
435436
#undef stdout

src/libraries/Native/Unix/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL Clang)
6060
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
6161
add_compile_options(-Wno-cast-function-type-strict)
6262
add_compile_options(-Wno-incompatible-function-pointer-types-strict)
63+
64+
# clang 18.1 supressions
65+
add_compile_options(-Wno-switch-default)
6366
elseif(CMAKE_C_COMPILER_ID STREQUAL GNU)
6467
add_compile_options(-Wno-stringop-truncation)
6568
endif()

0 commit comments

Comments
 (0)