[Top][All Lists]

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

Re: Be done with AU_DEFUN's third argument

From: Bonzini
Subject: Re: Be done with AU_DEFUN's third argument
Date: Mon, 2 Feb 2004 07:11:50 -0500
User-agent: Mutt/1.3.28i

This one seems quite obvious, so I'll install this tomorrow
if I get no reaction (for example with respect to my English).

Fixing autoupdate's warnings is actually very easy.  The bug
is in macros whose AU_DEFUN third argument includes $0, it
is fixed by expanding the warning in the AU_DEFUN'd macro
instead of expanding it in _au_warn_XXX.  I hope this is
clearer with the new documentation.


2004-02-02  Paolo Bonzini  <address@hidden>

        * bin/ Define __file__ so that warnings
        refer to the correct file.
        * doc/autoconf.texi (AU_DEFUN): Describe more correctly
        the behavior of the third argument.
        * lib/autoconf/autoupdate.m4 (AU_DEFUN): Describe more
        correctly the behavior of the third argument.  Document
        what the three macros that AU_DEFUN defines do.  Fix
        warning message when the third argument includes $0
        (reported by Alexandre Duret-Lutz).

Index: bin/
RCS file: /cvsroot/autoconf/autoconf/bin/,v
retrieving revision 1.50
diff -u -r1.50
--- bin/   30 Jan 2004 14:21:35 -0000      1.50
+++ bin/   2 Feb 2004 11:39:49 -0000
@@ -282,6 +282,9 @@
       divert(-1)                                            -*- Autoconf -*-
       changequote([, ])
+      # Redefine __file__ to make warnings nicer; $file is replaced below.
+      define([__file__], [$file])
       # Move all the builtins into the `_au_' pseudo namespace
@@ -379,6 +382,7 @@
     $input_m4 =~ s/^      //mg;
+    $input_m4 =~ s/\$file/$file/g;
     # prepared input -- input, but reenables the quote before each AU macro.
     open INPUT_M4, ">$tmp/input.m4"
Index: doc/autoconf.texi
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.798
diff -u -r1.798 autoconf.texi
--- doc/autoconf.texi   30 Jan 2004 14:21:35 -0000      1.798
+++ doc/autoconf.texi   2 Feb 2004 11:39:53 -0000
@@ -8940,8 +8940,10 @@
 @var{old-macro} is now obsolete.
 If she then uses @command{autoupdate}, the call to @var{old-macro} will be
-replaced by the modern @var{implementation}.  @command{autoupdate} will
-then print the additional @var{message}.
+replaced by the modern @var{implementation}.  @var{message} should
+include information on what to do after running @command{autoupdate},
+and @command{autoupdate} will print it as a warning, @emph{and} include
+it in the updated @file{} file.
 @end defmac
 @node Coding Style
Index: lib/autoconf/autoupdate.m4
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autoupdate.m4,v
retrieving revision 1.7
diff -u -r1.7 autoupdate.m4
--- lib/autoconf/autoupdate.m4  30 Jan 2004 14:21:36 -0000      1.7
+++ lib/autoconf/autoupdate.m4  2 Feb 2004 11:39:53 -0000
@@ -67,8 +67,9 @@
 # -----------------------------------
 # Declare that the macro NAME is now obsoleted, and should be replaced
-# by NEW-CODE.  Tell the user she should run autoupdate, and include
-# the additional MESSAGE.
+# by NEW-CODE.  Tell the user she should run autoupdate, and when
+# autoupdate is run, emit MESSAGE as a warning and include it in
+# the updated file.
 # Also define NAME as a macro which code is NEW-CODE.
@@ -76,15 +77,31 @@
 # and to update a
 # See `acobsolete.m4' for a longer description.
-[m4_ifval([$3], [_au_warn_$1[]AC_DIAGNOSE([obsolete], [$3])d[]nl
+[# This is what autoupdate's m4 run will expand.  It fires
+# the warning (with _au_warn_XXX), outputs it into the
+# updated (with AC_DIAGNOSE), and then outputs
+# the replacement expansion.
+[m4_ifval([$3], [_au_warn_$1([$3])AC_DIAGNOSE([obsolete], [$3])d[]nl
+# This is an auxiliary macro that is also run when
+# autoupdate runs m4.  It simply calls m4_warning, but
+# we need a wrapper so that each warning is emitted only
+# once.  We break the quoting in m4_warning's argument in
+# order to expand this macro's arguments, not AU_DEFUN's.
 m4_define([_au_warn_$1], [])])
+# Finally, this is the expansion that is picked up by
+# autoconf.  It tells the user to run autoupdate, and
+# then outputs the replacement expansion.  We do not care
+# about autoupdate's warning because that contains
+# information on what to do *after* running autoupdate.
-          [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
+        [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
 You should run autoupdate.])dnl

reply via email to

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