Browse Source

add errors_occurred flag

David Rose 21 years ago
parent
commit
d4447cf753
6 changed files with 111 additions and 15 deletions
  1. 1 1
      ppremake/config_msvc.h
  2. 1 1
      ppremake/configure.in
  3. 63 3
      ppremake/ppCommandFile.cxx
  4. 32 8
      ppremake/ppScope.cxx
  5. 10 2
      ppremake/ppremake.cxx
  6. 4 0
      ppremake/ppremake.h

+ 1 - 1
ppremake/config_msvc.h

@@ -86,5 +86,5 @@
  **         Also be sure to change the version number        **
  **             at the beginning of configure.in.            **
  ****************                              ****************/
-#define VERSION "1.15"
+#define VERSION "1.16"
 /****************  UPDATE VERSION NUMBER HERE  ****************/

+ 1 - 1
ppremake/configure.in

@@ -5,7 +5,7 @@ dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 dnl **         Also be sure to change the version number        **
 dnl **                at the end of config_msvc.h.              **
 dnl ****************                              ****************
-AM_INIT_AUTOMAKE(ppremake, 1.15)
+AM_INIT_AUTOMAKE(ppremake, 1.16)
 dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 
 AM_CONFIG_HEADER(config.h)

+ 63 - 3
ppremake/ppCommandFile.cxx

@@ -119,6 +119,7 @@ write_line(const string &line) {
     }
 
     cerr << "Unsupported write format: " << (int)_format << "\n";
+    errors_occurred = true;
     return false;
   }
 }
