THRIFT-2784 Eliminate compiler warnings in generated C++ code

Patch: Roger Meier
diff --git a/compiler/cpp/src/generate/t_as3_generator.cc b/compiler/cpp/src/generate/t_as3_generator.cc
index 42486d6..e84ab0d 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/generate/t_as3_generator.cc
@@ -215,7 +215,7 @@
   std::ofstream f_service_;
   std::string package_dir_;
   
-  bool bindable_;	
+  bool bindable_; 
 };
 
 
@@ -332,8 +332,8 @@
       }
     }
 
-    as3_thrift_gen_imports((*f_iter)->get_arglist(), imports);	    
-    as3_thrift_gen_imports((*f_iter)->get_xceptions(), imports);	    
+    as3_thrift_gen_imports((*f_iter)->get_arglist(), imports);      
+    as3_thrift_gen_imports((*f_iter)->get_xceptions(), imports);      
 
   }
  
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 26c3374..e143171 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -3506,12 +3506,12 @@
       if (t->is_map() || t->is_set()) {
         f_types_impl_ << indent() << "if (tobject->" << name << " != NULL)" << endl;
         f_types_impl_ << indent() << "{" << endl;
-	indent_up();
-	f_types_impl_ <<
-	indent() << "g_hash_table_destroy (tobject->" << name << ");" << endl;
-	f_types_impl_ << indent() << "tobject->" << name << " = NULL;" << endl;
-	indent_down();
-	f_types_impl_ << indent() << "}" << endl;
+        indent_up();
+        f_types_impl_ <<
+        indent() << "g_hash_table_destroy (tobject->" << name << ");" << endl;
+        f_types_impl_ << indent() << "tobject->" << name << " = NULL;" << endl;
+        indent_down();
+        f_types_impl_ << indent() << "}" << endl;
       } else if (t->is_list()) {
         t_type *etype = ((t_list *) t)->get_elem_type();
         string destructor_function = "g_ptr_array_unref";
diff --git a/compiler/cpp/src/generate/t_d_generator.cc b/compiler/cpp/src/generate/t_d_generator.cc
index ecf908b..c23aa1f 100644
--- a/compiler/cpp/src/generate/t_d_generator.cc
+++ b/compiler/cpp/src/generate/t_d_generator.cc
@@ -743,7 +743,7 @@
         ss << "Compiler error: Invalid requirement level " << req;
         throw ss.str();
       }
-	  
+    
     }
   }
 
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index 8185391..35b8da9 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -57,7 +57,10 @@
       : t_oop_generator(program)
     {
       (void) option_string;
-
+      indent_impl_ = 0;
+      has_forward = false;
+      has_enum = false;
+      has_const = false;
       std::map<std::string, std::string>::const_iterator iter;
 
       iter = parsed_options.find("ansistr_binary");
@@ -1338,7 +1341,7 @@
 
 
 void t_delphi_generator::generate_delphi_struct_type_factory( ostream& out, string cls_prefix, t_struct* tstruct, bool is_exception, bool is_result, bool is_x_factory) {
-  
+  (void) cls_prefix;
   if (is_exception)
     return;
   if (is_result)
@@ -1362,6 +1365,7 @@
 }
 
 void t_delphi_generator::generate_delphi_struct_type_factory_registration( ostream& out, string cls_prefix, t_struct* tstruct, bool is_exception, bool is_result, bool is_x_factory) {
+  (void) cls_prefix;
   if (is_exception)
     return;
   if (is_result)
@@ -2952,8 +2956,13 @@
   indent(out) << "function Get__isset_" << prop_name( tfield, is_xception) << ": Boolean;" << endl;
 }
 
-void t_delphi_generator::generate_delphi_clear_union_value(ostream& out, std::string cls_prefix, std::string name, t_type* type, t_field* tfield, std::string fieldPrefix, bool is_xception_class, bool is_union, bool is_xception_factory, std::string xception_factroy_name) {
+void t_delphi_generator::generate_delphi_clear_union_value(ostream& out, std::string cls_prefix, std::string name, t_type* type, t_field* tfield, std::string fieldPrefix, bool is_xception_class, bool is_union, bool is_xception_factory, std::string xception_factory_name) {
+  (void) cls_prefix;
+  (void) name;
   (void) type;
+  (void) is_union;
+  (void) is_xception_factory;
+  (void) xception_factory_name;
 
   t_type * ftype = tfield->get_type();
   bool is_xception = ftype->is_xception();
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index 54ad887..36a4e36 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -73,7 +73,8 @@
         const std::map<std::string, std::string>& parsed_options,
         const std::string& option_string)
         : t_generator(program) {
-        std::map<std::string, std::string>::const_iterator iter;
+    	(void) option_string;
+    	std::map<std::string, std::string>::const_iterator iter;
         out_dir_base_ = "gen-go";
         gen_thrift_import_ = default_thrift_import;
 
@@ -344,6 +345,7 @@
 
 //returns false if field could not use comparison to default value as !IsSet*
 bool t_go_generator::is_pointer_field(t_field* tfield, bool in_container_value) {
+	(void) in_container_value;
 	if (tfield->annotations_.count("cpp.ref")!=0) {
 		return true;
 	}
@@ -1250,6 +1252,7 @@
         const string& tstruct_name,
         bool is_result)
 {
+    (void) is_result;
     const vector<t_field*>& fields = tstruct->get_members();
     vector<t_field*>::const_iterator f_iter;
     const string escaped_tstruct_name(escape_string(tstruct->get_name()));
@@ -1292,7 +1295,8 @@
         const string& tstruct_name,
         bool is_result)
 {
-    const vector<t_field*>& fields = tstruct->get_members();
+	(void) is_result;
+	const vector<t_field*>& fields = tstruct->get_members();
     vector<t_field*>::const_iterator f_iter;
     string escaped_tstruct_name(escape_string(tstruct->get_name()));
     out <<
@@ -1416,7 +1420,8 @@
         const string& tstruct_name,
         bool is_result)
 {
-    string name(tstruct->get_name());
+	(void) is_result;
+	string name(tstruct->get_name());
     const vector<t_field*>& fields = tstruct->get_sorted_members();
     vector<t_field*>::const_iterator f_iter;
     indent(out) <<
@@ -2627,7 +2632,9 @@
         bool inkey,
         bool in_container_value)
 {
-    t_type* orig_type = tfield->get_type();
+    (void) inclass;
+    (void) coerceData;
+	t_type* orig_type = tfield->get_type();
     t_type* type = get_true_type(orig_type);
     string name(prefix + publicize(variable_name_to_go_name(tfield->get_name())));
 
@@ -2848,6 +2855,7 @@
         bool   declare,
         string prefix)
 {
+    (void) declare;
     string key = tmp("_key");
     string val = tmp("_val");
     t_field fkey(tmap->get_key_type(), key);
@@ -2869,6 +2877,7 @@
         bool   declare,
         string prefix)
 {
+    (void) declare;
     string elem = tmp("_elem");
     t_field felem(tset->get_elem_type(), elem);
     felem.set_req(t_field::T_OPT_IN_REQ_OUT);
@@ -2885,6 +2894,7 @@
         bool   declare,
         string prefix)
 {
+    (void) declare;
     string elem = tmp("_elem");
     t_field felem(((t_list*)tlist)->get_elem_type(), elem);
     felem.set_req(t_field::T_OPT_IN_REQ_OUT);
@@ -2997,6 +3007,7 @@
         t_struct* tstruct,
         string prefix)
 {
+    (void) tstruct;
     out <<
         indent() << "if err := " << prefix << ".Write(oprot); err != nil {" << endl <<
         indent() << "  return fmt.Errorf(\"%T error writing struct: %s\", " << prefix << ", err)" << endl <<
@@ -3428,7 +3439,8 @@
  */
 string t_go_generator::type_to_go_type_with_opt(t_type* type, bool optional_field, bool is_container_value)
 {
-    string maybe_pointer(optional_field ? "*" : "");
+	(void) is_container_value;
+	string maybe_pointer(optional_field ? "*" : "");
     if (type->is_base_type()) {
         t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
 
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/generate/t_html_generator.cc
index 8ac7ddb..8632721 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/generate/t_html_generator.cc
@@ -620,7 +620,7 @@
     }
 
     // some control code?
-    if( (0 <= ic) && (31 >= ic))
+    if(ic <= 31)
     {
       switch( c)
       {
@@ -764,6 +764,7 @@
         break;
       default:
           f_out_ << "UNKNOWN BASE TYPE";
+          break;
     }
   } else if (truetype->is_enum()) {
     f_out_ << escape_html(truetype->get_name()) << "." << escape_html(tvalue->get_identifier_name());
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index ddf4c91..11b4754 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -2414,10 +2414,15 @@
       case t_base_type::TYPE_I32    : return       "org.apache.thrift.protocol.TType.I32"; break;
       case t_base_type::TYPE_I64    : return       "org.apache.thrift.protocol.TType.I64"; break;
       case t_base_type::TYPE_DOUBLE : return    "org.apache.thrift.protocol.TType.DOUBLE"; break;
-      default : throw std::runtime_error("Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!"); break; // This should never happen!
+      default :
+        throw std::runtime_error("Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!");
+        return "Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!";
+        break; // This should never happen!
     }
   } else {
-    throw std::runtime_error("Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!"); // This should never happen!
+      throw std::runtime_error("Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!");
+      return "Unknown thrift type \"" + type->get_name() + "\" passed to t_java_generator::get_java_type_string!";
+      // This should never happen!
   }
 }
 
@@ -3922,6 +3927,7 @@
 }
 
 string t_java_generator::async_function_call_arglist(t_function* tfunc, bool use_base_method, bool include_types) {
+  (void) use_base_method;
   std::string arglist = "";
   if (tfunc->get_arglist()->get_members().size() > 0) {
     arglist = argument_list(tfunc->get_arglist(), include_types) + ", ";
@@ -3959,6 +3965,7 @@
 }
 
 string t_java_generator::async_argument_list(t_function* tfunct, t_struct* tstruct, t_type* ttype, bool include_types) {
+  (void) tfunct;
   (void) ttype;
   string result = "";
   const vector<t_field*>& fields = tstruct->get_members();
diff --git a/compiler/cpp/src/generate/t_json_generator.cc b/compiler/cpp/src/generate/t_json_generator.cc
index 14a2f89..290ffaa 100644
--- a/compiler/cpp/src/generate/t_json_generator.cc
+++ b/compiler/cpp/src/generate/t_json_generator.cc
@@ -51,6 +51,8 @@
     const std::string& option_string)
     : t_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-json";
   }
 
@@ -405,6 +407,7 @@
             break;
         default:
             write_key("required", "false");
+            break;
   }
   if (field->get_value())
     write_key("default", get_const_value(field->get_value()));
diff --git a/compiler/cpp/src/generate/t_lua_generator.cc b/compiler/cpp/src/generate/t_lua_generator.cc
index 6acc6a9..7303c21 100644
--- a/compiler/cpp/src/generate/t_lua_generator.cc
+++ b/compiler/cpp/src/generate/t_lua_generator.cc
@@ -40,6 +40,7 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) option_string;
     std::map<std::string, std::string>::const_iterator iter;
 
     iter = parsed_options.find("omit_requires");
