# Expect COUNT matches of the PERL-REGEXP in FILE. The file is
# taken in "slurp" mode, i.e., one can match end-of-lines.
m4_define([AT_MATCHES_CHECK],
-[AT_CHECK([perl -0777 -ne '
+[AT_CHECK([$PERL -0777 -ne '
my $count = 0;
s{$2}{ ++$count; "" }gem;
printf "$count\n";' $1], [0], [$3
m4_pushdef([AT_LOCATION_IF],
[m4_bmatch([$3], [%locations], [$1], [$2])])
m4_pushdef([AT_LOCATION_TYPE_IF],
-[m4_bmatch([$3], [%define location_type], [$1], [$2])])
+[m4_bmatch([$3], [%define \(api\.location\.type\|location_type\)], [$1], [$2])])
m4_pushdef([AT_PARAM_IF],
[m4_bmatch([$3], [%parse-param], [$1], [$2])])
m4_pushdef([AT_PURE_IF],
[m4_bregexp([$3], [\(%define api\.prefix\|%name-prefix\) "\([^""]*\)"], [\2])],
[yy])])
m4_pushdef([AT_TOKEN_PREFIX],
-[m4_bmatch([$3], [%define api.tokens.prefix ".*"],
- [m4_bregexp([$3], [%define api.tokens.prefix "\(.*\)"], [\1])])])
+[m4_bmatch([$3], [%define api.token.prefix ".*"],
+ [m4_bregexp([$3], [%define api.token.prefix "\(.*\)"], [\1])])])
m4_pushdef([AT_API_prefix],
[m4_bmatch([$3], [%define api\.prefix ".*"],
[m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
public void yyerror (String s)
{
System.err.println (s);
-}]])])dnl
+ }]])],
+[m4_fatal([$0: invalid language: ]AT_LANG)])dnl
])
[m4_null_if([$2], [AT_BISON_CHECK_XML($@)])
AT_BISON_CHECK_NO_XML($@)])
-m4_define([AT_BISON_WERROR_MSG],
- [[bison: warnings being treated as errors]])
-
-
# AT_BISON_CHECK_(BISON_ARGS, [OTHER_AT_CHECK_ARGS])
# --------------------------------------------------
# Low-level macro to run bison once.
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
m4_define([AT_BISON_CHECK_WARNINGS_],
-[[# Defining POSIXLY_CORRECT causes bison to complain if options
- # are added after the grammar file name, so skip these checks
- # in that case.
- if test -z "${POSIXLY_CORRECT+set}"; then
+[[# Defining POSIXLY_CORRECT causes bison to complain if options are
+# added after the grammar file name, so skip these checks in that
+# case.
+#
+# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
+# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
+# the environment variable.
+if env | grep '^POSIXLY_CORRECT=' >/dev/null; then :; else
]AT_SAVE_SPECIAL_FILES[
- # To avoid expanding it repeatedly, store specified stdout.
- ]AT_DATA([expout], [$3])[
+ # To avoid expanding it repeatedly, store specified stdout.
+ ]AT_DATA([expout], [$3])[
- # Run with -Werror.
+ # Run with -Werror.
]AT_BISON_CHECK_([$1[ -Werror]], [[1]], [expout], [stderr])[
- # Build expected stderr up to and including the "warnings being
- # treated as errors" message.
- ]AT_DATA([[at-bison-check-warnings]], [$4])[
- at_bison_check_first=`sed -n \
- '/: warning: /{=;q;}' at-bison-check-warnings`
- : ${at_bison_check_first:=1}
- at_bison_check_first_tmp=`sed -n \
- '/conflicts: [0-9].*reduce$/{=;q;}' at-bison-check-warnings`
- : ${at_bison_check_first_tmp:=1}
- if test $at_bison_check_first_tmp -lt $at_bison_check_first; then
- at_bison_check_first=$at_bison_check_first_tmp
- fi
- if test $at_bison_check_first -gt 1; then
- sed -n "1,`expr $at_bison_check_first - 1`"p \
- at-bison-check-warnings > experr
- fi
- echo ']AT_BISON_WERROR_MSG[' >> experr
-
- # Finish building expected stderr and check. Unlike warnings,
- # complaints cause bison to exit early. Thus, with -Werror, bison
- # does not necessarily report all warnings that it does without
- # -Werror, but it at least reports one.
- at_bison_check_last=`sed -n '$=' stderr`
- : ${at_bison_check_last:=1}
- at_bison_check_last=`expr $at_bison_check_last - 1`
- sed -n "$at_bison_check_first,$at_bison_check_last"p \
- at-bison-check-warnings >> experr
- ]AT_CHECK([[sed 's,.*/\(]AT_BISON_WERROR_MSG[\)$,\1,' \
- stderr 1>&2]], [[0]], [[]], [experr])[
-
- # Now check --warnings=error.
- cp stderr experr
+ # Build expected stderr up to and including the "warnings being
+ # treated as errors" message.
+ ]AT_DATA([[experr]], [$4])[
+ $PERL -pi -e 's{(.*): warning: (.*)\[-W(.*)\]$}
+ {$][1: error: $][2\@<:@-Werror=$][3@:>@}' experr
+ ]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
+
+ # Now check --warnings=error.
+ cp stderr experr
]AT_BISON_CHECK_([$1[ --warnings=error]], [[1]], [expout], [experr])[
- # Now check -Wnone and --warnings=none by making sure that
- # -Werror doesn't change the exit status when -Wnone or
- # --warnings=none is specified.
+ # Now check -Wnone and --warnings=none by making sure that
+ # -Werror doesn't change the exit status when -Wnone or
+ # --warnings=none is specified.
]AT_BISON_CHECK_([$1[ -Wnone -Werror]], [[0]], [expout])[
]AT_BISON_CHECK_([$1[ --warnings=none -Werror]], [[0]], [expout])[
- ]AT_RESTORE_SPECIAL_FILES[
+ ]AT_RESTORE_SPECIAL_FILES[
fi]dnl
])