From: Roger Meier Date: Wed, 17 Nov 2010 22:11:26 +0000 (+0000) Subject: THRIFT-916 compile with -Wall -Wextra without warning on Debian Lenny X-Git-Tag: 0.6.0~33 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=3b771a10f1b815d5168d244374cddd1014ba3c02;p=common%2Fthrift.git 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 d06d9337..aa258a15 100644 --- a/compiler/cpp/src/generate/t_as3_generator.cc +++ b/compiler/cpp/src/generate/t_as3_generator.cc @@ -44,6 +44,7 @@ class t_as3_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("bindable"); @@ -285,7 +286,9 @@ void t_as3_generator::close_generator() {} * * @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 @@ void t_as3_generator::print_const_value(std::ofstream& out, string name, t_type* } 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_as3_struct_result_writer(ofstream& out, } 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_getters(ostringstream& out, t_type* ty } 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_function_helpers(t_function* tfunction) { */ 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_field(ofstream& out, 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 @@ void t_as3_generator::generate_serialize_list_element(ofstream& out, * @return As3 type name, i.e. HashMap */ 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::type_name(t_type* ttype, bool in_container, bool in_init */ 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 a569ae61..8d34bac0 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 @@ class t_c_glib_generator : public t_oop_generator const map &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 @@ t_c_glib_generator::is_complex_type (t_type *ttype) 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 @@ t_c_glib_generator::generate_service_client (t_service *tservice) 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 @@ void 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 @@ t_c_glib_generator::generate_deserialize_list_element (ofstream &out, t_list *tl 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 29ace00b..26537ac1 100644 --- a/compiler/cpp/src/generate/t_cocoa_generator.cc +++ b/compiler/cpp/src/generate/t_cocoa_generator.cc @@ -43,6 +43,7 @@ class t_cocoa_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("log_unexpected"); @@ -541,6 +542,7 @@ void t_cocoa_generator::generate_cocoa_struct_initializer_signature(ofstream &ou void t_cocoa_generator::generate_cocoa_struct_field_accessor_declarations(ofstream &out, t_struct* tstruct, bool is_exception) { + (void) is_exception; const vector& members = tstruct->get_members(); vector::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_result_writer(ofstream& out, void t_cocoa_generator::generate_cocoa_struct_field_accessor_implementations(ofstream& out, t_struct* tstruct, bool is_exception) { + (void) is_exception; const vector& fields = tstruct->get_members(); vector::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_field(ofstream& out, 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 f5c8def8..6fe33979 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -48,6 +48,7 @@ class t_cpp_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("pure_enums"); @@ -686,6 +687,7 @@ void t_cpp_generator::print_const_value(ofstream& out, string name, t_type* type * */ 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_field(ofstream& out, 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_field(ofstream& out, 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 d32652cf..45ed646b 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -44,6 +44,8 @@ class t_csharp_generator : public t_oop_generator 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 @@ string t_csharp_generator::csharp_thrift_usings() { } 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 @@ bool t_csharp_generator::print_const_value(std::ofstream& out, string name, t_ty } 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_function_helpers(t_function* tfunction) { } 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_field(ofstream& out, t_field* tfield } 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 @@ std::string t_csharp_generator::prop_name(t_field* tfield) { } 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::type_name(t_type* ttype, bool in_container, bool in_i } 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 7e2ac75c..0f9a8223 100644 --- a/compiler/cpp/src/generate/t_erl_generator.cc +++ b/compiler/cpp/src/generate/t_erl_generator.cc @@ -44,6 +44,8 @@ class t_erl_generator : public t_generator { 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_header(ostream& out, string name) { } void t_erl_generator::hrl_footer(ostream& out, string name) { + (void) name; out << "-endif." << endl; } @@ -274,6 +277,7 @@ void t_erl_generator::close_generator() { * @param ttypedef The type definition */ void t_erl_generator::generate_typedef(t_typedef* ttypedef) { + (void) ttypedef; } /** @@ -472,6 +476,7 @@ void t_erl_generator::generate_erl_struct_definition(ostream& out, bool is_exception, bool is_result) { + (void) is_result; const vector& members = tstruct->get_members(); vector::const_iterator m_iter; @@ -612,6 +617,7 @@ void t_erl_generator::generate_service_helpers(t_service* tservice) { * @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_service_interface(t_service* tservice) { */ 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 458922ff..4de05688 100644 --- a/compiler/cpp/src/generate/t_generator.h +++ b/compiler/cpp/src/generate/t_generator.h @@ -73,7 +73,10 @@ class t_generator { * 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 @@ class t_generator { 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 36eb36ca..fcc055a6 100644 --- a/compiler/cpp/src/generate/t_hs_generator.cc +++ b/compiler/cpp/src/generate/t_hs_generator.cc @@ -43,6 +43,8 @@ class t_hs_generator : public t_oop_generator { const string& option_string) : t_oop_generator(program) { + (void) parsed_options; + (void) option_string; out_dir_base_ = "gen-hs"; } @@ -517,6 +519,7 @@ void t_hs_generator::generate_hs_struct_definition(ofstream& out, 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_service_server(t_service* tservice) { */ 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_process_function(t_service* tservice, 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 d1b2f055..881e0f86 100644 --- a/compiler/cpp/src/generate/t_html_generator.cc +++ b/compiler/cpp/src/generate/t_html_generator.cc @@ -44,6 +44,8 @@ class t_html_generator : public t_generator { const std::string& option_string) : t_generator(program) { + (void) parsed_options; + (void) option_string; out_dir_base_ = "gen-html"; escape_.clear(); escape_['&'] = "&"; diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index 94717744..7acd9aca 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -44,6 +44,7 @@ class t_java_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("beans"); @@ -356,7 +357,9 @@ void t_java_generator::close_generator() {} * * @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 @@ void t_java_generator::print_const_value(std::ofstream& out, string name, t_type } 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_field_desc(ofstream& out, t_struct* tstruct) } 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_comparisons(ofstream& out, t_struct* tstru } 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_result_writer(ofstream& out, } 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_function_helpers(t_function* tfunction) { */ 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_field(ofstream& out, 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 @@ void t_java_generator::generate_serialize_map_element(ofstream& out, 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::argument_list(t_struct* tstruct, bool include_types) { } 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& fields = tstruct->get_members(); vector::const_iterator f_iter; @@ -3721,6 +3732,7 @@ void t_java_generator::generate_deep_copy_container(ofstream &out, std::string s } 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 ff2d285a..b390239c 100644 --- a/compiler/cpp/src/generate/t_javame_generator.cc +++ b/compiler/cpp/src/generate/t_javame_generator.cc @@ -44,6 +44,8 @@ class t_javame_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) parsed_options; + (void) option_string; std::map::const_iterator iter; out_dir_base_ = "gen-javame"; } @@ -313,7 +315,9 @@ void t_javame_generator::close_generator() {} * * @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 @@ void t_javame_generator::print_const_value(std::ofstream& out, string name, t_ty } 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_field_desc(ofstream& out, t_struct* tstruc } 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_comparisons(ofstream& out, t_struct* tst } 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_reflection_setters(ostringstream& out, t_type* } 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_function_helpers(t_function* tfunction) { */ 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_field(ofstream& out, 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 @@ void t_javame_generator::generate_serialize_list_element(ofstream& out, * @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 921cbb4e..bb1033cf 100644 --- a/compiler/cpp/src/generate/t_js_generator.cc +++ b/compiler/cpp/src/generate/t_js_generator.cc @@ -41,7 +41,8 @@ class t_js_generator : public t_oop_generator { const std::map& 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 @@ void t_js_generator::close_generator() { * * @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 @@ void t_js_generator::generate_service(t_service* tservice) { * @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_service_processor(t_service* tservice) { */ void t_js_generator::generate_process_function(t_service* tservice, t_function* tfunction) { - + (void) tservice; + (void) tfunction; } /** @@ -705,14 +709,14 @@ void t_js_generator::generate_js_function_helpers(t_function* tfunction) { * @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 @@ void t_js_generator::generate_deserialize_field(ofstream &out, 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_field(ofstream &out, 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 5ed4a99b..18a8072a 100644 --- a/compiler/cpp/src/generate/t_ocaml_generator.cc +++ b/compiler/cpp/src/generate/t_ocaml_generator.cc @@ -43,6 +43,8 @@ class t_ocaml_generator : public t_oop_generator { 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_service_server(t_service* tservice) { */ 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_field(ofstream &out, 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 33589c21..e1796dc6 100644 --- a/compiler/cpp/src/generate/t_perl_generator.cc +++ b/compiler/cpp/src/generate/t_perl_generator.cc @@ -43,6 +43,8 @@ class t_perl_generator : public t_oop_generator { 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 @@ void t_perl_generator::close_generator() { * * @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 @@ void t_perl_generator::generate_deserialize_field(ofstream &out, 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_field(ofstream &out, 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 200d89a2..d1b33a96 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -42,6 +42,7 @@ class t_php_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("inlined"); @@ -317,7 +318,9 @@ void t_php_generator::close_generator() { * * @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_field(ofstream &out, 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 bdd0c291..cb1950fb 100644 --- a/compiler/cpp/src/generate/t_py_generator.cc +++ b/compiler/cpp/src/generate/t_py_generator.cc @@ -44,6 +44,7 @@ class t_py_generator : public t_generator { const std::string& option_string) : t_generator(program) { + (void) option_string; std::map::const_iterator iter; iter = parsed_options.find("new_style"); @@ -365,7 +366,9 @@ void t_py_generator::close_generator() { * * @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 @@ void t_py_generator::generate_py_struct_definition(ofstream& out, t_struct* tstruct, bool is_exception, bool is_result) { - + (void) is_result; const vector& members = tstruct->get_members(); const vector& sorted_members = tstruct->get_sorted_members(); vector::const_iterator m_iter; @@ -1572,6 +1575,7 @@ void t_py_generator::generate_service_server(t_service* tservice) { */ 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 @@ void t_py_generator::generate_deserialize_field(ofstream &out, 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_field(ofstream &out, 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 770f8e76..c9db29ac 100644 --- a/compiler/cpp/src/generate/t_rb_generator.cc +++ b/compiler/cpp/src/generate/t_rb_generator.cc @@ -49,6 +49,8 @@ class t_rb_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) parsed_options; + (void) option_string; out_dir_base_ = "gen-rb"; } @@ -282,7 +284,9 @@ void t_rb_generator::close_generator() { * * @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 @@ void t_rb_generator::generate_rb_struct(std::ofstream& out, t_struct* tstruct, b * 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_service_server(t_service* tservice) { */ 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 fd8f035d..6ca37015 100644 --- a/compiler/cpp/src/generate/t_st_generator.cc +++ b/compiler/cpp/src/generate/t_st_generator.cc @@ -49,6 +49,8 @@ class t_st_generator : public t_oop_generator { const std::string& option_string) : t_oop_generator(program) { + (void) parsed_options; + (void) option_string; out_dir_base_ = "gen-st"; } @@ -240,7 +242,9 @@ string t_st_generator::generated_category() { * * @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 c343b9a8..923ec705 100644 --- a/compiler/cpp/src/generate/t_xsd_generator.cc +++ b/compiler/cpp/src/generate/t_xsd_generator.cc @@ -41,6 +41,8 @@ class t_xsd_generator : public t_generator { const std::string& option_string) : t_generator(program) { + (void) parsed_options; + (void) option_string; out_dir_base_ = "gen-xsd"; } @@ -58,7 +60,9 @@ class t_xsd_generator : public t_generator { */ 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 17ac818f..a6229f40 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 #include diff --git a/lib/cpp/src/TProcessor.h b/lib/cpp/src/TProcessor.h index 16b46df0..cf4f3b8a 100644 --- a/lib/cpp/src/TProcessor.h +++ b/lib/cpp/src/TProcessor.h @@ -44,42 +44,69 @@ class TProcessorEventHandler { * 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 05d504b5..eaa86e0e 100644 --- a/lib/cpp/src/async/TAsyncProtocolProcessor.cpp +++ b/lib/cpp/src/async/TAsyncProtocolProcessor.cpp @@ -43,6 +43,7 @@ void TAsyncProtocolProcessor::process( std::tr1::function _return, boost::shared_ptr 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 a65394b5..f7b26901 100644 --- a/lib/cpp/src/concurrency/ThreadManager.cpp +++ b/lib/cpp/src/concurrency/ThreadManager.cpp @@ -68,7 +68,7 @@ class ThreadManager::Impl : public ThreadManager { void join() { stopImpl(true); } - const ThreadManager::STATE state() const { + ThreadManager::STATE state() const { return state_; } @@ -492,6 +492,7 @@ void ThreadManager::Impl::removeWorker(size_t value) { } void ThreadManager::Impl::remove(shared_ptr 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 95c49068..6d7b0ef5 100644 --- a/lib/cpp/src/concurrency/ThreadManager.h +++ b/lib/cpp/src/concurrency/ThreadManager.h @@ -93,7 +93,7 @@ class ThreadManager { STOPPED }; - virtual const STATE state() const = 0; + virtual STATE state() const = 0; virtual boost::shared_ptr threadFactory() const = 0; diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp index 10eabda8..f7acd0ad 100644 --- a/lib/cpp/src/concurrency/TimerManager.cpp +++ b/lib/cpp/src/concurrency/TimerManager.cpp @@ -271,13 +271,14 @@ void TimerManager::add(shared_ptr task, const struct timespec& value) void TimerManager::remove(shared_ptr 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 dfbf0ea4..d905ddb7 100644 --- a/lib/cpp/src/concurrency/TimerManager.h +++ b/lib/cpp/src/concurrency/TimerManager.h @@ -99,7 +99,7 @@ class TimerManager { STOPPED }; - virtual const STATE state() const; + virtual STATE state() const; private: boost::shared_ptr threadFactory_; diff --git a/lib/cpp/src/concurrency/Util.cpp b/lib/cpp/src/concurrency/Util.cpp index ac2a4609..af234492 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 18a221d5..c6bd25e3 100644 --- a/lib/cpp/src/concurrency/Util.h +++ b/lib/cpp/src/concurrency/Util.h @@ -68,7 +68,7 @@ class Util { 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 @@ class Util { /** * 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 @@ class Util { /** * 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 @@ class Util { /** * 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 @@ class Util { /** * 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 @@ class Util { /** * 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 e4f98a9e..c1dc89d0 100644 --- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h +++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h @@ -308,6 +308,7 @@ public: }; 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 129a9a25..b6b5c3e4 100644 --- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h +++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h @@ -235,7 +235,7 @@ public: * 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 076975b5..9a9b672f 100644 --- a/lib/cpp/src/processor/PeekProcessor.cpp +++ b/lib/cpp/src/processor/PeekProcessor.cpp @@ -107,14 +107,18 @@ bool PeekProcessor::process(boost::shared_ptr in, } 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 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 0f1c34a9..3d933483 100644 --- a/lib/cpp/src/protocol/TBinaryProtocol.tcc +++ b/lib/cpp/src/protocol/TBinaryProtocol.tcc @@ -54,6 +54,7 @@ uint32_t TBinaryProtocolT::writeMessageEnd() { template uint32_t TBinaryProtocolT::writeStructBegin(const char* name) { + (void) name; return 0; } @@ -66,6 +67,7 @@ template uint32_t TBinaryProtocolT::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 @@ template uint32_t TBinaryProtocolT::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 ed9c281a..55b784f2 100644 --- a/lib/cpp/src/protocol/TCompactProtocol.tcc +++ b/lib/cpp/src/protocol/TCompactProtocol.tcc @@ -131,6 +131,7 @@ uint32_t TCompactProtocolT::writeFieldStop() { */ template uint32_t TCompactProtocolT::writeStructBegin(const char* name) { + (void) name; lastField_.push(lastFieldId_); lastFieldId_ = 0; return 0; @@ -286,6 +287,7 @@ int32_t TCompactProtocolT::writeFieldBeginInternal( 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 @@ template uint32_t TCompactProtocolT::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 ee82e71d..28e175b6 100644 --- a/lib/cpp/src/protocol/TDebugProtocol.cpp +++ b/lib/cpp/src/protocol/TDebugProtocol.cpp @@ -148,6 +148,7 @@ uint32_t TDebugProtocol::writeItem(const std::string& str) { 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 b9a3d1fd..86e5e285 100644 --- a/lib/cpp/src/protocol/TDenseProtocol.cpp +++ b/lib/cpp/src/protocol/TDenseProtocol.cpp @@ -281,6 +281,7 @@ uint32_t TDenseProtocol::writeMessageEnd() { } 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::writeStructEnd() { 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::readMessageEnd() { } uint32_t TDenseProtocol::readStructBegin(string& name) { + (void) name; uint32_t xfer = 0; if (ts_stack_.empty()) { @@ -544,6 +547,7 @@ uint32_t TDenseProtocol::readStructEnd() { 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 5b0b18da..d038df4a 100644 --- a/lib/cpp/src/protocol/TJSONProtocol.cpp +++ b/lib/cpp/src/protocol/TJSONProtocol.cpp @@ -255,6 +255,7 @@ class TJSONContext { * 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 @@ class TJSONContext { * 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::writeMessageEnd() { } uint32_t TJSONProtocol::writeStructBegin(const char* name) { + (void) name; return writeJSONObjectStart(); } @@ -571,6 +574,7 @@ uint32_t TJSONProtocol::writeStructEnd() { 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::readMessageEnd() { } uint32_t TJSONProtocol::readStructBegin(std::string& name) { + (void) name; return readJSONObjectStart(); } @@ -884,6 +889,7 @@ uint32_t TJSONProtocol::readStructEnd() { 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 9133dbed..6c7f5197 100644 --- a/lib/cpp/src/protocol/TVirtualProtocol.h +++ b/lib/cpp/src/protocol/TVirtualProtocol.h @@ -42,6 +42,9 @@ class TProtocolDefaults : public TProtocol { 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 @@ class TProtocolDefaults : public TProtocol { } uint32_t readStructBegin(std::string& name) { + (void) name; throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, "this protocol does not support reading (yet)."); } @@ -64,6 +68,9 @@ class TProtocolDefaults : public TProtocol { 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 @@ class TProtocolDefaults : public TProtocol { } 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 @@ class TProtocolDefaults : public TProtocol { } 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 @@ class TProtocolDefaults : public TProtocol { } 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 @@ class TProtocolDefaults : public TProtocol { } uint32_t readBool(bool& value) { + (void) value; throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, "this protocol does not support reading (yet)."); } uint32_t readBool(std::vector::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 @@ class TProtocolDefaults : public TProtocol { 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 @@ class TProtocolDefaults : public TProtocol { uint32_t writeStructBegin(const char* name) { + (void) name; throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, "this protocol does not support writing (yet)."); } @@ -174,6 +201,9 @@ class TProtocolDefaults : public TProtocol { 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 @@ class TProtocolDefaults : public TProtocol { 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 @@ class TProtocolDefaults : public TProtocol { } 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 @@ class TProtocolDefaults : public TProtocol { } 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 @@ class TProtocolDefaults : public TProtocol { } 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 8f5a9f38..69ae2351 100644 --- a/lib/cpp/src/server/TNonblockingServer.cpp +++ b/lib/cpp/src/server/TNonblockingServer.cpp @@ -602,6 +602,7 @@ void TNonblockingServer::returnConnection(TConnection* connection) { * 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 fa705310..52920c22 100644 --- a/lib/cpp/src/transport/TBufferTransports.cpp +++ b/lib/cpp/src/transport/TBufferTransports.cpp @@ -109,6 +109,8 @@ void TBufferedTransport::writeSlow(const uint8_t* buf, uint32_t len) { } 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 @@ uint32_t TFramedTransport::writeEnd() { } 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 @@ void TMemoryBuffer::wroteBytes(uint32_t len) { } 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 400597e1..604df0d3 100644 --- a/lib/cpp/src/transport/THttpClient.cpp +++ b/lib/cpp/src/transport/THttpClient.cpp @@ -64,7 +64,7 @@ bool THttpClient::parseStatusLine(char* status) { } *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 3ed869a3..166c0f67 100644 --- a/lib/cpp/src/transport/THttpServer.cpp +++ b/lib/cpp/src/transport/THttpServer.cpp @@ -61,7 +61,7 @@ bool THttpServer::parseStatusLine(char* status) { } *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 881150db..be65288e 100644 --- a/lib/cpp/src/transport/TZlibTransport.cpp +++ b/lib/cpp/src/transport/TZlibTransport.cpp @@ -313,6 +313,7 @@ void TZlibTransport::flushToZlib(const uint8_t* buf, int len, int flush) { } 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 db29cccf..8fec7f54 100644 --- a/lib/cpp/test/AllProtocolTests.cpp +++ b/lib/cpp/test/AllProtocolTests.cpp @@ -31,6 +31,8 @@ using namespace apache::thrift::transport; char errorMessage[ERR_LEN]; int main(int argc, char** argv) { + (void) argc; + (void) argv; try { testProtocol("TBinaryProtocol"); testProtocol("TCompactProtocol"); diff --git a/lib/cpp/test/DebugProtoTest_extras.cpp b/lib/cpp/test/DebugProtoTest_extras.cpp index e68c544b..c89db74a 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 98fd18d2..6260094a 100644 --- a/lib/cpp/test/TFileTransportTest.cpp +++ b/lib/cpp/test/TFileTransportTest.cpp @@ -70,6 +70,7 @@ class FsyncLog { 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 46a89a7e..d12e384d 100644 --- a/lib/cpp/test/TransportTest.cpp +++ b/lib/cpp/test/TransportTest.cpp @@ -341,6 +341,7 @@ unsigned int numTriggersFired; 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;