THRIFT-916 gcc warnings in c++ header files
authorRoger Meier <roger@apache.org>
Sun, 17 Jul 2011 18:55:59 +0000 (18:55 +0000)
committerRoger Meier <roger@apache.org>
Sun, 17 Jul 2011 18:55:59 +0000 (18:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1147700 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
compiler/cpp/src/generate/t_as3_generator.cc
compiler/cpp/src/generate/t_cpp_generator.cc
compiler/cpp/src/generate/t_go_generator.cc [changed mode: 0644->0755]
compiler/cpp/src/generate/t_java_generator.cc
lib/cpp/src/async/TEvhttpClientChannel.cpp [changed mode: 0644->0755]
lib/cpp/src/async/TEvhttpServer.cpp [changed mode: 0644->0755]
lib/cpp/src/transport/TSSLSocket.cpp [changed mode: 0644->0755]
lib/cpp/src/transport/TSSLSocket.h [changed mode: 0644->0755]
test/cpp/src/StressTest.cpp [changed mode: 0644->0755]
test/cpp/src/StressTestNonBlocking.cpp [changed mode: 0644->0755]
test/cpp/src/TestClient.cpp [changed mode: 0644->0755]
test/cpp/src/TestServer.cpp

index cebb078..05514f1 100644 (file)
@@ -769,7 +769,6 @@ void t_as3_generator::generate_as3_struct_definition(ofstream &out,
   "public function " << tstruct->get_name() << "() {" << endl;
   indent_up();
   for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    t_type* t = get_true_type((*m_iter)->get_type());
     if ((*m_iter)->get_value() != NULL) {
       indent(out) << "this._" << (*m_iter)->get_name() << " = " << (*m_iter)->get_value()->get_integer() << ";" <<
       endl;
index 389bbf9..6b1f607 100755 (executable)
@@ -3007,6 +3007,12 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
         indent() << "T_GENERIC_PROTOCOL(this, oprot, _oprot);" << endl << endl;
     }
 
+    if (tfunction->is_oneway()) {
+      out <<
+        indent() << "(void) seqid;" << endl <<
+        indent() << "(void) oprot;" << endl;
+    }
+
     out <<
       indent() << tservice->get_name() + "_" + tfunction->get_name() + "_args" << " args;" << endl <<
       indent() << "void* ctx = NULL;" << endl <<
@@ -3996,7 +4002,7 @@ string t_cpp_generator::function_signature(t_function* tfunction,
                   ? "()"
                   : ("(" + type_name(ttype) + " const& _return)"));
       if (has_xceptions) {
-        exn_cob = ", std::tr1::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob";
+        exn_cob = ", std::tr1::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */";
       }
     } else {
       throw "UNKNOWN STYLE";
old mode 100644 (file)
new mode 100755 (executable)
index fe34bb7..6b2efc8
@@ -46,6 +46,8 @@ class t_go_generator : public t_generator {
       const std::string& option_string)
     : t_generator(program)
   {
+    (void) parsed_options;
+    (void) option_string;
     std::map<std::string, std::string>::const_iterator iter;
     out_dir_base_ = "gen-go";
   }
@@ -771,6 +773,7 @@ void t_go_generator::generate_go_struct_definition(ofstream& out,
                                                    bool is_exception,
                                                    bool is_result) {
 
+  (void) is_exception;
   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;
@@ -996,6 +999,7 @@ void t_go_generator::generate_go_struct_reader(ofstream& out,
                                                 t_struct* tstruct,
                                                 const string& tstruct_name,
                                                 bool is_result) {
+  (void) is_result;
   const vector<t_field*>& fields = tstruct->get_members();
   vector<t_field*>::const_iterator f_iter;
   string escaped_tstruct_name(escape_string(tstruct->get_name()));
@@ -2236,6 +2240,8 @@ void t_go_generator::generate_deserialize_field(ofstream &out,
                                                 string err,
                                                 bool inclass,
                                                 bool coerceData) {
+  (void) inclass;
+  (void) coerceData;
   t_type* orig_type = tfield->get_type();
   t_type* type = get_true_type(orig_type);
   string name(prefix + publicize(variable_name_to_go_name(tfield->get_name())));
@@ -2330,6 +2336,7 @@ void t_go_generator::generate_deserialize_struct(ofstream &out,
                                                   bool declare,
                                                   string prefix,
                                                   string err) {
+  (void) err;
   string err2(tmp("err"));
   string eq(" := ");
   if(!declare) {
@@ -2452,6 +2459,8 @@ void t_go_generator::generate_deserialize_map_element(ofstream &out,
                                                        bool   declare,
                                                        string prefix,
                                                        string err) {
+  (void) declare;
+  (void) err;
   string key = tmp("_key");
   string val = tmp("_val");
   t_field fkey(tmap->get_key_type(), key);
@@ -2472,6 +2481,7 @@ void t_go_generator::generate_deserialize_set_element(ofstream &out,
                                                        bool   declare,
                                                        string prefix,
                                                        string err) {
+  (void) declare;
   string elem = tmp("_elem");
   t_field felem(tset->get_elem_type(), elem);
 
@@ -2489,6 +2499,7 @@ void t_go_generator::generate_deserialize_list_element(ofstream &out,
                                                         bool   declare,
                                                         string prefix,
                                                         string err) {
+  (void) declare;
   string elem = tmp("_elem");
   t_field felem(tlist->get_elem_type(), elem);
 
@@ -3074,4 +3085,4 @@ string t_go_generator::type_to_spec_args(t_type* ttype) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(go, "Go", "");
+THRIFT_REGISTER_GENERATOR(go, "Go", "")
index 04aaa40..1b55172 100644 (file)
@@ -3875,6 +3875,7 @@ void t_java_generator::generate_java_struct_clear(std::ofstream& out, t_struct*
 
 // generates java method to serialize (in the Java sense) the object
 void t_java_generator::generate_java_struct_write_object(ofstream& out, t_struct* tstruct) {
+  (void) tstruct;
   indent(out) << "private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {" << endl;
   indent(out) << "  try {" << endl;
   indent(out) << "    write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));" << endl;
old mode 100644 (file)
new mode 100755 (executable)
index 8b47173..b5265ce
@@ -93,12 +93,16 @@ bool TEvhttpClientChannel::sendAndRecvMessage(
 
 bool TEvhttpClientChannel::sendMessage(
     const VoidCallback& cob, apache::thrift::transport::TMemoryBuffer* message) {
+  (void) cob;
+  (void) message;
   abort(); // XXX
 }
 
 
 bool TEvhttpClientChannel::recvMessage(
     const VoidCallback& cob, apache::thrift::transport::TMemoryBuffer* message) {
+  (void) cob;
+  (void) message;
   abort(); // XXX
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 30e33e5..701f8bd
@@ -124,6 +124,7 @@ void TEvhttpServer::process(struct evhttp_request* req) {
 
 
 void TEvhttpServer::complete(RequestContext* ctx, bool success) {
+  (void) success;
   std::auto_ptr<RequestContext> ptr(ctx);
 
   int code = 200;
old mode 100644 (file)
new mode 100755 (executable)
index 602a894..913c258
@@ -258,7 +258,7 @@ void TSSLSocket::authorize() {
   // both certificate and access manager are present
 
   string host;
-  sockaddr_storage sa = {};
+  sockaddr_storage sa;
   socklen_t saLength = sizeof(sa);
 
   if (getpeername(socket_, (sockaddr*)&sa, &saLength) != 0) {
@@ -591,7 +591,10 @@ void buildErrors(string& errors, int errno_copy) {
  * Default implementation of AccessManager
  */
 Decision DefaultClientAccessManager::verify(const sockaddr_storage& sa)
-  throw() { return SKIP; }
+  throw() { 
+  (void) sa;
+  return SKIP;
+}
 
 Decision DefaultClientAccessManager::verify(const string& host,
                                             const char* name,
old mode 100644 (file)
new mode 100755 (executable)
index 6b241b2..a0a1502
@@ -201,7 +201,7 @@ class TSSLSocketFactory {
    * @param password Pass collected password to OpenSSL
    * @param size     Maximum length of password including NULL character
    */
-  virtual void getPassword(std::string& password, int size) { }
+  virtual void getPassword(std::string& /* password */, int /* size */) {}
  private:
   bool server_;
   boost::shared_ptr<AccessManager> access_;
@@ -253,7 +253,7 @@ class AccessManager {
   enum Decision {
     DENY   = -1,    // deny access
     SKIP   =  0,    // cannot make decision, move on to next (if any)
-    ALLOW  =  1,    // allow access
+    ALLOW  =  1     // allow access
   };
  /**
   * Destructor
@@ -270,7 +270,7 @@ class AccessManager {
   * @param  sa Peer IP address
   * @return True if the peer is trusted, false otherwise
   */
- virtual Decision verify(const sockaddr_storage& sa) throw() { return DENY; }
+ virtual Decision verify(const sockaddr_storage& /* sa */ ) throw() { return DENY; }
  /**
   * Determine whether the peer should be granted access or not. It's called
   * every time a DNS subjectAltName/common name is extracted from peer's
@@ -284,7 +284,7 @@ class AccessManager {
   *
   * Note: The "name" parameter may be UTF8 encoded.
   */
- virtual Decision verify(const std::string& host, const char* name, int size)
+ virtual Decision verify(const std::string& /* host */, const char* /* name */, int /* size */)
    throw() { return DENY; }
  /**
   * Determine whether the peer should be granted access or not. It's called
@@ -295,7 +295,7 @@ class AccessManager {
   * @param  size Length of the IP address
   * @return True if the peer is trusted, false otherwise
   */
- virtual Decision verify(const sockaddr_storage& sa, const char* data, int size)
+ virtual Decision verify(const sockaddr_storage& /* sa */, const char* /* data */, int /* size */)
    throw() { return DENY; }
 };
 
old mode 100644 (file)
new mode 100755 (executable)
index 0c91956..4892722
@@ -92,7 +92,7 @@ class Server : public ServiceIf {
   int64_t echoI64(const int64_t arg) {return arg;}
   void echoString(string& out, const string &arg) {
     if (arg != "hello") {
-      T_ERROR_ABORT("WRONG STRING!!!!");
+      T_ERROR_ABORT("WRONG STRING (%s)!!!!", arg.c_str());
     }
     out = arg;
   }
old mode 100644 (file)
new mode 100755 (executable)
index 7650d49..0d8bc3a
@@ -98,7 +98,7 @@ class Server : public ServiceIf {
   int64_t echoI64(const int64_t arg) {return arg;}
   void echoString(string& out, const string &arg) {
     if (arg != "hello") {
-      T_ERROR_ABORT("WRONG STRING!!!!");
+      T_ERROR_ABORT("WRONG STRING (%s)!!!!", arg.c_str());
     }
     out = arg;
   }
old mode 100644 (file)
new mode 100755 (executable)
index 3f22ad2..9aed551
@@ -63,6 +63,9 @@ uint64_t now()
 }
 
 static void testString_clientReturn(const char* host, int port, event_base *base, TProtocolFactory* protocolFactory, ThriftTestCobClient* client) {
+  (void) host;
+  (void) port;
+  (void) protocolFactory;
   try {
     string s;
     client->recv_testString(s);
@@ -283,7 +286,7 @@ int main(int argc, char** argv) {
      */
     printf("testDouble(-5.2098523)");
     double dub = testClient.testDouble(-5.2098523);
-    printf(" = %lf\n", dub);
+    printf(" = %f\n", dub);
 
     /**
      * STRUCT TEST
index 2c9d43a..4afbef6 100755 (executable)
@@ -88,7 +88,7 @@ class TestHandler : public ThriftTestIf {
   }
 
   double testDouble(const double thing) {
-    printf("testDouble(%lf)\n", thing);
+    printf("testDouble(%f)\n", thing);
     return thing;
   }
 
@@ -193,6 +193,7 @@ class TestHandler : public ThriftTestIf {
   }
 
   void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
+    (void) argument;
     printf("testInsanity()\n");
 
     Xtruct hello;
@@ -262,6 +263,10 @@ class TestHandler : public ThriftTestIf {
   }
 
   void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz::type arg4, const UserId arg5) {
+    (void) arg3;
+    (void) arg4;
+    (void) arg5;
+    
     printf("testMulti()\n");
 
     hello.string_thing = "Hello2";
@@ -319,21 +324,25 @@ class TestHandler : public ThriftTestIf {
 
 class TestProcessorEventHandler : public TProcessorEventHandler {
   virtual void* getContext(const char* fn_name, void* serverContext) {
+    (void) serverContext;
     return new std::string(fn_name);
   }
   virtual void freeContext(void* ctx, const char* fn_name) {
+    (void) fn_name;
     delete static_cast<std::string*>(ctx);
   }
   virtual void preRead(void* ctx, const char* fn_name) {
     communicate("preRead", ctx, fn_name);
   }
   virtual void postRead(void* ctx, const char* fn_name, uint32_t bytes) {
+    (void) bytes;
     communicate("postRead", ctx, fn_name);
   }
   virtual void preWrite(void* ctx, const char* fn_name) {
     communicate("preWrite", ctx, fn_name);
   }
   virtual void postWrite(void* ctx, const char* fn_name, uint32_t bytes) {
+    (void) bytes;
     communicate("postWrite", ctx, fn_name);
   }
   virtual void asyncComplete(void* ctx, const char* fn_name) {