From: Akim Demaille Date: Thu, 19 Jul 2012 15:32:01 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/maint' X-Git-Tag: v2.7.90~400 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/3eb4f1a3e62807125a815dc572da9204b5b51865?hp=9553083c729070877095948ba2d48553690ac9e9 Merge remote-tracking branch 'origin/maint' * origin/maint: maint: update gnu-web-doc-update. maint: post-release administrivia version 2.6 maint: prepare for release 2.6 maint: post-release administrivia version 2.5.91 maint: prepare NEWS. maint: fix spaces. tests: adjust to case where the C compiler is actually a C++ compiler tests: fix dependencies doc: fix Texinfo command maint: Valgrind on OS X. tests: be sure that backups are safe. maint: dead comment. tests: refactor for legibility. tests: refactor the bison invocations. maint: fix syntax-check ignore patterns. gnulib: update gnulib: update. gnulib: update Conflicts: build-aux/Makefile.am cfg.mk tests/Makefile.am --- diff --git a/.prev-version b/.prev-version index b042f94e..5154b3f6 100644 --- a/.prev-version +++ b/.prev-version @@ -1 +1 @@ -2.5.90 +2.6 diff --git a/Makefile.am b/Makefile.am index ab3460d8..a9861190 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,6 +96,7 @@ gen-ChangeLog: --strip-cherry-pick \ --no-cluster \ --amend=$(srcdir)/build-aux/git-log-fix \ + --srcdir=$(srcdir) \ --since=$(gen_start_date) > $$cl.tmp && \ mv -f $$cl.tmp $$cl; \ fi diff --git a/NEWS b/NEWS index 0552ba21..8db03d60 100644 --- a/NEWS +++ b/NEWS @@ -122,7 +122,7 @@ GNU Bison NEWS * Noteworthy changes in release ?.? (????-??-??) [?] -* Noteworthy changes in release 2.5.90 (2012-07-05) [beta] +* Noteworthy changes in release 2.6 (2012-07-19) [stable] ** Future changes: diff --git a/README-hacking b/README-hacking index f128c9c5..2b92edcf 100644 --- a/README-hacking +++ b/README-hacking @@ -1,5 +1,3 @@ --*- outline -*- - This file attempts to describe the rules to use when hacking Bison. Don't put this file into the distribution. @@ -67,8 +65,8 @@ tools we depend upon, including: - Rsync - Tar -Valgrind is also highly recommended, if -Valgrind supports your architecture. +Valgrind is also highly recommended, if it supports +your architecture. Bison is written using Bison grammars, so there are bootstrapping issues. The bootstrap script attempts to discover when the C code @@ -131,7 +129,7 @@ import requests for updated submodules. A simple "git diff" will reveal if the current version of the submodule (i.e., the actual contents of the gnulib directory) and the current request from the subscriber (i.e., the reference of the version of gnulib that the -Bison reporitory requests) differ. To upgrade the submodules (i.e., +Bison repository requests) differ. To upgrade the submodules (i.e., to check out the version that is actually requested by the subscriber, run "git submodule update". @@ -162,7 +160,7 @@ formal release, see the ChangeLog in the latest gnulib snapshot at: http://erislabs.net/ianb/projects/gnulib/ -The autoconf files we use are currently: +The Autoconf files we use are currently: m4/m4.m4 lib/m4sugar/m4sugar.m4 @@ -177,6 +175,23 @@ decide whether to update. ** make check Use liberally. +** make maintainer-check-valgrind +This target uses valgrind both to check bison, and the generated parsers. + +This is not mature on Mac OS X. First, Valgrind does support the way bison +calls m4, so Valgrind cannot be used to check bison on Mac OS X. + +Second, there are many errors that come from the platform itself, not from +bison. build-aux/darwin11.4.0.valgrind addresses some of them. + +Third, valgrind issues warnings such as: + + --99312:0:syswrap- WARNING: Ignoring sigreturn( ..., UC_RESET_ALT_STACK ); + +which cause the test to fail uselessly. It is hard to ignore these errors +with a major overhaul of the way instrumentation is performed in the test +suite. So currently, do not try to run valgrind on Mac OS X. + ** Release checks Try to run the test suite with more severe conditions before a release: @@ -387,7 +402,6 @@ spaces): Push these changes. - ----- Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc. @@ -406,3 +420,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . + + LocalWords: Automake Autoconf Gettext Gzip Rsync Valgrind gnulib submodules + LocalWords: submodule init cd distcheck checkin ChangeLog valgrind sigreturn + LocalWords: UC gcc DGNULIB POSIXCHECK xml XSLT glr lalr README po runtime rc + LocalWords: gnupload gnupg gpg keyserver BDF ncftp filename clearsign cvs dir + LocalWords: symlinks vti html lt POSIX Cc'ed + +Local Variables: +mode: outline +fill-column: 76 +End: diff --git a/bootstrap b/bootstrap index e9849102..e3e270b0 100755 --- a/bootstrap +++ b/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2012-07-03.20; # UTC +scriptversion=2012-07-19.14; # UTC # Bootstrap this package from checked-out sources. @@ -77,6 +77,33 @@ Running without arguments will suffice in most cases. EOF } +# warnf_ FORMAT-STRING ARG1... +warnf_ () +{ + warnf_format_=$1 + shift + nl=' +' + case $* in + *$nl*) me_=$(printf "$me"|tr "$nl|" '??') + printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;; + *) printf "$me: $warnf_format_" "$@" ;; + esac >&2 +} + +# warn_ WORD1... +warn_ () +{ + # If IFS does not start with ' ', set it and emit the warning in a subshell. + case $IFS in + ' '*) warnf_ '%s\n' "$*";; + *) (IFS=' '; warn_ "$@");; + esac +} + +# die WORD1... +die() { warn_ "$@"; exit 1; } + # Configuration. # Name of the Makefile.am @@ -130,7 +157,8 @@ extract_package_name=' p } ' -package=$(sed -n "$extract_package_name" configure.ac) || exit +package=$(sed -n "$extract_package_name" configure.ac) \ + || die 'cannot find package name in configure.ac' gnulib_name=lib$package build_aux=build-aux @@ -186,6 +214,8 @@ use_git=true # otherwise find the first of the NAMES that can be run (i.e., # supports --version). If found, set ENVVAR to the program name, # die otherwise. +# +# FIXME: code duplication, see also gnu-web-doc-update. find_tool () { find_tool_envvar=$1 @@ -203,14 +233,10 @@ find_tool () else find_tool_error_prefix="\$$find_tool_envvar: " fi - if test x"$find_tool_res" = x; then - echo >&2 "$me: one of these is required: $find_tool_names" - exit 1 - fi - ($find_tool_res --version /dev/null 2>&1 || { - echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version" - exit 1 - } + test x"$find_tool_res" != x \ + || die "one of these is required: $find_tool_names" + ($find_tool_res --version /dev/null 2>&1 \ + || die "${find_tool_error_prefix}cannot run $find_tool_res --version" eval "$find_tool_envvar=\$find_tool_res" eval "export $find_tool_envvar" } @@ -269,21 +295,15 @@ do --no-git) use_git=false;; *) - echo >&2 "$0: $option: unknown option" - exit 1;; + die "$option: unknown option";; esac done -if $use_git || test -d "$GNULIB_SRCDIR"; then - : -else - echo "$0: Error: --no-git requires --gnulib-srcdir" >&2 - exit 1 -fi +$use_git || test -d "$GNULIB_SRCDIR" \ + || die "Error: --no-git requires --gnulib-srcdir" if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then - echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2 - exit 1 + die "Bootstrapping from a non-checked-out distribution is risky." fi # Ensure that lines starting with ! sort last, per gitignore conventions @@ -309,7 +329,7 @@ insert_sorted_if_absent() { echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \ || { echo "$str" | sort_patterns - $file > $file.bak \ && mv $file.bak $file; } \ - || exit 1 + || die "insert_sorted_if_absent $file $str: failed" } # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with @@ -333,11 +353,8 @@ grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ >/dev/null && found_aux_dir=yes grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ >/dev/null && found_aux_dir=yes -if test $found_aux_dir = no; then - echo "$0: expected line not found in configure.ac. Add the following:" >&2 - echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2 - exit 1 -fi +test $found_aux_dir = yes \ + || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it" # If $build_aux doesn't exist, create it now, otherwise some bits # below will malfunction. If creating it, also mark it as ignored. @@ -443,7 +460,7 @@ check_versions() { automake-ng|aclocal-ng) app=${app%-ng} ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || { - echo "$me: Error: '$app' not found or not from Automake-NG" >&2 + warn_ "Error: '$app' not found or not from Automake-NG" ret=1 continue } ;; @@ -453,20 +470,21 @@ check_versions() { # so we have to rely on $? rather than get_version. $app --version >/dev/null 2>&1 if [ 126 -le $? ]; then - echo "$me: Error: '$app' not found" >&2 + warn_ "Error: '$app' not found" ret=1 fi else # Require app to produce a new enough version string. inst_ver=$(get_version $app) if [ ! "$inst_ver" ]; then - echo "$me: Error: '$app' not found" >&2 + warn_ "Error: '$app' not found" ret=1 else latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) if [ ! "$latest_ver" = "$inst_ver" ]; then - echo "$me: Error: '$app' version == $inst_ver is too old" >&2 - echo " '$app' version >= $req_ver is required" >&2 + warnf_ '%s\n' \ + "Error: '$app' version == $inst_ver is too old" \ + " '$app' version >= $req_ver is required" ret=1 fi fi @@ -523,11 +541,10 @@ fi if ! printf "$buildreq" | check_versions; then echo >&2 if test -f README-prereq; then - echo "$0: See README-prereq for how to get the prerequisite programs" >&2 + die "See README-prereq for how to get the prerequisite programs" else - echo "$0: Please install the prerequisite programs" >&2 + die "Please install the prerequisite programs" fi - exit 1 fi echo "$0: Bootstrapping from checked-out $package sources..." @@ -738,11 +755,10 @@ symlink_to_dir() *) case /$dst/ in *//* | */../* | */./* | /*/*/*/*/*/) - echo >&2 "$me: invalid symlink calculation: $src -> $dst" - exit 1;; - /*/*/*/*/) dot_dots=../../../;; - /*/*/*/) dot_dots=../../;; - /*/*/) dot_dots=../;; + die "invalid symlink calculation: $src -> $dst";; + /*/*/*/*/) dot_dots=../../../;; + /*/*/*/) dot_dots=../../;; + /*/*/) dot_dots=../;; esac;; esac @@ -764,7 +780,7 @@ version_controlled_file() { grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null | grep '^/[^/]*/[0-9]' > /dev/null else - echo "$me: no version control for $file?" >&2 + warn_ "no version control for $file?" false fi } @@ -855,11 +871,11 @@ $gnulib_tool $gnulib_tool_options --import $gnulib_modules && for file in $gnulib_files; do symlink_to_dir "$GNULIB_SRCDIR" $file \ - || { echo "$0: failed to symlink $file" 1>&2; exit 1; } + || die "failed to symlink $file" done bootstrap_post_import_hook \ - || { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; } + || die "bootstrap_post_import_hook failed" # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some # gnulib-populated directories. Such .m4 files would cause aclocal to fail. @@ -887,7 +903,7 @@ echo "running: AUTOPOINT=true LIBTOOLIZE=true " \ "$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS" AUTOPOINT=true LIBTOOLIZE=true \ $AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \ - || exit 1 + || die "autoreconf failed" # Get some extra files from gnulib, overriding existing files. for file in $gnulib_extra_files; do @@ -897,7 +913,7 @@ for file in $gnulib_extra_files; do *) dst=$file;; esac symlink_to_dir "$GNULIB_SRCDIR" $file $dst \ - || { echo "$0: failed to symlink $file" 1>&2; exit 1; } + || die "failed to symlink $file" done if test $with_gettext = yes; then @@ -913,7 +929,8 @@ if test $with_gettext = yes; then a\ '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} } - ' po/Makevars.template >po/Makevars || exit 1 + ' po/Makevars.template >po/Makevars \ + || die 'cannot generate po/Makevars' # If the 'gettext' module is in use, grab the latest Makefile.in.in. # If only the 'gettext-h' module is in use, assume autopoint already @@ -921,7 +938,8 @@ if test $with_gettext = yes; then case $gnulib_modules in *gettext-h*) ;; *gettext*) - cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1 + cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \ + || die "cannot create po/Makefile.in.in" ;; esac @@ -937,7 +955,8 @@ if test $with_gettext = yes; then a\ '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+} } - ' po/Makevars.template >runtime-po/Makevars || exit 1 + ' po/Makevars.template >runtime-po/Makevars \ + || die 'cannot generate runtime-po/Makevars' # Copy identical files from po to runtime-po. (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) diff --git a/build-aux/darwin11.4.0.valgrind b/build-aux/darwin11.4.0.valgrind new file mode 100644 index 00000000..ff355ebc --- /dev/null +++ b/build-aux/darwin11.4.0.valgrind @@ -0,0 +1,64 @@ +# Copyright (C) 2012 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Valgrind suppression file for Bison. + +{ + Mac OS X initialization + Memcheck:Leak + fun:?alloc* + ... + fun:*ImageLoader* +} + +{ + Mac OS X initialization + Memcheck:Leak + fun:?alloc* + ... + fun:*dyld* +} + +{ + Mac OS X initialization + Memcheck:Leak + fun:?alloc* + ... + fun:__CFInitialize +} + +{ + Mac OS X I/O buffer + Memcheck:Leak + fun:malloc + fun:__smakebuf + fun:__swsetup + fun:__sfvwrite + fun:fwrite +} + +{ + Mac OS X I/O buffer + Memcheck:Leak + fun:malloc + fun:__smakebuf + fun:__swsetup + fun:__swbuf + fun:putchar +} + +# Local Variables: +# mode: shell-script +# End: diff --git a/build-aux/local.mk b/build-aux/local.mk index 29c907a4..7daf6cf7 100644 --- a/build-aux/local.mk +++ b/build-aux/local.mk @@ -1,5 +1,23 @@ +## Makefile for Bison testsuite. + +# Copyright (C) 2000-2012 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + EXTRA_DIST += \ build-aux/cross-options.pl \ + build-aux/darwin11.4.0.valgrind \ build-aux/move-if-change \ build-aux/prev-version.txt \ build-aux/update-b4-copyright diff --git a/cfg.mk b/cfg.mk index 9e9f8065..f1caf313 100644 --- a/cfg.mk +++ b/cfg.mk @@ -54,7 +54,8 @@ update-copyright: update-b4-copyright update-package-copyright-year update-copyright-env = \ UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1 -exclude = $(foreach a,$(1),$(eval exclude_file_name_regexp--sc_$(a))) +exclude = \ + $(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a)))) $(call exclude, \ bindtextdomain=^lib/main.c$$ \ program_name=^lib/main.c$$ \ @@ -62,6 +63,7 @@ $(call exclude, \ prohibit_always-defined_macros+=?|^lib/timevar.c$$ \ prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \ prohibit_always-defined_macros+=?|^tests/regression.at$$ \ + prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \ prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \ prohibit_strcmp=^doc/bison\.texi$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ diff --git a/configure.ac b/configure.ac index 0facd4ab..cf42d2c6 100644 --- a/configure.ac +++ b/configure.ac @@ -170,6 +170,16 @@ AC_CONFIG_TESTDIR(tests) AC_CONFIG_FILES([tests/atlocal]) AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison]) AC_CHECK_PROGS([VALGRIND], [valgrind]) +case $VALGRIND:$host_os in + '':*) ;; + *:darwin*) + # See README-hacking. + # VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind' + VALGRIND=;; + *:*) + AC_SUBST([VALGRIND_PREBISON], [$VALGRIND -q]);; +esac + AM_MISSING_PROG([AUTOM4TE], [autom4te]) # Needed by tests/atlocal.in. AC_SUBST([GCC]) diff --git a/doc/bison.texi b/doc/bison.texi index d4ac6e40..2d06fec9 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -8820,7 +8820,7 @@ parser. This is compliant with POSIX Yacc. You could use YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The Prologue}). -If the @code{%define} variable @code{api.prefix} is used (@xref{Multiple +If the @code{%define} variable @code{api.prefix} is used (@pxref{Multiple Parsers, ,Multiple Parsers in the Same Program}), for instance @samp{%define api.prefix x}, then if @code{CDEBUG} is defined, its value controls the tracing feature (enabled iff nonzero); otherwise tracing is enabled iff diff --git a/etc/README b/etc/README index 6e8161af..e4f2abc0 100644 --- a/etc/README +++ b/etc/README @@ -1,6 +1,3 @@ -A directory of tools provided to people using CVS Bison. None of -these is distributed. - * bench.pl A primitive Perl script to run benches. Currently its only bench is the usual calculator: it has a lightweight processing part (but not diff --git a/gnulib b/gnulib index be2b0391..2f67aa79 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit be2b039116133e5fd07e07c5d272b8adb91d72b2 +Subproject commit 2f67aa79c6f13961eda685144130692dc9f7b95f diff --git a/m4/.gitignore b/m4/.gitignore index e157f19c..875400a9 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -34,6 +34,7 @@ /fprintf-posix.m4 /frexp.m4 /frexpl.m4 +/fseterr.m4 /fstat.m4 /getdtablesize.m4 /getopt.m4 @@ -180,6 +181,3 @@ /xalloc.m4 /xsize.m4 /xstrndup.m4 -/off_t.m4 -/sys_types_h.m4 -/fseterr.m4 diff --git a/tests/atlocal.in b/tests/atlocal.in index 315e98ed..8adb3933 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -49,10 +49,13 @@ BISON_CXX_WORKS='@BISON_CXX_WORKS@' # Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known. if "$at_arg_compile_c_with_cxx"; then + CC_IS_CXX=1 CC=$CXX O0CFLAGS=$O0CXXFLAGS NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS CFLAGS=$CXXFLAGS +else + CC_IS_CXX=0 fi diff --git a/tests/headers.at b/tests/headers.at index 8475a090..421dd7d8 100644 --- a/tests/headers.at +++ b/tests/headers.at @@ -183,8 +183,12 @@ AT_BISON_OPTION_POPDEFS AT_DATA([main.cc], [AT_DATA_SOURCE_PROLOGUE -[extern "C" +[// If we are compiling with CC=$CXX, then do not load the C headers +// inside extern "C", since they were _not_ compiled this way. +#if ! CC_IS_CXX +extern "C" { +#endif #include "x1.h" #include "x2.h" #include "x3.h" @@ -192,7 +196,9 @@ AT_DATA([main.cc], #include "x6.h" #include "x7.h" #include "x8.h" +#if ! CC_IS_CXX } +#endif #include "x5.hh" //#include "x6.hh" @@ -231,7 +237,7 @@ AT_TEST([x7], [%define api.push-pull both]) AT_TEST([x8], [%define api.pure %define api.push-pull both]) #AT_TEST([x5], [%locations %language "c++" %glr-parser]) -AT_COMPILE_CXX([parser], [[x[1-8].o main.cc]]) +AT_COMPILE_CXX([parser], [[x[1-8].o -DCC_IS_CXX=$CC_IS_CXX main.cc]]) AT_CHECK([./parser], [0], [[expout]]) m4_popdef([AT_TEST]) diff --git a/tests/local.at b/tests/local.at index 5d318ba7..c79fc08e 100644 --- a/tests/local.at +++ b/tests/local.at @@ -20,6 +20,15 @@ m4_version_prereq([2.58]) +# m4_null_if(VAL, IF-TRUE, IF-FALSE) +# ---------------------------------- +# If VAL evaluates to empty or 0, run IF-TRUE, otherwise IF-FALSE. +m4_define([m4_null_if], +[m4_case(m4_quote($1), + [0], [$2], + [], [$2], + [$3])]) + ## ------------- ## ## Basic tests. ## ## ------------- ## @@ -44,6 +53,8 @@ m4_divert_text([PREPARE_TESTS], { for at_save_file in stderr experr expout do + test ! -f at-bison-check-$at_save_file.bak || + as_fn_error 1 "fatal error: back-up on top of a back-up" test ! -f $at_save_file || mv $at_save_file at-bison-check-$at_save_file.bak done } @@ -407,6 +418,9 @@ void # AT_BISON_CHECK(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) # ------------------------------------------------- +# High-level routine that may call bison several times, under different +# conditions. +# # Check Bison by invoking `bison BISON_ARGS'. BISON_ARGS should not contain # shell constructs (such as redirection or pipes) that would prevent # appending additional command-line arguments for bison. OTHER_AT_CHECK_ARGS @@ -427,24 +441,30 @@ void # # 4. If stderr contains a warning, -Wnone and --warnings=none suppress it. m4_define([AT_BISON_CHECK], -[m4_if(m4_quote($2), [0], [AT_BISON_CHECK_XML($@)], - m4_quote($2), [], [AT_BISON_CHECK_XML($@)]) +[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_NO_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) -# -------------------------------------------------------- -# Same as AT_BISON_CHECK except don't perform XML/XSLT checks. This is useful -# when a tortured grammar's XML is known to be too large for xsltproc to -# handle. -m4_define([AT_BISON_CHECK_NO_XML], -[AT_CHECK(m4_if(m4_quote($2), [0], [], m4_quote($2), [], [], - [AT_QUELL_VALGRIND ])[[bison ]]$@) -m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], - m4_quote(m4_if(m4_quote($2), [], [0], [$2])), [0], [[ - # Defining POSIXLY_CORRECT causes bison to complain if options + +# AT_BISON_CHECK_(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# -------------------------------------------------- +# Low-level macro to run bison once. +m4_define([AT_BISON_CHECK_], +[AT_CHECK(AT_QUELL_VALGRIND[[ bison ]]$@)]) + + +# AT_BISON_CHECK_WARNINGS(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# ---------------------------------------------------------- +# Check that warnings (if some are expected) are correctly +# turned into errors with -Werror, etc. +m4_define([AT_BISON_CHECK_WARNINGS], +[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], + [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 @@ -454,8 +474,7 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], ]AT_DATA([expout], [$3])[ # Run with -Werror. - ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ -Werror]], - [[1]], [expout], [stderr])[ + ]AT_BISON_CHECK_([$1[ -Werror]], [[1]], [expout], [stderr])[ # Build expected stderr up to and including the "warnings being # treated as errors" message. @@ -489,22 +508,27 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [], # Now check --warnings=error. cp stderr experr - ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=error]], - [[1]], [expout], [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. - ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ -Wnone -Werror]], - [[0]], [expout])[ - ]AT_CHECK(AT_QUELL_VALGRIND[[ bison ]$1[ --warnings=none \ - -Werror]], [[0]], [expout])[ + ]AT_BISON_CHECK_([$1[ -Wnone -Werror]], [[0]], [expout])[ + ]AT_BISON_CHECK_([$1[ --warnings=none -Werror]], [[0]], [expout])[ ]AT_RESTORE_SPECIAL_FILES[ - fi - ]]) +fi]dnl ]) +# AT_BISON_CHECK_NO_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) +# -------------------------------------------------------- +# Same as AT_BISON_CHECK except don't perform XML/XSLT checks. This is useful +# when a tortured grammar's XML is known to be too large for xsltproc to +# handle. +m4_define([AT_BISON_CHECK_NO_XML], +[AT_CHECK(m4_null_if([$2], [], [AT_QUELL_VALGRIND ])[[bison ]]$@) +AT_BISON_CHECK_WARNINGS($@)]) + # AT_BISON_CHECK_XML(BISON_ARGS, [OTHER_AT_CHECK_ARGS]) # ----------------------------------------------------- # Run AT_BISON_CHECK's XML/XSLT checks if $BISON_TEST_XML=1 and $XSLTPROC is @@ -521,10 +545,10 @@ m4_define([AT_BISON_CHECK_XML], [--xml=[^][ ]*], [])])dnl # Don't combine these Bison invocations since we want to be sure that # --report=all isn't required to get the full XML file. - AT_CHECK([[bison --report=all --report-file=xml-tests/test.output \ + AT_BISON_CHECK_([[--report=all --report-file=xml-tests/test.output \ --graph=xml-tests/test.dot ]]AT_BISON_ARGS, [[0]], [ignore], [ignore]) - AT_CHECK([[bison --xml=xml-tests/test.xml ]]AT_BISON_ARGS, + AT_BISON_CHECK_([[--xml=xml-tests/test.xml ]]AT_BISON_ARGS, [[0]], [ignore], [ignore]) m4_popdef([AT_BISON_ARGS])dnl [cp xml-tests/test.output expout] @@ -553,6 +577,8 @@ m4_define([AT_BISON_CHECK_XML], m4_define([AT_QUELL_VALGRIND], [[[VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no"; export VALGRIND_OPTS;]]]) + + ## ------------------------ ## ## Compiling C, C++ Files. ## ## ------------------------ ## diff --git a/tests/local.mk b/tests/local.mk index 4f2ee52d..dc5b6c48 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -108,7 +108,7 @@ maintainer-check-posix: $(RUN_TESTSUITE_deps) maintainer-check-valgrind: $(RUN_TESTSUITE_deps) test -z '$(VALGRIND)' || \ $(RUN_TESTSUITE) \ - PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q' \ + PREBISON='$(VALGRIND_PREBISON)' PREPARSER='$(VALGRIND) -q' \ VALGRIND_OPTS='--leak-check=full --show-reachable=yes' .PHONY: maintainer-check