Change from using a stub function to a stub variable for passing to the
authorReid Spencer <rspencer@reidspencer.com>
Thu, 1 Jun 2006 07:02:51 +0000 (07:02 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 1 Jun 2006 07:02:51 +0000 (07:02 +0000)
IncludeFile hack to ensure linkage of analysis passes. This works around
some -pedantic warnings about assigning an object to a function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28621 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
include/llvm/Analysis/AliasAnalysis.h
include/llvm/Analysis/CallGraph.h
include/llvm/Analysis/Dominators.h
include/llvm/Analysis/FindUsedTypes.h
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/PostDominators.h
include/llvm/Analysis/ValueNumbering.h
lib/Analysis/AliasAnalysis.cpp
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/FindUsedTypes.cpp
lib/Analysis/LoopInfo.cpp
lib/Analysis/PostDominators.cpp
lib/Analysis/ValueNumbering.cpp
lib/VMCore/Dominators.cpp

index 1cce4ea3930519abd065ea6167ee68c5dc9d255a..0de7a7fd86236778a3e50915bf6978cfba262a3e 100644 (file)
@@ -321,8 +321,8 @@ public:
 // the risk of AliasAnalysis being used, but the default implementation not
 // being linked into the tool that uses it.
 //
-extern void BasicAAStub();
-static IncludeFile HDR_INCLUDE_BASICAA_CPP((void*)&BasicAAStub);
+extern int BasicAAStub;
+static IncludeFile HDR_INCLUDE_BASICAA_CPP(&BasicAAStub);
 
 } // End llvm namespace
 
index 734306015c0fbad2aa48cf3379a4853aa98bde3e..5602cec26ec124123836f28d6fb41eab7b61131e 100644 (file)
@@ -155,7 +155,7 @@ public:
   void dump() const;
   
   // stub - dummy function, just ignore it
-  static void stub();
+  static int stub;
 protected:
 
   // destroy - Release memory for the call graph
@@ -289,7 +289,7 @@ template<> struct GraphTraits<const CallGraph*> :
 
 // Make sure that any clients of this file link in CallGraph.cpp
 static IncludeFile
-CALLGRAPH_INCLUDE_FILE((void*)&CallGraph::stub);
+CALLGRAPH_INCLUDE_FILE(&CallGraph::stub);
 
 extern void BasicCallGraphStub();
 static IncludeFile HDR_INCLUDE_CALLGRAPH_CPP((void*)&BasicCallGraphStub);
index d73b407d21fd44c14c87f6db7468aae4513021d2..224e529915fa51dded46fd3af3a0334907e23c88 100644 (file)
@@ -276,7 +276,7 @@ public:
   }
 
   // stub - dummy function, just ignore it
-  static void stub();
+  static int stub;
 };
 
 
@@ -654,7 +654,7 @@ private:
 
 // Make sure that any clients of this file link in Dominators.cpp
 static IncludeFile
-DOMINATORS_INCLUDE_FILE((void*)&DominatorSet::stub);
+DOMINATORS_INCLUDE_FILE(&DominatorSet::stub);
 } // End llvm namespace
 
 #endif
index 92f3677502d78562636c2cb306fe302be71ea19b..e16fe9d7c30199b567c31a5874dc7c35bae26e03 100644 (file)
@@ -55,12 +55,12 @@ public:
   }
 
   // stub - dummy function, just ignore it
-  static void stub();
+  static int stub;
 };
 
 // Make sure that any clients of this file link in PostDominators.cpp
 static IncludeFile
-FIND_USED_TYPES_INCLUDE_FILE((void*)(&FindUsedTypes::stub));
+FIND_USED_TYPES_INCLUDE_FILE(&FindUsedTypes::stub);
 
 } // End llvm namespace
 
index 425c33f418b199be38c668202e3ace75a5f60ab7..065ce31d8bbd688a1324862ae686377754cb6ec4 100644 (file)
@@ -295,7 +295,7 @@ public:
   /// BasicBlocks to loops.
   void removeBlock(BasicBlock *BB);
 
-  static void stub();  // Noop
+  static int stub;  // Noop
 private:
   void Calculate(ETForest &EF);
   Loop *ConsiderForLoop(BasicBlock *BB, ETForest &EF);
@@ -306,7 +306,7 @@ private:
 
 // Make sure that any clients of this file link in LoopInfo.cpp
 static IncludeFile
-LOOP_INFO_INCLUDE_FILE((void*)(&LoopInfo::stub));
+LOOP_INFO_INCLUDE_FILE(&LoopInfo::stub);
 
 // Allow clients to walk the list of nested loops...
 template <> struct GraphTraits<const Loop*> {
index b9a1feb8ba323ee1c68e4e4bd3dd3185a2b4e551..1436be30375f57e95abcddb3c17d7159b793a109 100644 (file)
@@ -129,7 +129,7 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
   }
 
   // stub - dummy function, just ignore it
