[llvm] r240140 - Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
Douglas Katzman
dougk at google.com
Fri Jun 19 10:21:02 PDT 2015
Author: dougk
Date: Fri Jun 19 12:21:02 2015
New Revision: 240140
URL: http://llvm.org/viewvc/llvm-project?rev=240140&view=rev
Log:
Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
Use POSIX.1-2003 Technical Corrigendum 1 suggested workaround.
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp?rev=240140&r1=240139&r2=240140&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp Fri Jun 19 12:21:02 2015
@@ -41,8 +41,8 @@ RTDyldMemoryManager::~RTDyldMemoryManage
#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
More information about the llvm-commits
mailing list