]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Give a means to report where the macros have been defined in error
authorAkim Demaille <akim@epita.fr>
Tue, 17 Oct 2000 08:07:59 +0000 (08:07 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 17 Oct 2000 08:07:59 +0000 (08:07 +0000)
messages.
* libm4.m4 (m4_location): New macro.
(m4_errprint): Rename as...
(m4_diagnose): this.  Use m4_location.
Adjust dependencies.
(m4_errprint): New macro, similar to `errprint' but for an
additional trailing `n'.
* acgeneral.m4 (AC_DEFUN, AC_DEFUN_ONCE): Define `m4_location($1)'
to the current location (i.e., that of the definition of $1).
(_AC_DEFUN_PRO, _AC_REQUIRE): Also push the location of the
current macro in the stack.
(_AC_EXPANSION_STACK_DUMP): Adjust.

ChangeLog
acgeneral.m4
lib/autoconf/general.m4
libm4.m4

index 453320b90d9e930573223d7c05eb283c55e523ef..a0fe65ccdb7a821718f22b2ef3c16cd85c3efd11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-10-17  Akim Demaille  <akim@epita.fr>
+
+       Give a means to report where the macros have been defined in error
+       messages.
+
+       * libm4.m4 (m4_location): New macro.
+       (m4_errprint): Rename as...
+       (m4_diagnose): this.  Use m4_location.
+       Adjust dependencies.
+       (m4_errprint): New macro, similar to `errprint' but for an
+       additional trailing `\n'.
+       * acgeneral.m4 (AC_DEFUN, AC_DEFUN_ONCE): Define `m4_location($1)'
+       to the current location (i.e., that of the definition of $1).
+       (_AC_DEFUN_PRO, _AC_REQUIRE): Also push the location of the
+       current macro in the stack.
+       (_AC_EXPANSION_STACK_DUMP): Adjust.
+
 2000-10-17  Akim Demaille  <akim@epita.fr>
 
        Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because
index efc6689c04abc7a59e3ea40a96247dab59224c80..05548957e55c43bf4bff740538bdc6afdb58146d 100644 (file)
@@ -540,10 +540,10 @@ pushdef([_AC_DIVERT_DIVERSION], _AC_DIVERT([KILL]))
 # Dump the expansion stack.
 define([_AC_EXPANSION_STACK_DUMP],
 [ifdef([_AC_EXPANSION_STACK],
-       [m4_errprint([  ]defn([_AC_EXPANSION_STACK]))dnl
+       [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
 popdef([_AC_EXPANSION_STACK])dnl
 _AC_EXPANSION_STACK_DUMP()],
-       [m4_errprint([  the top level])])])
+       [m4_diagnose([the top level])])])
 
 
 # _AC_DEFUN_PRO(MACRO-NAME)