-  static void stub();
+  static int stub;
 
 private:
   const DomSetType &calculate(const PostDominatorTree &DT,
@@ -138,7 +138,7 @@ private:
 
 // Make sure that any clients of this file link in PostDominators.cpp
 static IncludeFile
-POST_DOMINATOR_INCLUDE_FILE((void*)&PostDominanceFrontier::stub);
+POST_DOMINATOR_INCLUDE_FILE(&PostDominanceFrontier::stub);
 
 } // End llvm namespace
 
index 6169955d94c1b449ac0089257c40ca8b2ce21fd1..2fc949766e7a9fbedd23d636ca466bec77417249 100644 (file)
@@ -65,9 +65,9 @@ struct ValueNumbering {
   }
 };
 
-extern void BasicValueNumberingStub();
+extern int BasicValueNumberingStub;
 static IncludeFile
-HDR_INCLUDE_VALUENUMBERING_CPP((void*)&BasicValueNumberingStub);
+HDR_INCLUDE_VALUENUMBERING_CPP(&BasicValueNumberingStub);
 
 } // End llvm namespace
 
index 15a27e7a47713f8934080ae20b7c44a0bf478a0a..6d5a37515debb152afbed0fffa4e9e9b43632c9f 100644 (file)
@@ -189,6 +189,6 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
 // being linked into the tool that uses it.
 //
 namespace llvm {
-  extern void BasicAAStub();
+  extern int BasicAAStub;
 }
 static IncludeFile INCLUDE_BASICAA_CPP((void*)&BasicAAStub);
index 2a37ab87fa4ae8c306acbf4043ec8521d822e47f..3cda92e49f5755b80142dc8ceb6659ae627e15db 100644 (file)
@@ -27,7 +27,7 @@
 using namespace llvm;
 
 // Make sure that anything that uses AliasAnalysis pulls in this file...
-void llvm::BasicAAStub() {}
+int llvm::BasicAAStub;
 
 namespace {
   /// NoAA - This class implements the -no-aa pass, which always returns "I
index 9089afe1a97ad7b96b245009e70ff18a7f8a62ea..71b303beca9b218d0709eba20543de46bf4826d5 100644 (file)
@@ -258,7 +258,7 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
 
 
 
-void CallGraph::stub() {}
+int CallGraph::stub; // to ensure linkage of this file.
 
 void CallGraphNode::print(std::ostream &OS) const {
   if (Function *F = getFunction())
index 09e14a87d40a5405b71b05a1ab4f6904fcb53b6c..f7efc7d3a4157efb9a876e6e8cd0b95701444a75 100644 (file)
@@ -25,7 +25,7 @@ static RegisterAnalysis<FindUsedTypes>
 X("printusedtypes", "Find Used Types");
 
 // stub to help linkage
-void FindUsedTypes::stub() {}
+int FindUsedTypes::stub; // to ensure linkage of this file
 
 // IncorporateType - Incorporate one type and all of its subtypes into the
 // collection of used types.
index 2860aa492ce6021d6a725f0aee530dbf80b172ca..f2ef17682fc8d0a2e75f96647fe4dbe60b98d638 100644 (file)
@@ -86,7 +86,7 @@ void Loop::dump() const {
 //===----------------------------------------------------------------------===//
 // LoopInfo implementation
 //
-void LoopInfo::stub() {}
+int LoopInfo::stub;
 
 bool LoopInfo::runOnFunction(Function &) {
   releaseMemory();
index b8b173e1ab46c5de3a5a011acd95a7569e59d441..611ea60a672f943f16fca33a768a6568d340c38c 100644 (file)
@@ -360,6 +360,5 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT,
 }
 
 // stub - a dummy function to make linking work ok.
-void PostDominanceFrontier::stub() {
-}
+int PostDominanceFrontier::stub;
 
index 9a359378c8ad746d20d65993c330c9fc91f60acc..06482224544c2be37953d02b57e330c894d3c601 100644 (file)
@@ -239,4 +239,4 @@ void BVNImpl::handleTernaryInst(Instruction &I) {
 }
 
 
-void llvm::BasicValueNumberingStub() { }
+int llvm::BasicValueNumberingStub; // to ensure linkage of this file
index 24b3e87cafd9c73abf17dc67068565ea46a87275..a0a6d253b2809e159d8d1e842512b15e74668dba 100644 (file)
@@ -304,7 +304,7 @@ bool DominatorSet::runOnFunction(Function &F) {
   return false;
 }
 
-void DominatorSet::stub() {}
+int DominatorSet::stub;
 
 namespace llvm {
 static std::ostream &operator<<(std::ostream &o,