From unknown Thu Jun 19 14:06:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7804: Automake does not warn if AM_YFLAGS is conditionally extended Resent-From: Stefano Lattarini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-automake@gnu.org Resent-Date: Fri, 07 Jan 2011 22:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7804 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: 7804@debbugs.gnu.org X-Debbugs-Original-To: bug-automake@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.129443914322778 (code B ref -1); Fri, 07 Jan 2011 22:26:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jan 2011 22:25:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PbKkh-0005vL-6n for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:25:43 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PbKkd-0005v8-Qr for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:25:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbKrg-0001Sj-NG for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:32:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbKrg-0001Sf-Kx for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:32:56 -0500 Received: from [140.186.70.92] (port=54011 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbKrf-00089e-Ae for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbKrd-0001SP-Ea for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:55 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:55766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbKrd-0001S8-7z for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:53 -0500 Received: by fxm12 with SMTP id 12so10896980fxm.0 for ; Fri, 07 Jan 2011 14:32:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:mime-version:content-type:content-transfer-encoding :message-id; bh=rAtHw9TXZ27URqB8iZWOBdJQncQomTlvmQb+sepGhGo=; b=nMNUOoLx9HwLtU7vS6G6w4ssYDz37tIv9W1fTg7LHJn2eoSmLbodM+CTWEK4kaVLK3 MZdkMW+2QWcJjhX8AheJ5GYIyWE1wwMqZTZr4lPuMe+0L6hThBoY0VJqJkg2XyNyLNVM qdZtRQqw9Y8mGCpVFOR2QyasvWn/R1stitaZI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; b=J00OUe/aGcx9/qgUxbSabdnZnAqyLmG0pKEYLjt8wEbMpX+OH8/BCwM8uR9DGrSxJA GdHbqqOWEduLrjwFCZWvJDeIeltJ1W2L442dHL3jKmDua21ioe5gm+leqNpiQApyw+// qK7wyEXDB2p+YEpHV6MZ+YXi4RJ/M0EfrGRe0= Received: by 10.223.107.133 with SMTP id b5mr882185fap.87.1294439571881; Fri, 07 Jan 2011 14:32:51 -0800 (PST) Received: from bigio.localnet (host177-52-dynamic.48-82-r.retail.telecomitalia.it [82.48.52.177]) by mx.google.com with ESMTPS id y3sm6293844fai.38.2011.01.07.14.32.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 Jan 2011 14:32:51 -0800 (PST) From: Stefano Lattarini Date: Fri, 7 Jan 2011 23:31:59 +0100 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201101072332.00485.stefano.lattarini@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -4.7 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Hello automakers. Due to current implementation details, when dealing with Yacc sources, automake must know the contents of the `$(AM_YFLAGS)' variable (or similar `$(foo_YFLAGS)' variables) *statically and unconditionally* in order to always generate proper code. This is due to the special handling of the `-d' yacc flag; on this issue, read at : ``AM_YFLAGS is usually used to pass the -d option to yacc. Automake knows what this means and will automatically adjust its rules to update and distribute the header file built by 'yacc -d'. '' And while automake correctly warns if AM_YFLAGS is conditionally *defined*: $ cat configure.ac AC_INIT(x,0) AM_INIT_AUTOMAKE(foreign) AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES(Makefile) AM_CONDITIONAL(COND,:) $ aclocal $ cat > Makefile.am <<'END' bin_PROGRAMS = foo bar foo_SOURCES = foo.y bar_SOURCES = bar.y if COND AM_YFLAGS = -d endif END $ automake -a -Werror; echo status=$? Makefile.am:5: automake does not support AM_YFLAGS being defined conditionally status=1 it erronously doesn't warn if AM_YFLAGS is conditionally *extended*: $ cat configure.ac AC_INIT(x,0) AM_INIT_AUTOMAKE(foreign) AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES(Makefile) AM_CONDITIONAL(COND,:) $ aclocal $ cat > Makefile.am <<'END' bin_PROGRAMS = foo bar foo_SOURCES = foo.y bar_SOURCES = bar.y AM_YFLAGS = if COND AM_YFLAGS += -d endif END $ automake -a -Werror; echo status=$? status=0 I think this bug shouldn't be difficult to fix, and I'll attempt a fix soonish; but as usual, having it in the bug tracker doesn't hurt IMHO. Regards, Stefano From unknown Thu Jun 19 14:06:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7804: [PATCH] yacc: warn about conditional content in *YFLAGS variables (was: bug#7804: Automake does not warn if AM_YFLAGS is conditionally extended) Resent-From: Stefano Lattarini Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-automake@gnu.org Resent-Date: Mon, 10 Jan 2011 14:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7804 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: 7804@debbugs.gnu.org Cc: automake-patches@gnu.org Received: via spool by 7804-submit@debbugs.gnu.org id=B7804.129467114512930 (code B ref 7804); Mon, 10 Jan 2011 14:53:02 +0000 Received: (at 7804) by debbugs.gnu.org; 10 Jan 2011 14:52:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcJ6S-0003MG-P2 for submit@debbugs.gnu.org; Mon, 10 Jan 2011 09:52:25 -0500 Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcJ6Q-0003M5-QP for 7804@debbugs.gnu.org; Mon, 10 Jan 2011 09:52:12 -0500 Received: by wyf23 with SMTP id 23so20325499wyf.3 for <7804@debbugs.gnu.org>; Mon, 10 Jan 2011 06:59:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :message-id; bh=6xD/IiQKqm1zNB+jKh5ErWSLUbau1SioxlbbJPxrYAA=; b=YSoTqLQZXkmeoUuKAaysI44JTKNacL9sqUIdln4FuteqzuspmdZychycPtJKIu5295 ensMJkZpm3oJ4wAS+5wZ3fKW+llnrfO9agRhIU1sX0EiEE6HQKShSkF09ug0IktPvEwV vERWE1ENRTOdcOqAUZPI8uo0qk89ULGZvVx04= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:message-id; b=KykO0Lj372J3FkekkKRnRycCgeyQQZ1cQ/bf5JjYrM7kEFLt/6IWJn9pVCd/63OgmJ GgvWYxlGj7vBn8IjtL6UtbrGPTsahu6YU36iqYYrFCzP8jKLO05Nc16jww+j6HsGpEpp yehbr4vNeycoWR7GdDHVjMsBv2xuaBSR1iYvw= Received: by 10.216.157.68 with SMTP id n46mr2014636wek.111.1294671570236; Mon, 10 Jan 2011 06:59:30 -0800 (PST) Received: from bigio.localnet (host22-93-dynamic.10-79-r.retail.telecomitalia.it [79.10.93.22]) by mx.google.com with ESMTPS id f52sm14128291wes.35.2011.01.10.06.59.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Jan 2011 06:59:29 -0800 (PST) From: Stefano Lattarini Date: Mon, 10 Jan 2011 15:59:10 +0100 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201101072332.00485.stefano.lattarini@gmail.com> In-Reply-To: <201101072332.00485.stefano.lattarini@gmail.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_/6xKNsFRMLe66dX" Message-Id: <201101101559.11830.stefano.lattarini@gmail.com> X-Spam-Score: -3.6 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) --Boundary-00=_/6xKNsFRMLe66dX Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Friday 07 January 2011, Stefano Lattarini wrote: > Hello automakers. > > Due to current implementation details, when dealing with Yacc sources, automake > must know the contents of the `$(AM_YFLAGS)' variable (or similar `$(foo_YFLAGS)' > variables) *statically and unconditionally* in order to always generate proper > code. > > This is due to the special handling of the `-d' yacc flag; on this issue, read > at : > ``AM_YFLAGS is usually used to pass the -d option to yacc. Automake knows what > this means and will automatically adjust its rules to update and distribute > the header file built by 'yacc -d'. '' > > And while automake correctly warns if AM_YFLAGS is conditionally *defined*: > > $ cat configure.ac > AC_INIT(x,0) > AM_INIT_AUTOMAKE(foreign) > AC_PROG_CC > AC_PROG_YACC > AC_CONFIG_FILES(Makefile) > AM_CONDITIONAL(COND,:) > $ aclocal > $ cat > Makefile.am <<'END' > bin_PROGRAMS = foo bar > foo_SOURCES = foo.y > bar_SOURCES = bar.y > if COND > AM_YFLAGS = -d > endif > END > $ automake -a -Werror; echo status=$? > Makefile.am:5: automake does not support AM_YFLAGS being defined conditionally > status=1 > > it erronously doesn't warn if AM_YFLAGS is conditionally *extended*: > > $ cat configure.ac > AC_INIT(x,0) > AM_INIT_AUTOMAKE(foreign) > AC_PROG_CC > AC_PROG_YACC > AC_CONFIG_FILES(Makefile) > AM_CONDITIONAL(COND,:) > $ aclocal > $ cat > Makefile.am <<'END' > bin_PROGRAMS = foo bar > foo_SOURCES = foo.y > bar_SOURCES = bar.y > AM_YFLAGS = > if COND > AM_YFLAGS += -d > endif > END > $ automake -a -Werror; echo status=$? > status=0 > > I think this bug shouldn't be difficult to fix, and I'll attempt a fix > soonish; but as usual, having it in the bug tracker doesn't hurt IMHO. > > Regards, > Stefano > The attached patch should fix the bug. OK for the temporary branch 'yacc-work', to be merged to master afterwards? Regards, Stefano --Boundary-00=_/6xKNsFRMLe66dX Content-Type: text/x-patch; charset="us-ascii"; name="0001-yacc-warn-about-conditional-content-in-YFLAGS-variab.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="0001-yacc-warn-about-conditional-content-in-YFLAGS-variab.patch" =46rom 2ffb8db20b74a319e63fe2d8eda12a075117272b Mon Sep 17 00:00:00 2001 =46rom: Stefano Lattarini Date: Mon, 10 Jan 2011 15:50:35 +0100 Subject: [PATCH] yacc: warn about conditional content in *YFLAGS variables This change fixes automake bug#7804. * automake.in (lang_yacc_target_hook): Warn if any of the relevant *YFLAGS variables has conditional contents (not only a conditional definition). Related refactoring. * tests/yflags-conditional.test: Updated and extended. =2D-- ChangeLog | 9 +++ automake.in | 34 ++++++++---- tests/yflags-conditional.test | 117 +++++++++++++++++++++++++++++++++++++= =2D--- 3 files changed, 140 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06f9b84..e40f608 100644 =2D-- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-01-10 Stefano Lattarini + + yacc: warn about conditional content in *YFLAGS variables + This change fixes automake bug#7804. + * automake.in (lang_yacc_target_hook): Warn if any of the relevant + *YFLAGS variables has conditional contents (not only a conditional + definition). Related refactoring. + * tests/yflags-conditional.test: Updated and extended. + 2011-01-08 Stefano Lattarini =20 yacc: support variable expansions in *YFLAGS definition. diff --git a/automake.in b/automake.in index 2bffe48..fa458d6 100755 =2D-- a/automake.in +++ b/automake.in @@ -6061,15 +6061,29 @@ sub lang_yacc_target_hook { my ($self, $aggregate, $output, $input, %transform) =3D @_; =20 =2D my $flagvar =3D var ($aggregate . "_YFLAGS"); =2D my $YFLAGSvar =3D var ('YFLAGS'); =2D # We cannot work reliably with conditionally-defined YFLAGS. =2D $flagvar->check_defined_unconditionally if $flagvar; =2D $YFLAGSvar->check_defined_unconditionally if $YFLAGSvar; =2D my @flags =3D $flagvar ? $flagvar->value_as_list_recursive : (); =2D my @YFLAGS =3D $YFLAGSvar ? $YFLAGSvar->value_as_list_recursive : (); =2D if (grep (/^-d$/, @flags) || grep (/^-d$/, @YFLAGS)) =2D { + # If some relevant *YFLAGS variable contains the `-d' flag, we'll + # have to to generate special code. + my $yflags_contains_minus_d =3D 0; + + foreach my $pfx ("", "${aggregate}_") + { + my $yflagsvar =3D var ("${pfx}YFLAGS"); + next unless $yflagsvar; + # We cannot work reliably with conditionally-defined YFLAGS. + if ($yflagsvar->has_conditional_contents) + { + msg_var ('unsupported', $yflagsvar, + "`${pfx}YFLAGS' cannot have conditional contents"); + } + else + { + $yflags_contains_minus_d =3D 1 + if grep (/^-d$/, $yflagsvar->value_as_list_recursive); + } + } + + if ($yflags_contains_minus_d) + { (my $output_base =3D $output) =3D~ s/$KNOWN_EXTENSIONS_PATTERN$//; my $header =3D $output_base . '.h'; =20 @@ -6098,7 +6112,7 @@ sub lang_yacc_target_hook # then we want to remove them with "make clean"; otherwise, # "make distcheck" will fail. $clean_files{$header} =3D $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : = CLEAN; =2D } + } # See the comment above for $HEADER. $clean_files{$output} =3D $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN= : CLEAN; } diff --git a/tests/yflags-conditional.test b/tests/yflags-conditional.test index 8c673b1..91e3da4 100755 =2D-- a/tests/yflags-conditional.test +++ b/tests/yflags-conditional.test @@ -14,7 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . =20 =2D# Check that automake complains about conditionally-defined *_YFLAGS. +# Check that automake complains about *_YFLAGS variables which have +# conditional content. =20 . ./defs || Exit 1 =20 @@ -22,25 +23,121 @@ set -e =20 cat >> configure.in <<'END' AC_PROG_CC =2DAC_PROG_YACC + +# `YFLAGS' is AC_SUBST'd by AC_PROG_YACC by default, but we +# don't want this, since it might confuse our error messages. +# Also, AM_SUBST_NOTMAKE seems not to help about this. +# So we simply define $(YACC) by hand. +AC_SUBST([YACC], [yacc]) + AM_CONDITIONAL([COND], [:]) END =20 +$ACLOCAL + cat > Makefile.am <<'END' =2Dbin_PROGRAMS =3D foo bar +bin_PROGRAMS =3D foo zardoz foo_SOURCES =3D foo.y =2Dbar_SOURCES =3D bar.y +zardoz_SOURCES =3D zardoz.y if COND =2DAM_YFLAGS =3D $(YFLAGS) =2Dbar_YFLAGS =3D -v +AM_YFLAGS =3D -v +zardoz_YFLAGS =3D -v endif COND END =20 +cat > Makefile1.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +## dummy comment to keep line count right +if COND +YFLAGS =3D foo +endif COND +END + +cat > Makefile2.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +AM_YFLAGS =3D am_yflags +if COND +YFLAGS =3D yflags +endif COND +END + +cat > Makefile3.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +foo_YFLAGS =3D foo_yflags +if COND +YFLAGS =3D yflags +endif COND +END + +cat > Makefile4.am <<'END' +bin_PROGRAMS =3D foo zardoz + +foo_SOURCES =3D foo.y +zardoz_SOURCES =3D $(foo_SOURCES) + +YFLAGS =3D +AM_YFLAGS =3D $(COND_VAR1) +zardoz_YFLAGS =3D $(COND_VAR2:z=3Dr) + +COND_VAR2 =3D foo +if COND +YFLAGS +=3D -v +COND_VAR2 +=3D bar +else !COND +COND_VAR1 =3D -d +endif !COND +END + +cat > Makefile5.am <<'END' +bin_PROGRAMS =3D foo zardoz +foo_SOURCES =3D foo.y +zardoz_SOURCES =3D zardoz.y +YFLAGS =3D -v +AM_YFLAGS =3D -v +if COND +zardoz_YFLAGS =3D -v +endif +END + +cat > Makefile6.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +foo_YFLAGS =3D -v +if COND +quux_YFLAGS =3D -v +AM_YFLAGS =3D -v +endif +END + : > ylwrap =20 =2D$ACLOCAL =2DAUTOMAKE_fails =2Dgrep "Makefile\.am:5:.*AM_YFLAGS.* defined conditionally" stderr =2Dgrep "Makefile\.am:6:.*bar_YFLAGS.* defined conditionally" stderr +LC_ALL=3DC; export LC_ALL # For grep regexes below. + +AUTOMAKE_fails -Wnone -Wunsupported Makefile +grep '^Makefile\.am:5:.*AM_YFLAGS.* conditional contents' stderr +grep '^Makefile\.am:6:.*zardoz_YFLAGS.* conditional contents' stderr + +for i in 1 2 3; do + AUTOMAKE_fails -Wnone -Wunsupported Makefile$i + grep "^Makefile$i\\.am:5:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents" \ + stderr +done + +AUTOMAKE_fails -Wnone -Wunsupported Makefile4 +grep '^Makefile4\.am:6:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents' stderr +grep '^Makefile4\.am:7:.*AM_YFLAGS.* conditional contents' stderr +grep '^Makefile4\.am:8:.*zardoz_YFLAGS.* conditional contents' stderr + +# Now let's check we avoid false positives. + +# Disable `gnu' warnings because we override the user variable `YFLAGS'. +AUTOMAKE_fails -Wno-gnu Makefile5 +grep -v '^Makefile5\.am:.*zardoz_YFLAGS' stderr | grep . && Exit 1 + +# Disable `gnu' warnings because we override the user variable `YFLAGS'. +$AUTOMAKE -Wno-gnu Makefile6 =20 : =2D-=20 1.7.2.3 --Boundary-00=_/6xKNsFRMLe66dX-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 10 17:21:03 2011 Received: (at control) by debbugs.gnu.org; 10 Jan 2011 22:21:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcQ6p-0005Mk-Fx for submit@debbugs.gnu.org; Mon, 10 Jan 2011 17:21:03 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcQ6n-0005MC-6L for control@debbugs.gnu.org; Mon, 10 Jan 2011 17:21:01 -0500 Received: by wwj40 with SMTP id 40so21947954wwj.15 for ; Mon, 10 Jan 2011 14:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:mime-version:content-type:content-transfer-encoding :message-id; bh=0jIKuT/dpDAoQrQbD3xfKNc+0UonPQvNAPL2yV/dY1Q=; b=cXlLMZc682KcacgV3ZLR1tEMxrR4ygODBvr3OuYyaL87fn0taskW4D4Gs4n3oRYVpu Qc3lEXOjB4FNg+aluzX48LhrMMR9dssxGHC6HwDiCzIcVzIoaq7ZSSQ1XGqBVhw2hZhP Bv3ZY/CePYZKAfu9kACrpX2P+0YH+ZxBdcwB8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; b=aIXQo9TN3ow/mk1171hNOF7RyjxHBod+QZTxWq2caCs7pFmjfv4UR/udK+h3L+OQNz ZL5xcIL4V4GEmlnTeUskenyjDPDMP0ziJ0jwFi2VZ3WTmuFfN/hqXTpC73bgrFS+L1PP BBuE3+sCD37ha3H7Ajl4Eprm8T0aVzZxIqGgY= Received: by 10.227.144.9 with SMTP id x9mr9707491wbu.103.1294698506440; Mon, 10 Jan 2011 14:28:26 -0800 (PST) Received: from bigio.localnet (host22-93-dynamic.10-79-r.retail.telecomitalia.it [79.10.93.22]) by mx.google.com with ESMTPS id 11sm20438803wbi.12.2011.01.10.14.28.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Jan 2011 14:28:25 -0800 (PST) From: Stefano Lattarini To: control@debbugs.gnu.org Subject: automake bug#7804 Date: Mon, 10 Jan 2011 23:28:14 +0100 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201101102328.14540.stefano.lattarini@gmail.com> X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.9 (---) tags 7804 patch thanks From unknown Thu Jun 19 14:06:23 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefano Lattarini Subject: bug#7804: closed (Re: [PATCH] yacc: warn about conditional content in *YFLAGS variables) Message-ID: References: <201101110059.43709.stefano.lattarini@gmail.com> <201101072332.00485.stefano.lattarini@gmail.com> X-Gnu-PR-Message: they-closed 7804 X-Gnu-PR-Package: automake X-Gnu-PR-Keywords: patch Reply-To: 7804@debbugs.gnu.org Date: Tue, 11 Jan 2011 00:00:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1294704004-31789-1" This is a multi-part message in MIME format... ------------=_1294704004-31789-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7804: Automake does not warn if AM_YFLAGS is conditionally extended which was filed against the automake package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7804@debbugs.gnu.org. --=20 7804: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7804 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1294704004-31789-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7804-done) by debbugs.gnu.org; 10 Jan 2011 23:59:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcReP-0008G7-SF for submit@debbugs.gnu.org; Mon, 10 Jan 2011 18:59:50 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PcReM-0008Fu-LF for 7804-done@debbugs.gnu.org; Mon, 10 Jan 2011 18:59:47 -0500 Received: by wwj40 with SMTP id 40so22025911wwj.15 for <7804-done@debbugs.gnu.org>; Mon, 10 Jan 2011 16:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:references:in-reply-to:cc:mime-version:content-type :message-id; bh=mI3QwLFEi1s6SzZWNkq3bGPyqbiGYhwgJPCdZCl1vs4=; b=kjxIJE5h1/JIPflqJcTxTgEp6x0AKQGdlSf/Ac6LKTeaDRKxrYpX79N/rGtt2DcUm5 AWyOiZuvwFhRlESJMNg3OXBzK2kSzYTMFX+JZvDPnKZB0yr5j3Sz/hs60s3zztoTSvaD BptHswqFcOxmEQLStgMjKTbv0Gp8r+FBPj//A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:references:in-reply-to:cc :mime-version:content-type:message-id; b=x4CYjkuv65ZAM1qennLlQ5qCSZOlKuneRlHCv8RfY4wzWYCB7m51hCpOVwvnPVneRu Y3abEMJ7ykoxcLk+aidpojro8Lwv32y62xt8d0yYusmu/768qzn5M4x/LXxIPoB8aTAC NFXAp0BDRESf0XjxwlY83vVbiML5B/WxlXKos= Received: by 10.227.128.208 with SMTP id l16mr3455280wbs.63.1294704432316; Mon, 10 Jan 2011 16:07:12 -0800 (PST) Received: from bigio.localnet (host22-93-dynamic.10-79-r.retail.telecomitalia.it [79.10.93.22]) by mx.google.com with ESMTPS id m6sm14411284wej.34.2011.01.10.16.07.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Jan 2011 16:07:11 -0800 (PST) From: Stefano Lattarini To: automake-patches@gnu.org Subject: Re: [PATCH] yacc: warn about conditional content in *YFLAGS variables Date: Tue, 11 Jan 2011 00:59:42 +0100 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201101072332.00485.stefano.lattarini@gmail.com> <20110110205307.GD15241@gmx.de> <201101102220.23859.stefano.lattarini@gmail.com> In-Reply-To: <201101102220.23859.stefano.lattarini@gmail.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_v15KN2mDXpXZo51" Message-Id: <201101110059.43709.stefano.lattarini@gmail.com> X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 7804-done Cc: 7804-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.8 (---) --Boundary-00=_v15KN2mDXpXZo51 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Monday 10 January 2011, Stefano Lattarini wrote: > On Monday 10 January 2011, Ralf Wildenhues wrote: > > [ dropping bug-automake ] > > > > * Stefano Lattarini wrote on Mon, Jan 10, 2011 at 03:59:10PM CET: > > > The attached patch should fix the bug. OK for the temporary branch > > > 'yacc-work', to be merged to master afterwards? > > > > OK, thanks. Please add a short NEWS blurb (or merge with other NEWS > > about yacc changes). > > > Oops, sorry! I don't know I could forget to do so right away ... :-( > > > How about ensuring in the test that the user can override > > automake by setting warning flags suitably (preapproved)? > > > Good idea (I'll assume that he won't try to make `-d' conditional, as > the behaviour should remain undefined in this case IMHO). I'll amend > the patch with a new testcase (tonight or tomorrow). > Attached is what I pushed. This should fix automake bug#7804. Regards, Stefano --Boundary-00=_v15KN2mDXpXZo51 Content-Type: text/x-patch; charset="us-ascii"; name="0001-yacc-warn-about-conditional-content-in-YFLAGS-variab.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="0001-yacc-warn-about-conditional-content-in-YFLAGS-variab.patch" =46rom 834dc3a98272e7eb1869e2a1972ac14ea45e0ec0 Mon Sep 17 00:00:00 2001 =46rom: Stefano Lattarini Date: Mon, 10 Jan 2011 15:50:35 +0100 Subject: [PATCH] yacc: warn about conditional content in *YFLAGS variables This commit fixes automake bug#7804. * automake.in (lang_yacc_target_hook): Warn if any of the relevant *YFLAGS variables has conditional contents (not only a conditional definition). Related refactoring. * NEWS: Updated. * tests/yflags-conditional.test: Updated and extended. * tests/yflags-conditional-force.test: New test. * tests/Makefile.am (TESTS): Updated. =2D-- ChangeLog | 12 ++++ NEWS | 3 + automake.in | 34 +++++++--- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/yflags-conditional.test | 117 +++++++++++++++++++++++++++++++= +--- tests/yflags-force-conditional.test | 95 ++++++++++++++++++++++++++++ 7 files changed, 243 insertions(+), 20 deletions(-) create mode 100755 tests/yflags-force-conditional.test diff --git a/ChangeLog b/ChangeLog index 06f9b84..90eb69e 100644 =2D-- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-01-10 Stefano Lattarini + + yacc: warn about conditional content in *YFLAGS variables + This change fixes automake bug#7804. + * automake.in (lang_yacc_target_hook): Warn if any of the relevant + *YFLAGS variables has conditional contents (not only a conditional + definition). Related refactoring. + * NEWS: Updated. + * tests/yflags-conditional.test: Updated and extended. + * tests/yflags-conditional-force.test: New test. + * tests/Makefile.am (TESTS): Updated. + 2011-01-08 Stefano Lattarini =20 yacc: support variable expansions in *YFLAGS definition. diff --git a/NEWS b/NEWS index 79860ad..a947af9 100644 =2D-- a/NEWS +++ b/NEWS @@ -62,6 +62,9 @@ Bugs fixed in 1.11.0a: through other variables, such as in: foo_opts =3D -d AM_YFLAGS =3D $(foo_opts) + + - Automake now complains if a `*YFLAGS' variable has any conditional + content, not only a conditional definition. =0C New in 1.11: =20 diff --git a/automake.in b/automake.in index 2bffe48..fa458d6 100755 =2D-- a/automake.in +++ b/automake.in @@ -6061,15 +6061,29 @@ sub lang_yacc_target_hook { my ($self, $aggregate, $output, $input, %transform) =3D @_; =20 =2D my $flagvar =3D var ($aggregate . "_YFLAGS"); =2D my $YFLAGSvar =3D var ('YFLAGS'); =2D # We cannot work reliably with conditionally-defined YFLAGS. =2D $flagvar->check_defined_unconditionally if $flagvar; =2D $YFLAGSvar->check_defined_unconditionally if $YFLAGSvar; =2D my @flags =3D $flagvar ? $flagvar->value_as_list_recursive : (); =2D my @YFLAGS =3D $YFLAGSvar ? $YFLAGSvar->value_as_list_recursive : (); =2D if (grep (/^-d$/, @flags) || grep (/^-d$/, @YFLAGS)) =2D { + # If some relevant *YFLAGS variable contains the `-d' flag, we'll + # have to to generate special code. + my $yflags_contains_minus_d =3D 0; + + foreach my $pfx ("", "${aggregate}_") + { + my $yflagsvar =3D var ("${pfx}YFLAGS"); + next unless $yflagsvar; + # We cannot work reliably with conditionally-defined YFLAGS. + if ($yflagsvar->has_conditional_contents) + { + msg_var ('unsupported', $yflagsvar, + "`${pfx}YFLAGS' cannot have conditional contents"); + } + else + { + $yflags_contains_minus_d =3D 1 + if grep (/^-d$/, $yflagsvar->value_as_list_recursive); + } + } + + if ($yflags_contains_minus_d) + { (my $output_base =3D $output) =3D~ s/$KNOWN_EXTENSIONS_PATTERN$//; my $header =3D $output_base . '.h'; =20 @@ -6098,7 +6112,7 @@ sub lang_yacc_target_hook # then we want to remove them with "make clean"; otherwise, # "make distcheck" will fail. $clean_files{$header} =3D $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : = CLEAN; =2D } + } # See the comment above for $HEADER. $clean_files{$output} =3D $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN= : CLEAN; } diff --git a/tests/Makefile.am b/tests/Makefile.am index bb1d786..39f1a39 100644 =2D-- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -817,6 +817,7 @@ yflags-cmdline-override.test \ yflags-conditional.test \ yflags-d-false-positives.test \ yflags-force-override.test \ +yflags-force-conditional.test \ yflags-var-expand.test \ $(parallel_tests) =20 diff --git a/tests/Makefile.in b/tests/Makefile.in index e83cf33..0ea9825 100644 =2D-- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1084,6 +1084,7 @@ yflags-cmdline-override.test \ yflags-conditional.test \ yflags-d-false-positives.test \ yflags-force-override.test \ +yflags-force-conditional.test \ yflags-var-expand.test \ $(parallel_tests) =20 diff --git a/tests/yflags-conditional.test b/tests/yflags-conditional.test index 8c673b1..91e3da4 100755 =2D-- a/tests/yflags-conditional.test +++ b/tests/yflags-conditional.test @@ -14,7 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . =20 =2D# Check that automake complains about conditionally-defined *_YFLAGS. +# Check that automake complains about *_YFLAGS variables which have +# conditional content. =20 . ./defs || Exit 1 =20 @@ -22,25 +23,121 @@ set -e =20 cat >> configure.in <<'END' AC_PROG_CC =2DAC_PROG_YACC + +# `YFLAGS' is AC_SUBST'd by AC_PROG_YACC by default, but we +# don't want this, since it might confuse our error messages. +# Also, AM_SUBST_NOTMAKE seems not to help about this. +# So we simply define $(YACC) by hand. +AC_SUBST([YACC], [yacc]) + AM_CONDITIONAL([COND], [:]) END =20 +$ACLOCAL + cat > Makefile.am <<'END' =2Dbin_PROGRAMS =3D foo bar +bin_PROGRAMS =3D foo zardoz foo_SOURCES =3D foo.y =2Dbar_SOURCES =3D bar.y +zardoz_SOURCES =3D zardoz.y if COND =2DAM_YFLAGS =3D $(YFLAGS) =2Dbar_YFLAGS =3D -v +AM_YFLAGS =3D -v +zardoz_YFLAGS =3D -v endif COND END =20 +cat > Makefile1.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +## dummy comment to keep line count right +if COND +YFLAGS =3D foo +endif COND +END + +cat > Makefile2.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +AM_YFLAGS =3D am_yflags +if COND +YFLAGS =3D yflags +endif COND +END + +cat > Makefile3.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +foo_YFLAGS =3D foo_yflags +if COND +YFLAGS =3D yflags +endif COND +END + +cat > Makefile4.am <<'END' +bin_PROGRAMS =3D foo zardoz + +foo_SOURCES =3D foo.y +zardoz_SOURCES =3D $(foo_SOURCES) + +YFLAGS =3D +AM_YFLAGS =3D $(COND_VAR1) +zardoz_YFLAGS =3D $(COND_VAR2:z=3Dr) + +COND_VAR2 =3D foo +if COND +YFLAGS +=3D -v +COND_VAR2 +=3D bar +else !COND +COND_VAR1 =3D -d +endif !COND +END + +cat > Makefile5.am <<'END' +bin_PROGRAMS =3D foo zardoz +foo_SOURCES =3D foo.y +zardoz_SOURCES =3D zardoz.y +YFLAGS =3D -v +AM_YFLAGS =3D -v +if COND +zardoz_YFLAGS =3D -v +endif +END + +cat > Makefile6.am <<'END' +bin_PROGRAMS =3D foo +foo_SOURCES =3D foo.y +foo_YFLAGS =3D -v +if COND +quux_YFLAGS =3D -v +AM_YFLAGS =3D -v +endif +END + : > ylwrap =20 =2D$ACLOCAL =2DAUTOMAKE_fails =2Dgrep "Makefile\.am:5:.*AM_YFLAGS.* defined conditionally" stderr =2Dgrep "Makefile\.am:6:.*bar_YFLAGS.* defined conditionally" stderr +LC_ALL=3DC; export LC_ALL # For grep regexes below. + +AUTOMAKE_fails -Wnone -Wunsupported Makefile +grep '^Makefile\.am:5:.*AM_YFLAGS.* conditional contents' stderr +grep '^Makefile\.am:6:.*zardoz_YFLAGS.* conditional contents' stderr + +for i in 1 2 3; do + AUTOMAKE_fails -Wnone -Wunsupported Makefile$i + grep "^Makefile$i\\.am:5:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents" \ + stderr +done + +AUTOMAKE_fails -Wnone -Wunsupported Makefile4 +grep '^Makefile4\.am:6:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents' stderr +grep '^Makefile4\.am:7:.*AM_YFLAGS.* conditional contents' stderr +grep '^Makefile4\.am:8:.*zardoz_YFLAGS.* conditional contents' stderr + +# Now let's check we avoid false positives. + +# Disable `gnu' warnings because we override the user variable `YFLAGS'. +AUTOMAKE_fails -Wno-gnu Makefile5 +grep -v '^Makefile5\.am:.*zardoz_YFLAGS' stderr | grep . && Exit 1 + +# Disable `gnu' warnings because we override the user variable `YFLAGS'. +$AUTOMAKE -Wno-gnu Makefile6 =20 : diff --git a/tests/yflags-force-conditional.test b/tests/yflags-force-condi= tional.test new file mode 100755 index 0000000..65f3197 =2D-- /dev/null +++ b/tests/yflags-force-conditional.test @@ -0,0 +1,95 @@ +#! /bin/sh +# Copyright (C) 2011 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 2, 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 . + +# Check that the user can force automake to use *_YFLAGS variables +# which have conditional content. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_PROG_CC +AC_PROG_YACC +AM_CONDITIONAL([COND], [test x"$cond" =3D x"yes"]) +AC_OUTPUT +END + +mkdir bin +cat > bin/fake-yacc <<'END' +#!/bin/sh +echo "/* $* */" > y.tab.c +echo 'extern int dummy;' >> y.tab.c +END +chmod a+x bin/fake-yacc +PATH=3D`pwd`/bin$PATH_SEPARATOR$PATH; export PATH +YACC=3Dfake-yacc; export YACC + +cat > Makefile.am <<'END' +bin_PROGRAMS =3D foo bar +foo_SOURCES =3D foo.y main.c +bar_SOURCES =3D $(foo_SOURCES) +bar_YFLAGS =3D $(bar_yflags2) +if COND +AM_YFLAGS =3D __am_cond_yes__ +bar_YFLAGS +=3D __bar_cond_yes__ +else !COND +AM_YFLAGS =3D __am_cond_no__ +bar_yflags2 =3D __bar_cond_no__ +endif !COND +END + +cat > main.c <<'END' +int main (void) +{ + return 0; +} +END + +: > foo.y + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a -Wno-unsupported + +$EGREP '(YFLAGS|yflags|am__append)' Makefile.in # For debugging. + +./configure cond=3Dyes +$MAKE + +ls -l +cat foo.c +cat bar-foo.c + +$FGREP ' __am_cond_yes__ ' foo.c +$FGREP ' __bar_cond_yes__ ' bar-foo.c +$FGREP 'cond_no' foo.c bar-foo.c && Exit 1 + +$MAKE maintainer-clean +ls -l + +./configure cond=3Dno +$MAKE + +ls -l +cat foo.c +cat bar-foo.c + +$FGREP ' __am_cond_no__ ' foo.c +$FGREP ' __bar_cond_no__ ' bar-foo.c +$FGREP 'cond_yes' foo.c bar-foo.c && Exit 1 + +: =2D-=20 1.7.2.3 --Boundary-00=_v15KN2mDXpXZo51-- ------------=_1294704004-31789-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Jan 2011 22:25:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PbKkh-0005vL-6n for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:25:43 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PbKkd-0005v8-Qr for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:25:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbKrg-0001Sj-NG for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:32:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbKrg-0001Sf-Kx for submit@debbugs.gnu.org; Fri, 07 Jan 2011 17:32:56 -0500 Received: from [140.186.70.92] (port=54011 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbKrf-00089e-Ae for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbKrd-0001SP-Ea for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:55 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:55766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbKrd-0001S8-7z for bug-automake@gnu.org; Fri, 07 Jan 2011 17:32:53 -0500 Received: by fxm12 with SMTP id 12so10896980fxm.0 for ; Fri, 07 Jan 2011 14:32:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:mime-version:content-type:content-transfer-encoding :message-id; bh=rAtHw9TXZ27URqB8iZWOBdJQncQomTlvmQb+sepGhGo=; b=nMNUOoLx9HwLtU7vS6G6w4ssYDz37tIv9W1fTg7LHJn2eoSmLbodM+CTWEK4kaVLK3 MZdkMW+2QWcJjhX8AheJ5GYIyWE1wwMqZTZr4lPuMe+0L6hThBoY0VJqJkg2XyNyLNVM qdZtRQqw9Y8mGCpVFOR2QyasvWn/R1stitaZI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; b=J00OUe/aGcx9/qgUxbSabdnZnAqyLmG0pKEYLjt8wEbMpX+OH8/BCwM8uR9DGrSxJA GdHbqqOWEduLrjwFCZWvJDeIeltJ1W2L442dHL3jKmDua21ioe5gm+leqNpiQApyw+// qK7wyEXDB2p+YEpHV6MZ+YXi4RJ/M0EfrGRe0= Received: by 10.223.107.133 with SMTP id b5mr882185fap.87.1294439571881; Fri, 07 Jan 2011 14:32:51 -0800 (PST) Received: from bigio.localnet (host177-52-dynamic.48-82-r.retail.telecomitalia.it [82.48.52.177]) by mx.google.com with ESMTPS id y3sm6293844fai.38.2011.01.07.14.32.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 Jan 2011 14:32:51 -0800 (PST) From: Stefano Lattarini To: bug-automake@gnu.org Subject: Automake does not warn if AM_YFLAGS is conditionally extended Date: Fri, 7 Jan 2011 23:31:59 +0100 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201101072332.00485.stefano.lattarini@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Hello automakers. Due to current implementation details, when dealing with Yacc sources, automake must know the contents of the `$(AM_YFLAGS)' variable (or similar `$(foo_YFLAGS)' variables) *statically and unconditionally* in order to always generate proper code. This is due to the special handling of the `-d' yacc flag; on this issue, read at : ``AM_YFLAGS is usually used to pass the -d option to yacc. Automake knows what this means and will automatically adjust its rules to update and distribute the header file built by 'yacc -d'. '' And while automake correctly warns if AM_YFLAGS is conditionally *defined*: $ cat configure.ac AC_INIT(x,0) AM_INIT_AUTOMAKE(foreign) AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES(Makefile) AM_CONDITIONAL(COND,:) $ aclocal $ cat > Makefile.am <<'END' bin_PROGRAMS = foo bar foo_SOURCES = foo.y bar_SOURCES = bar.y if COND AM_YFLAGS = -d endif END $ automake -a -Werror; echo status=$? Makefile.am:5: automake does not support AM_YFLAGS being defined conditionally status=1 it erronously doesn't warn if AM_YFLAGS is conditionally *extended*: $ cat configure.ac AC_INIT(x,0) AM_INIT_AUTOMAKE(foreign) AC_PROG_CC AC_PROG_YACC AC_CONFIG_FILES(Makefile) AM_CONDITIONAL(COND,:) $ aclocal $ cat > Makefile.am <<'END' bin_PROGRAMS = foo bar foo_SOURCES = foo.y bar_SOURCES = bar.y AM_YFLAGS = if COND AM_YFLAGS += -d endif END $ automake -a -Werror; echo status=$? status=0 I think this bug shouldn't be difficult to fix, and I'll attempt a fix soonish; but as usual, having it in the bug tracker doesn't hurt IMHO. Regards, Stefano ------------=_1294704004-31789-1--