Subzero: Fix the g++ build (e.g. Windows).

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4006
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/773583004
diff --git a/src/IceELFSection.cpp b/src/IceELFSection.cpp
index 1910e77..fd49e61 100644
--- a/src/IceELFSection.cpp
+++ b/src/IceELFSection.cpp
@@ -55,6 +55,7 @@
   else
     Unique = GlobalSymbols.insert(std::make_pair(Key, NewSymbol)).second;
   assert(Unique);
+  (void)Unique;
 }
 
 void ELFSymbolTableSection::noteUndefinedSym(const IceString &Name,
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 095f288..2f5269b 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -26,12 +26,14 @@
 #include "IceTimerTree.h"
 #include "IceTypes.h"
 
-template <> struct std::hash<Ice::RelocatableTuple> {
-  std::size_t operator()(const Ice::RelocatableTuple &Key) const {
-    return std::hash<Ice::IceString>()(Key.Name) +
-           std::hash<Ice::RelocOffsetT>()(Key.Offset);
+namespace std {
+template <> struct hash<Ice::RelocatableTuple> {
+  size_t operator()(const Ice::RelocatableTuple &Key) const {
+    return hash<Ice::IceString>()(Key.Name) +
+           hash<Ice::RelocOffsetT>()(Key.Offset);
   }
 };
+} // end of namespace std
 
 namespace Ice {
 
diff --git a/src/IceInst.h b/src/IceInst.h
index 16b1b65..15751d3 100644
--- a/src/IceInst.h
+++ b/src/IceInst.h
@@ -128,8 +128,17 @@
   // result in any native instructions, and a target-specific
   // instruction results in a single native instruction.
   virtual uint32_t getEmitInstCount() const { return 0; }
-  virtual void emit(const Cfg *Func) const = 0;
-  virtual void emitIAS(const Cfg *Func) const = 0;
+  // TODO(stichnot): Change Inst back to abstract once the g++ build
+  // issue is fixed.  llvm::ilist<Ice::Inst> doesn't work under g++
+  // because the resize(size_t, Ice::Inst) method is incorrectly
+  // declared and thus doesn't allow the abstract class Ice::Inst.
+  // The method should be declared resize(size_t, const Ice::Inst &).
+  // virtual void emit(const Cfg *Func) const = 0;
+  // virtual void emitIAS(const Cfg *Func) const = 0;
+  virtual void emit(const Cfg *) const {
+    llvm_unreachable("emit on abstract class");
+  }
+  virtual void emitIAS(const Cfg *Func) const { emit(Func); }
   virtual void dump(const Cfg *Func) const;
   virtual void dumpExtras(const Cfg *Func) const;
   void dumpDecorated(const Cfg *Func) const;
@@ -835,11 +844,12 @@
 
 } // end of namespace Ice
 
+namespace llvm {
+
 // Override the default ilist traits so that Inst's private ctor and
 // deleted dtor aren't invoked.
 template <>
-struct llvm::ilist_traits<Ice::Inst>
-    : public llvm::ilist_default_traits<Ice::Inst> {
+struct ilist_traits<Ice::Inst> : public ilist_default_traits<Ice::Inst> {
   Ice::Inst *createSentinel() const {
     return static_cast<Ice::Inst *>(&Sentinel);
   }
@@ -853,4 +863,6 @@
   mutable ilist_half_node<Ice::Inst> Sentinel;
 };
 
+} // end of namespace llvm
+
 #endif // SUBZERO_SRC_ICEINST_H
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index d7ea10b..fc2a7ca 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -253,6 +253,7 @@
     assert(FirstOrSingleDefinition);
     return FirstOrSingleDefinition;
   }
+  return NULL;
 }
 
 const Inst *VariableTracking::getSingleDefinition() const {
@@ -265,6 +266,7 @@
     assert(FirstOrSingleDefinition);
     return FirstOrSingleDefinition;
   }
+  return NULL;
 }
 
 void VariablesMetadata::init(MetadataKind TrackingKind) {
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 3f14ae0..b74de0a 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -1681,6 +1681,8 @@
       Cond = Ice::InstIcmp::Sle;
       return true;
     default:
+      // Make sure Cond is always initialized.
+      Cond = static_cast<Ice::InstIcmp::ICond>(0);
       return false;
     }
   }
@@ -1739,6 +1741,8 @@
       Cond = Ice::InstFcmp::True;
       return true;
     default:
+      // Make sure Cond is always initialized.
+      Cond = static_cast<Ice::InstFcmp::FCond>(0);
       return false;
     }
   }