From bb7dcec385ce59fc1ff1bda90aaf535cf0da59df Mon Sep 17 00:00:00 2001 From: qiaopengcheng Date: Mon, 8 Apr 2024 14:51:13 +0800 Subject: [PATCH] Fix building error for `error: fallthrough annotation in unreachable code` when building on debug mode on loongarch64/arm64/amd64-linux by clang<14. Also delete `#ifndef FALLTHROUGH` block as #98336 added after #98712. --- src/coreclr/interop/comwrappers.cpp | 2 ++ src/coreclr/pal/inc/pal.h | 8 -------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/coreclr/interop/comwrappers.cpp b/src/coreclr/interop/comwrappers.cpp index 095f098e286015..58b83368f7bf4b 100644 --- a/src/coreclr/interop/comwrappers.cpp +++ b/src/coreclr/interop/comwrappers.cpp @@ -736,7 +736,9 @@ HRESULT ManagedObjectWrapper::QueryInterface( return E_NOINTERFACE; default: +#if !defined(__clang__) || (__clang_major__ > 13) // Workaround bug in old clang _ASSERTE(false && "Unknown result value"); +#endif FALLTHROUGH; case TryInvokeICustomQueryInterfaceResult::FailedToInvoke: // Set the 'lacks' flag since our attempt to use ICustomQueryInterface diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index 9a1d25515bb32e..70b934a8ccd88e 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -184,14 +184,6 @@ extern bool g_arm64_atomics_present; #define __has_cpp_attribute(x) (0) #endif -#ifndef FALLTHROUGH -#if __has_cpp_attribute(fallthrough) -#define FALLTHROUGH [[fallthrough]] -#else // __has_cpp_attribute(fallthrough) -#define FALLTHROUGH -#endif // __has_cpp_attribute(fallthrough) -#endif // FALLTHROUGH - /******************* PAL-Specific Entrypoints *****************************/ #define IsDebuggerPresent PAL_IsDebuggerPresent