[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: fix for PR/322 (continued comments)
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: fix for PR/322 (continued comments) |
Date: |
Tue, 14 May 2002 16:07:39 +0200 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) |
I'm checking this in.
2002-05-14 Alexandre Duret-Lutz <address@hidden>
Fix for PR automake/322:
* automake.in (read_am_file): Rename $was_rule as $prev_state, and
set it with IN_RULE_DEF, IN_VAR_DEF, or IN_COMMENT as appropriate.
Handle comments continued by backslashes.
* tests/comment6.test: New file.
* tests/Makefile.am (TESTS): Add comment6.test.
Reported by Braden N. McDaniel.
Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.166.2.4
diff -u -r1.166.2.4 THANKS
--- THANKS 8 May 2002 08:57:12 -0000 1.166.2.4
+++ THANKS 14 May 2002 14:03:21 -0000
@@ -24,6 +24,7 @@
Bill Davidson address@hidden
Bill Fenner address@hidden
Bob Proulx address@hidden
+Braden N. McDaniel address@hidden
Brendan O'Dea address@hidden
Brian Ford address@hidden
Brian Jones address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1287.2.6
diff -u -r1.1287.2.6 automake.in
--- automake.in 6 May 2002 19:12:11 -0000 1.1287.2.6
+++ automake.in 14 May 2002 14:03:24 -0000
@@ -7007,6 +7007,11 @@
my $blank = 0;
my $saw_bk = 0;
+ use constant IN_VAR_DEF => 0;
+ use constant IN_RULE_DEF => 1;
+ use constant IN_COMMENT => 2;
+ my $prev_state = IN_RULE_DEF;
+
while ($_ = $am_file->getline)
{
if (/$IGNORE_PATTERN/o)
@@ -7036,6 +7041,7 @@
$blank = 1;
$comment .= $spacing . $_;
$spacing = '';
+ $prev_state = IN_COMMENT;
}
else
{
@@ -7050,7 +7056,6 @@
my @saved_cond_stack = @cond_stack;
my $cond = conditional_string (@cond_stack);
- my $was_rule = 0;
my $last_var_name = '';
my $last_var_type = '';
my $last_var_value = '';
@@ -7088,15 +7093,20 @@
$spacing = '';
file_error ($here, "comment following trailing backslash")
if $saw_bk && $comment eq '';
+ $prev_state = IN_COMMENT;
}
elsif ($saw_bk)
{
- if ($was_rule)
+ if ($prev_state == IN_RULE_DEF)
{
$output_trailer .= &make_condition (@cond_stack);
$output_trailer .= $_;
}
- else
+ elsif ($prev_state == IN_COMMENT)
+ {
+ $comment .= $spacing . $_;
+ }
+ else # $prev_state == IN_VAR_DEF
{
$last_var_value .= ' '
unless $last_var_value =~ /\s$/;
@@ -7131,7 +7141,7 @@
elsif (/$RULE_PATTERN/o)
{
# Found a rule.
- $was_rule = 1;
+ $prev_state = IN_RULE_DEF;
rule_define ($1, 0, $cond, $here);
@@ -7143,7 +7153,7 @@
elsif (/$ASSIGNMENT_PATTERN/o)
{
# Found a macro definition.
- $was_rule = 0;
+ $prev_state = IN_VAR_DEF;
$last_var_name = $1;
$last_var_type = $2;
$last_var_value = $3;
@@ -7191,7 +7201,7 @@
{
# This isn't an error; it is probably a continued rule.
# In fact, this is what we assume.
- $was_rule = 1;
+ $prev_state = IN_RULE_DEF;
$output_trailer .= $comment . $spacing;
$output_trailer .= &make_condition (@cond_stack);
$output_trailer .= $_;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.385.2.8
diff -u -r1.385.2.8 Makefile.am
--- tests/Makefile.am 8 May 2002 08:57:13 -0000 1.385.2.8
+++ tests/Makefile.am 14 May 2002 14:03:24 -0000
@@ -60,6 +60,7 @@
comment3.test \
comment4.test \
comment5.test \
+comment6.test \
compile_f_c_cxx.test \
cond.test \
cond2.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.499.2.11
diff -u -r1.499.2.11 Makefile.in
--- tests/Makefile.in 8 May 2002 08:57:13 -0000 1.499.2.11
+++ tests/Makefile.in 14 May 2002 14:03:24 -0000
@@ -136,6 +136,7 @@
comment3.test \
comment4.test \
comment5.test \
+comment6.test \
compile_f_c_cxx.test \
cond.test \
cond2.test \
Index: tests/comment6.test
===================================================================
RCS file: tests/comment6.test
diff -N tests/comment6.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/comment6.test 14 May 2002 14:03:24 -0000
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Test for PR/322.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+## There are two tests: one with backslashed comments at the top
+## of the file, and one with a rule first. This is because
+## Comments at the top of the file are handled specially
+## since Automake 1.5.
+
+cat > Makefile.am << 'EOF'
+# SOME_FILES = \
+ file1 \
+ file2 \
+ file3
+
+all-local:
+ @echo Good
+
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+
+cat > Makefile.am << 'EOF'
+all-local:
+ @echo Good
+
+# SOME_FILES = \
+ file1 \
+ file2 \
+ file3
+EOF
+
+$AUTOMAKE
+./configure
+$MAKE
--
Alexandre Duret-Lutz
- FYI: fix for PR/322 (continued comments),
Alexandre Duret-Lutz <=