You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by be...@apache.org on 2013/10/09 16:54:10 UTC

git commit: Revert "THRIFT-2045: C++ compiler warning and build cleanup"

Updated Branches:
  refs/heads/master 282e440c6 -> 9f9cd10e8


Revert "THRIFT-2045: C++ compiler warning and build cleanup"

This reverts commit 282e440c6de219b7b8f32b01cc7eb599f534f33f.

This change had unintended autoconf side effects.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/9f9cd10e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/9f9cd10e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/9f9cd10e

Branch: refs/heads/master
Commit: 9f9cd10e813ef574dd5578d78ca26a9088383d3a
Parents: 282e440
Author: Ben Craig <be...@apache.org>
Authored: Wed Oct 9 09:47:48 2013 -0500
Committer: Ben Craig <be...@apache.org>
Committed: Wed Oct 9 09:47:48 2013 -0500

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_cpp_generator.cc |  8 ++------
 compiler/cpp/src/generate/t_go_generator.cc  |  2 +-
 compiler/cpp/src/generate/t_py_generator.cc  |  2 +-
 compiler/cpp/src/main.cc                     | 21 ++++++++++-----------
 compiler/cpp/src/parse/t_field.h             |  2 +-
 compiler/cpp/src/platform.h                  | 14 ++------------
 compiler/cpp/src/thriftl.ll                  | 12 ------------
 compiler/cpp/src/thrifty.yy                  | 20 ++++++--------------
 compiler/cpp/src/windows/config.h            |  4 ----
 compiler/cpp/src/windows/version.h.in        |  9 +++++++++
 10 files changed, 32 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/generate/t_cpp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 333fe60..1faa2c3 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -3341,11 +3341,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
       }
     }
 
-    if (!tfunction->is_oneway()) {
-       out << " catch (const std::exception& e) {" << endl;
-    } else {
-       out << " catch (const std::exception&) {" << endl;
-    }
+    out << " catch (const std::exception& e) {" << endl;
 
     indent_up();
     out <<
@@ -3475,7 +3471,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
 
     // TODO(dreiss): Handle TExceptions?  Expose to server?
     out <<
-      indent() << "catch (const std::exception&) {" << endl <<
+      indent() << "catch (const std::exception& exn) {" << endl <<
       indent() << "  if (this->eventHandler_.get() != NULL) {" << endl <<
       indent() << "    this->eventHandler_->handlerError(ctx, " <<
         service_func_name << ");" << endl <<

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/generate/t_go_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index 0d7e6c2..00af893 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -2165,7 +2165,7 @@ void t_go_generator::generate_service_remote(t_service* tservice)
           S_IRUSR
           | S_IWUSR
           | S_IXUSR
