diff --git a/tools/binpac/src/pac_common.h b/tools/binpac/src/pac_common.h index 81e59c184e..079e14ac1f 100644 --- a/tools/binpac/src/pac_common.h +++ b/tools/binpac/src/pac_common.h @@ -12,6 +12,7 @@ using namespace std; extern bool FLAGS_pac_debug; +extern bool FLAGS_quiet; extern vector FLAGS_include_directories; extern string input_filename; extern int line_number; diff --git a/tools/binpac/src/pac_main.cc b/tools/binpac/src/pac_main.cc index 6b6fe64a63..68405effef 100644 --- a/tools/binpac/src/pac_main.cc +++ b/tools/binpac/src/pac_main.cc @@ -21,6 +21,7 @@ extern void switch_to_file(FILE* fp_input); string input_filename; bool FLAGS_pac_debug = false; +bool FLAGS_quiet = false; string FLAGS_output_directory; vector FLAGS_include_directories; @@ -192,6 +193,7 @@ void usage() fprintf(stderr, " | pac-language input files\n"); fprintf(stderr, " -d | use given directory for compiler output\n"); fprintf(stderr, " -D | enable debugging output\n"); + fprintf(stderr, " -q | stay quiet\n"); fprintf(stderr, " -h | show command line help\n"); fprintf(stderr, " -I | include in input file search path\n"); exit(1); @@ -203,7 +205,7 @@ int main(int argc, char* argv[]) extern char *malloc_options; #endif int o; - while ( (o = getopt(argc, argv, "DI:d:h")) != -1 ) + while ( (o = getopt(argc, argv, "DqI:d:h")) != -1 ) { switch(o) { @@ -214,6 +216,10 @@ int main(int argc, char* argv[]) malloc_options = "A"; #endif break; + + case 'q': + FLAGS_quiet = true; + break; case 'I': // Add to FLAGS_include_directories diff --git a/tools/binpac/src/pac_scan.ll b/tools/binpac/src/pac_scan.ll index ec435ea4ea..79743b540c 100644 --- a/tools/binpac/src/pac_scan.ll +++ b/tools/binpac/src/pac_scan.ll @@ -313,7 +313,8 @@ void switch_to_file(const char *filename) input_filename = string(filename); line_number = 1; switch_to_file(yyin); - fprintf(stderr, "switching to file %s\n", input_filename.c_str()); + if ( !FLAGS_quiet ) + fprintf(stderr, "switching to file %s\n", input_filename.c_str()); } void include_file(const char *filename) diff --git a/tools/binpac/src/pac_typedecl.cc b/tools/binpac/src/pac_typedecl.cc index c989869d20..35d52a098e 100644 --- a/tools/binpac/src/pac_typedecl.cc +++ b/tools/binpac/src/pac_typedecl.cc @@ -94,7 +94,8 @@ void TypeDecl::GenCode(Output* out_h, Output* out_cc) if ( type_->tot() == Type::EXTERN || type_->tot() == Type::STRING ) return; - fprintf(stderr, "Generating code for %s\n", class_name().c_str()); + if ( !FLAGS_quiet ) + fprintf(stderr, "Generating code for %s\n", class_name().c_str()); if ( RequiresAnalyzerContext::compute(type_) ) { @@ -125,7 +126,8 @@ void TypeDecl::GenCode(Output* out_h, Output* out_cc) out_h->println(""); out_h->print("class %s", class_name().c_str()); bool first = true; - foreach(i, vector, &base_classes) + vector::iterator i; + for ( i = (&base_classes)->begin(); i != (&base_classes)->end(); ++i ) { if ( first ) {