@@ -1057,6 +1058,7 @@
 void t_lua_generator::generate_serialize_struct(ofstream &out,
                                                 t_struct* tstruct,
                                                 string prefix) {
+  (void) tstruct;
   indent(out) << prefix << ":write(oprot)" << endl;
 }
 
@@ -1167,6 +1169,7 @@
 
 string t_lua_generator::function_signature(t_function* tfunction,
                                            string prefix) {
+  (void) prefix;
   std::string ret = tfunction->get_name() + "(" +
     argument_list(tfunction->get_arglist()) + ")";
   return ret;
diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc
index 0c34a13..ae57ec3 100644
--- a/compiler/cpp/src/generate/t_php_generator.cc
+++ b/compiler/cpp/src/generate/t_php_generator.cc
@@ -250,6 +250,7 @@
 
   //add a directory to allready existing namespace
   string php_namespace_directory(string directory, bool end = true) {
+    (void) directory;
     if(end) {
       return ";";
     } else {
@@ -413,8 +414,8 @@
   package_dir_ = get_out_dir();
 
   for (size_t i = 0; i < NSx.size(); ++i) {
-	package_dir_ = package_dir_ + "/" + NSx[i] + "/";
-	MKDIR(package_dir_.c_str());
+    package_dir_ = package_dir_ + "/" + NSx[i] + "/";
+    MKDIR(package_dir_.c_str());
   }
 
   // Make output file
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 5cf2738..1536f81 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -89,7 +89,7 @@
   const std::string& get_out_path() const { return out_path_; }
 
   // Create gen-* dir accessor
-  const bool is_out_path_absolute() const { return out_path_is_absolute_; }
+  bool is_out_path_absolute() const { return out_path_is_absolute_; }
 
   // Name accessor
   const std::string& get_name() const { return name_; }