[llvm] 593f708 - [Support] Silence function cast warning when building with Clang ToT targetting Windows

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 17:50:25 PDT 2024


Author: Alexandre Ganea
Date: 2024-07-05T20:49:40-04:00
New Revision: 593f708118aef792f434185547f74fedeaf51dd4

URL: https://github.com/llvm/llvm-project/commit/593f708118aef792f434185547f74fedeaf51dd4
DIFF: https://github.com/llvm/llvm-project/commit/593f708118aef792f434185547f74fedeaf51dd4.diff

LOG: [Support] Silence function cast warning when building with Clang ToT targetting Windows

Added: 
    

Modified: 
    llvm/lib/Support/Windows/Process.inc
    llvm/lib/Support/Windows/Signals.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc
index 34d294b232c32..b9110d4e414ff 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 29ebf7c696e04..d057981c1c84c 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.


        


More information about the llvm-commits mailing list