THRIFT-916 gcc warnings in c++ header files

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1147700 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 cebb078..05514f1 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/generate/t_as3_generator.cc
@@ -769,7 +769,6 @@
   "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;
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 389bbf9..6b1f607 100755
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -3007,6 +3007,12 @@
         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 @@
                   ? "()"
                   : ("(" + 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";
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
old mode 100644
new mode 100755
index fe34bb7..6b2efc8
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -46,6 +46,8 @@
       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 @@
                                                    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 @@
                                                 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 @@
                                                 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 @@
                                                   bool declare,
                                                   string prefix,
                                                   string err) {
+  (void) err;
   string err2(tmp("err"));
   string eq(" := ");
   if(!declare) {
@@ -2452,6 +2459,8 @@
                                                        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 @@
                                                        bool   declare,
                                                        string prefix,
                                                        string err) {
+  (void) declare;
   string elem = tmp("_elem");
   t_field felem(tset->get_elem_type(), elem);
 
@@ -2489,6 +2499,7 @@
                                                         bool   declare,
                                                         string prefix,
                                                         string err) {
+  (void) declare;
   string elem = tmp("_elem");
   t_field felem(tlist->get_elem_type(), elem);
 
@@ -3074,4 +3085,4 @@
 }
 
 
-THRIFT_REGISTER_GENERATOR(go, "Go", "");
+THRIFT_REGISTER_GENERATOR(go, "Go", "")
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index 04aaa40..1b55172 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -3875,6 +3875,7 @@
 
 // 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;
diff --git a/lib/cpp/src/async/TEvhttpClientChannel.cpp b/lib/cpp/src/async/TEvhttpClientChannel.cpp
old mode 100644
new mode 100755
index 8b47173..b5265ce
--- a/lib/cpp/src/async/TEvhttpClientChannel.cpp
+++ b/lib/cpp/src/async/TEvhttpClientChannel.cpp
@@ -93,12 +93,16 @@
 
 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
 }
 
diff --git a/lib/cpp/src/async/TEvhttpServer.cpp b/lib/cpp/src/async/TEvhttpServer.cpp
old mode 100644
new mode 100755
index 30e33e5..701f8bd
--- a/lib/cpp/src/async/TEvhttpServer.cpp
+++ b/lib/cpp/src/async/TEvhttpServer.cpp
@@ -124,6 +124,7 @@
 
 
 void TEvhttpServer::complete(RequestContext* ctx, bool success) {
+  (void) success;
   std::auto_ptr<RequestContext> ptr(ctx);
 
   int code = 200;
diff --git a/lib/cpp/src/transport/TSSLSocket.cpp b/lib/cpp/src/transport/TSSLSocket.cpp
old mode 100644
new mode 100755
index 602a894..913c258
--- a/lib/cpp/src/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/transport/TSSLSocket.cpp
@@ -258,7 +258,7 @@
   // 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 @@
  * 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,
diff --git a/lib/cpp/src/transport/TSSLSocket.h b/lib/cpp/src/transport/TSSLSocket.h
old mode 100644
new mode 100755
index 6b241b2..a0a1502
--- a/lib/cpp/src/transport/TSSLSocket.h
+++ b/lib/cpp/src/transport/TSSLSocket.h
@@ -201,7 +201,7 @@
    * @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 @@
   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 @@
   * @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 @@
   *
   * 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 @@
   * @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; }
 };
 
diff --git a/test/cpp/src/StressTest.cpp b/test/cpp/src/StressTest.cpp
old mode 100644
new mode 100755
index 0c91956..4892722
--- a/test/cpp/src/StressTest.cpp
+++ b/test/cpp/src/StressTest.cpp
@@ -92,7 +92,7 @@
   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;
   }
diff --git a/test/cpp/src/StressTestNonBlocking.cpp b/test/cpp/src/StressTestNonBlocking.cpp
old mode 100644
new mode 100755
index 7650d49..0d8bc3a
--- a/test/cpp/src/StressTestNonBlocking.cpp
+++ b/test/cpp/src/StressTestNonBlocking.cpp
@@ -98,7 +98,7 @@
   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;
   }
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
old mode 100644
new mode 100755
index 3f22ad2..9aed551
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -63,6 +63,9 @@
 }
 
 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 @@
      */
     printf("testDouble(-5.2098523)");
     double dub = testClient.testDouble(-5.2098523);
-    printf(" = %lf\n", dub);
+    printf(" = %f\n", dub);
 
     /**
      * STRUCT TEST
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 2c9d43a..4afbef6 100755
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -88,7 +88,7 @@
   }
 
   double testDouble(const double thing) {
-    printf("testDouble(%lf)\n", thing);
+    printf("testDouble(%f)\n", thing);
     return thing;
   }
 
@@ -193,6 +193,7 @@
   }
 
   void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
+    (void) argument;
     printf("testInsanity()\n");
 
     Xtruct hello;
@@ -262,6 +263,10 @@
   }
 
   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 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) {