Skip to content

Commit

Permalink
Support building against clang 18 (#102529)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
omajid committed Jun 5, 2024
1 parent f71677a commit 2f62289
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ if (CLR_CMAKE_HOST_UNIX)
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
add_compile_options(-Wno-cast-function-type-strict)
add_compile_options(-Wno-incompatible-function-pointer-types-strict)

# clang 18.1 supressions
add_compile_options(-Wno-switch-default)
else()
add_compile_options(-Wno-unknown-pragmas)
add_compile_options(-Wno-uninitialized)
Expand Down
2 changes: 1 addition & 1 deletion eng/native/init-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [[ -z "$CLR_CC" ]]; then
# Set default versions
if [[ -z "$majorVersion" ]]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
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 )
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 )
elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi

for version in "${versions[@]}"; do
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/pal/src/include/pal/palinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ function_name() to call the system's implementation
#undef va_list
#undef va_start
#undef va_end
#undef va_arg
#undef va_copy
#undef stdin
#undef stdout
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL Clang)
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
add_compile_options(-Wno-cast-function-type-strict)
add_compile_options(-Wno-incompatible-function-pointer-types-strict)

# clang 18.1 supressions
add_compile_options(-Wno-switch-default)
elseif(CMAKE_C_COMPILER_ID STREQUAL GNU)
add_compile_options(-Wno-stringop-truncation)
endif()
Expand Down

0 comments on commit 2f62289

Please sign in to comment.