[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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user