Fixed cc65 exitcode when there are only preprocessor errors.

This commit is contained in:
acqn 2023-12-19 19:30:50 +08:00
parent cd7c688dff
commit b876a6b213
2 changed files with 10 additions and 2 deletions

View File

@ -1089,7 +1089,7 @@ int main (int argc, char* argv[])
Compile (InputFile);
/* Create the output file if we didn't had any errors */
if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) {
if (PreprocessOnly == 0 && (GetTotalErrors () == 0 || Debug)) {
/* Emit literals, do cleanup and optimizations */
FinishCompile ();
@ -1115,5 +1115,5 @@ int main (int argc, char* argv[])
DoneSegAddrSizes ();
/* Return an apropriate exit code */
return (ErrorCount > 0)? EXIT_FAILURE : EXIT_SUCCESS;
return (GetTotalErrors () > 0)? EXIT_FAILURE : EXIT_SUCCESS;
}

View File

@ -0,0 +1,8 @@
/* Bug #2312 */
#error "Compiler should exit with failure"
int main(void)
{
return 0;
}