https://github.com/tru updated https://github.com/llvm/llvm-project/pull/101266
>From c3004032c244cb5264790dc535437b9c3b93acb6 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea <aga...@havenstudios.com> Date: Tue, 30 Jul 2024 19:06:03 -0400 Subject: [PATCH] [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 (cherry picked from commit 39e192b379362e9e645427631c35450d55ed517d) --- llvm/lib/Support/Windows/Process.inc | 3 ++- llvm/lib/Support/Windows/Signals.inc | 38 +++++++++++++++------------- 2 files changed, 23 insertions(+), 18 deletions(-) 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(); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits