mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 18:58:51 +00:00
THRIFT-2045: C++ compiler warning and build cleanup
Client: cpp compiler, go compiler, python compiler, compiler build Patch: Ben Craig
This commit is contained in:
parent
380a45d0f7
commit
282e440c6d
@ -3341,7 +3341,11 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
|
||||
}
|
||||
}
|
||||
|
||||
out << " catch (const std::exception& e) {" << endl;
|
||||
if (!tfunction->is_oneway()) {
|
||||
out << " catch (const std::exception& e) {" << endl;
|
||||
} else {
|
||||
out << " catch (const std::exception&) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
out <<
|
||||
@ -3471,7 +3475,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
|
||||
|
||||
// TODO(dreiss): Handle TExceptions? Expose to server?
|
||||
out <<
|
||||
indent() << "catch (const std::exception& exn) {" << endl <<
|
||||
indent() << "catch (const std::exception&) {" << endl <<
|
||||
indent() << " if (this->eventHandler_.get() != NULL) {" << endl <<
|
||||
indent() << " this->eventHandler_->handlerError(ctx, " <<
|
||||
service_func_name << ");" << endl <<
|
||||
|
@ -2165,7 +2165,7 @@ void t_go_generator::generate_service_remote(t_service* tservice)
|
||||
S_IRUSR
|
||||
| S_IWUSR
|
||||
| S_IXUSR
|
||||
#ifndef MINGW
|
||||
#ifndef _WIN32
|
||||
| S_IRGRP
|
||||
| S_IXGRP
|
||||
| S_IROTH
|
||||
|
@ -1697,7 +1697,7 @@ void t_py_generator::generate_service_remote(t_service* tservice) {
|
||||
S_IRUSR
|
||||
| S_IWUSR
|
||||
| S_IXUSR
|
||||
#ifndef MINGW
|
||||
#ifndef _WIN32
|
||||
| S_IRGRP
|
||||
| S_IXGRP
|
||||
| S_IROTH
|
||||
|
@ -39,13 +39,14 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef MINGW
|
||||
#ifdef _WIN32
|
||||
# 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"
|
||||
@ -161,11 +162,11 @@ int g_allow_64bit_consts = 0;
|
||||
bool gen_recurse = false;
|
||||
|
||||
/**
|
||||
* MinGW doesn't have realpath, so use fallback implementation in that case,
|
||||
* Win32 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 MINGW
|
||||
#ifdef _WIN32
|
||||
char buf[MAX_PATH];
|
||||
char* basename;
|
||||
DWORD len = GetFullPathName(path, MAX_PATH, buf, &basename);
|
||||
@ -190,7 +191,7 @@ char *saferealpath(const char *path, char *resolved_path) {
|
||||
}
|
||||
|
||||
bool check_is_directory(const char *dir_name) {
|
||||
#ifdef MINGW
|
||||
#ifdef _WIN32
|
||||
DWORD attributes = ::GetFileAttributesA(dir_name);
|
||||
if(attributes == INVALID_FILE_ATTRIBUTES) {
|
||||
fprintf(stderr, "Output directory %s is unusable: GetLastError() = %ld\n", dir_name, GetLastError());
|
||||
@ -336,7 +337,7 @@ string include_file(string filename) {
|
||||
// Absolute path? Just try that
|
||||
if (filename[0] == '/') {
|
||||
// Realpath!
|
||||
char rp[PATH_MAX];
|
||||
char rp[THRIFT_PATH_MAX];
|
||||
if (saferealpath(filename.c_str(), rp) == NULL) {
|
||||
pwarning(0, "Cannot open include file %s\n", filename.c_str());
|
||||
return std::string();
|
||||
@ -358,7 +359,7 @@ string include_file(string filename) {
|
||||
string sfilename = *(it) + "/" + filename;
|
||||
|
||||
// Realpath!
|
||||
char rp[PATH_MAX];
|
||||
char rp[THRIFT_PATH_MAX];
|
||||
if (saferealpath(sfilename.c_str(), rp) == NULL) {
|
||||
continue;
|
||||
}
|
||||
@ -1066,7 +1067,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
out_path = arg;
|
||||
|
||||
#ifdef MINGW
|
||||
#ifdef _WIN32
|
||||
//strip out trailing \ on Windows
|
||||
int last = out_path.length()-1;
|
||||
if (out_path[last] == '\\')
|
||||
@ -1104,7 +1105,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
// Real-pathify it
|
||||
char rp[PATH_MAX];
|
||||
char rp[THRIFT_PATH_MAX];
|
||||
if (argv[i] == NULL) {
|
||||
fprintf(stderr, "Missing file name\n");
|
||||
usage();
|
||||
|
@ -155,7 +155,7 @@ class t_field : public t_doc {
|
||||
* not it was specified by the user or automatically chosen.
|
||||
*/
|
||||
struct t_field_id {
|
||||
int64_t value;
|
||||
int32_t value;
|
||||
bool auto_assigned;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,11 @@
|
||||
* is different for the non-POSIX MinGW
|
||||
*/
|
||||
|
||||
#ifdef MINGW
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#else
|
||||
@ -30,8 +34,14 @@
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if defined MINGW
|
||||
#ifdef _WIN32
|
||||
#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
|
||||
|
@ -33,14 +33,26 @@
|
||||
* 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"
|
||||
|
@ -34,11 +34,19 @@
|
||||
#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
|
||||
@ -584,7 +592,7 @@ EnumDef:
|
||||
pwarning(1, "64-bit value supplied for enum %s.\n", $2);
|
||||
}
|
||||
validate_simple_identifier( $2);
|
||||
$$ = new t_enum_value($2, $4);
|
||||
$$ = new t_enum_value($2, static_cast<int>($4));
|
||||
if ($1 != NULL) {
|
||||
$$->set_doc($1);
|
||||
}
|
||||
@ -986,17 +994,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 = $1 - 1;
|
||||
$$.value = $1;
|
||||
y_field_val = static_cast<int32_t>($1 - 1);
|
||||
$$.value = static_cast<int32_t>($1);
|
||||
$$.auto_assigned = false;
|
||||
} else {
|
||||
pwarning(1, "Nonpositive value (%"PRIi64") not allowed as a field key.\n",
|
||||
pwarning(1, "Nonpositive value (%d) not allowed as a field key.\n",
|
||||
$1);
|
||||
$$.value = y_field_val--;
|
||||
$$.auto_assigned = true;
|
||||
}
|
||||
} else {
|
||||
$$.value = $1;
|
||||
$$.value = static_cast<int32_t>($1);
|
||||
$$.auto_assigned = false;
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,10 @@
|
||||
#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_
|
||||
|
@ -28,15 +28,6 @@
|
||||
#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_
|
||||
|
Loading…
Reference in New Issue
Block a user