Use (void *)(intptr_t) to cast function addresses to void*
authorDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 21:03:39 +0000 (21:03 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 21:03:39 +0000 (21:03 +0000)
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
tools/llvm-ld/llvm-ld.cpp

index bce4d52c69d4faa5c73b12f00266abe1b59a6dbf..c9efbb8c76f0d81d32a0e0a1d6f960c430d1088e 100644 (file)
@@ -232,8 +232,7 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const char *Argv0,
                                                     std::string &Message,
                                      const std::vector<std::string> *ToolArgs) {
   std::string LLIPath =
-    FindExecutable("lli", Argv0,
-                   reinterpret_cast<void *>(&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<std::string> *Args,
                                     const std::vector<std::string> *GCCArgs) {
   std::string LLCPath =
-    FindExecutable("llc", Argv0,
-                   reinterpret_cast<void *>(&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<std::string> *Args) {
   std::string LLIPath =
-    FindExecutable("lli", Argv0,
-                   reinterpret_cast<void *>(&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<std::string> *Args,
                                     const std::vector<std::string> *GCCArgs) {
   sys::Path LLCPath =
-    FindExecutable("llc", Argv0,
-                   reinterpret_cast<void *>(&createCBE));
+    FindExecutable("llc", Argv0, (void *)(intptr_t)&createCBE);
   if (LLCPath.isEmpty()) {
     Message =
       "Cannot find `llc' in executable directory or PATH!\n";
index 62e5f09a085696fe4397932ff7aae1b62c523846..17035e2a31fe4a47dd3961994986021fa6a7a6aa 100644 (file)
@@ -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<void *>(&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<void *>(&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<void *>(&Optimize));
+                                       (void *)(intptr_t)&Optimize);
         if (llc.isEmpty())
           PrintAndExit("Failed to find llc");