THRIFT-916 no errors on GNU/Linux when compiling with CXXFLAGS="-Wall -Wextra -pedantic"
authorRoger Meier <roger@apache.org>
Wed, 13 Oct 2010 18:10:18 +0000 (18:10 +0000)
committerRoger Meier <roger@apache.org>
Wed, 13 Oct 2010 18:10:18 +0000 (18:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1022220 13f79535-47bb-0310-9956-ffa450edef68

25 files changed:
compiler/cpp/src/generate/t_as3_generator.cc
compiler/cpp/src/generate/t_cocoa_generator.cc
compiler/cpp/src/generate/t_cpp_generator.cc
compiler/cpp/src/generate/t_csharp_generator.cc
compiler/cpp/src/generate/t_erl_generator.cc
compiler/cpp/src/generate/t_hs_generator.cc
compiler/cpp/src/generate/t_html_generator.cc
compiler/cpp/src/generate/t_java_generator.cc
compiler/cpp/src/generate/t_javame_generator.cc
compiler/cpp/src/generate/t_js_generator.cc
compiler/cpp/src/generate/t_ocaml_generator.cc
compiler/cpp/src/generate/t_perl_generator.cc
compiler/cpp/src/generate/t_php_generator.cc
compiler/cpp/src/generate/t_py_generator.cc
compiler/cpp/src/generate/t_rb_generator.cc
compiler/cpp/src/generate/t_st_generator.cc
compiler/cpp/src/generate/t_xsd_generator.cc
compiler/cpp/src/parse/t_field.h
lib/cpp/src/concurrency/Mutex.h
lib/cpp/src/protocol/TCompactProtocol.tcc
lib/cpp/src/server/TThreadPoolServer.cpp
lib/cpp/src/transport/TFileTransport.cpp
lib/cpp/test/TBufferBaseTest.cpp
lib/cpp/test/TMemoryBufferTest.cpp
lib/cpp/test/TransportTest.cpp

index fa0a1fe..d06d933 100644 (file)
@@ -2595,4 +2595,5 @@ std::string t_as3_generator::get_enum_class_name(t_type* type) {
 
 THRIFT_REGISTER_GENERATOR(as3, "AS3",
 "    bindable:          Add [bindable] metadata to all the struct classes.\n"
-);
+)
+
index d9b53f6..29ace00 100644 (file)
@@ -2462,4 +2462,5 @@ string t_cocoa_generator::call_field_setter(t_field* tfield, string fieldName) {
 
 THRIFT_REGISTER_GENERATOR(cocoa, "Cocoa",
 "    log_unexpected:  Log every time an unexpected field ID or type is encountered.\n"
-);
+)
+
index 55cb4ca..f5c8def 100644 (file)
@@ -4118,4 +4118,5 @@ THRIFT_REGISTER_GENERATOR(cpp, "C++",
 "    pure_enums:      Generate pure enums instead of wrapper classes.\n"
 "    dense:           Generate type specifications for the dense protocol.\n"
 "    include_prefix:  Use full include paths in generated files.\n"
-);
+)
+
index 4b26c98..123795c 100644 (file)
@@ -1697,4 +1697,5 @@ string t_csharp_generator::type_to_enum(t_type* type) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(csharp, "C#", "");
+THRIFT_REGISTER_GENERATOR(csharp, "C#", "")
+
index f8bfde3..7e2ac75 100644 (file)
@@ -921,4 +921,5 @@ std::string t_erl_generator::type_module(t_type* ttype) {
   return uncapitalize(ttype->get_program()->get_name()) + "_types";
 }
 
-THRIFT_REGISTER_GENERATOR(erl, "Erlang", "");
+THRIFT_REGISTER_GENERATOR(erl, "Erlang", "")
+
index 43bc397..c41ff68 100644 (file)
@@ -1468,4 +1468,5 @@ string t_hs_generator::render_hs_type(t_type* type, bool needs_parens) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(hs, "Haskell", "");
+THRIFT_REGISTER_GENERATOR(hs, "Haskell", "")
+
index 2bf0523..d1b2f05 100644 (file)
@@ -644,4 +644,5 @@ void t_html_generator::generate_service(t_service* tservice) {
   }
 }
 
