binpac: pac_scan: Exit with failure for include errors

Elsewhere (zeek/zeek#2482), it was observed that when binpac encounters
include failures, it still exits with 0 indicating success. Subsequent
compilation of the produced .h and .cc files likely fails.

Exit with 1 on include errors to make pin pointing issues easier by
having make/ninja stop earlier.
This commit is contained in:
Arne Welzel 2022-10-14 13:42:53 +02:00 committed by Tim Wojtulewicz
parent d21f99ef2b
commit 60265b8ce7

View file

@ -337,8 +337,7 @@ void switch_to_file(const char *filename)
{
fprintf(stderr, "%s:%d: error: cannot include file \"%s\"\n",
input_filename.c_str(), line_number,filename);
--include_stack_ptr;
return;
exit( 1 );
}
yyin = fp;
@ -367,7 +366,7 @@ void include_file(const char *filename)
fprintf(stderr, "%s:%d error: cannot include file \"%s\": %s\n",
input_filename.c_str(), line_number, filename,
strerror(errno));
return;
exit( 1 );
}
}
else