thrift: add --allow-neg-keys argument to allow ------------------------------------------------
Key: THRIFT-1270 URL: https://issues.apache.org/jira/browse/THRIFT-1270 Project: Thrift Issue Type: Improvement Components: C++ - Library Reporter: Dave Watson Priority: Minor >From 0df0b8cec89a9d7652fbbabd06e5b4d153537431 Mon Sep 17 00:00:00 2001 From: Dave Watson <davejwat...@fb.com> Date: Tue, 2 Aug 2011 08:40:44 -0700 Subject: [PATCH 02/33] thrift: add --allow-neg-keys argument to allow negative field keys Summary: Several of our .thrift files already deployed in production do not have explicitly specified key values for all fields. Thrift automatically chooses negative values for these keys (and also emits a warning while doing so). Previously, this couldn't be fixed without breaking protocol compatibility, since thrift refuses to accept explicitly specified negative key values. This new flag causes thrift to accept negative key values, so that these older .thrift files can be updated with explicitly specified values. It emits a warning if a negative value is specified that is different from what thrift would have otherwise chosen. Test Plan: Tested modifying common/fbunit/logger/if/UnitTestLogger.thrift and biggrep/BigGrep.thrift to pass in negative field values. I'll check in the changes to these .thrift files separately, since it also requires changes to fbconfig to support passing in the --allow-neg-keys argument. For fbunit, I'll probably change it to just use positive key values, since we don't really care about backwards compatibility in that case. --- compiler/cpp/src/globals.h | 15 +++++++++++++ compiler/cpp/src/main.cc | 10 ++++++++ compiler/cpp/src/parse/t_field.h | 9 ++++++++ compiler/cpp/src/thrifty.yy | 43 +++++++++++++++++++++++++++++++------ 4 files changed, 70 insertions(+), 7 deletions(-) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira