Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 07ef2e5..5a24b26 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -242,11 +242,12 @@
 
   unsigned MismatchOperand = ~0U;
   for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
-    if (Operands[i] != Other.Operands[i])
+    if (Operands[i] != Other.Operands[i]) {
       if (MismatchOperand != ~0U)  // Already have one mismatch?
         return ~1U;
       else
         MismatchOperand = i;
+    }
   }
   return MismatchOperand;
 }
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index ddfaaac..0faaa72 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1342,14 +1342,14 @@
         while (TPN->ApplyTypeConstraints(P, false))
           /* Resolve all types */;
       
-        if (TPN->ContainsUnresolvedType())
+        if (TPN->ContainsUnresolvedType()) {
           if (iter == 0)
             throw "Value #" + utostr(i) + " of PredicateOperand '" +
               DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
           else
             throw "Value #" + utostr(i) + " of OptionalDefOperand '" +
               DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
-      
+        }
         DefaultOpInfo.DefaultOps.push_back(TPN);
       }
 
diff --git a/utils/TableGen/CodeGenRegisters.h b/utils/TableGen/CodeGenRegisters.h
index 4efae78..0f1b501 100644
--- a/utils/TableGen/CodeGenRegisters.h
+++ b/utils/TableGen/CodeGenRegisters.h
@@ -15,9 +15,10 @@
 #ifndef CODEGEN_REGISTERS_H
 #define CODEGEN_REGISTERS_H
 
+#include "llvm/CodeGen/ValueTypes.h"
 #include <string>
 #include <vector>
-#include "llvm/CodeGen/ValueTypes.h"
+#include <cstdlib>
 
 namespace llvm {
   class Record;
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index bdf6b64..6f562fa 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1123,7 +1123,7 @@
           Code += "), 0";
         emitCode(Code2 + Code + ");");
 
-        if (NodeHasChain)
+        if (NodeHasChain) {
           // Remember which op produces the chain.
           if (!isRoot)
             emitCode(ChainName + " = SDOperand(" + NodeName +
@@ -1131,6 +1131,7 @@
           else
             emitCode(ChainName + " = SDOperand(" + NodeName +
                      ", " + utostr(NumResults+NumDstRegs) + ");");
+        }
 
         if (!isRoot) {
           NodeOps.push_back("Tmp" + utostr(ResNo));
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index 9fa696e..2af35b0 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -17,6 +17,8 @@
 #include <ostream>
 #include "llvm/Config/config.h"
 #include <cctype>
+#include <cstdlib>
+#include <cstring>
 using namespace llvm;
 
 TGLexer::TGLexer(MemoryBuffer *StartBuf) : CurLineNo(1), CurBuf(StartBuf) {