-THRIFT_REGISTER_GENERATOR(html, "HTML", "");
+THRIFT_REGISTER_GENERATOR(html, "HTML", "")
+
index ae4a5a9..134a826 100644 (file)
@@ -3924,5 +3924,5 @@ THRIFT_REGISTER_GENERATOR(java, "Java",
 "    private-members: Members will be private, but setter methods will return 'this' like usual.\n"
 "    nocamel:         Do not use CamelCase field accessors with beans.\n"
 "    hashcode:        Generate quality hashCode methods.\n"
-);
+)
 
index 696db69..ff2d285 100644 (file)
@@ -3375,4 +3375,5 @@ void t_javame_generator::generate_java_struct_clear(std::ofstream& out, t_struct
   indent(out) << "}" << endl << endl;
 }
 
-THRIFT_REGISTER_GENERATOR(javame, "Java ME", "");
+THRIFT_REGISTER_GENERATOR(javame, "Java ME", "")
+
index c330657..19ec156 100644 (file)
@@ -1469,4 +1469,5 @@ string t_js_generator ::type_to_enum(t_type* type) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(js, "Javascript", "");
+THRIFT_REGISTER_GENERATOR(js, "Javascript", "")
+
index 1db77b3..5ed4a99 100644 (file)
@@ -1873,4 +1873,5 @@ string t_ocaml_generator::render_ocaml_type(t_type* type) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(ocaml, "OCaml", "");
+THRIFT_REGISTER_GENERATOR(ocaml, "OCaml", "")
+
index d3d8236..33589c2 100644 (file)
@@ -1803,4 +1803,5 @@ string t_perl_generator ::type_to_enum(t_type* type) {
   throw "INVALID TYPE IN type_to_enum: " + type->get_name();
 }
 
-THRIFT_REGISTER_GENERATOR(perl, "Perl", "");
+THRIFT_REGISTER_GENERATOR(perl, "Perl", "")
+
index 04242c4..200d89a 100644 (file)
@@ -2303,4 +2303,5 @@ THRIFT_REGISTER_GENERATOR(php, "PHP",
 "    autoload:        Generate PHP with autoload\n"
 "    oop:             Generate PHP with object oriented subclasses\n"
 "    rest:            Generate PHP REST processors\n"
-);
+)
+
index 315cde2..bdd0c29 100644 (file)
@@ -2379,4 +2379,5 @@ string t_py_generator::type_to_spec_args(t_type* ttype) {
 THRIFT_REGISTER_GENERATOR(py, "Python",
 "    new_style:       Generate new-style classes.\n" \
 "    twisted:         Generate Twisted-friendly RPC services.\n"
-);
+)
+
index a7836c7..770f8e7 100644 (file)
@@ -1183,4 +1183,5 @@ void t_rb_generator::generate_rb_union_validator(std::ofstream& out,
   indent(out) << "end" << endl << endl;
 }
 
-THRIFT_REGISTER_GENERATOR(rb, "Ruby", "");
+THRIFT_REGISTER_GENERATOR(rb, "Ruby", "")
+
index 27b5449..fd8f035 100644 (file)
@@ -1051,4 +1051,5 @@ string t_st_generator::type_to_enum(t_type* type) {
 }
 
 
-THRIFT_REGISTER_GENERATOR(st, "Smalltalk", "");
+THRIFT_REGISTER_GENERATOR(st, "Smalltalk", "")
+
index 729a91a..c343b9a 100644 (file)
@@ -351,4 +351,5 @@ string t_xsd_generator::base_type_name(t_base_type::t_base tbase) {
   }
 }
 
