output: do not generate source files when early errors are caught

Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

One problem is that some errors are caught early, before the
generation of output files, while others can only be detected
afterwards (since, for instance, skeletons can raise errors
themselves).

This will be addressed in two steps: early errors do not generate
source files at all, while later errors will remove the files that
have already been generated.

* src/scan-skel.l (yyout): Open to /dev/null when there are errors.
* tests/output.at (AT_CHECK_FILES): Factored out of...
(AT_CHECK_OUTPUT): this.
Fuse the "SHELLIO" argument in the "FLAGS" one.
Use $5 to denote the expected exit status.
Add a test case for early errors.
This commit is contained in:
Akim Demaille
2013-12-04 09:30:08 +01:00
parent be29c71dd8
commit 184b42c85b
3 changed files with 35 additions and 13 deletions

View File

@@ -245,7 +245,8 @@ at_output (int argc, char *argv[], char **out_namep, int *out_linenop)
}
*out_namep = xstrdup (argv[1]);
output_file_name_check (out_namep);
yyout = xfopen (*out_namep, "w");
/* If there were errors, do not generate the output. */
yyout = xfopen (complaint_status ? "/dev/null" : *out_namep, "w");
*out_linenop = 1;
}