[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `autoconf -' does not work twice
From: |
Noah Misch |
Subject: |
Re: `autoconf -' does not work twice |
Date: |
Wed, 16 May 2007 19:43:47 -0700 |
User-agent: |
Mutt/1.5.9i |
On Wed, May 16, 2007 at 07:36:23PM +0200, Ralf Wildenhues wrote:
> > + # Don't complain in comments. Well, until we have something
> > + # better, don't consider `#include' etc. are comments.
>
> s/are/to be/
Thanks; I fixed this.
The problem you reported today[1] stems from the pieces of the change that
were to improve reporting of forbidden symbol locations. That was not really
related to fixing the bug in stdin handling. I modified the test suite to catch
the would-be bug, but I simply removed the new semantics that caused it.
This is the updated patch, which I checked in.
[1] http://lists.gnu.org/archive/html/bug-autoconf/2007-05/msg00019.html
2007-05-16 Noah Misch <address@hidden>
* bin/autoconf.as: Handle `-' just like other input files.
* bin/autom4te.in (parse_args): Pass `-' through.
(handle_output): Skip the forbidden token search if we read from stdin.
(up_to_date): Always treat stdin as out of date.
* tests/tools.at (autoconf: input from stdin): New test.
(autoconf: forbidden tokens, basic): Check a second `autoconf' run.
diff -Nurp -X dontdiff ac-clean/bin/autoconf.as ac-cachestdin/bin/autoconf.as
--- ac-clean/bin/autoconf.as 2007-05-05 00:39:13.000000000 -0400
+++ ac-cachestdin/bin/autoconf.as 2007-05-16 22:03:52.000000000 -0400
@@ -164,8 +164,8 @@ case $# in
exit 1
fi
test -z "$traces" && test -z "$outfile" && outfile=configure;;
- 1) # autom4te doesn't like `-'.
- test "x$1" != "x-" && infile=$1 ;;
+ 1)
+ infile=$1 ;;
*) exec >&2
AS_ECHO(["$as_me: invalid number of arguments."])
AS_ECHO(["$help"])
diff -Nurp -X dontdiff ac-clean/bin/autom4te.in ac-cachestdin/bin/autom4te.in
--- ac-clean/bin/autom4te.in 2007-05-05 00:39:13.000000000 -0400
+++ ac-cachestdin/bin/autom4te.in 2007-05-16 22:14:29.000000000 -0400
@@ -418,7 +418,11 @@ Try `$me --help' for more information."
my @argv;
foreach (@ARGV)
{
- if (/\.m4f$/)
+ if ($_ eq '-')
+ {
+ push @argv, $_;
+ }
+ elsif (/\.m4f$/)
{
# Frozen files are optional => pass a `?' to `find_file'.
my $file = find_file ("$_?", @include);
@@ -586,27 +590,30 @@ sub handle_output ($$)
# Locate the forbidden words in the last input file.
# This is unsatisfying but...
- my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
- my $file = new Autom4te::XFile ($ARGV[$#ARGV]);
$exit_code = 1;
-
- while ($_ = $file->getline)
+ if ($ARGV[$#ARGV] ne '-')
{
- # Don't complain in comments. Well, until we have something
- # better, don't consider `#include' etc. are comments.
- s/\#.*//
- unless /^\#(if|include|endif|ifdef|ifndef|define)\b/;
-
- # Complain once per word, but possibly several times per line.
- while (/$prohibited/)
+ my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+ my $file = new Autom4te::XFile ($ARGV[$#ARGV]);
+
+ while ($_ = $file->getline)
{
- my $word = $1;
- warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
- delete $prohibited{$word};
- # If we're done, exit.
- return
- if ! %prohibited;
- $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+ # Don't complain in comments. Well, until we have something
+ # better, don't consider `#include' etc. to be comments.
+ s/\#.*//
+ unless /^\#(if|include|endif|ifdef|ifndef|define)\b/;
+
+ # Complain once per word, but possibly several times per line.
+ while (/$prohibited/)
+ {
+ my $word = $1;
+ warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
+ delete $prohibited{$word};
+ # If we're done, exit.
+ return
+ if ! %prohibited;
+ $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+ }
}
}
warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
@@ -876,6 +883,10 @@ sub up_to_date ($)
# We depend at least upon the arguments.
my @dep = @ARGV;
+ # stdin is always out of date.
+ if (grep { $_ eq '-' } @dep)
+ { return 0 }
+
# Files may include others. We can use traces since we just checked
# if they are available.
handle_traces ($req, "$tmp/dependencies",
diff -Nurp -X dontdiff ac-clean/tests/tools.at ac-cachestdin/tests/tools.at
--- ac-clean/tests/tools.at 2007-05-05 00:39:14.000000000 -0400
+++ ac-cachestdin/tests/tools.at 2007-05-16 22:14:45.000000000 -0400
@@ -285,6 +285,8 @@ configure.ac:4: error: possibly undefine
configure.ac:5: error: possibly undefined macro: _AS@&address@hidden
configure.ac:6: error: possibly undefined macro: d@&address@hidden
]])
+# Second run should succeed and yield no output.
+AT_CHECK([autoconf])
AT_CLEANUP
@@ -386,6 +388,23 @@ AT_CHECK([[grep '^[^/].*/mkdir -p' sub/f
AT_CLEANUP
+# autoconf: input from stdin
+# --------------------------
+AT_SETUP([autoconf: input from stdin])
+
+# Past Autoconf versions failed to read from stdin when other, non-frozen input
+# files were present.
+AT_DATA([aclocal.m4])
+
+AT_CHECK([echo 'AC_INIT(X, 1.0, address@hidden)' | autoconf -t AC_INIT -],
+ 0, [stdin:1:AC_INIT:X:1.0:address@hidden
+])
+AT_CHECK([echo 'AC_INIT(X, 2.0, address@hidden)' | autoconf -t AC_INIT -],
+ 0, [stdin:1:AC_INIT:X:2.0:address@hidden
+])
+
+AT_CLEANUP
+