[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02-locations-in-stack.patch
From: |
Akim Demaille |
Subject: |
02-locations-in-stack.patch |
Date: |
16 Oct 2000 09:46:46 +0200 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
The aim of this patch is to give locations of the definition of macros
involved in errors. For instance with:
/tmp % cat -n aclocal.m4 20:15 remo
1 AC_DEFUN([FOO1],
2 [AC_REQUIRE([FOO2])])
3
4
5 AC_DEFUN([FOO2],
6 [AC_REQUIRE([FOO3])])
7
8
9
10
11
12
13
14
15
16
17
18 AC_DEFUN([FOO3],
19 [AC_REQUIRE([FOO1])])
/tmp % cat -n configure.in 20:15 remo
1 AC_INIT
2 FOO1
where you had before:
| /tmp % ace
| configure.in:2: AC_REQUIRE: circular dependency of FOO1
| configure.in:2: FOO1 is required by...
| configure.in:2: FOO3 is expanded from...
| configure.in:2: FOO3 is required by...
| configure.in:2: FOO2 is expanded from...
| configure.in:2: FOO2 is required by...
| configure.in:2: FOO1 is expanded from...
| configure.in:2: the top level
you now have:
| /tmp % ace
| configure.in:2: AC_REQUIRE: circular dependency of FOO1
| configure.in:2: FOO1 is required by...
| ./aclocal.m4:19: FOO3 is expanded from...
| configure.in:2: FOO3 is required by...
| ./aclocal.m4:6: FOO2 is expanded from...
| configure.in:2: FOO2 is required by...
| ./aclocal.m4:2: FOO1 is expanded from...
| configure.in:2: the top level
I'm not truly satisfied by this implementation, in particular I
dislike having a human message pushed in the stack. Maybe we should
push pairs instead, something like
[_AC_EXPANSION_EXPANSION], [AC_COMPILE_IFELSE]
[_AC_EXPANSION_REQUIREMENT], [AC_PROG_CC]
It would make it easier to tune the message we want to display.
Index: ChangeLog
from Akim Demaille <address@hidden>
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.
Index: acgeneral.m4
--- acgeneral.m4 Sun, 15 Oct 2000 09:30:12 +0200 akim (ace/27_acgeneral.
1.169.8.70 666)
+++ acgeneral.m4 Sun, 15 Oct 2000 20:13:49 +0200 akim (ace/27_acgeneral.
1.169.8.70 666)
@@ -540,10 +540,10 @@ define([_AC_DIVERT_DIVERSION], _AC_DIVER
# 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 @@ define([_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 @@ define([_AC_DEFUN_EPI],
# 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 @@ define([AC_INIT],
_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: libm4.m4
--- libm4.m4 Sun, 15 Oct 2000 09:30:12 +0200 akim (ace/b/27_libm4.m4 1.20 666)
+++ libm4.m4 Sun, 15 Oct 2000 20:07:42 +0200 akim (ace/b/27_libm4.m4 1.20 666)
@@ -85,24 +85,37 @@ define([m4_rename],
## 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]))])
- 02-locations-in-stack.patch,
Akim Demaille <=