Skip to content

Commit 7202fe5

Browse files
committed
[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 llvm#97905
1 parent 20baa9a commit 7202fe5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ size_t PageSize() {
241241
void SetThreadName(std::thread &thread, const std::string &name) {
242242
typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR);
243243
HMODULE kbase = GetModuleHandleA("KernelBase.dll");
244-
proc ThreadNameProc =
245-
reinterpret_cast<proc>(GetProcAddress(kbase, "SetThreadDescription"));
244+
proc ThreadNameProc = reinterpret_cast<proc>(
245+
(void *)GetProcAddress(kbase, "SetThreadDescription"));
246246
if (ThreadNameProc) {
247247
std::wstring buf;
248248
auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0);

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ void InitializeDbgHelpIfNeeded() {
6565
HMODULE dbghelp = LoadLibraryA("dbghelp.dll");
6666
CHECK(dbghelp && "failed to load dbghelp.dll");
6767

68-
#define DBGHELP_IMPORT(name) \
69-
do { \
70-
name = \
71-
reinterpret_cast<decltype(::name) *>(GetProcAddress(dbghelp, #name)); \
72-
CHECK(name != nullptr); \
73-
} while (0)
68+
# define DBGHELP_IMPORT(name) \
69+
do { \
70+
name = reinterpret_cast<decltype(::name) *>( \
71+
(void *)GetProcAddress(dbghelp, #name)); \
72+
CHECK(name != nullptr); \
73+
} while (0)
74+
7475
DBGHELP_IMPORT(StackWalk64);
7576
DBGHELP_IMPORT(SymCleanup);
7677
DBGHELP_IMPORT(SymFromAddr);

0 commit comments

Comments
 (0)