mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-23 14:09:51 +08:00
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.
This commit is contained in:
parent
4e40bb2d16
commit
b69b909d8c
17
ChangeLog
17
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
|
||||
|
17
acgeneral.m4
17
acgeneral.m4
@ -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
|
||||
|
@ -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
|
||||
|
21
libm4.m4
21
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]))])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user