-THRIFT_REGISTER_GENERATOR(xsd, "XSD", "");
+THRIFT_REGISTER_GENERATOR(xsd, "XSD", "")
+
index fb58ca7..0c3c2b1 100644 (file)
@@ -71,7 +71,7 @@ class t_field : public t_doc {
   enum e_req {
     T_REQUIRED,
     T_OPTIONAL,
-    T_OPT_IN_REQ_OUT,
+    T_OPT_IN_REQ_OUT
   };
 
   void set_req(e_req req) {
index 7cedbe3..3ee5c6b 100644 (file)
@@ -133,7 +133,7 @@ class Guard {
 // as to whether we're doing acquireRead() or acquireWrite().
 enum RWGuardType {
   RW_READ = 0,
-  RW_WRITE = 1,
+  RW_WRITE = 1
 };
 
 
index 8ad999c..ed9c281 100644 (file)
@@ -58,7 +58,7 @@ enum Types {
   CT_LIST           = 0x09,
   CT_SET            = 0x0A,
   CT_MAP            = 0x0B,
-  CT_STRUCT         = 0x0C,
+  CT_STRUCT         = 0x0C
 };
 
 const int8_t TTypeToCType[16] = {
index 18319be..840b835 100644 (file)
@@ -30,7 +30,7 @@ using boost::shared_ptr;
 using namespace std;
 using namespace apache::thrift;
 using namespace apache::thrift::concurrency;
-using namespace apache::thrift::protocol;;
+using namespace apache::thrift::protocol;
 using namespace apache::thrift::transport;
 
 class TThreadPoolServer::Task : public Runnable {
index 704dc56..4b14dee 100644 (file)
@@ -421,8 +421,9 @@ void TFileTransport::writerThread() {
             offset_ = lseek(fd_, 0, SEEK_CUR);
             int32_t padding = (int32_t)((offset_ / chunkSize_ + 1) * chunkSize_ - offset_);
 
-            uint8_t zeros[padding];
-            bzero(zeros, padding);
+            uint8_t* zeros = new uint8_t[padding];
+            memset(zeros, '\0', padding);
+            boost::scoped_array<uint8_t> array(zeros);
             if (-1 == ::write(fd_, zeros, padding)) {
               int errno_copy = errno;
               GlobalOutput.perror("TFileTransport: writerThread() error while padding zeros ", errno_copy);
@@ -1004,7 +1005,7 @@ TFileProcessor::TFileProcessor(shared_ptr<TProcessor> processor,
   inputProtocolFactory_(protocolFactory),
   outputProtocolFactory_(protocolFactory),
   inputTransport_(inputTransport),
-  outputTransport_(outputTransport) {};
+  outputTransport_(outputTransport) {}
 
 void TFileProcessor::process(uint32_t numEvents, bool tail) {
   shared_ptr<TProtocol> inputProtocol = inputProtocolFactory_->getProtocol(inputTransport_);
index 21f4747..6e1bf16 100644 (file)
@@ -172,7 +172,7 @@ void init_data() {
 }
 
 
-BOOST_AUTO_TEST_SUITE( TBufferBaseTest );
+BOOST_AUTO_TEST_SUITE( TBufferBaseTest )
 
 BOOST_AUTO_TEST_CASE( test_MemoryBuffer_Write_GetBuffer ) {
   init_data();
@@ -641,4 +641,5 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Empty_Flush ) {
   BOOST_CHECK_EQUAL(buffer->getBufferAsString(), output2);
 }
 
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()
+
index 3dc19f8..3711970 100644 (file)
@@ -25,7 +25,7 @@
 #include <protocol/TBinaryProtocol.h>
 #include "gen-cpp/ThriftTest_types.h"
 
-BOOST_AUTO_TEST_SUITE( TMemoryBufferTest );
+BOOST_AUTO_TEST_SUITE( TMemoryBufferTest )
 
 BOOST_AUTO_TEST_CASE( test_roundtrip ) {
     using apache::thrift::transport::TMemoryBuffer;
@@ -104,4 +104,5 @@ BOOST_AUTO_TEST_CASE( test_exceptions )
     }
   }
 
-BOOST_AUTO_TEST_SUITE_END();
+BOOST_AUTO_TEST_SUITE_END()
+
index dceb708..59f2427 100644 (file)
@@ -360,8 +360,9 @@ void alarm_handler(int signum) {
   set_alarm();
 
   // Write some data to the transport to hopefully unblock it.
-  uint8_t buf[info->writeLength];
+  uint8_t* buf = new uint8_t[info->writeLength];
   memset(buf, 'b', info->writeLength);
+  boost::scoped_array<uint8_t> array(buf);
   info->transport->write(buf, info->writeLength);
   info->transport->flush();
 
@@ -895,7 +896,7 @@ class TransportTestGen {
     boost::unit_test::test_case* tc =
       boost::unit_test::make_test_case(test_func, name.str());
     suite_->add(tc, expectedFailures);
-  };
+  }
 
   template <class CoupledTransports>
   void addTestBlocking(const char* transportName,