# Checking the output filenames. -*- Autotest -*-
-# Copyright (C) 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007 Free Software Foundation,
+# Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# [ADDITIONAL-TESTS])
# -----------------------------------------------------------------------------
m4_define([AT_CHECK_OUTPUT],
-[AT_SETUP([Output files: $2 $3 $5])
+[AT_SETUP([[Output files: $2 $3 $5]])
case "$1" in
*/*) mkdir `echo "$1" | sed 's,/.*,,'`;;
esac
[-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'
+])
+
+
+# AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS])
+# -----------------------------------------------------------------------------
+m4_define([AT_CHECK_OUTPUT_FILE_NAME],
+[AT_SETUP([Output file name: $1])
+
+AT_DATA([glr.y],
+[[%glr-parser
+%code {
+ int yylex (void);
+ void yyerror (const char *);
+}
+%%
+start: {};
+]])
+AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" glr.y])
+AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore])
+AT_COMPILE([glr.o], [-c "AS_ESCAPE([$1.c])"])
+$2
+
+AT_DATA([cxx.y],
+[[%skeleton "lalr1.cc"
+%code { int yylex (yy::parser::semantic_type*); }
+%%
+start: {};
+]])
+AT_CHECK([bison -o "AS_ESCAPE([$1.c])" --defines="AS_ESCAPE([$1.h])" cxx.y])
+AT_CHECK([ls "AS_ESCAPE([$1.c])" "AS_ESCAPE([$1.h])"], [], [ignore])
+AT_COMPILE_CXX([cxx.o], [-c "AS_ESCAPE([$1.c])"])
+$2
+
+AT_CLEANUP
+])
+
+# Notice that the header file name here cannot contain
+# `"' since FILENAME in `#include "FILENAME"' cannot.
+AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']])
+AT_CHECK_OUTPUT_FILE_NAME([[(]])
+AT_CHECK_OUTPUT_FILE_NAME([[)]])
+AT_CHECK_OUTPUT_FILE_NAME([[#]])
+AT_CHECK_OUTPUT_FILE_NAME([[@@]])
+AT_CHECK_OUTPUT_FILE_NAME([[@{]])
+AT_CHECK_OUTPUT_FILE_NAME([[@}]])
+AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
+AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])