For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index 233462f..73b49be 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -525,7 +525,6 @@
   std::cout << "\n*** Debugging optimizer crash!\n";
 
   // Reduce the list of passes which causes the optimizer to crash...
-  unsigned OldSize = PassesToRun.size();
   if (!BugpointIsInterrupted)
     ReducePassList(*this).reduceList(PassesToRun);
 
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 3503f7b..850fb83 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -747,7 +747,7 @@
 
           // Pass on the arguments to the real function, return its result
           if (F->getReturnType() == Type::VoidTy) {
-            CallInst *Call = new CallInst(FuncPtr, Args, "", DoCallBB);
+            new CallInst(FuncPtr, Args, "", DoCallBB);
             new ReturnInst(DoCallBB);
           } else {
             CallInst *Call = new CallInst(FuncPtr, Args, "retval", DoCallBB);
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 7f13bf2..1e8bcec 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -445,7 +445,6 @@
 doExtract(std::string* ErrMsg) {
   if (buildPaths(false, ErrMsg))
     return true;
-  unsigned countDown = Count;
   for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
        I != E; ++I ) {
     if (Paths.empty() ||
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 2ac7834..01fa513 100644
--- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -57,7 +57,6 @@
     sys::PrintStackTraceOnErrorSignal();
 
     std::ostream* Out = &std::cout;  // Default to printing to stdout...
-    std::istream* In  = &std::cin;   // Default to reading stdin
     std::string ErrorMessage;
     BytecodeAnalysis bca;
 
diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp
index f74294f..1512af6 100644
--- a/tools/llvm2cpp/CppWriter.cpp
+++ b/tools/llvm2cpp/CppWriter.cpp
@@ -383,7 +383,7 @@
   if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(val)) {
     name = std::string("gvar_") + 
            getTypePrefix(GV->getType()->getElementType());
-  } else if (const Function* F = dyn_cast<Function>(val)) {
+  } else if (isa<Function>(val)) {
     name = std::string("func_");
   } else if (const Constant* C = dyn_cast<Constant>(val)) {
     name = std::string("const_") + getTypePrefix(C->getType());
@@ -536,7 +536,6 @@
       break;
     }
     case Type::OpaqueTyID: {
-      const OpaqueType* OT = cast<OpaqueType>(Ty);
       Out << "OpaqueType* " << typeName << " = OpaqueType::get();";
       nl(Out);
       break;
diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp
index 46dbd89..18aab21 100644
--- a/tools/llvmc/CompilerDriver.cpp
+++ b/tools/llvmc/CompilerDriver.cpp
@@ -62,13 +62,6 @@
   DumpAction(&cd->Linker);
 }
 
-/// This specifies the passes to run for OPT_FAST_COMPILE (-O1)
-/// which should reduce the volume of code and make compilation
-/// faster. This is also safe on any llvm module.
-static const char* DefaultFastCompileOptimizations[] = {
-  "-simplifycfg", "-mem2reg", "-instcombine"
-};
-
 class CompilerDriverImpl : public CompilerDriver {
 /// @name Constructors
 /// @{
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 0602289..5a6adcd 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -163,7 +163,6 @@
     // FIXME: The choice of target should be controllable on the command line.
     std::auto_ptr<TargetMachine> target;
 
-    TargetMachine* TM = NULL;
     std::string ErrorMessage;
 
     // Load the input module...
@@ -233,9 +232,9 @@
         Passes.add(P);
         
         if (AnalyzeOnly) {
-          if (BasicBlockPass *BBP = dynamic_cast<BasicBlockPass*>(P))
+          if (dynamic_cast<BasicBlockPass*>(P))
             Passes.add(new BasicBlockPassPrinter(PassInf));
-          else if (FunctionPass *FP = dynamic_cast<FunctionPass*>(P))
+          else if (dynamic_cast<FunctionPass*>(P))
             Passes.add(new FunctionPassPrinter(PassInf));
           else
             Passes.add(new ModulePassPrinter(PassInf));