-2001-12-29 Alexandre Duret-Lutz <duret_g@epita.fr>
+2002-01-02 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ Fix for PR automake/280:
+ * automake.in (read_am_file): Warn about trailing backslashes
+ in comments.
+ * tests/comment5.test: New file.
+ * tests/Makefile.am (TESTS): Add comment5.test.
+ Reported by Enrico Scholz.
+
+2002-01-02 Alexandre Duret-Lutz <duret_g@epita.fr>
* tests/comment4.test: New file.
* tests/Makefile.am (TESTS): Add command4.test.
my $spacing = '';
my $comment = '';
my $blank = 0;
+ my $saw_bk = 0;
while ($_ = $am_file->getline)
{
}
elsif (/$WHITE_PATTERN/o)
{
+ file_error ("$amfile:$.",
+ "blank line following trailing backslash")
+ if $saw_bk;
# Stick a single white line before the incoming macro or rule.
$spacing = "\n";
$blank = 1;
{
last;
}
+ $saw_bk = /\\$/ && ! /$IGNORE_PATTERN/o;
}
# We save the conditional stack on entry, and then check to make
my @saved_cond_stack = @cond_stack;
my $cond = conditional_string (@cond_stack);
- my $saw_bk = 0;
my $was_rule = 0;
my $last_var_name = '';
my $last_var_type = '';
$_ =~ s/\@MAINT\@//g
unless $seen_maint_mode;
- my $new_saw_bk = /\\$/ && ! /$COMMENT_PATTERN/o;
+ my $new_saw_bk = /\\$/ && ! /$IGNORE_PATTERN/o;
if (/$IGNORE_PATTERN/o)
{
$comment .= $spacing . $_;
$spacing = '';
file_error ($here, "comment following trailing backslash")
- if $saw_bk;
+ if $saw_bk && $comment ne '';
}
elsif ($saw_bk)
{
comment2.test \
comment3.test \
comment4.test \
+comment5.test \
compile_f_c_cxx.test \
cond.test \
cond2.test \
comment2.test \
comment3.test \
comment4.test \
+comment5.test \
compile_f_c_cxx.test \
cond.test \
cond2.test \
--- /dev/null
+#! /bin/sh
+# Test for PR/280.
+# (Automake should complain about trailing backslashes in comments.)
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am << 'EOF'
+all-local:
+ @echo ${var}
+
+# a comment with backslash \
+
+
+var = foo
+EOF
+
+$ACLOCAL
+$AUTOMAKE && exit 1
+
+## Here is a second test because head comments are
+## handled differently in Automake 1.5.
+
+cat > Makefile.am << 'EOF'
+# a comment with backslash \
+
+
+all-local:
+ @echo ${var}
+
+var = foo
+EOF
+
+$AUTOMAKE && exit 1
+: