bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comment after trailing backslash inconsistent warning


From: Ralf Wildenhues
Subject: Re: comment after trailing backslash inconsistent warning
Date: Sun, 19 Apr 2009 10:00:53 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

* Ralf Wildenhues wrote on Sun, Apr 19, 2009 at 01:24:27AM CEST:
> * Karl Berry wrote on Sun, Apr 19, 2009 at 12:10:31AM CEST:
> > The line numbers are probably off now since I made more
> > changes since sending the message, but the essential point is that it
> > complains about \
> > #
> > at the end of man1_MANS definition (it is not present below), but does
> > not complain about the same at the end of EXTRA_DIST (twice).
> 
> Confirmed.  What is much more disconcerting though, is that automake is
> completely ignoring those EXTRA_DIST additions that end in backslash
> newline hash (i.e., they never make it into Makefile.in).  Ewww, silent
> breakage.  Will investigate.

What an ugly bug, and it has been present nearly forever!  Automake
1.6.3 already fails silently on this, 1.4-p6 did warn but then creates
garbage nonetheless.

Fixed with this patch, pushed to master.  Will also cherry-pick into
branch-1-10 soonish.

Thanks again!
Ralf

    Correctly treat all assignments with bogus trailing comments.
    
    Before this patch, automake would silently fail to diagnose and
    to copy into the output those variable assignments which are
    preceded by a comment, and end in backslash newline comment.
    
    * automake.in (read_am_file): When determining whether an
    escaped newline followed by a comment is an error, correctly use
    the parser state, not the contents of a saved comment, which
    could still be carried over from a comment before an assignment.
    * tests/commen11.test: New test.
    * tests/Makefile.am: Update.
    Report by Karl Berry.

diff --git a/NEWS b/NEWS
index 2c69e46..e806cf6 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,11 @@ Bugs fixed in 1.10c:
   - Renamed objects also work with the `subdir-objects' option and
     source file languages which Automake does not know itself.
 
+  - `automake' now correctly complains about variable assignments which are
+    preceded by a comment, extend over multiple lines with backslash-escaped
+    newlines, and end in a comment sign.  Previous versions would silently
+    and wrongly ignore such assignments completely.
+
 * Bugs introduced by 1.10:
 
   - The `parallel-tests' driver also works on systems with a nonempty
diff --git a/automake.in b/automake.in
index d494907..fe2ff3d 100755
--- a/automake.in
+++ b/automake.in
@@ -6704,7 +6704,7 @@ sub read_am_file ($$)
        elsif (/$COMMENT_PATTERN/o)
        {
            error $where, "comment following trailing backslash"
-             if $saw_bk && $comment eq '';
+             if $saw_bk && $prev_state != IN_COMMENT;
 
            # Stick comments before the incoming macro or rule.
            $comment .= $spacing . $_;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c36237e..093dde5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -137,6 +137,7 @@ comment7.test \
 comment8.test \
 comment9.test \
 commen10.test \
+commen11.test \
 compile.test \
 compile2.test \
 compile_f90_c_cxx.test \
diff --git a/tests/commen11.test b/tests/commen11.test
new file mode 100755
index 0000000..7596723
--- /dev/null
+++ b/tests/commen11.test
@@ -0,0 +1,42 @@
+#! /bin/sh
+# Copyright (C) 2005, 2009  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, 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 <http://www.gnu.org/licenses/>.
+
+# Make sure backslash-newline-hash combinations are diagnosed as
+# comments following a trailing backslash, even when the combination
+# follows a variable assignment that is preceded by a comment.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+# initial comment
+variable = value-before-comment \
+#
+
+# comment
+SUBDIRS = foo \
+# bar
+
+END
+
+mkdir foo
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 3.*backslash stderr
+grep 7.*backslash stderr
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]