summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2013-12-04 09:30:08 +0100
committerAkim Demaille <akim@lrde.epita.fr>2013-12-04 15:53:01 +0100
commit184b42c85be3d42c958173c550ea442baf96a8cd (patch)
treee61aac71e26d7b3f643cbf910ea9509a154a25cc /src
parentbe29c71dd8867cca0c1aab4cf3ef9d4d4d0cb7b6 (diff)
downloadbison-184b42c85be3d42c958173c550ea442baf96a8cd.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/scan-skel.l3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scan-skel.l b/src/scan-skel.l
index f13ee813..48c5e46a 100644
--- a/src/scan-skel.l
+++ b/src/scan-skel.l
@@ -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;
}