From 8608cf23dae982c7435120d800eaec2fca410ff6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 5 Aug 2009 21:03:39 +0000 Subject: [PATCH] Use (void *)(intptr_t) to cast function addresses to void* for use with sys::Path::GetMainExecutable, to avoid warnings with -pedantic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78245 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/ToolRunner.cpp | 12 ++++-------- tools/llvm-ld/llvm-ld.cpp | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index bce4d52c69d..c9efbb8c76f 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -232,8 +232,7 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const char *Argv0, std::string &Message, const std::vector *ToolArgs) { std::string LLIPath = - FindExecutable("lli", Argv0, - reinterpret_cast(&createLLI)).toString(); + FindExecutable("lli", Argv0, (void *)(intptr_t)&createLLI).toString(); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new LLI(LLIPath, ToolArgs); @@ -420,8 +419,7 @@ LLC *AbstractInterpreter::createLLC(const char *Argv0, const std::vector *Args, const std::vector *GCCArgs) { std::string LLCPath = - FindExecutable("llc", Argv0, - reinterpret_cast(&createLLC)).toString(); + FindExecutable("llc", Argv0, (void *)(intptr_t)&createLLC).toString(); if (LLCPath.empty()) { Message = "Cannot find `llc' in executable directory or PATH!\n"; return 0; @@ -507,8 +505,7 @@ int JIT::ExecuteProgram(const std::string &Bitcode, AbstractInterpreter *AbstractInterpreter::createJIT(const char *Argv0, std::string &Message, const std::vector *Args) { std::string LLIPath = - FindExecutable("lli", Argv0, - reinterpret_cast(&createJIT)).toString(); + FindExecutable("lli", Argv0, (void *)(intptr_t)&createJIT).toString(); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new JIT(LLIPath, Args); @@ -587,8 +584,7 @@ CBE *AbstractInterpreter::createCBE(const char *Argv0, const std::vector *Args, const std::vector *GCCArgs) { sys::Path LLCPath = - FindExecutable("llc", Argv0, - reinterpret_cast(&createCBE)); + FindExecutable("llc", Argv0, (void *)(intptr_t)&createCBE); if (LLCPath.isEmpty()) { Message = "Cannot find `llc' in executable directory or PATH!\n"; diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 62e5f09a085..17035e2a31f 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -415,7 +415,7 @@ static void EmitShellScript(char **argv) { // build tree to the destination file. std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0], - reinterpret_cast(&Optimize)); + (void *)(intptr_t)&Optimize); if (llvmstub.isEmpty()) PrintAndExit("Could not find llvm-stub.exe executable!"); @@ -642,7 +642,7 @@ int main(int argc, char **argv, char **envp) { // Determine the locations of the llc and gcc programs. sys::Path llc = FindExecutable("llc", argv[0], - reinterpret_cast(&Optimize)); + (void *)(intptr_t)&Optimize); if (llc.isEmpty()) PrintAndExit("Failed to find llc"); @@ -672,7 +672,7 @@ int main(int argc, char **argv, char **envp) { // Determine the locations of the llc and gcc programs. sys::Path llc = FindExecutable("llc", argv[0], - reinterpret_cast(&Optimize)); + (void *)(intptr_t)&Optimize); if (llc.isEmpty()) PrintAndExit("Failed to find llc"); -- 2.34.1