[llvm] 39e192b - [Support] Silence warnings when retrieving exported functions (#97905)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 30 16:06:06 PDT 2024
Author: Alexandre Ganea
Date: 2024-07-30T19:06:03-04:00
New Revision: 39e192b379362e9e645427631c35450d55ed517d
URL: https://github.com/llvm/llvm-project/commit/39e192b379362e9e645427631c35450d55ed517d
DIFF: https://github.com/llvm/llvm-project/commit/39e192b379362e9e645427631c35450d55ed517d.diff
LOG: [Support] Silence warnings when retrieving exported functions (#97905)
Since functions exported from DLLs are type-erased, before this patch I
was seeing the new Clang 19 warning `-Wcast-function-type-mismatch`.
This happens when building LLVM on Windows.
Following discussion in
https://github.com/llvm/llvm-project/commit/593f708118aef792f434185547f74fedeaf51dd4#commitcomment-143905744
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..d525f5b16e862 100644
--- a/llvm/lib/Support/Windows/Process.inc
+++ b/llvm/lib/Support/Windows/Process.inc
@@ -482,7 +482,8 @@ static RTL_OSVERSIONINFOEXW GetWindowsVer() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
assert(hMod);
- auto getVer = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
+ auto getVer =
+ (RtlGetVersionPtr)(void *)::GetProcAddress(hMod, "RtlGetVersion");
assert(getVer);
RTL_OSVERSIONINFOEXW info{};
diff --git a/llvm/lib/Support/Windows/Signals.inc b/llvm/lib/Support/Windows/Signals.inc
index 29ebf7c696e04..f11ad09f37139 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -171,23 +171,27 @@ static bool load64BitDebugHelp(void) {
HMODULE hLib =
::LoadLibraryExA("Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hLib) {
- fMiniDumpWriteDump =
- (fpMiniDumpWriteDump)::GetProcAddress(hLib, "MiniDumpWriteDump");
- fStackWalk64 = (fpStackWalk64)::GetProcAddress(hLib, "StackWalk64");
- fSymGetModuleBase64 =
- (fpSymGetModuleBase64)::GetProcAddress(hLib, "SymGetModuleBase64");
- fSymGetSymFromAddr64 =
- (fpSymGetSymFromAddr64)::GetProcAddress(hLib, "SymGetSymFromAddr64");
- fSymGetLineFromAddr64 =
- (fpSymGetLineFromAddr64)::GetProcAddress(hLib, "SymGetLineFromAddr64");
- fSymGetModuleInfo64 =
- (fpSymGetModuleInfo64)::GetProcAddress(hLib, "SymGetModuleInfo64");
- fSymFunctionTableAccess64 = (fpSymFunctionTableAccess64)::GetProcAddress(
- hLib, "SymFunctionTableAccess64");
- fSymSetOptions = (fpSymSetOptions)::GetProcAddress(hLib, "SymSetOptions");
- fSymInitialize = (fpSymInitialize)::GetProcAddress(hLib, "SymInitialize");
- fEnumerateLoadedModules = (fpEnumerateLoadedModules)::GetProcAddress(
- hLib, "EnumerateLoadedModules64");
+ fMiniDumpWriteDump = (fpMiniDumpWriteDump)(void *)::GetProcAddress(
+ hLib, "MiniDumpWriteDump");
+ fStackWalk64 = (fpStackWalk64)(void *)::GetProcAddress(hLib, "StackWalk64");
+ fSymGetModuleBase64 = (fpSymGetModuleBase64)(void *)::GetProcAddress(
+ hLib, "SymGetModuleBase64");
+ fSymGetSymFromAddr64 = (fpSymGetSymFromAddr64)(void *)::GetProcAddress(
+ hLib, "SymGetSymFromAddr64");
+ fSymGetLineFromAddr64 = (fpSymGetLineFromAddr64)(void *)::GetProcAddress(
+ hLib, "SymGetLineFromAddr64");
+ fSymGetModuleInfo64 = (fpSymGetModuleInfo64)(void *)::GetProcAddress(
+ hLib, "SymGetModuleInfo64");
+ fSymFunctionTableAccess64 =
+ (fpSymFunctionTableAccess64)(void *)::GetProcAddress(
+ hLib, "SymFunctionTableAccess64");
+ fSymSetOptions =
+ (fpSymSetOptions)(void *)::GetProcAddress(hLib, "SymSetOptions");
+ fSymInitialize =
+ (fpSymInitialize)(void *)::GetProcAddress(hLib, "SymInitialize");
+ fEnumerateLoadedModules =
+ (fpEnumerateLoadedModules)(void *)::GetProcAddress(
+ hLib, "EnumerateLoadedModules64");
}
return isDebugHelpInitialized();
}
More information about the llvm-commits
mailing list