dotnet8.0/runtime-100258-clang-18.patch
Omair Majid bf06fbc0eb Fix build
- Resolves: RHEL-25950
- Resolves: RHEL-45214
2024-07-31 14:37:54 -04:00

58 lines
2.6 KiB
Diff

From 5ba9eb4aa57cbdc150e1cf7cd99f5b5bda74c959 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Mon, 25 Mar 2024 17:26:44 -0400
Subject: [PATCH] Support building against clang 18
This is a targeted backport from a few other PRs that makes it possible
to build dotnet/runtme's 8.0 branch on Fedora 40 which includes clang
18.
- https://github.com/dotnet/arcade/pull/14572
- https://github.com/dotnet/runtime/pull/94782
- https://github.com/dotnet/runtime/pull/99811
---
eng/common/native/init-compiler.sh | 2 +-
eng/native/configurecompiler.cmake | 3 +++
src/coreclr/pal/src/include/pal/palinternal.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/runtime/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh
index f5c1ec7eafeb2..2d5660642b8d4 100644
--- a/src/runtime/eng/common/native/init-compiler.sh
+++ b/src/runtime/eng/common/native/init-compiler.sh
@@ -63,7 +63,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="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"
+ 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="13 12 11 10 9 8 7 6 5 4.9"; fi
for version in $versions; do
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 183811018533a..0e6ee88b245eb 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -590,6 +590,9 @@ if (CLR_CMAKE_HOST_UNIX)
# other clang 16.0 suppressions
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
add_compile_options(-Wno-cast-function-type-strict)
+
+ # clang 18.1 supressions
+ add_compile_options(-Wno-switch-default)
else()
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)
diff --git a/src/coreclr/pal/src/include/pal/palinternal.h b/src/coreclr/pal/src/include/pal/palinternal.h
index a7c5ba129c90f..3b8a55a94496c 100644
--- a/src/runtime/src/coreclr/pal/src/include/pal/palinternal.h
+++ b/src/runtime/src/coreclr/pal/src/include/pal/palinternal.h
@@ -426,6 +426,7 @@ function_name() to call the system's implementation
#undef va_start
#undef va_end
#undef va_copy
+#undef va_arg
#undef stdin
#undef stdout
#undef stderr