[compiler-rt] 7202fe5 - [compiler-rt] Silence warnings
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 11 16:01:33 PDT 2024
Author: Alexandre Ganea
Date: 2024-08-11T19:01:12-04:00
New Revision: 7202fe5829319a70ac05232af7206781a8a5437f
URL: https://github.com/llvm/llvm-project/commit/7202fe5829319a70ac05232af7206781a8a5437f
DIFF: https://github.com/llvm/llvm-project/commit/7202fe5829319a70ac05232af7206781a8a5437f.diff
LOG: [compiler-rt] Silence warnings
This fixes a few of these warnings, when building with Clang ToT on
Windows:
```
[622/7618] Building CXX object
projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommonSymbolizer.x86_64.dir\sanitizer_symbolizer_win.cpp.obj
C:\src\git\llvm-project\compiler-rt\lib\sanitizer_common\sanitizer_symbolizer_win.cpp(74,3):
warning: cast from 'FARPROC' (aka 'long long (*)()') to
'decltype(::StackWalk64) *' (aka 'int (*)(unsigned long, void *, void *,
_tagSTACKFRAME64 *, void *, int (*)(void *, unsigned long long, void *,
unsigned long, unsigned long *), void *(*)(void *, unsigned long long),
unsigned long long (*)(void *, unsigned long long), unsigned long long
(*)(void *, void *, _tagADDRESS64 *))') converts to incompatible
function type [-Wcast-function-type-mismatch]
```
This is similar to https://github.com/llvm/llvm-project/pull/97905
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
index db80eb383885e6..e0210aa0ac3651 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp
@@ -241,8 +241,8 @@ size_t PageSize() {
void SetThreadName(std::thread &thread, const std::string &name) {
typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
HMODULE kbase = GetModuleHandleA("KernelBase.dll");
- proc ThreadNameProc =
- reinterpret_cast<proc>(GetProcAddress(kbase, "SetThreadDescription"));
+ proc ThreadNameProc = reinterpret_cast<proc>(
+ (void *)GetProcAddress(kbase, "SetThreadDescription"));
if (ThreadNameProc) {
std::wstring buf;
auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
index aae3e76ea229ff..1ff8b8f1bab480 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
@@ -65,12 +65,13 @@ void InitializeDbgHelpIfNeeded() {
HMODULE dbghelp = LoadLibraryA("dbghelp.dll");
CHECK(dbghelp && "failed to load dbghelp.dll");
-#define DBGHELP_IMPORT(name) \
- do { \
- name = \
- reinterpret_cast<decltype(::name) *>(GetProcAddress(dbghelp, #name)); \
- CHECK(name != nullptr); \
- } while (0)
+# define DBGHELP_IMPORT(name) \
+ do { \
+ name = reinterpret_cast<decltype(::name) *>( \
+ (void *)GetProcAddress(dbghelp, #name)); \
+ CHECK(name != nullptr); \
+ } while (0)
+
DBGHELP_IMPORT(StackWalk64);
DBGHELP_IMPORT(SymCleanup);
DBGHELP_IMPORT(SymFromAddr);
More information about the llvm-commits
mailing list