automake-patches
[Top][All Lists]
Advanced

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

check $#args in the --trace output


From: Alexandre Duret-Lutz
Subject: check $#args in the --trace output
Date: Tue, 01 Jul 2003 23:25:16 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:

[...]

 Bonzini> automake always fails, while "automake Makefile"
 Bonzini> complains but creates Makefile.in appropriately.

 adl> It's because your test case calls AC_CONFIG_FILES without arguments.
 adl> (M4 will not allow spaces between a macro name and its arguments.) 

[...]

I'm checking this in on HEAD and branch-1-7.

2003-07-01  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (scan_autoconf_traces): Check the expected
        number of arguments of each traced macro.
        * tests/overrid.test: Fix call to AM_CONDITIONAL.
        * tests/conff2.test: New files.
        * tests/Makefile.am (TESTS): Add conff2.test.
        Report from Paolo Bonzini.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1471
diff -u -r1.1471 automake.in
--- automake.in 30 Jun 2003 06:35:55 -0000      1.1471
+++ automake.in 1 Jul 2003 21:09:14 -0000
@@ -4660,29 +4660,33 @@
 {
   my ($filename) = @_;
 
-  my @traced = qw(AC_CANONICAL_HOST
-                 AC_CANONICAL_SYSTEM
-                 AC_CONFIG_AUX_DIR
-                 AC_CONFIG_FILES
-                 AC_CONFIG_HEADERS
-                 AC_INIT
-                 AC_LIBSOURCE
-                 AC_SUBST
-                 AM_AUTOMAKE_VERSION
-                 AM_CONDITIONAL
-                 AM_GNU_GETTEXT
-                 AM_INIT_AUTOMAKE
-                 AM_MAINTAINER_MODE
-                 AM_PROG_CC_C_O
-                 m4_include
-                 m4_sinclude);
+  # Macros to trace, with their minimal number of arguments.
+  my %traced = (
+               AC_CANONICAL_HOST => 0,
+               AC_CANONICAL_SYSTEM => 0,
+               AC_CONFIG_AUX_DIR => 1,
+               AC_CONFIG_FILES => 1,
+               AC_CONFIG_HEADERS => 1,
+               AC_INIT => 0,
+               AC_LIBSOURCE => 1,
+               AC_SUBST => 1,
+               AM_AUTOMAKE_VERSION => 1,
+               AM_CONDITIONAL => 2,
+               AM_GNU_GETTEXT => 0,
+               AM_INIT_AUTOMAKE => 0,
+               AM_MAINTAINER_MODE => 0,
+               AM_PROG_CC_C_O => 0,
+               m4_include => 1,
+               m4_sinclude => 1,
+             );
 
   my $traces = ($ENV{AUTOCONF} || 'autoconf') . " ";
 
   # Use a separator unlikely to be used, not `:', the default, which
   # has a precise meaning for AC_CONFIG_FILES and so on.
   $traces .= join (' ',
-                  map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' } @traced);
+                  map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' }
+                  (keys %traced));
 
   my $tracefh = new Automake::XFile ("$traces $filename |");
   verb "reading $traces";
@@ -4693,6 +4697,16 @@
       my ($here, @args) = split /::/;
       my $where = new Automake::Location $here;
       my $macro = $args[0];
+
+      prog_error ("unrequested trace `$macro'")
+       unless exists $traced{$macro};
+
+      # Skip and diagnose malformed calls.
+      if ($#args < $traced{$macro})
+       {
+         msg ('syntax', $where, "not enough arguments for $macro");
+         next;
+       }
 
       # Alphabetical ordering please.
       if ($macro eq 'AC_CANONICAL_HOST')
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.500
diff -u -r1.500 Makefile.am
--- tests/Makefile.am   23 Jun 2003 21:39:53 -0000      1.500
+++ tests/Makefile.am   1 Jul 2003 21:09:15 -0000
@@ -118,6 +118,7 @@
 conf2.test \
 confdeps.test \
 conff.test \
+conff2.test \
 confh.test \
 confh4.test \
 config.test \
Index: tests/conff2.test
===================================================================
RCS file: tests/conff2.test
diff -N tests/conff2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/conff2.test   1 Jul 2003 21:09:15 -0000
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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 2, or (at your option)
+# any later version.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure empty calls to AC_CONFIG_FILES or AC_CONFIG_HEADERS are diagnosed.
+
+. ./defs || exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES ([oops])
+AC_CONFIG_HEADERS
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'configure.in:3:.*AC_CONFIG_FILES' stderr
+grep 'configure.in:4:.*AC_CONFIG_HEADERS' stderr
Index: tests/overrid.test
===================================================================
RCS file: /cvs/automake/automake/tests/overrid.test,v
retrieving revision 1.1
diff -u -r1.1 overrid.test
--- tests/overrid.test  16 Apr 2003 19:59:03 -0000      1.1
+++ tests/overrid.test  1 Jul 2003 21:09:15 -0000
@@ -26,7 +26,7 @@
 set -e
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL([COND])
+AM_CONDITIONAL([COND], [:])
 END
 
 cat > Makefile.am << 'END'

-- 
Alexandre Duret-Lutz





reply via email to

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