Skip to content

Commit 593f708

Browse files
committed
[Support] Silence function cast warning when building with Clang ToT targetting Windows
1 parent f118c88 commit 593f708

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

llvm/lib/Support/Windows/Process.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,18 @@ static RTL_OSVERSIONINFOEXW GetWindowsVer() {
482482
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
483483
assert(hMod);
484484

485+
#if defined(__clang__)
486+
#pragma clang diagnostic push
487+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
488+
#endif
489+
485490
auto getVer = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
486491
assert(getVer);
487492

493+
#if defined(__clang__)
494+
#pragma clang diagnostic pop
495+
#endif
496+
488497
RTL_OSVERSIONINFOEXW info{};
489498
info.dwOSVersionInfoSize = sizeof(info);
490499
NTSTATUS r = getVer((PRTL_OSVERSIONINFOW)&info);

llvm/lib/Support/Windows/Signals.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ static bool isDebugHelpInitialized() {
167167
return fStackWalk64 && fSymInitialize && fSymSetOptions && fMiniDumpWriteDump;
168168
}
169169

170+
#if defined(__clang__)
171+
#pragma clang diagnostic push
172+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
173+
#endif
174+
170175
static bool load64BitDebugHelp(void) {
171176
HMODULE hLib =
172177
::LoadLibraryExA("Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
@@ -192,6 +197,10 @@ static bool load64BitDebugHelp(void) {
192197
return isDebugHelpInitialized();
193198
}
194199

200+
#if defined(__clang__)
201+
#pragma clang diagnostic pop
202+
#endif
203+
195204
using namespace llvm;
196205

197206
// Forward declare.

0 commit comments

Comments
 (0)