Skip to content

Commit

Permalink
Avoid warning about inability to cast from ptr-to-obj to ptr-to-fun.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
snuglas committed Jun 19, 2015
1 parent cf0db29 commit ae7a59f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@ 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.
// For example, this happens when building LLVM with Visual C++
// 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

Expand Down

0 comments on commit ae7a59f

Please sign in to comment.