From 593f708118aef792f434185547f74fedeaf51dd4 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Fri, 5 Jul 2024 20:44:25 -0400 Subject: [Support] Silence function cast warning when building with Clang ToT targetting Windows --- llvm/lib/Support/Windows/Process.inc | 9 +++++++++ llvm/lib/Support/Windows/Signals.inc | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc index 34d294b..b9110d4 100644 --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -482,9 +482,18 @@ static RTL_OSVERSIONINFOEXW GetWindowsVer() { HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll"); assert(hMod); +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-function-type-mismatch" +#endif + auto getVer = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion"); assert(getVer); +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + RTL_OSVERSIONINFOEXW info{}; info.dwOSVersionInfoSize = sizeof(info); NTSTATUS r = getVer((PRTL_OSVERSIONINFOW)&info); diff --git a/llvm/lib/Support/Windows/Signals.inc b/llvm/lib/Support/Windows/Signals.inc index 29ebf7c..d057981 100644 --- a/llvm/lib/Support/Windows/Signals.inc +++ b/llvm/lib/Support/Windows/Signals.inc @@ -167,6 +167,11 @@ static bool isDebugHelpInitialized() { return fStackWalk64 && fSymInitialize && fSymSetOptions && fMiniDumpWriteDump; } +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-function-type-mismatch" +#endif + static bool load64BitDebugHelp(void) { HMODULE hLib = ::LoadLibraryExA("Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); @@ -192,6 +197,10 @@ static bool load64BitDebugHelp(void) { return isDebugHelpInitialized(); } +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + using namespace llvm; // Forward declare. -- cgit v1.1