THRIFT-916 compile with -Wall -Wextra without warning on Debian Lenny


git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1036250 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_as3_generator.cc b/compiler/cpp/src/generate/t_as3_generator.cc
index d06d933..aa258a1 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/generate/t_as3_generator.cc
@@ -44,6 +44,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("bindable");
@@ -285,7 +286,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_as3_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_as3_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Enums are a class with a set of static constants.
@@ -498,6 +501,7 @@
 }
 
 string t_as3_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+  (void) name;
   type = get_true_type(type);
   std::ostringstream render;
   
@@ -967,6 +971,8 @@
 }
 
 void t_as3_generator::generate_reflection_getters(ostringstream& out, t_type* type, string field_name, string cap_name) {
+  (void) type;
+  (void) cap_name;
   indent(out) << "case " << upcase_string(field_name) << ":" << endl;
   indent_up();
   indent(out) << "return this." << field_name << ";" << endl;
@@ -974,6 +980,8 @@
 }
 
 void t_as3_generator::generate_reflection_setters(ostringstream& out, t_type* type, string field_name, string cap_name) {
+  (void) type;
+  (void) cap_name;
   indent(out) << "case " << upcase_string(field_name) << ":" << endl;
   indent_up();
   indent(out) << "if (value == null) {" << endl;
@@ -1772,6 +1780,7 @@
  */
 void t_as3_generator::generate_process_function(t_service* tservice,
                                                  t_function* tfunction) {
+  (void) tservice;
   // Open class
   indent(f_service_) <<
   "private function " << tfunction->get_name() << "():Function {" << endl;
@@ -2194,6 +2203,7 @@
 void t_as3_generator::generate_serialize_struct(ofstream& out,
                                                  t_struct* tstruct,
                                                  string prefix) {
+  (void) tstruct;
   out <<
     indent() << prefix << ".write(oprot);" << endl;
 }
@@ -2313,6 +2323,7 @@
  * @return As3 type name, i.e. HashMap<Key,Value>
  */
 string t_as3_generator::type_name(t_type* ttype, bool in_container, bool in_init) {
+  (void) in_init;
   // In As3 typedefs are just resolved to their real type
   ttype = get_true_type(ttype);
   string prefix;
@@ -2349,6 +2360,7 @@
  */
 string t_as3_generator::base_type_name(t_base_type* type,
                                         bool in_container) {
+  (void) in_container;
   t_base_type::t_base tbase = type->get_base();
 
   switch (tbase) {
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index a569ae6..8d34bac 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -28,6 +28,8 @@
                       const map<string, string> &parsed_options,
                       const string &option_string) : t_oop_generator (program)
   {
+    (void) parsed_options;
+    (void) option_string;
     /* set the output directory */
     this->out_dir_base_ = "gen-c_glib";
 
@@ -520,6 +522,7 @@
 string
 t_c_glib_generator::type_name (t_type* ttype, bool in_typedef, bool is_const)
 {
+  (void) in_typedef;
   if (ttype->is_base_type ())
   {
     string bname = base_type_name ((t_base_type *) ttype);
@@ -1709,6 +1712,7 @@
 void
 t_c_glib_generator::generate_service_server (t_service *tservice)
 {
+  (void) tservice;
   /* get some C friendly service names */
   string service_name_u = initial_caps_to_underscores (service_name_);
   string service_name_uc = to_upper_case (service_name_u);
@@ -2349,6 +2353,7 @@
 t_c_glib_generator::generate_serialize_struct (ofstream &out, t_struct *tstruct,
                                           string prefix, int error_ret)
 {
+  (void) tstruct;
   out <<
     indent () << "if ((ret = thrift_struct_write (THRIFT_STRUCT (" << prefix << "), protocol, error)) < 0)" << endl <<
     indent () << "  return " << error_ret << ";" << endl <<
@@ -2823,6 +2828,7 @@
                                                   string prefix, string index,
                                                   int error_ret)
 {
+  (void) index;
   string elem = tmp ("_elem");
   t_field felem (tlist->get_elem_type (), elem);
 
diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/generate/t_cocoa_generator.cc
index 29ace00..26537ac 100644
--- a/compiler/cpp/src/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/generate/t_cocoa_generator.cc
@@ -43,6 +43,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("log_unexpected");
@@ -541,6 +542,7 @@
 void t_cocoa_generator::generate_cocoa_struct_field_accessor_declarations(ofstream &out,
                                                                           t_struct* tstruct,
                                                                           bool is_exception) {
+  (void) is_exception;
   const vector<t_field*>& members = tstruct->get_members();
   vector<t_field*>::const_iterator m_iter;
   for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
@@ -1019,6 +1021,7 @@
 void t_cocoa_generator::generate_cocoa_struct_field_accessor_implementations(ofstream& out,
                                                                              t_struct* tstruct,
                                                                              bool is_exception) {
+  (void) is_exception;
   const vector<t_field*>& fields = tstruct->get_members();
   vector<t_field*>::const_iterator f_iter;
   for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -1954,6 +1957,7 @@
 void t_cocoa_generator::generate_serialize_struct(ofstream& out,
                                                   t_struct* tstruct,
                                                   string fieldName) {
+  (void) tstruct;
   out <<
     indent() << "[" << fieldName << " write: outProtocol];" << endl;
 }
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index f5c8def..6fe3397 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -48,6 +48,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("pure_enums");
@@ -686,6 +687,7 @@
  *
  */
 string t_cpp_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+  (void) name;
   std::ostringstream render;
 
   if (type->is_base_type()) {
@@ -3389,6 +3391,7 @@
 void t_cpp_generator::generate_deserialize_struct(ofstream& out,
                                                   t_struct* tstruct,
                                                   string prefix) {
+  (void) tstruct;
   indent(out) <<
     "xfer += " << prefix << ".read(iprot);" << endl;
 }
@@ -3607,6 +3610,7 @@
 void t_cpp_generator::generate_serialize_struct(ofstream& out,
                                                 t_struct* tstruct,
                                                 string prefix) {
+  (void) tstruct;
   indent(out) <<
     "xfer += " << prefix << ".write(oprot);" << endl;
 }
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index d32652c..45ed646 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -44,6 +44,8 @@
         const std::string& option_string)
       : t_oop_generator(program)
     {
+      (void) parsed_options;
+      (void) option_string;
       out_dir_base_ = "gen-csharp";
     }
     void init_generator();
@@ -175,7 +177,9 @@
 }
 
 void t_csharp_generator::close_generator() { }
-void t_csharp_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_csharp_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 void t_csharp_generator::generate_enum(t_enum* tenum) {
   string f_enum_name = namespace_dir_+"/" + (tenum->get_name())+".cs";
@@ -334,6 +338,7 @@
 }
 
 std::string t_csharp_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+  (void) name;
   std::ostringstream render;
 
   if (type->is_base_type()) {
@@ -1096,6 +1101,7 @@
 }
 
 void t_csharp_generator::generate_process_function(t_service* tservice, t_function* tfunction) {
+  (void) tservice;
   indent(f_service_) <<
     "public void " << tfunction->get_name() << "_Process(int seqid, TProtocol iprot, TProtocol oprot)" << endl;
   scope_up(f_service_);
@@ -1424,6 +1430,7 @@
 }
 
 void t_csharp_generator::generate_serialize_struct(ofstream& out, t_struct* tstruct, string prefix) {
+  (void) tstruct;
   out <<
     indent() << prefix << ".Write(oprot);" << endl;
 }
@@ -1537,6 +1544,7 @@
 }
 
 string t_csharp_generator::type_name(t_type* ttype, bool in_container, bool in_init) {
+  (void) in_init;
   while (ttype->is_typedef()) {
     ttype = ((t_typedef*)ttype)->get_type();
   }
@@ -1567,6 +1575,7 @@
 }
 
 string t_csharp_generator::base_type_name(t_base_type* tbase, bool in_container) {
+  (void) in_container;
   switch (tbase->get_base()) {
     case t_base_type::TYPE_VOID:
       return "void";
diff --git a/compiler/cpp/src/generate/t_erl_generator.cc b/compiler/cpp/src/generate/t_erl_generator.cc
index 7e2ac75..0f9a822 100644
--- a/compiler/cpp/src/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/generate/t_erl_generator.cc
@@ -44,6 +44,8 @@
       const std::string& option_string)
     : t_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     program_name_[0] = tolower(program_name_[0]);
     service_name_[0] = tolower(service_name_[0]);
     out_dir_base_ = "gen-erl";
@@ -213,6 +215,7 @@
 }
 
 void t_erl_generator::hrl_footer(ostream& out, string name) {
+  (void) name;
   out << "-endif." << endl;
 }
 
@@ -274,6 +277,7 @@
  * @param ttypedef The type definition
  */
 void t_erl_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
 }
 
 /**
@@ -472,6 +476,7 @@
                                                      bool is_exception,
                                                      bool is_result)
 {
+  (void) is_result;
   const vector<t_field*>& members = tstruct->get_members();
   vector<t_field*>::const_iterator m_iter;
 
@@ -612,6 +617,7 @@
  * @param tfunction The function
  */
 void t_erl_generator::generate_erl_function_helpers(t_function* tfunction) {
+  (void) tfunction;
 }
 
 /**
@@ -655,7 +661,7 @@
  */
 void t_erl_generator::generate_function_info(t_service* tservice,
                                                 t_function* tfunction) {
-
+  (void) tservice;
   string name_atom = "'" + tfunction->get_name() + "'";
 
 
diff --git a/compiler/cpp/src/generate/t_generator.h b/compiler/cpp/src/generate/t_generator.h
index 458922f..4de0568 100644
--- a/compiler/cpp/src/generate/t_generator.h
+++ b/compiler/cpp/src/generate/t_generator.h
@@ -73,7 +73,10 @@
    * Will be called with subnamespace, i.e. is_valid_namespace("twisted")
    * will be called for the above example.
    */
-  static bool is_valid_namespace(const std::string& sub_namespace) { return false; }
+  static bool is_valid_namespace(const std::string& sub_namespace) {
+    (void) sub_namespace;
+    return false;
+  }
 
   /**
    * Escape string to use one in generated sources.
@@ -102,7 +105,9 @@
 
   virtual void generate_typedef  (t_typedef*  ttypedef)  = 0;
   virtual void generate_enum     (t_enum*     tenum)     = 0;
-  virtual void generate_const    (t_const*    tconst) {}
+  virtual void generate_const    (t_const*    tconst) {
+    (void) tconst;
+  }
   virtual void generate_struct   (t_struct*   tstruct)   = 0;
   virtual void generate_service  (t_service*  tservice)  = 0;
   virtual void generate_xception (t_struct*   txception) {
diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc
index 36eb36c..fcc055a 100644
--- a/compiler/cpp/src/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/generate/t_hs_generator.cc
@@ -43,6 +43,8 @@
                  const string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-hs";
   }
 
@@ -517,6 +519,7 @@
                                                    t_struct* tstruct,
                                                    bool is_exception,
                                                    bool helper) {
+  (void) helper;
   string tname = type_name(tstruct);
   string name = tstruct->get_name();
 
@@ -992,6 +995,7 @@
  */
 void t_hs_generator::generate_process_function(t_service* tservice,
                                                t_function* tfunction) {
+  (void) tservice;
   // Open function
   string funname = decapitalize(tfunction->get_name());
   indent(f_service_) << "process_" << funname << " (seqid, iprot, oprot, handler) = do" << endl;
@@ -1098,6 +1102,7 @@
 void t_hs_generator::generate_deserialize_field(ofstream &out,
                                                 t_field* tfield,
                                                 string prefix) {
+  (void) prefix;
   t_type* type = tfield->get_type();
   generate_deserialize_type(out,type);
 }
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/generate/t_html_generator.cc
index d1b2f05..881e0f8 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/generate/t_html_generator.cc
@@ -44,6 +44,8 @@
       const std::string& option_string)
     : t_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;  
     out_dir_base_ = "gen-html";
     escape_.clear();
     escape_['&']  = "&amp;";
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index 9471774..7acd9ac 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -44,6 +44,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("beans");
@@ -356,7 +357,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_java_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_java_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Enums are a class with a set of static constants.
@@ -585,6 +588,7 @@
 }
 
 string t_java_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+  (void) name;
   type = get_true_type(type);
   std::ostringstream render;
 
@@ -978,6 +982,7 @@
 }
 
 void t_java_generator::generate_get_struct_desc(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   indent(out) << "@Override" << endl;
   indent(out) << "protected TStruct getStructDesc() {" << endl;
   indent(out) << "  return STRUCT_DESC;" << endl;
@@ -1013,6 +1018,7 @@
 }
 
 void t_java_generator::generate_union_hashcode(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   if (gen_hash_code_) {
     indent(out) << "@Override" << endl;
     indent(out) << "public int hashCode() {" << endl;
@@ -1653,6 +1659,7 @@
 }
 
 void t_java_generator::generate_java_struct_field_by_id(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   indent(out) << "public _Fields fieldForId(int fieldId) {" << endl;
   indent(out) << "  return _Fields.findByThriftId(fieldId);" << endl;
   indent(out) << "}" << endl << endl;
@@ -2704,6 +2711,7 @@
  */
 void t_java_generator::generate_process_function(t_service* tservice,
                                                  t_function* tfunction) {
+  (void) tservice;
   // Open class
   indent(f_service_) <<
     "private class " << tfunction->get_name() << " implements ProcessFunction {" << endl;
@@ -3141,6 +3149,7 @@
 void t_java_generator::generate_serialize_struct(ofstream& out,
                                                  t_struct* tstruct,
                                                  string prefix) {
+  (void) tstruct;
   out <<
     indent() << prefix << ".write(oprot);" << endl;
 }
@@ -3228,6 +3237,7 @@
                                                       t_map* tmap,
                                                       string iter,
                                                       string map) {
+  (void) map;
   t_field kfield(tmap->get_key_type(), iter + ".getKey()");
   generate_serialize_field(out, &kfield, "");
   t_field vfield(tmap->get_val_type(), iter + ".getValue()");
@@ -3474,6 +3484,7 @@
 }
 
 string t_java_generator::async_argument_list(t_function* tfunct, t_struct* tstruct, t_type* ttype, bool include_types) {
+  (void) ttype;
   string result = "";
   const vector<t_field*>& fields = tstruct->get_members();
   vector<t_field*>::const_iterator f_iter;
@@ -3721,6 +3732,7 @@
 }
 
 void t_java_generator::generate_deep_copy_non_container(ofstream& out, std::string source_name, std::string dest_name, t_type* type) {
+  (void) dest_name;
   if (type->is_base_type() || type->is_enum() || type->is_typedef()) {
     if (((t_base_type*)type)->is_binary()) {
       out << "TBaseHelper.copyBinary(" << source_name << ");" << endl;
diff --git a/compiler/cpp/src/generate/t_javame_generator.cc b/compiler/cpp/src/generate/t_javame_generator.cc
index ff2d285..b390239 100644
--- a/compiler/cpp/src/generate/t_javame_generator.cc
+++ b/compiler/cpp/src/generate/t_javame_generator.cc
@@ -44,6 +44,8 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     std::map<std::string, std::string>::const_iterator iter;
     out_dir_base_ = "gen-javame";
   }
@@ -313,7 +315,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_javame_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_javame_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Enums are a class with a set of static constants.
@@ -537,6 +541,7 @@
 }
 
 string t_javame_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+  (void) name;
   type = get_true_type(type);
   std::ostringstream render;
 
@@ -934,6 +939,7 @@
 }
 
 void t_javame_generator::generate_get_struct_desc(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   indent(out) << "protected TStruct getStructDesc() {" << endl;
   indent(out) << "  return STRUCT_DESC;" << endl;
   indent(out) << "}" << endl;
@@ -967,6 +973,7 @@
 }
 
 void t_javame_generator::generate_union_hashcode(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   indent(out) << "/**" << endl;
   indent(out) << " * If you'd like this to perform more respectably, use the hashcode generator option." << endl;
   indent(out) << " */" << endl;
@@ -1553,7 +1560,7 @@
 }
 
 void t_javame_generator::generate_generic_field_getters_setters(std::ofstream& out, t_struct* tstruct) {
-
+  (void) out;
   std::ostringstream getter_stream;
   std::ostringstream setter_stream;
 
@@ -2313,6 +2320,7 @@
  */
 void t_javame_generator::generate_process_function(t_service* tservice,
                                                  t_function* tfunction) {
+  (void) tservice;
   // Open class
   indent(f_service_) <<
     "private class " << tfunction->get_name() << " implements ProcessFunction {" << endl;
@@ -2754,6 +2762,7 @@
 void t_javame_generator::generate_serialize_struct(ofstream& out,
                                                  t_struct* tstruct,
                                                  string prefix) {
+  (void) tstruct;
   out <<
     indent() << prefix << ".write(oprot);" << endl;
 }
@@ -2881,6 +2890,8 @@
  * @return Java type name, i.e. Vector
  */
 string t_javame_generator::type_name(t_type* ttype, bool in_container, bool in_init, bool skip_generic) {
+  (void) in_init;
+  (void) skip_generic;
   // In Java typedefs are just resolved to their real type
   ttype = get_true_type(ttype);
   string prefix;
diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/generate/t_js_generator.cc
index 921cbb4..bb1033c 100644
--- a/compiler/cpp/src/generate/t_js_generator.cc
+++ b/compiler/cpp/src/generate/t_js_generator.cc
@@ -41,7 +41,8 @@
                 const std::map<std::string, std::string>& parsed_options,
                 const std::string& option_string) :
      t_oop_generator(program) {
-
+     (void) parsed_options;
+     (void) option_string;
      out_dir_base_ = "gen-js";
   }
 
@@ -262,7 +263,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_js_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_js_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Generates code for an enumerated type. Since define is expensive to lookup
@@ -642,7 +645,7 @@
  * @param tservice The service to generate a server for.
  */
 void t_js_generator::generate_service_processor(t_service* tservice) {
-
+  (void) tservice;
 }
 
 /**
@@ -652,7 +655,8 @@
  */
 void t_js_generator::generate_process_function(t_service* tservice,
                                                  t_function* tfunction) {
-
+  (void) tservice;
+  (void) tfunction;
 }
 
 /**
@@ -705,14 +709,14 @@
  * @param tservice The service to generate a header definition for
  */
 void t_js_generator::generate_service_interface(t_service* tservice) {
-
+  (void) tservice;
 }
 
 /**
  * Generates a REST interface
  */
 void t_js_generator::generate_service_rest(t_service* tservice) {
-
+  (void) tservice;
 }
 
 /**
@@ -904,6 +908,7 @@
                                                   t_field* tfield,
                                                   string prefix,
                                                   bool inclass) {
+  (void) inclass;
   t_type* type = get_true_type(tfield->get_type());
 
   if (type->is_void()) {
@@ -1207,7 +1212,8 @@
 void t_js_generator::generate_serialize_struct(ofstream &out,
                                                  t_struct* tstruct,
                                                  string prefix) {
-    indent(out) << prefix << ".write(output)" << endl;
+  (void) tstruct;
+  indent(out) << prefix << ".write(output)" << endl;
 }
 
 /**
diff --git a/compiler/cpp/src/generate/t_ocaml_generator.cc b/compiler/cpp/src/generate/t_ocaml_generator.cc
index 5ed4a99..18a8072 100644
--- a/compiler/cpp/src/generate/t_ocaml_generator.cc
+++ b/compiler/cpp/src/generate/t_ocaml_generator.cc
@@ -43,6 +43,8 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-ocaml";
   }
 
@@ -1283,6 +1285,7 @@
  */
 void t_ocaml_generator::generate_process_function(t_service* tservice,
                                                t_function* tfunction) {
+  (void) tservice;
   // Open function
   indent(f_service_) <<
     "method private process_" << tfunction->get_name() <<
@@ -1624,6 +1627,7 @@
 void t_ocaml_generator::generate_serialize_struct(ofstream &out,
                                                t_struct* tstruct,
                                                string prefix) {
+  (void) tstruct;
   indent(out) << prefix << "#write(oprot)";
 }
 
diff --git a/compiler/cpp/src/generate/t_perl_generator.cc b/compiler/cpp/src/generate/t_perl_generator.cc
index 33589c2..e1796dc 100644
--- a/compiler/cpp/src/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/generate/t_perl_generator.cc
@@ -43,6 +43,8 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-perl";
     escape_['$'] = "\\$";
     escape_['@'] = "\\@";
@@ -291,7 +293,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_perl_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_perl_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Generates code for an enumerated type. Since define is expensive to lookup
@@ -1254,6 +1258,7 @@
                                                   t_field* tfield,
                                                   string prefix,
                                                   bool inclass) {
+  (void) inclass;
   t_type* type = get_true_type(tfield->get_type());
 
   if (type->is_void()) {
@@ -1556,7 +1561,8 @@
 void t_perl_generator::generate_serialize_struct(ofstream &out,
                                                  t_struct* tstruct,
                                                  string prefix) {
-    indent(out) <<
+  (void) tstruct;
+  indent(out) <<
       "$xfer += $" << prefix << "->write($output);" << endl;
 }
 
diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc
index 200d89a..d1b33a9 100644
--- a/compiler/cpp/src/generate/t_php_generator.cc
+++ b/compiler/cpp/src/generate/t_php_generator.cc
@@ -42,6 +42,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("inlined");
@@ -317,7 +318,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_php_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_php_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Generates code for an enumerated type. Since define is expensive to lookup
@@ -2018,6 +2021,7 @@
 void t_php_generator::generate_serialize_struct(ofstream &out,
                                                 t_struct* tstruct,
                                                 string prefix) {
+  (void) tstruct;
   indent(out) <<
     "$xfer += $" << prefix << "->write($output);" << endl;
 }
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc
index bdd0c29..cb1950f 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/generate/t_py_generator.cc
@@ -44,6 +44,7 @@
       const std::string& option_string)
     : t_generator(program)
   {
+    (void) option_string;
     std::map<std::string, std::string>::const_iterator iter;
 
     iter = parsed_options.find("new_style");
@@ -365,7 +366,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_py_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_py_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Generates code for an enumerated type. Done using a class to scope
@@ -562,7 +565,7 @@
                                                    t_struct* tstruct,
                                                    bool is_exception,
                                                    bool is_result) {
-
+  (void) is_result;
   const vector<t_field*>& members = tstruct->get_members();
   const vector<t_field*>& sorted_members = tstruct->get_sorted_members();
   vector<t_field*>::const_iterator m_iter;
@@ -1572,6 +1575,7 @@
  */
 void t_py_generator::generate_process_function(t_service* tservice,
                                                t_function* tfunction) {
+  (void) tservice;
   // Open function
   indent(f_service_) <<
     "def process_" << tfunction->get_name() <<
@@ -1767,6 +1771,7 @@
                                                 t_field* tfield,
                                                 string prefix,
                                                 bool inclass) {
+  (void) inclass;
   t_type* type = get_true_type(tfield->get_type());
 
   if (type->is_void()) {
@@ -2040,6 +2045,7 @@
 void t_py_generator::generate_serialize_struct(ofstream &out,
                                                t_struct* tstruct,
                                                string prefix) {
+  (void) tstruct;
   indent(out) <<
     prefix << ".write(oprot)" << endl;
 }
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 770f8e7..c9db29a 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -49,6 +49,8 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-rb";
   }
 
@@ -282,7 +284,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_rb_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_rb_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 /**
  * Generates code for an enumerated type. Done using a class to scope
@@ -511,6 +515,7 @@
  * Generates a ruby union
  */
 void t_rb_generator::generate_rb_union(std::ofstream& out, t_struct* tstruct, bool is_exception = false) {
+  (void) is_exception;
   generate_rdoc(out, tstruct);
   indent(out) << "class " << type_name(tstruct) << " < ::Thrift::Union" << endl;
 
@@ -933,6 +938,7 @@
  */
 void t_rb_generator::generate_process_function(t_service* tservice,
                                                t_function* tfunction) {
+  (void) tservice;
   // Open function
   indent(f_service_) <<
     "def process_" << tfunction->get_name() <<
diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/generate/t_st_generator.cc
index fd8f035..6ca3701 100644
--- a/compiler/cpp/src/generate/t_st_generator.cc
+++ b/compiler/cpp/src/generate/t_st_generator.cc
@@ -49,6 +49,8 @@
       const std::string& option_string)
     : t_oop_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-st";
   }
 
@@ -240,7 +242,9 @@
  *
  * @param ttypedef The type definition
  */
-void t_st_generator::generate_typedef(t_typedef* ttypedef) {}
+void t_st_generator::generate_typedef(t_typedef* ttypedef) {
+  (void) ttypedef;
+}
 
 void t_st_generator::st_class_def(std::ofstream &out, string name) {
   out << "Object subclass: #" << prefix(name) << endl;
diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/generate/t_xsd_generator.cc
index c343b9a..923ec70 100644
--- a/compiler/cpp/src/generate/t_xsd_generator.cc
+++ b/compiler/cpp/src/generate/t_xsd_generator.cc
@@ -41,6 +41,8 @@
       const std::string& option_string)
     : t_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     out_dir_base_ = "gen-xsd";
   }
 
@@ -58,7 +60,9 @@
    */
 
   void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum) {}
+  void generate_enum(t_enum* tenum) {
+    (void) tenum;
+  }
 
   void generate_service(t_service* tservice);
   void generate_struct(t_struct* tstruct);
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index 17ac818..a6229f4 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -25,6 +25,9 @@
 
 %{
 
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-label"
+
 #include <string>
 #include <errno.h>
 
diff --git a/lib/cpp/src/TProcessor.h b/lib/cpp/src/TProcessor.h
index 16b46df..cf4f3b8 100644
--- a/lib/cpp/src/TProcessor.h
+++ b/lib/cpp/src/TProcessor.h
@@ -44,42 +44,69 @@
    * The return value is passed to all other callbacks
    * for that function invocation.
    */
-  virtual void* getContext(const char* fn_name, void* serverContext) { return NULL; }
+  virtual void* getContext(const char* fn_name, void* serverContext) {
+    (void) fn_name;
+    (void) serverContext;
+    return NULL;
+  }
 
   /**
    * Expected to free resources associated with a context.
    */
-  virtual void freeContext(void* ctx, const char* fn_name) { }
+  virtual void freeContext(void* ctx, const char* fn_name) {
+    (void) ctx;
+    (void) fn_name;
+  }
 
   /**
    * Called before reading arguments.
    */
-  virtual void preRead(void* ctx, const char* fn_name) {}
+  virtual void preRead(void* ctx, const char* fn_name) {
+    (void) ctx;
+    (void) fn_name;
+  }
 
   /**
    * Called between reading arguments and calling the handler.
    */
-  virtual void postRead(void* ctx, const char* fn_name, uint32_t bytes) {}
+  virtual void postRead(void* ctx, const char* fn_name, uint32_t bytes) {
+    (void) ctx;
+    (void) fn_name;
+    (void) bytes;
+  }
 
   /**
    * Called between calling the handler and writing the response.
    */
-  virtual void preWrite(void* ctx, const char* fn_name) {}
+  virtual void preWrite(void* ctx, const char* fn_name) {
+    (void) ctx;
+    (void) fn_name;
+  }
 
   /**
    * Called after writing the response.
    */
-  virtual void postWrite(void* ctx, const char* fn_name, uint32_t bytes) {}
+  virtual void postWrite(void* ctx, const char* fn_name, uint32_t bytes) {
+    (void) ctx;
+    (void) fn_name;
+    (void) bytes;
+  }
 
   /**
    * Called when an async function call completes successfully.
    */
-  virtual void asyncComplete(void* ctx, const char* fn_name) {}
+  virtual void asyncComplete(void* ctx, const char* fn_name) {
+    (void) ctx;
+    (void) fn_name;
+  }
 
   /**
    * Called if the handler throws an undeclared exception.
    */
-  virtual void handlerError(void* ctx, const char* fn_name) {}
+  virtual void handlerError(void* ctx, const char* fn_name) {
+    (void) ctx;
+    (void) fn_name;
+  }
 
  protected:
   TProcessorEventHandler() {}
diff --git a/lib/cpp/src/async/TAsyncProtocolProcessor.cpp b/lib/cpp/src/async/TAsyncProtocolProcessor.cpp
index 05d504b..eaa86e0 100644
--- a/lib/cpp/src/async/TAsyncProtocolProcessor.cpp
+++ b/lib/cpp/src/async/TAsyncProtocolProcessor.cpp
@@ -43,6 +43,7 @@
     std::tr1::function<void(bool healthy)> _return,
     boost::shared_ptr<TProtocol> oprot,
     bool healthy) {
+  (void) oprot;
   // This is a stub function to hold a reference to oprot.
   return _return(healthy);
 }
diff --git a/lib/cpp/src/concurrency/ThreadManager.cpp b/lib/cpp/src/concurrency/ThreadManager.cpp
index a65394b..f7b2690 100644
--- a/lib/cpp/src/concurrency/ThreadManager.cpp
+++ b/lib/cpp/src/concurrency/ThreadManager.cpp
@@ -68,7 +68,7 @@
 
   void join() { stopImpl(true); }
 
-  const ThreadManager::STATE state() const {
+  ThreadManager::STATE state() const {
     return state_;
   }
 
@@ -492,6 +492,7 @@
   }
 
 void ThreadManager::Impl::remove(shared_ptr<Runnable> task) {
+  (void) task;
   Synchronized s(monitor_);
   if (state_ != ThreadManager::STARTED) {
     throw IllegalStateException();
diff --git a/lib/cpp/src/concurrency/ThreadManager.h b/lib/cpp/src/concurrency/ThreadManager.h
index 95c4906..6d7b0ef 100644
--- a/lib/cpp/src/concurrency/ThreadManager.h
+++ b/lib/cpp/src/concurrency/ThreadManager.h
@@ -93,7 +93,7 @@
     STOPPED
   };
 
-  virtual const STATE state() const = 0;
+  virtual STATE state() const = 0;
 
   virtual boost::shared_ptr<ThreadFactory> threadFactory() const = 0;
 
diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp
index 10eabda..f7acd0a 100644
--- a/lib/cpp/src/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/concurrency/TimerManager.cpp
@@ -271,13 +271,14 @@
 
 
 void TimerManager::remove(shared_ptr<Runnable> task) {
+  (void) task;
   Synchronized s(monitor_);
   if (state_ != TimerManager::STARTED) {
     throw IllegalStateException();
   }
 }
 
-const TimerManager::STATE TimerManager::state() const { return state_; }
+TimerManager::STATE TimerManager::state() const { return state_; }
 
 }}} // apache::thrift::concurrency
 
diff --git a/lib/cpp/src/concurrency/TimerManager.h b/lib/cpp/src/concurrency/TimerManager.h
index dfbf0ea..d905ddb 100644
--- a/lib/cpp/src/concurrency/TimerManager.h
+++ b/lib/cpp/src/concurrency/TimerManager.h
@@ -99,7 +99,7 @@
     STOPPED
   };
 
-  virtual const STATE state() const;
+  virtual STATE state() const;
 
  private:
   boost::shared_ptr<const ThreadFactory> threadFactory_;
diff --git a/lib/cpp/src/concurrency/Util.cpp b/lib/cpp/src/concurrency/Util.cpp
index ac2a460..af23449 100644
--- a/lib/cpp/src/concurrency/Util.cpp
+++ b/lib/cpp/src/concurrency/Util.cpp
@@ -31,7 +31,7 @@
 
 namespace apache { namespace thrift { namespace concurrency {
 
-const int64_t Util::currentTimeTicks(int64_t ticksPerSec) {
+int64_t Util::currentTimeTicks(int64_t ticksPerSec) {
   int64_t result;
 
 #if defined(HAVE_CLOCK_GETTIME)
diff --git a/lib/cpp/src/concurrency/Util.h b/lib/cpp/src/concurrency/Util.h
index 18a221d..c6bd25e 100644
--- a/lib/cpp/src/concurrency/Util.h
+++ b/lib/cpp/src/concurrency/Util.h
@@ -68,7 +68,7 @@
     result.tv_usec = (value % MS_PER_S) * US_PER_MS; // ms to us
   }
 
-  static const void toTicks(int64_t& result, int64_t secs, int64_t oldTicks,
+  static void toTicks(int64_t& result, int64_t secs, int64_t oldTicks,
                             int64_t oldTicksPerSec, int64_t newTicksPerSec) {
     result = secs * newTicksPerSec;
     result += oldTicks * newTicksPerSec / oldTicksPerSec;
@@ -81,7 +81,7 @@
   /**
    * Converts struct timespec to arbitrary-sized ticks since epoch
    */
-  static const void toTicks(int64_t& result,
+  static void toTicks(int64_t& result,
                             const struct timespec& value,
                             int64_t ticksPerSec) {
     return toTicks(result, value.tv_sec, value.tv_nsec, NS_PER_S, ticksPerSec);
@@ -90,7 +90,7 @@
   /**
    * Converts struct timeval to arbitrary-sized ticks since epoch
    */
-  static const void toTicks(int64_t& result,
+  static void toTicks(int64_t& result,
                             const struct timeval& value,
                             int64_t ticksPerSec) {
     return toTicks(result, value.tv_sec, value.tv_usec, US_PER_S, ticksPerSec);
@@ -99,7 +99,7 @@
   /**
    * Converts struct timespec to milliseconds
    */
-  static const void toMilliseconds(int64_t& result,
+  static void toMilliseconds(int64_t& result,
                                    const struct timespec& value) {
     return toTicks(result, value, MS_PER_S);
   }
@@ -107,7 +107,7 @@
   /**
    * Converts struct timeval to milliseconds
    */
-  static const void toMilliseconds(int64_t& result,
+  static void toMilliseconds(int64_t& result,
                                    const struct timeval& value) {
     return toTicks(result, value, MS_PER_S);
   }
@@ -115,31 +115,31 @@
   /**
    * Converts struct timespec to microseconds
    */
-  static const void toUsec(int64_t& result, const struct timespec& value) {
+  static void toUsec(int64_t& result, const struct timespec& value) {
     return toTicks(result, value, US_PER_S);
   }
 
   /**
    * Converts struct timeval to microseconds
    */
-  static const void toUsec(int64_t& result, const struct timeval& value) {
+  static void toUsec(int64_t& result, const struct timeval& value) {
     return toTicks(result, value, US_PER_S);
   }
 
   /**
    * Get current time as a number of arbitrary-size ticks from epoch
    */
-  static const int64_t currentTimeTicks(int64_t ticksPerSec);
+  static int64_t currentTimeTicks(int64_t ticksPerSec);
 
   /**
    * Get current time as milliseconds from epoch
    */
-  static const int64_t currentTime() { return currentTimeTicks(MS_PER_S); }
+  static int64_t currentTime() { return currentTimeTicks(MS_PER_S); }
 
   /**
    * Get current time as micros from epoch
    */
-  static const int64_t currentTimeUsec() { return currentTimeTicks(US_PER_S); }
+  static int64_t currentTimeUsec() { return currentTimeTicks(US_PER_S); }
 };
 
 }}} // apache::thrift::concurrency
diff --git a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
index e4f98a9..c1dc89d 100644
--- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
@@ -308,6 +308,7 @@
   };
 
   void foo(PosixThreadFactory *tf) {
+    (void) tf;
   }
 
   bool floodNTest(size_t loop=1, size_t count=100000) {
diff --git a/lib/cpp/src/concurrency/test/ThreadManagerTests.h b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
index 129a9a2..b6b5c3e 100644
--- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
@@ -235,7 +235,7 @@
    * pendingTaskCountMax + 1th task.  Verify that we unblock when a task completes */
 
   bool blockTest(int64_t timeout=100LL, size_t workerCount=2) {
-
+    (void) timeout;
     bool success = false;
 
     try {
diff --git a/lib/cpp/src/processor/PeekProcessor.cpp b/lib/cpp/src/processor/PeekProcessor.cpp
index 076975b..9a9b672 100644
--- a/lib/cpp/src/processor/PeekProcessor.cpp
+++ b/lib/cpp/src/processor/PeekProcessor.cpp
@@ -107,14 +107,18 @@
 }
 
 void PeekProcessor::peekName(const std::string& fname) {
+  (void) fname;
 }
 
 void PeekProcessor::peekBuffer(uint8_t* buffer, uint32_t size) {
+  (void) buffer;
+  (void) size;
 }
 
 void PeekProcessor::peek(boost::shared_ptr<TProtocol> in,
                          TType ftype,
                          int16_t fid) {
+  (void) fid;
   in->skip(ftype);
 }
 
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.tcc b/lib/cpp/src/protocol/TBinaryProtocol.tcc
index 0f1c34a..3d93348 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.tcc
+++ b/lib/cpp/src/protocol/TBinaryProtocol.tcc
@@ -54,6 +54,7 @@
 
 template <class Transport_>
 uint32_t TBinaryProtocolT<Transport_>::writeStructBegin(const char* name) {
+  (void) name;
   return 0;
 }
 
@@ -66,6 +67,7 @@
 uint32_t TBinaryProtocolT<Transport_>::writeFieldBegin(const char* name,
                                                        const TType fieldType,
                                                        const int16_t fieldId) {
+  (void) name;
   uint32_t wsize = 0;
   wsize += writeByte((int8_t)fieldType);
   wsize += writeI16(fieldId);
@@ -244,6 +246,7 @@
 uint32_t TBinaryProtocolT<Transport_>::readFieldBegin(std::string& name,
                                                       TType& fieldType,
                                                       int16_t& fieldId) {
+  (void) name;
   uint32_t result = 0;
   int8_t type;
   result += readByte(type);
diff --git a/lib/cpp/src/protocol/TCompactProtocol.tcc b/lib/cpp/src/protocol/TCompactProtocol.tcc
index ed9c281..55b784f 100644
--- a/lib/cpp/src/protocol/TCompactProtocol.tcc
+++ b/lib/cpp/src/protocol/TCompactProtocol.tcc
@@ -131,6 +131,7 @@
  */
 template <class Transport_>
 uint32_t TCompactProtocolT<Transport_>::writeStructBegin(const char* name) {
+  (void) name;
   lastField_.push(lastFieldId_);
   lastFieldId_ = 0;
   return 0;
@@ -286,6 +287,7 @@
     const TType fieldType,
     const int16_t fieldId,
     int8_t typeOverride) {
+  (void) name;
   uint32_t wsize = 0;
 
   // if there's a type override, use that.
@@ -455,6 +457,7 @@
 uint32_t TCompactProtocolT<Transport_>::readFieldBegin(std::string& name,
                                                        TType& fieldType,
                                                        int16_t& fieldId) {
+  (void) name;
   uint32_t rsize = 0;
   int8_t byte;
   int8_t type;
diff --git a/lib/cpp/src/protocol/TDebugProtocol.cpp b/lib/cpp/src/protocol/TDebugProtocol.cpp
index ee82e71..28e175b 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.cpp
+++ b/lib/cpp/src/protocol/TDebugProtocol.cpp
@@ -148,6 +148,7 @@
 uint32_t TDebugProtocol::writeMessageBegin(const std::string& name,
                                            const TMessageType messageType,
                                            const int32_t seqid) {
+  (void) seqid;
   string mtype;
   switch (messageType) {
     case T_CALL      : mtype = "call"   ; break;
diff --git a/lib/cpp/src/protocol/TDenseProtocol.cpp b/lib/cpp/src/protocol/TDenseProtocol.cpp
index b9a3d1f..86e5e28 100644
--- a/lib/cpp/src/protocol/TDenseProtocol.cpp
+++ b/lib/cpp/src/protocol/TDenseProtocol.cpp
@@ -281,6 +281,7 @@
 }
 
 uint32_t TDenseProtocol::writeStructBegin(const char* name) {
+  (void) name;
   uint32_t xfer = 0;
 
   // The TypeSpec stack should be empty if this is the top-level read/write.
@@ -314,6 +315,7 @@
 uint32_t TDenseProtocol::writeFieldBegin(const char* name,
                                          const TType fieldType,
                                          const int16_t fieldId) {
+  (void) name;
   uint32_t xfer = 0;
 
   // Skip over optional fields.
@@ -507,6 +509,7 @@
 }
 
 uint32_t TDenseProtocol::readStructBegin(string& name) {
+  (void) name;
   uint32_t xfer = 0;
 
   if (ts_stack_.empty()) {
@@ -544,6 +547,7 @@
 uint32_t TDenseProtocol::readFieldBegin(string& name,
                                         TType& fieldType,
                                         int16_t& fieldId) {
+  (void) name;
   uint32_t xfer = 0;
 
   // For optional fields, check to see if they are there.
diff --git a/lib/cpp/src/protocol/TJSONProtocol.cpp b/lib/cpp/src/protocol/TJSONProtocol.cpp
index 5b0b18d..d038df4 100644
--- a/lib/cpp/src/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/protocol/TJSONProtocol.cpp
@@ -255,6 +255,7 @@
    * Write context data to the transport. Default is to do nothing.
    */
   virtual uint32_t write(TTransport &trans) {
+    (void) trans;
     return 0;
   };
 
@@ -262,6 +263,7 @@
    * Read context data from the transport. Default is to do nothing.
    */
   virtual uint32_t read(TJSONProtocol::LookaheadReader &reader) {
+    (void) reader;
     return 0;
   };
 
@@ -561,6 +563,7 @@
 }
 
 uint32_t TJSONProtocol::writeStructBegin(const char* name) {
+  (void) name;
   return writeJSONObjectStart();
 }
 
@@ -571,6 +574,7 @@
 uint32_t TJSONProtocol::writeFieldBegin(const char* name,
                                         const TType fieldType,
                                         const int16_t fieldId) {
+  (void) name;
   uint32_t result = writeJSONInteger(fieldId);
   result += writeJSONObjectStart();
   result += writeJSONString(getTypeNameForTypeID(fieldType));
@@ -874,6 +878,7 @@
 }
 
 uint32_t TJSONProtocol::readStructBegin(std::string& name) {
+  (void) name;
   return readJSONObjectStart();
 }
 
@@ -884,6 +889,7 @@
 uint32_t TJSONProtocol::readFieldBegin(std::string& name,
                                        TType& fieldType,
                                        int16_t& fieldId) {
+  (void) name;
   uint32_t result = 0;
   // Check if we hit the end of the list
   uint8_t ch = reader_.peek();
diff --git a/lib/cpp/src/protocol/TVirtualProtocol.h b/lib/cpp/src/protocol/TVirtualProtocol.h
index 9133dbe..6c7f519 100644
--- a/lib/cpp/src/protocol/TVirtualProtocol.h
+++ b/lib/cpp/src/protocol/TVirtualProtocol.h
@@ -42,6 +42,9 @@
   uint32_t readMessageBegin(std::string& name,
                             TMessageType& messageType,
                             int32_t& seqid) {
+    (void) name;
+    (void) messageType;
+    (void) seqid;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -52,6 +55,7 @@
   }
 
   uint32_t readStructBegin(std::string& name) {
+    (void) name;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -64,6 +68,9 @@
   uint32_t readFieldBegin(std::string& name,
                           TType& fieldType,
                           int16_t& fieldId) {
+    (void) name;
+    (void) fieldType;
+    (void) fieldId;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -74,6 +81,9 @@
   }
 
   uint32_t readMapBegin(TType& keyType, TType& valType, uint32_t& size) {
+    (void) keyType;
+    (void) valType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -84,6 +94,8 @@
   }
 
   uint32_t readListBegin(TType& elemType, uint32_t& size) {
+    (void) elemType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -94,6 +106,8 @@
   }
 
   uint32_t readSetBegin(TType& elemType, uint32_t& size) {
+    (void) elemType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -104,46 +118,55 @@
   }
 
   uint32_t readBool(bool& value) {
+    (void) value;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readBool(std::vector<bool>::reference value) {
+    (void) value;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readByte(int8_t& byte) {
+    (void) byte;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readI16(int16_t& i16) {
+    (void) i16;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readI32(int32_t& i32) {
+    (void) i32;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readI64(int64_t& i64) {
+    (void) i64;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readDouble(double& dub) {
+    (void) dub;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readString(std::string& str) {
+    (void) str;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
 
   uint32_t readBinary(std::string& str) {
+    (void) str;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support reading (yet).");
   }
@@ -151,6 +174,9 @@
   uint32_t writeMessageBegin(const std::string& name,
                              const TMessageType messageType,
                              const int32_t seqid) {
+    (void) name;
+    (void) messageType;
+    (void) seqid;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -162,6 +188,7 @@
 
 
   uint32_t writeStructBegin(const char* name) {
+    (void) name;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -174,6 +201,9 @@
   uint32_t writeFieldBegin(const char* name,
                            const TType fieldType,
                            const int16_t fieldId) {
+    (void) name;
+    (void) fieldType;
+    (void) fieldId;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -191,6 +221,9 @@
   uint32_t writeMapBegin(const TType keyType,
                          const TType valType,
                          const uint32_t size) {
+    (void) keyType;
+    (void) valType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -201,6 +234,8 @@
   }
 
   uint32_t writeListBegin(const TType elemType, const uint32_t size) {
+    (void) elemType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -211,6 +246,8 @@
   }
 
   uint32_t writeSetBegin(const TType elemType, const uint32_t size) {
+    (void) elemType;
+    (void) size;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
@@ -221,41 +258,49 @@
   }
 
   uint32_t writeBool(const bool value) {
+    (void) value;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeByte(const int8_t byte) {
+    (void) byte;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeI16(const int16_t i16) {
+    (void) i16;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeI32(const int32_t i32) {
+    (void) i32;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeI64(const int64_t i64) {
+    (void) i64;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeDouble(const double dub) {
+    (void) dub;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeString(const std::string& str) {
+    (void) str;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
 
   uint32_t writeBinary(const std::string& str) {
+    (void) str;
     throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
                              "this protocol does not support writing (yet).");
   }
diff --git a/lib/cpp/src/server/TNonblockingServer.cpp b/lib/cpp/src/server/TNonblockingServer.cpp
index 8f5a9f3..69ae235 100644
--- a/lib/cpp/src/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/server/TNonblockingServer.cpp
@@ -602,6 +602,7 @@
  * connections on fd and assign TConnection objects to handle those requests.
  */
 void TNonblockingServer::handleEvent(int fd, short which) {
+  (void) which;
   // Make sure that libevent didn't mess up the socket handles
   assert(fd == serverSocket_);
 
diff --git a/lib/cpp/src/transport/TBufferTransports.cpp b/lib/cpp/src/transport/TBufferTransports.cpp
index fa70531..52920c2 100644
--- a/lib/cpp/src/transport/TBufferTransports.cpp
+++ b/lib/cpp/src/transport/TBufferTransports.cpp
@@ -109,6 +109,8 @@
 }
 
 const uint8_t* TBufferedTransport::borrowSlow(uint8_t* buf, uint32_t* len) {
+  (void) buf;
+  (void) len;
   // Simply return NULL.  We don't know if there is actually data available on
   // the underlying transport, so calling read() might block.
   return NULL;
@@ -262,6 +264,8 @@
 }
 
 const uint8_t* TFramedTransport::borrowSlow(uint8_t* buf, uint32_t* len) {
+  (void) buf;
+  (void) len;
   // Don't try to be clever with shifting buffers.
   // If the fast path failed let the protocol use its slow path.
   // Besides, who is going to try to borrow across messages?
@@ -364,6 +368,7 @@
 }
 
 const uint8_t* TMemoryBuffer::borrowSlow(uint8_t* buf, uint32_t* len) {
+  (void) buf;
   rBound_ = wBase_;
   if (available_read() >= *len) {
     *len = available_read();
diff --git a/lib/cpp/src/transport/THttpClient.cpp b/lib/cpp/src/transport/THttpClient.cpp
index 400597e..604df0d 100644
--- a/lib/cpp/src/transport/THttpClient.cpp
+++ b/lib/cpp/src/transport/THttpClient.cpp
@@ -64,7 +64,7 @@
   }
 
   *code = '\0';
-  while (*(code++) == ' ');
+  while (*(code++) == ' ') {};
 
   char* msg = strchr(code, ' ');
   if (msg == NULL) {
diff --git a/lib/cpp/src/transport/THttpServer.cpp b/lib/cpp/src/transport/THttpServer.cpp
index 3ed869a..166c0f6 100644
--- a/lib/cpp/src/transport/THttpServer.cpp
+++ b/lib/cpp/src/transport/THttpServer.cpp
@@ -61,7 +61,7 @@
   }
 
   *path = '\0';
-  while (*(++path) == ' ');
+  while (*(++path) == ' ') {};
 
   char* http = strchr(path, ' ');
   if (http == NULL) {
diff --git a/lib/cpp/src/transport/TZlibTransport.cpp b/lib/cpp/src/transport/TZlibTransport.cpp
index 881150d..be65288 100644
--- a/lib/cpp/src/transport/TZlibTransport.cpp
+++ b/lib/cpp/src/transport/TZlibTransport.cpp
@@ -313,6 +313,7 @@
 }
 
 const uint8_t* TZlibTransport::borrow(uint8_t* buf, uint32_t* len) {
+  (void) buf;
   // Don't try to be clever with shifting buffers.
   // If we have enough data, give a pointer to it,
   // otherwise let the protcol use its slow path.
diff --git a/lib/cpp/test/AllProtocolTests.cpp b/lib/cpp/test/AllProtocolTests.cpp
index db29ccc..8fec7f5 100644
--- a/lib/cpp/test/AllProtocolTests.cpp
+++ b/lib/cpp/test/AllProtocolTests.cpp
@@ -31,6 +31,8 @@
 char errorMessage[ERR_LEN];
 
 int main(int argc, char** argv) {
+  (void) argc;
+  (void) argv;
   try {
     testProtocol<TBinaryProtocol>("TBinaryProtocol");
     testProtocol<TCompactProtocol>("TCompactProtocol");
diff --git a/lib/cpp/test/DebugProtoTest_extras.cpp b/lib/cpp/test/DebugProtoTest_extras.cpp
index e68c544..c89db74 100644
--- a/lib/cpp/test/DebugProtoTest_extras.cpp
+++ b/lib/cpp/test/DebugProtoTest_extras.cpp
@@ -25,6 +25,7 @@
 namespace thrift { namespace test { namespace debug {
 
 bool Empty::operator<(Empty const& other) const {
+  (void) other;
   // It is empty, so all are equal.
   return false;
 }
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index 98fd18d..6260094 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -70,6 +70,7 @@
   FsyncLog() {}
 
   void fsync(int fd) {
+    (void) fd;
     FsyncCall call;
     gettimeofday(&call.time, NULL);
     calls_.push_back(call);
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 46a89a7..d12e384 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -341,6 +341,7 @@
 void set_alarm();
 
 void alarm_handler(int signum) {
+  (void) signum;
   // The alarm timed out, which almost certainly means we're stuck
   // on a transport that is incorrectly blocked.
   ++numTriggersFired;