]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Correctly treat all assignments with bogus trailing comments.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 19 Apr 2009 00:19:20 +0000 (02:19 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 19 Apr 2009 07:58:48 +0000 (09:58 +0200)
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.
* NEWS: Update.
* tests/commen11.test: New test.
* tests/Makefile.am: Update.
Report by Karl Berry.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/commen11.test [new file with mode: 0755]

index 15adab4a2abafd6b3817e83d861b9780959e9e32..8be052c1e53d11b419686ab101a0e538efee58c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-04-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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.
+       * NEWS: Update.
+       * tests/commen11.test: New test.
+       * tests/Makefile.am: Update.
+       Report by Karl Berry.
+
 2009-04-14  Karl Berry  <karl@freefriends.org>
 
        manual: improve markup: itemize list in `Extending'.
diff --git a/NEWS b/NEWS
index 2c69e460a76b7a294c565edd05750b41abfd6b15..e806cf638e38770344721338f82aebd73fa8d333 100644 (file)
--- 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
index d4949075c8e0688a42b75927af6ec8fe1f846166..fe2ff3d788d4d2edfc94c05dfb16f4ee69743f08 100755 (executable)
@@ -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 . $_;
index c36237e00fca7b43d43d095738f7028b93761af1..093dde532799454c3de1d5c094768cc51e34e174 100644 (file)
@@ -137,6 +137,7 @@ comment7.test \
 comment8.test \
 comment9.test \
 commen10.test \
+commen11.test \
 compile.test \
 compile2.test \
 compile_f90_c_cxx.test \
index b339664b7baa344434968788728dcc69b4630fa8..54422bf1d7ea77e16c7db96497ec7ef0ea72aa89 100644 (file)
@@ -369,6 +369,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 (executable)
index 0000000..7596723
--- /dev/null
@@ -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
+: