mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 18:58:51 +00:00
THRIFT-1276 Add thrift compiler option to suppress warnings about
Patch: Dave Watson git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1159593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b6af6dbf05
commit
887ff756cb
@ -129,4 +129,13 @@ extern int g_doctext_lineno;
|
||||
*/
|
||||
extern int g_allow_neg_field_keys;
|
||||
|
||||
/**
|
||||
* Whether or not 64-bit constants will generate a warning.
|
||||
*
|
||||
* Some languages don't support 64-bit constants, but many do, so we can
|
||||
* suppress this warning for projects that don't use any non-64-bit-safe
|
||||
* languages.
|
||||
*/
|
||||
extern int g_allow_64bit_consts;
|
||||
|
||||
#endif
|
||||
|
@ -156,6 +156,11 @@ int g_doctext_lineno;
|
||||
*/
|
||||
int g_allow_neg_field_keys;
|
||||
|
||||
/**
|
||||
* Whether or not 64-bit constants will generate a warning.
|
||||
*/
|
||||
int g_allow_64bit_consts = 0;
|
||||
|
||||
/**
|
||||
* Flags to control code generation
|
||||
*/
|
||||
@ -647,6 +652,7 @@ void usage() {
|
||||
fprintf(stderr, " --allow-neg-keys Allow negative field keys (Used to "
|
||||
"preserve protocol\n");
|
||||
fprintf(stderr, " compatibility with older .thrift files)\n");
|
||||
fprintf(stderr, " --allow-64bit-consts Do not print warnings about using 64-bit constants\n");
|
||||
fprintf(stderr, " --gen STR Generate code with a dynamically-registered generator.\n");
|
||||
fprintf(stderr, " STR has the form language[:key1=val1[,key2,[key3=val3]]].\n");
|
||||
fprintf(stderr, " Keys and values are options passed to the generator.\n");
|
||||
@ -980,6 +986,8 @@ int main(int argc, char** argv) {
|
||||
gen_recurse = true;
|
||||
} else if (strcmp(arg, "-allow-neg-keys") == 0) {
|
||||
g_allow_neg_field_keys = true;
|
||||
} else if (strcmp(arg, "-allow-64bit-consts") == 0) {
|
||||
g_allow_64bit_consts = true;
|
||||
} else if (strcmp(arg, "-gen") == 0) {
|
||||
arg = argv[++i];
|
||||
if (arg == NULL) {
|
||||
|
@ -618,7 +618,7 @@ ConstValue:
|
||||
pdebug("ConstValue => tok_int_constant");
|
||||
$$ = new t_const_value();
|
||||
$$->set_integer($1);
|
||||
if ($1 < INT32_MIN || $1 > INT32_MAX) {
|
||||
if (!g_allow_64bit_consts && ($1 < INT32_MIN || $1 > INT32_MAX)) {
|
||||
pwarning(1, "64-bit constant \"%"PRIi64"\" may not work in all languages.\n", $1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user