-#ifndef _WIN32
+#ifndef MINGW
           | S_IRGRP
           | S_IXGRP
           | S_IROTH

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/generate/t_py_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc
index b910cf6..e215195 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/generate/t_py_generator.cc
@@ -1697,7 +1697,7 @@ void t_py_generator::generate_service_remote(t_service* tservice) {
           S_IRUSR
         | S_IWUSR
         | S_IXUSR
-#ifndef _WIN32
+#ifndef MINGW
         | S_IRGRP
         | S_IXGRP
         | S_IROTH

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/main.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index 4ce22b4..b9f7513 100755
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -39,14 +39,13 @@
 #include <errno.h>
 #include <limits.h>
 
-#ifdef _WIN32
+#ifdef MINGW
 # include <windows.h> /* for GetFullPathName */
 #endif
 
 // Careful: must include globals first for extern definitions
 #include "globals.h"
 
-#include "platform.h"
 #include "main.h"
 #include "parse/t_program.h"
 #include "parse/t_scope.h"
@@ -162,11 +161,11 @@ int g_allow_64bit_consts = 0;
 bool gen_recurse = false;
 
 /**
- * Win32 doesn't have realpath, so use fallback implementation in that case,
+ * MinGW doesn't have realpath, so use fallback implementation in that case,
  * otherwise this just calls through to realpath
  */
 char *saferealpath(const char *path, char *resolved_path) {
-#ifdef _WIN32
+#ifdef MINGW
   char buf[MAX_PATH];
   char* basename;
   DWORD len = GetFullPathName(path, MAX_PATH, buf, &basename);
@@ -191,7 +190,7 @@ char *saferealpath(const char *path, char *resolved_path) {
 }
 
 bool check_is_directory(const char *dir_name) {
-#ifdef _WIN32
+#ifdef MINGW
   DWORD attributes = ::GetFileAttributesA(dir_name);
   if(attributes == INVALID_FILE_ATTRIBUTES) {
     fprintf(stderr, "Output directory %s is unusable: GetLastError() = %ld\n", dir_name, GetLastError());
@@ -337,7 +336,7 @@ string include_file(string filename) {
   // Absolute path? Just try that
   if (filename[0] == '/') {
     // Realpath!
-    char rp[THRIFT_PATH_MAX];
+    char rp[PATH_MAX];
     if (saferealpath(filename.c_str(), rp) == NULL) {
       pwarning(0, "Cannot open include file %s\n", filename.c_str());
       return std::string();
@@ -359,7 +358,7 @@ string include_file(string filename) {
       string sfilename = *(it) + "/" + filename;
 
       // Realpath!
-      char rp[THRIFT_PATH_MAX];
+      char rp[PATH_MAX];
       if (saferealpath(sfilename.c_str(), rp) == NULL) {
         continue;
       }
@@ -758,8 +757,8 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) {
       }
     }
     if (!found) {
-      throw "type error: const " + name + " was declared as type "
-        + type->get_name() + " which is an enum, but "
+      throw "type error: const " + name + " was declared as type " 
+        + type->get_name() + " which is an enum, but " 
         + value->get_identifier() + " is not a valid value for that enum";
     }
   } else if (type->is_struct() || type->is_xception()) {
@@ -1067,7 +1066,7 @@ int main(int argc, char** argv) {
         }
         out_path = arg;
 
-#ifdef _WIN32
+#ifdef MINGW
         //strip out trailing \ on Windows
         int last = out_path.length()-1;
         if (out_path[last] == '\\')
@@ -1105,7 +1104,7 @@ int main(int argc, char** argv) {
   }
 
   // Real-pathify it
-  char rp[THRIFT_PATH_MAX];
+  char rp[PATH_MAX];
   if (argv[i] == NULL) {
     fprintf(stderr, "Missing file name\n");
     usage();

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/parse/t_field.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/parse/t_field.h
index 7bbcc0f..ac10d57 100644
--- a/compiler/cpp/src/parse/t_field.h
+++ b/compiler/cpp/src/parse/t_field.h
@@ -155,7 +155,7 @@ class t_field : public t_doc {
  * not it was specified by the user or automatically chosen.
  */
 struct t_field_id {
-  int32_t value;
+  int64_t value;
   bool auto_assigned;
 };
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/platform.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/platform.h b/compiler/cpp/src/platform.h
index 7eb891d..04f04c7 100644
--- a/compiler/cpp/src/platform.h
+++ b/compiler/cpp/src/platform.h
@@ -22,11 +22,7 @@
  * is different for the non-POSIX MinGW
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef _WIN32
+#ifdef MINGW
 #include <direct.h>
 #include <io.h>
 #else
@@ -34,14 +30,8 @@
 #include <sys/stat.h>
 #endif
 
-#ifdef _WIN32
+#if defined MINGW
 #define MKDIR(x) mkdir(x)
 #else
 #define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
-
-#ifdef PATH_MAX
-#define THRIFT_PATH_MAX PATH_MAX
-#else
-#define THRIFT_PATH_MAX MAX_PATH
-#endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/thriftl.ll
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index db17a63..96d61ec 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -33,26 +33,14 @@
  * We should revert the Makefile.am changes once Apple ships a reasonable
  * GCC.
  */
-#ifdef __GNUC__
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-label"
-#endif
-
-#ifdef _MSC_VER
-//warning C4102: 'find_rule' : unreferenced label
-#pragma warning(disable:4102)
-//avoid isatty redefinition
-#define YY_NEVER_INTERACTIVE 1
-#endif
 
 #include <cassert>
 #include <string>
 #include <errno.h>
 #include <stdlib.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "main.h"
 #include "globals.h"
 #include "parse/t_program.h"

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/thrifty.yy
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index a8ebf50..f5ab4a6 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -34,19 +34,11 @@
 #include <stdint.h>
 #endif
 #include <limits.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "main.h"
 #include "globals.h"
 #include "parse/t_program.h"
 #include "parse/t_scope.h"
 
-#ifdef _MSC_VER
-//warning C4065: switch statement contains 'default' but no 'case' labels
-#pragma warning(disable:4065)
-#endif
-
 /**
  * This global variable is used for automatic numbering of field indices etc.
  * when parsing the members of a struct. Field values are automatically
@@ -592,7 +584,7 @@ EnumDef:
         pwarning(1, "64-bit value supplied for enum %s.\n", $2);
       }
       validate_simple_identifier( $2);
-      $$ = new t_enum_value($2, static_cast<int>($4));
+      $$ = new t_enum_value($2, $4);
       if ($1 != NULL) {
         $$->set_doc($1);
       }
@@ -772,7 +764,7 @@ Struct:
         delete $7;
       }
     }
-
+    
 XsdAll:
   tok_xsd_all
     {
@@ -994,17 +986,17 @@ FieldIdentifier:
            * Leave $1 as-is, and update y_field_val to be one less than $1.
            * The FieldList parsing will catch any duplicate key values.
            */
-          y_field_val = static_cast<int32_t>($1 - 1);
-          $$.value = static_cast<int32_t>($1);
+          y_field_val = $1 - 1;
+          $$.value = $1;
           $$.auto_assigned = false;
         } else {
-          pwarning(1, "Nonpositive value (%d) not allowed as a field key.\n",
+          pwarning(1, "Nonpositive value (%"PRIi64") not allowed as a field key.\n",
                    $1);
           $$.value = y_field_val--;
           $$.auto_assigned = true;
         }
       } else {
-        $$.value = static_cast<int32_t>($1);
+        $$.value = $1;
         $$.auto_assigned = false;
       }
     }

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/windows/config.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/windows/config.h b/compiler/cpp/src/windows/config.h
index 356f4e5..9d75e80 100644
--- a/compiler/cpp/src/windows/config.h
+++ b/compiler/cpp/src/windows/config.h
@@ -37,10 +37,6 @@
 #define PRIu64 "I64d"
 #define PRIi64 "I64d"
 
-// squelch deprecation warnings
 #pragma warning(disable:4996)
-// squelch bool conversion performance warning
-#pragma warning(disable:4800)
-
 
 #endif // _THRIFT_WINDOWS_CONFIG_H_

http://git-wip-us.apache.org/repos/asf/thrift/blob/9f9cd10e/compiler/cpp/src/windows/version.h.in
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/windows/version.h.in b/compiler/cpp/src/windows/version.h.in
index 33708ba..94b7c56 100644
--- a/compiler/cpp/src/windows/version.h.in
+++ b/compiler/cpp/src/windows/version.h.in
@@ -28,6 +28,15 @@
 #error "This is a Windows header only"
 #endif
 
+#define PATH_MAX MAX_PATH
 #define THRIFT_VERSION "@PACKAGE_VERSION@"
 
+#ifndef S_ISDIR
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#endif
+
 #endif // _THRIFT_WINDOWS_VERSION_H_