@@ -551,7 +551,8 @@ _AC_EXPANSION_STACK_DUMP()],
 # The prologue for Autoconf macros.
 define([_AC_DEFUN_PRO],
 [AC_PROVIDE([$1])dnl
-pushdef([_AC_EXPANSION_STACK], [$1 is expanded from...])dnl
+pushdef([_AC_EXPANSION_STACK],
+        defn([m4_location($1)])[: $1 is expanded from...])dnl
 pushdef([_AC_EXPANDING($1)])dnl
 ifdef([_AC_DIVERT_DUMP],
       [AC_DIVERT_PUSH(defn([_AC_DIVERT_DIVERSION]))],
@@ -585,7 +586,9 @@ popdef([_AC_EXPANDING($1)])dnl
 # macros that are not involved in ordering constraints, to save m4
 # processing.
 define([AC_DEFUN],
-[define([$1], [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
+[define([m4_location($1)], m4_location)dnl
+define([$1],
+       [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
 
 
 # AC_DEFUN_ONCE(NAME, EXPANSION)
@@ -650,9 +653,9 @@ define([AC_BEFORE],
 #   it passes to `AC_LANG_COMPILER(C)'.
 define([_AC_REQUIRE],
 [pushdef([_AC_EXPANSION_STACK],
-         [$1 is required by...])dnl
+         m4_location[: $1 is required by...])dnl
 ifdef([_AC_EXPANDING($1)],
-      [m4_errprint([AC_REQUIRE: circular dependency of $1])dnl
+      [m4_diagnose([AC_REQUIRE: circular dependency of $1])dnl
 _AC_EXPANSION_STACK_DUMP()dnl
 m4exit(1)])dnl
 ifndef([_AC_DIVERT_DUMP],
@@ -2116,7 +2119,7 @@ _AC_INIT_SRCDIR
 _AC_INIT_HELP
 _AC_INIT_VERSION
 _AC_INIT_PREPARE
-dnl _AC__INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
+dnl _AC_INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
 dnl it dumps into a diversion prepared by _AC_INIT_VERSION.
 _AC_INIT_NOTICE
 _AC_INIT_COPYRIGHT
index efc6689c04abc7a59e3ea40a96247dab59224c80..05548957e55c43bf4bff740538bdc6afdb58146d 100644 (file)
@@ -540,10 +540,10 @@ pushdef([_AC_DIVERT_DIVERSION], _AC_DIVERT([KILL]))
 # Dump the expansion stack.
 define([_AC_EXPANSION_STACK_DUMP],
 [ifdef([_AC_EXPANSION_STACK],
-       [m4_errprint([  ]defn([_AC_EXPANSION_STACK]))dnl
+       [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
 popdef([_AC_EXPANSION_STACK])dnl
 _AC_EXPANSION_STACK_DUMP()],
-       [m4_errprint([  the top level])])])
+       [m4_diagnose([the top level])])])
 
 
 # _AC_DEFUN_PRO(MACRO-NAME)
@@ -551,7 +551,8 @@ _AC_EXPANSION_STACK_DUMP()],
 # The prologue for Autoconf macros.
 define([_AC_DEFUN_PRO],
 [AC_PROVIDE([$1])dnl
-pushdef([_AC_EXPANSION_STACK], [$1 is expanded from...])dnl
+pushdef([_AC_EXPANSION_STACK],
+        defn([m4_location($1)])[: $1 is expanded from...])dnl
 pushdef([_AC_EXPANDING($1)])dnl
 ifdef([_AC_DIVERT_DUMP],
       [AC_DIVERT_PUSH(defn([_AC_DIVERT_DIVERSION]))],
@@ -585,7 +586,9 @@ popdef([_AC_EXPANDING($1)])dnl
 # macros that are not involved in ordering constraints, to save m4
 # processing.
 define([AC_DEFUN],
-[define([$1], [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
+[define([m4_location($1)], m4_location)dnl
+define([$1],
+       [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
 
 
 # AC_DEFUN_ONCE(NAME, EXPANSION)
@@ -650,9 +653,9 @@ define([AC_BEFORE],
 #   it passes to `AC_LANG_COMPILER(C)'.
 define([_AC_REQUIRE],
 [pushdef([_AC_EXPANSION_STACK],
-         [$1 is required by...])dnl
+         m4_location[: $1 is required by...])dnl
 ifdef([_AC_EXPANDING($1)],
-      [m4_errprint([AC_REQUIRE: circular dependency of $1])dnl
+      [m4_diagnose([AC_REQUIRE: circular dependency of $1])dnl
 _AC_EXPANSION_STACK_DUMP()dnl
 m4exit(1)])dnl
 ifndef([_AC_DIVERT_DUMP],
@@ -2116,7 +2119,7 @@ _AC_INIT_SRCDIR
 _AC_INIT_HELP
 _AC_INIT_VERSION
 _AC_INIT_PREPARE
-dnl _AC__INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
+dnl _AC_INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
 dnl it dumps into a diversion prepared by _AC_INIT_VERSION.
 _AC_INIT_NOTICE
 _AC_INIT_COPYRIGHT
index ebba0e1b06b8f966b6105eb1a930937d716d2daa..06bad9589a99e90c789df72e14e3b63a6e5bda8c 100644 (file)
--- a/libm4.m4
+++ b/libm4.m4
@@ -85,24 +85,37 @@ m4_rename([symbols], [m4_symbols])
 ## Move some m4 builtins to a safer name space.  ##
 ## --------------------------------------------- ##
 
+
+# m4_location
+# -----------
+define([m4_location], [__file__:__line__])
+
+
 # m4_errprint(MSG)
 # ----------------
-# Same as `errprint', but reports the file and line.
-define([m4_errprint], [errprint(__file__:__line__: [$1
+# Same as `errprint', but with the missing end of line.
+define([m4_errprint], [errprint([$1
 ])])
 
 
+# m4_diagnose(MSG)
+# ----------------
+# Same as `m4_errprint', but reports the file and line.
+define([m4_diagnose],
+[m4_errprint(m4_location: [$1])])
+
+
 # m4_warn(MSG)
 # ------------
 # Warn the user.
-define([m4_warn], [m4_errprint([warning: $1])])
+define([m4_warn], [m4_diagnose([warning: $1])])
 
 
 # m4_fatal(MSG, [EXIT-STATUS])
 # ----------------------------
 # Fatal the user.                                                      :)
 define([m4_fatal],
-[m4_errprint([error: $1])dnl
+[m4_diagnose([error: $1])dnl
 m4exit(ifelse([$2],, 1, [$2]))])