@@ -314,6 +315,7 @@ read_file(Filename filename) {
 
   if (!filename.open_read(in)) {
     cerr << "Unable to open " << filename << ".\n";
+    errors_occurred = true;
     return false;
   }
   if (verbose) {
@@ -345,6 +347,7 @@ read_stream(istream &in, const string &filename) {
   if (!read_stream(in)) {
     if (!in.eof()) {
       cerr << "Error reading " << filename << ".\n";
+      errors_occurred = true;
     }
     return false;
   }
@@ -484,6 +487,7 @@ end_read() {
 
   if (_if_nesting != (IfNesting *)NULL) {
     cerr << "Unclosed if\n";
+    errors_occurred = true;
     _if_nesting = (IfNesting *)NULL;
     okflag = false;
   }
@@ -492,38 +496,46 @@ end_read() {
     switch (_block_nesting->_state) {
     case BS_begin:
       cerr << "Unclosed begin " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_while:
     case BS_nested_while:
       cerr << "Unclosed while " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_forscopes:
     case BS_nested_forscopes:
       cerr << "Unclosed forscopes " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_foreach:
     case BS_nested_foreach:
       cerr << "Unclosed foreach " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_formap:
     case BS_nested_formap:
       cerr << "Unclosed formap " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_defsub:
       cerr << "Unclosed defsub " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_defun:
       cerr << "Unclosed defun " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
 
     case BS_output:
       cerr << "Unclosed output " << _block_nesting->_name << "\n";
+      errors_occurred = true;
       break;
     }
     _block_nesting = (BlockNesting *)NULL;
@@ -682,6 +694,7 @@ handle_command(const string &line) {
   }
    
   cerr << "Invalid command: " << COMMAND_PREFIX << _command << "\n";
+  errors_occurred = true;
   return false;
 }
 
@@ -734,10 +747,12 @@ bool PPCommandFile::
 handle_elif_command() {
   if (_if_nesting == (IfNesting *)NULL) {
     cerr << "elif encountered without if.\n";
+    errors_occurred = true;
     return false;
   }
   if (_if_nesting->_state == IS_else) {
     cerr << "elif encountered after else.\n";
+    errors_occurred = true;
     return false;
   }
   if (_if_nesting->_state == IS_on || _if_nesting->_state == IS_done) {
@@ -772,10 +787,12 @@ bool PPCommandFile::
 handle_else_command() {
   if (_if_nesting == (IfNesting *)NULL) {
     cerr << "else encountered without if.\n";
+    errors_occurred = true;
     return false;
   }
   if (_if_nesting->_state == IS_else) {
     cerr << "else encountered after else.\n";
+    errors_occurred = true;
     return false;
   }
   if (_if_nesting->_state == IS_on || _if_nesting->_state == IS_done) {
@@ -797,6 +814,7 @@ bool PPCommandFile::
 handle_endif_command() {
   if (_if_nesting == (IfNesting *)NULL) {
     cerr << "endif encountered without if.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -806,8 +824,10 @@ handle_endif_command() {
   if (nest->_block != _block_nesting) {
     if (nest->_block != (BlockNesting *)NULL) {
       cerr << "If block not closed within scoping block " << nest->_block->_name << ".\n";
+      errors_occurred = true;
     } else {
       cerr << "If block not closed within scoping block " << _block_nesting->_name << ".\n";
+      errors_occurred = true;
     }
     return false;
   }
@@ -833,6 +853,7 @@ handle_begin_command() {
   if (contains_whitespace(name)) {
     cerr << "Attempt to define scope named \"" << name 
          << "\".\nScope names may not contain whitespace.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -840,6 +861,7 @@ handle_begin_command() {
     cerr << "Attempt to define scope named \"" << name 
          << "\".\nScope names may not contain the '"
          << SCOPE_DIRNAME_SEPARATOR << "' character.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -890,6 +912,7 @@ handle_for_command() {
 
   if (name.empty()) {
     cerr << "#for without varname\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -899,6 +922,7 @@ handle_for_command() {
   if (words.size() != 2 && words.size() != 3) {
     cerr << "Invalid numeric range: '" << _params.substr(p) 
          << "' for #for " << name << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -957,6 +981,7 @@ handle_foreach_command() {
 
   if (words.empty()) {
     cerr << "#foreach requires at least one parameter.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -996,6 +1021,7 @@ handle_formap_command() {
 
   if (words.size() != 2) {
     cerr << "#formap requires exactly two parameters.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1042,6 +1068,7 @@ handle_defsub_command(bool is_defsub) {
 
   if (subroutine_name.empty()) {
     cerr << command << " requires at least one parameter.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1053,6 +1080,7 @@ handle_defsub_command(bool is_defsub) {
     if (!is_valid_formal(*fi)) {
       cerr << command << " " << subroutine_name
            << ": invalid formal parameter name '" << (*fi) << "'\n";
+      errors_occurred = true;
       return false;
     }
   }
@@ -1060,6 +1088,7 @@ handle_defsub_command(bool is_defsub) {
   if (_in_for) {
     cerr << command << " may not appear within another block scoping command like\n"
          << "#forscopes, #foreach, #formap, #defsub, or #defun.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1092,6 +1121,7 @@ handle_output_command() {
 
   if (name.empty()) {
     cerr << "#output command requires one parameter.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1107,6 +1137,7 @@ handle_output_command() {
       nest->_flags |= OF_notouch;
     } else {
       cerr << "Invalid output flag: " << words[i] << "\n";
+      errors_occurred = true;
     }
   }
 
@@ -1116,6 +1147,7 @@ handle_output_command() {
     Filename filename = trim_blanks(_scope->expand_string(nest->_name));
     if (filename.empty()) {
       cerr << "Attempt to output to empty filename\n";
+      errors_occurred = true;
       return false;
     }
     
@@ -1144,6 +1176,7 @@ bool PPCommandFile::
 handle_end_command() {
   if (_block_nesting == (BlockNesting *)NULL) {
     cerr << "Unmatched end " << _params << ".\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1157,6 +1190,7 @@ handle_end_command() {
   if (name != _block_nesting->_name) {
     cerr << "end " << name << " encountered where end "
          << _block_nesting->_name << " expected.\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1165,6 +1199,7 @@ handle_end_command() {
 
   if (nest->_if != _if_nesting) {
     cerr << "If block not closed within scoping block " << name << ".\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1226,6 +1261,7 @@ handle_end_command() {
     if (!_in_for) {
       if (!nest->_output) {
         cerr << "Error while writing " << nest->_params << "\n";
+        errors_occurred = true;
         return false;
       }
 
@@ -1274,6 +1310,7 @@ handle_format_command() {
 
   } else {
     cerr << "Ignoring invalid write format: " << _params << "\n";
+    errors_occurred = true;
   }
 
   return true;
@@ -1389,12 +1426,14 @@ handle_call_command() {
 
   if (subroutine_name.empty()) {
     cerr << "#call requires at least one parameter.\n";
+    errors_occurred = true;
     return false;
   }
 
   const PPSubroutine *sub = PPSubroutine::get_sub(subroutine_name);
   if (sub == (const PPSubroutine *)NULL) {
     cerr << "Attempt to call undefined subroutine " << subroutine_name << "\n";
+    errors_occurred = true;
   }
 
   PPScope *old_scope = _scope;
@@ -1429,6 +1468,7 @@ handle_error_command() {
   
   if (!message.empty()) {
     cerr << message << "\n";
+    errors_occurred = true;
   }
   return false;
 }
@@ -1457,6 +1497,7 @@ handle_mkdir_command() {
     if (!filename.make_dir()) {
       if (!dirname.is_directory()) {
         cerr << "Unable to create directory " << dirname << "\n";
+        errors_occurred = true;
       }
     }
   }
@@ -1500,8 +1541,8 @@ handle_defer_command() {
   def = _scope->expand_self_reference(def, varname);
   _scope->define_variable(varname, def);
 
-  if (verbose>=2) {
-    cerr<<"#defer "<<varname<<" = "<<_params.substr(p)<<endl;
+  if (verbose >= 2) {
+    cerr << "#defer " << varname << " = " << _params.substr(p) << endl;
   }
   return true;
 }
@@ -1533,7 +1574,8 @@ handle_define_command() {
   _scope->define_variable(varname, def);
 
   if (verbose>=2) {
-    cerr<<"#define "<<varname<<" = "<<_params.substr(p)<<"\n          \""<<def<<"\""<<endl;
+    cerr << "#define " << varname << " = " << _params.substr(p)
+         << "\n          \"" << def << "\"" <<endl;
   }
   return true;
 }
@@ -1572,6 +1614,7 @@ handle_set_command() {
 
   if (!_scope->set_variable(varname, def)) {
     cerr << "Attempt to set undefined variable " << varname << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1651,6 +1694,7 @@ handle_push_command() {
   if (n == param || levels < 0) {
     // Invalid integer.
     cerr << "#push with invalid level count: " << levels_str << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1693,6 +1737,7 @@ include_file(Filename filename) {
   ifstream in;
   if (!filename.open_read(in)) {
     cerr << "Unable to open include file " << filename << ".\n";
+    errors_occurred = true;
     return false;
   }
   if (verbose) {
@@ -1712,6 +1757,7 @@ include_file(Filename filename) {
 
   if (!in.eof()) {
     cerr << "Error reading " << filename << ".\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1751,6 +1797,7 @@ replay_while(const string &name) {
 
   if (saved_block != _block_nesting || saved_if != _if_nesting) {
     cerr << "Misplaced #end or #endif.\n";
+    errors_occurred = true;
     okflag = false;
   }
 
@@ -1789,12 +1836,14 @@ replay_for(const string &name, const vector<string> &words) {
     range[i] = strtol(param, &n, 10);
     if (n == param) {
       cerr << "Invalid integer in #for: " << param << "\n";
+      errors_occurred = true;
       return false;
     }
   }
 
   if (range[2] == 0) {
     cerr << "Step by zero in #for " << name << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1824,6 +1873,7 @@ replay_for(const string &name, const vector<string> &words) {
 
   if (saved_block != _block_nesting || saved_if != _if_nesting) {
     cerr << "Misplaced #end or #endif.\n";
+    errors_occurred = true;
     okflag = false;
   }
 
@@ -1883,6 +1933,7 @@ replay_forscopes(const string &name) {
 
   if (saved_block != _block_nesting || saved_if != _if_nesting) {
     cerr << "Misplaced #end or #endif.\n";
+    errors_occurred = true;
     okflag = false;
   }
 
@@ -1924,6 +1975,7 @@ replay_foreach(const string &varname, const vector<string> &words) {
 
   if (saved_block != _block_nesting || saved_if != _if_nesting) {
     cerr << "Misplaced #end or #endif.\n";
+    errors_occurred = true;
     okflag = false;
   }
 
@@ -1955,6 +2007,7 @@ replay_formap(const string &varname, const string &mapvar) {
   if (&def == &PPScope::_null_map_def) {
     cerr << "Undefined map variable: #formap " << varname << " " 
          << mapvar << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1979,6 +2032,7 @@ replay_formap(const string &varname, const string &mapvar) {
 
   if (saved_block != _block_nesting || saved_if != _if_nesting) {
     cerr << "Misplaced #end or #endif.\n";
+    errors_occurred = true;
     okflag = false;
   }
 
@@ -2036,6 +2090,7 @@ compare_output(const string &new_contents, Filename filename,
       ofstream out_b;
       if (!temp_filename.open_write(out_b)) {
         cerr << "Unable to open temporary file " << filename << " for writing.\n";
+        errors_occurred = true;
         return false;
       }
       
@@ -2044,6 +2099,7 @@ compare_output(const string &new_contents, Filename filename,
       bool diff_ok = true;
       if (!out_b) {
         cerr << "Unable to write to temporary file " << filename << "\n";
+        errors_occurred = true;
         diff_ok = true;
       }
       out_b.close();
@@ -2052,6 +2108,7 @@ compare_output(const string &new_contents, Filename filename,
       int sys_result = system(command.c_str());
       if (sys_result < 0) {
         cerr << "Unable to invoke diff\n";
+        errors_occurred = true;
         diff_ok = false;
       }
       out_b.close();
@@ -2069,6 +2126,7 @@ compare_output(const string &new_contents, Filename filename,
         if (exists) {
           if (!filename.unlink()) {
             cerr << "Unable to remove old " << filename << "\n";
+            errors_occurred = true;
             return false;
           }
         }
@@ -2076,6 +2134,7 @@ compare_output(const string &new_contents, Filename filename,
         ofstream out_b;
         if (!filename.open_write(out_b)) {
           cerr << "Unable to open file " << filename << " for writing.\n";
+          errors_occurred = true;
           return false;
         }
         
@@ -2083,6 +2142,7 @@ compare_output(const string &new_contents, Filename filename,
         
         if (!out_b) {
           cerr << "Unable to write to file " << filename << "\n";
+          errors_occurred = true;
           return false;
         }
         out_b.close();

+ 32 - 8
ppremake/ppScope.cxx

@@ -356,6 +356,7 @@ expand_defined(const string &params) {
 
   if (tokens.size() != 1) {
     cerr << "error: defined requires one parameter.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -363,8 +364,6 @@ expand_defined(const string &params) {
   string falsestr;
   string truestr = "1";
 
-  cerr << "defined arg is: '" << varname << "'" << endl;
-
   // Is it a user-defined function?
   const PPSubroutine *sub = PPSubroutine::get_func(varname);
 
@@ -376,8 +375,6 @@ expand_defined(const string &params) {
     }
   }      
 
-  cerr << "zzz 3111\n";
-
   string result;
 
   if (p_get_variable(varname, result)) {
@@ -392,16 +389,12 @@ expand_defined(const string &params) {
     }
   }
 
-  cerr << "zzz 4111\n";
-
   // If the variable isn't defined, we check the environment.
   const char *env = getenv(varname.c_str());
   if (env != (const char *)NULL) {
     return truestr;
   }
 
-  cerr << "zzz 5111\n";
-
   // It's not defined anywhere, so it's implicitly empty.
   return falsestr;
 }
@@ -687,6 +680,7 @@ tokenize_numeric_pair(const string &str, double &a, double &b) {
   if (words.size() != 2) {
     cerr << words.size() << " parameters supplied when two were expected:\n"
          << str << "\n";
+    errors_occurred = true;
     return false;
   }
 
@@ -1194,6 +1188,7 @@ r_expand_variable(const string &str, size_t &vp,
            << VARIABLE_PATSUBST << PATTERN_WILDCARD << ".c"
            << VARIABLE_PATSUBST_DELIM << PATTERN_WILDCARD << ".o"
            << VARIABLE_CLOSE_BRACE << ".\n";
+      errors_occurred = true;
     } else {
       PPFilenamePattern from(tokens[0]);
       PPFilenamePattern to(tokens[1]);
@@ -1201,6 +1196,7 @@ r_expand_variable(const string &str, size_t &vp,
       if (!from.has_wildcard() || !to.has_wildcard()) {
         cerr << "The two parameters of inline patsubst must both include "
              << PATTERN_WILDCARD << ".\n";
+        errors_occurred = true;
         return string();
       }
     
@@ -1433,6 +1429,7 @@ expand_libtest(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "libtest requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -1595,6 +1592,7 @@ string PPScope::
 expand_shell(const string &params) {
 #ifdef WIN32_VC
   cerr << "$[shell] is not presently supported on Win32 without Cygwin.\n";
+  errors_occurred = true;
   string output;
 
 #else  // WIN32_VC
@@ -1762,6 +1760,7 @@ expand_substr(const string &params) {
 
   if (tokens.size() != 3) {
     cerr << "substr requires three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -1922,6 +1921,7 @@ expand_makeguid(const string &params) {
 
   if (expansion.size() == 0) {
     cerr << "makeguid requires an argument.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -1990,6 +1990,7 @@ expand_word(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "word requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2021,6 +2022,7 @@ expand_wordlist(const string &params) {
 
   if (tokens.size() != 3) {
     cerr << "wordlist requires three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2106,11 +2108,13 @@ expand_patsubst(const string &params, bool separate_words) {
 
   if (tokens.size() < 3) {
     cerr << "patsubst requires at least three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
   if ((tokens.size() % 2) != 1) {
     cerr << "patsubst requires an odd number of parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2142,6 +2146,7 @@ expand_patsubst(const string &params, bool separate_words) {
       if (!pattern.has_wildcard()) {
         cerr << "All the \"from\" parameters of patsubst must include "
              << PATTERN_WILDCARD << ".\n";
+        errors_occurred = true;
         return string();
       }
       from.back().push_back(pattern);
@@ -2191,6 +2196,7 @@ expand_filter(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "filter requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2247,6 +2253,7 @@ expand_filter_out(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "filter-out requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2303,11 +2310,13 @@ expand_subst(const string &params) {
 
   if (tokens.size() < 3) {
     cerr << "subst requires at least three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
   if ((tokens.size() % 2) != 1) {
     cerr << "subst requires an odd number of parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2346,6 +2355,7 @@ expand_findstring(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "findstring requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
   string str = tokens.back();
@@ -2372,11 +2382,13 @@ expand_wordsubst(const string &params) {
 
   if (tokens.size() < 3) {
     cerr << "subst requires at least three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
   if ((tokens.size() % 2) != 1) {
     cerr << "subst requires an odd number of parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2413,6 +2425,7 @@ expand_join(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "join requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2535,6 +2548,7 @@ expand_if(const string &params) {
   }
 
   cerr << "if requires two or three parameters.\n";
+  errors_occurred = true;
   return string();
 }
 
@@ -2552,6 +2566,7 @@ expand_eq(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "eq requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2577,6 +2592,7 @@ expand_ne(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "ne requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2797,6 +2813,7 @@ expand_divide(const string &params) {
   if (tokens.size() != 2) {
     cerr << tokens.size() << " parameters supplied when two were expected:\n"
          << params << "\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2819,6 +2836,7 @@ expand_modulo(const string &params) {
   if (tokens.size() != 2) {
     cerr << tokens.size() << " parameters supplied when two were expected:\n"
          << params << "\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2840,6 +2858,7 @@ expand_not(const string &params) {
 
   if (tokens.size() != 1) {
     cerr << "not requires one parameter.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -2974,6 +2993,7 @@ expand_closure(const string &params) {
 
   if (tokens.size() != 2 && tokens.size() != 3) {
     cerr << "closure requires two or three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -3060,6 +3080,7 @@ expand_unmapped(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "unmapped requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -3147,6 +3168,7 @@ expand_foreach(const string &params) {
 
   if (tokens.size() != 3) {
     cerr << "foreach requires three parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -3184,6 +3206,7 @@ expand_forscopes(const string &params) {
 
   if (tokens.size() != 2) {
     cerr << "forscopes requires two parameters.\n";
+    errors_occurred = true;
     return string();
   }
 
@@ -3289,6 +3312,7 @@ expand_map_variable(const string &varname, const string &params) {
   if (tokens.size() != 2) {
     cerr << "map variable expansions require two parameters: $["
          << varname << " " << params << "]\n";
+    errors_occurred = true;
     return string();
   }
 

+ 10 - 2
ppremake/ppremake.cxx

@@ -35,6 +35,8 @@ bool verbose_dry_run = false;
 int verbose = 0;
 int debug_expansions = 0;
 
+bool errors_occurred = false;
+
 DebugExpand debug_expand;
 
 class DebugExpandReport {
@@ -474,6 +476,12 @@ main(int argc, char *argv[]) {
     cerr << "\n";
   }
 
-  cerr << "No errors.\n";
-  return (0);
+  if (errors_occurred) {
+    cerr << "Errors occurred during processing.\n";
+    return (1);
+
+  } else {
+    cerr << "No errors.\n";
+    return (0);
+  }
 }

+ 4 - 0
ppremake/ppremake.h

@@ -95,6 +95,10 @@ extern bool verbose_dry_run;
 extern int verbose; // 0..9 to set verbose level.  0 == off.
 extern int debug_expansions;
 
+/* This is set true internally if an error occurred while processing
+   any of the scripts. */
+extern bool errors_occurred;
+
 /* This structure tracks the number of expansions that are performed
    on a particular string, and the different values it produces, only
    if debug_expansions (above) is set true by command-line parameter