From: David Reiss Date: Wed, 27 Feb 2008 01:54:47 +0000 (+0000) Subject: Make warnings from the Thrift compiler a little clearer. X-Git-Tag: 0.2.0~966 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=9cc2c137102ce4b5a2e0d362832ea1021c20ca19;p=common%2Fthrift.git 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 b2aaeb4f..8b1848c9 100644 --- a/compiler/cpp/src/main.cc +++ b/compiler/cpp/src/main.cc @@ -993,6 +993,9 @@ int main(int argc, char** argv) { 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 @@ int main(int argc, char** argv) { // 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);