*/
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
*/
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
*/
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");
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) {
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);
}
}