])])
+# AT_SAVE_SPECIAL_FILES / AT_RESTORE_SPECIAL_FILES
+# ------------------------------------------------
+# Don't interfere with caller's files.
+m4_divert_text([PREPARE_TESTS],
+[at_save_special_files ()
+{
+ for at_save_file in stderr experr expout
+ do
+ test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak
+ done
+}
+
+at_restore_special_files ()
+{
+ for at_save_file in stderr experr expout
+ do
+ test ! -f at-bison-check-$at_save_file.bak ||
+ mv at-bison-check-$at_save_file.bak $at_save_file
+ done
+}
+])
+
+m4_define([AT_SAVE_SPECIAL_FILES], [at_save_special_files])
+m4_define([AT_RESTORE_SPECIAL_FILES], [at_restore_special_files])
+
+
+
## ------------------------------- ##
## Macros decoding Bison options. ##
## ------------------------------- ##
# are added after the grammar file name, so skip these checks
# in that case.
if test -z "${POSIXLY_CORRECT+set}"; then
- # Don't interfere with caller's files.
- if test -f stderr; then mv stderr at-bison-check-stderr.bak; fi
- if test -f experr; then mv experr at-bison-check-experr.bak; fi
- if test -f expout; then mv expout at-bison-check-expout.bak; fi
+ ]AT_SAVE_SPECIAL_FILES[
# To avoid expanding it repeatedly, store specified stdout.
]AT_DATA([expout], [$3])[
]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \
-Werror]], [[0]], [expout])[
- # Restore caller's files.
- if test -f at-bison-check-expout.bak; then
- mv at-bison-check-expout.bak expout
- fi
- if test -f at-bison-check-experr.bak; then
- mv at-bison-check-experr.bak experr
- fi
- if test -f at-bison-check-stderr.bak; then
- mv at-bison-check-stderr.bak stderr
- fi
+ ]AT_RESTORE_SPECIAL_FILES[
fi
]])
])