thrift-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bryanduxb...@apache.org
Subject svn commit: r761736 - in /incubator/thrift/trunk/compiler/cpp/src: globals.h main.cc thrifty.yy
Date Fri, 03 Apr 2009 17:29:26 GMT
Author: bryanduxbury
Date: Fri Apr  3 17:29:25 2009
New Revision: 761736

URL: http://svn.apache.org/viewvc?rev=761736&view=rev
Log:
THRIFT-423. -strict should turn omitted field ids into compile error

Issue name says it all.


Modified:
    incubator/thrift/trunk/compiler/cpp/src/globals.h
    incubator/thrift/trunk/compiler/cpp/src/main.cc
    incubator/thrift/trunk/compiler/cpp/src/thrifty.yy

Modified: incubator/thrift/trunk/compiler/cpp/src/globals.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/globals.h?rev=761736&r1=761735&r2=761736&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/globals.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/globals.h Fri Apr  3 17:29:25 2009
@@ -54,6 +54,11 @@
 };
 
 /**
+ * Strictness level
+ */
+extern int g_strict;
+
+/**
  * The master program parse tree. This is accessed from within the parser code
  * to build up the program elements.
  */

Modified: incubator/thrift/trunk/compiler/cpp/src/main.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/main.cc?rev=761736&r1=761735&r2=761736&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/main.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/main.cc Fri Apr  3 17:29:25 2009
@@ -121,6 +121,11 @@
 int g_debug = 0;
 
 /**
+ * Strictness level
+ */
+int g_strict = 127;
+
+/**
  * Warning level
  */
 int g_warn = 1;
@@ -928,6 +933,7 @@
       } else if (strcmp(arg, "-nowarn") == 0) {
         g_warn = 0;
       } else if (strcmp(arg, "-strict") == 0) {
+        g_strict = 255;
         g_warn = 2;
       } else if (strcmp(arg, "-v") == 0 || strcmp(arg, "-verbose") == 0 ) {
         g_verbose = 1;

Modified: incubator/thrift/trunk/compiler/cpp/src/thrifty.yy
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/thrifty.yy?rev=761736&r1=761735&r2=761736&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/thrifty.yy (original)
+++ incubator/thrift/trunk/compiler/cpp/src/thrifty.yy Fri Apr  3 17:29:25 2009
@@ -848,6 +848,10 @@
       pdebug("tok_int_constant : Field -> FieldType tok_identifier");
       if ($2 < 0) {
         pwarning(1, "No field key specified for %s, resulting protocol may have conflicts
or not be backwards compatible!\n", $5);
+        if (g_strict >= 192) {
+          yyerror("Implicit field keys are deprecated and not allowed with -strict");
+          exit(1);
+        }
       }
       $$ = new t_field($4, $5, $2);
       $$->set_req($3);



Mime
View raw message