Make warnings from the Thrift compiler a little clearer.
Reviewed by: mcslee
Warning and error messages from the Thrift compiler include
the file currently being parsed and the line number.
This change sets those to dummy values for stages that
have nothing to do with parsing.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665506 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index b2aaeb4..8b1848c 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -993,6 +993,9 @@
usage();
}
+ // Set the current path to a dummy value to make warning messages clearer.
+ g_curpath = "arguments";
+
// Hacky parameter handling... I didn't feel like using a library sorry!
for (i = 1; i < argc-1; i++) {
char* arg;
@@ -1159,6 +1162,13 @@
// Parse it!
parse(program, NULL);
+ // The current path is not really relevant when we are doing generation.
+ // Reset the variable to make warning messages clearer.
+ g_curpath = "generation";
+ // Reset yylineno for the heck of it. Use 1 instead of 0 because
+ // That is what shows up during argument parsing.
+ yylineno = 1;
+
// Generate it!
generate(program);