Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
diff --git a/tools/generate-operator-out.py b/tools/generate-operator-out.py
index f666ad1..2b57222 100755
--- a/tools/generate-operator-out.py
+++ b/tools/generate-operator-out.py
@@ -39,6 +39,7 @@
 def ProcessFile(filename):
   lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n')
   in_enum = False
+  is_enum_private = False
   is_enum_class = False
   line_number = 0
   
@@ -57,15 +58,16 @@
         
         # Except when it's private
         if m.group(3) is not None:
-          continue
-        
-        is_enum_class = m.group(1) is not None
-        enum_name = m.group(2)
-        if len(enclosing_classes) > 0:
-          enum_name = '::'.join(enclosing_classes) + '::' + enum_name
-        _ENUMS[enum_name] = []
-        _NAMESPACES[enum_name] = '::'.join(namespaces)
-        _ENUM_CLASSES[enum_name] = is_enum_class
+          is_enum_private = True
+        else:
+          is_enum_private = False
+          is_enum_class = m.group(1) is not None
+          enum_name = m.group(2)
+          if len(enclosing_classes) > 0:
+            enum_name = '::'.join(enclosing_classes) + '::' + enum_name
+          _ENUMS[enum_name] = []
+          _NAMESPACES[enum_name] = '::'.join(namespaces)
+          _ENUM_CLASSES[enum_name] = is_enum_class
         in_enum = True
         continue
 
@@ -80,11 +82,11 @@
         continue
 
       # Is this the start or end of an enclosing class or struct?
-      m = re.compile(r'^(?:class|struct)(?: MANAGED)? (\S+).* \{').search(raw_line)
+      m = re.compile(r'^\s*(?:class|struct)(?: MANAGED)?(?: PACKED\([0-9]\))? (\S+).* \{').search(raw_line)
       if m:
         enclosing_classes.append(m.group(1))
         continue
-      m = re.compile(r'^\};').search(raw_line)
+      m = re.compile(r'^\s*\}( .*)?;').search(raw_line)
       if m:
         enclosing_classes = enclosing_classes[0:len(enclosing_classes) - 1]
         continue
@@ -99,6 +101,9 @@
       in_enum = False
       continue
 
+    if is_enum_private:
+      continue
+
     # The only useful thing in comments is the <<alternate text>> syntax for
     # overriding the default enum value names. Pull that out...
     enum_text = None
@@ -146,6 +151,7 @@
 
     # There shouldn't be anything left.
     if len(rest):
+      sys.stderr.write('%s\n' % (rest))
       Confused(filename, line_number, raw_line)
 
     if len(enclosing_classes) > 0: