summaryrefslogtreecommitdiff
path: root/tests/output.at
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny@ces.clemson.edu>2006-12-10 00:16:15 +0000
committerJoel E. Denny <jdenny@ces.clemson.edu>2006-12-10 00:16:15 +0000
commit3f7ca628535da8ee4296061580cc9a944bcf4ab4 (patch)
treec66812740b36a0bcab48ee2ed4ae82b2d86702e3 /tests/output.at
parent178e123eec54fc49bfaf4997f7d328c072fd68b6 (diff)
downloadbison-3f7ca628535da8ee4296061580cc9a944bcf4ab4.tar.gz
Warn about output files that are generated by the skeletons and that
conflict with other output files. * data/glr.c: Don't generate the header file here when glr.cc does. * src/files.c (file_names, file_names_count): New static globals. (compute_output_file_names): Invoke output_file_name_check for files not generated by the skeletons and remove existing checks. (output_file_name_check): New function that warns about conflicting output file names. (output_file_names_free): Free file_names. * src/files.h (output_file_name_check): Declare. * src/scan-skel.l: Invoke output_file_name_check for files generated by the skeletons. * tests/output.at (AT_CHECK_CONFLICTING_OUTPUT): New. (Conflicting output files): New tests.
Diffstat (limited to 'tests/output.at')
-rw-r--r--tests/output.at33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/output.at b/tests/output.at
index 468aa5fd..6362ef2d 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -116,3 +116,36 @@ AT_CHECK_OUTPUT([subdir/foo.yy], [%skeleton "lalr1.cc" %defines %verbose],
[-o subdir/foo.cc],
[subdir/foo.cc subdir/foo.hh subdir/foo.output subdir/location.hh subdir/stack.hh subdir/position.hh],
[], [AT_CHECK_NO_SUBDIR_PART([subdir/foo])])
+
+
+# AT_CHECK_CONFLICTING_OUTPUT(INPUT-FILE, DIRECTIVES, FLAGS, STDERR)
+# -----------------------------------------------------------------------------
+m4_define([AT_CHECK_CONFLICTING_OUTPUT],
+[AT_SETUP([Conflicting output files: $2 $3])
+case "$1" in
+ */*) mkdir `echo "$1" | sed 's,/.*,,'`;;
+esac
+AT_DATA([$1],
+[[$2
+%%
+foo: {};
+]])
+
+AT_CHECK([bison $3 $1], 0, [], [$4])
+AT_CLEANUP
+])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[], [--graph="foo.tab.c"],
+[foo.y: warning: conflicting outputs to file `foo.tab.c'
+])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[%defines "foo.output"], [-v],
+[foo.y: warning: conflicting outputs to file `foo.output'
+])
+
+AT_CHECK_CONFLICTING_OUTPUT([foo.y],
+[%skeleton "lalr1.cc" %defines], [--graph="location.hh"],
+[foo.y: warning: conflicting outputs to file `location.hh'
+])