From ae7a59fa3e52ff7b74cff07dbfa19382eec1d9e3 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Fri, 19 Jun 2015 17:21:02 +0000 Subject: [PATCH] Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun. Use POSIX.1-2003 Technical Corrigendum 1 suggested workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240140 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../RuntimeDyld/RTDyldMemoryManager.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp b/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp index 2a5e4f83228..044eee43c9e 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp @@ -41,8 +41,8 @@ RTDyldMemoryManager::~RTDyldMemoryManager() {} #endif #if HAVE_EHTABLE_SUPPORT -extern "C" void __register_frame(void*); -extern "C" void __deregister_frame(void*); +extern "C" void __register_frame(void *); +extern "C" void __deregister_frame(void *); #else // The building compiler does not have __(de)register_frame but // it may be found at runtime in a dynamically-loaded library. @@ -50,28 +50,28 @@ extern "C" void __deregister_frame(void*); // but using the MingW runtime. void __register_frame(void *p) { static bool Searched = false; - static void *rf = 0; + static void((*rf)(void *)) = 0; if (!Searched) { Searched = true; - rf = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol( - "__register_frame"); + *(void **)&rf = + llvm::sys::DynamicLibrary::SearchForAddressOfSymbol("__register_frame"); } if (rf) - ((void (*)(void *))rf)(p); + rf(p); } void __deregister_frame(void *p) { static bool Searched = false; - static void *df = 0; + static void((*df)(void *)) = 0; if (!Searched) { Searched = true; - df = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol( - "__deregister_frame"); + *(void **)&df = llvm::sys::DynamicLibrary::SearchForAddressOfSymbol( + "__deregister_frame"); } if (df) - ((void (*)(void *))df)(p); + df(p); } #endif -- 2.34.1