+2000-11-03 Akim Demaille <akim@epita.fr>
+
+ * m4sugar.m4 (m4_location): When using its value, don't use
+ `m4_defn', since m4_location is not a variable, it's a macro which
+ expands to __file__:__line__.
+ * tests/m4sugar.at (m4_warn): New test.
+
2000-11-03 Akim Demaille <akim@epita.fr>
* tests/tools.at (unexpanded macros): Strengthen.
[m4_errprint(m4_defn([_m4_expansion_stack]))dnl
m4_popdef([_m4_expansion_stack])dnl
_m4_expansion_stack_dump()],
- [m4_errprint(m4_defn([m4_location])[: the top level])])])
+ [m4_errprint(m4_location[: the top level])])])
# _m4_defun_pro(MACRO-NAME)
# macros that are not involved in ordering constraints, to save m4
# processing.
m4_define([m4_defun],
-[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
[_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
# As m4_defun, but issues the EXPANSION only once, and warns if used
# several times.
m4_define([m4_defun_once],
-[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
[m4_provide_ifelse([$1],
[m4_warn([syntax], [$1 invoked multiple times])],
# it passes to `AC_LANG_COMPILER(C)'.
m4_define([_m4_require],
[m4_pushdef([_m4_expansion_stack],
- m4_defn([m4_location])[: $1 is required by...])dnl
+ m4_location[: $1 is required by...])dnl
ifdef([_m4_expanding($1)],
[m4_fatal([m4_require: circular dependency of $1])])dnl
ifndef([_m4_divert_dump],
[m4_errprint(m4_defn([_m4_expansion_stack]))dnl
m4_popdef([_m4_expansion_stack])dnl
_m4_expansion_stack_dump()],
- [m4_errprint(m4_defn([m4_location])[: the top level])])])
+ [m4_errprint(m4_location[: the top level])])])
# _m4_defun_pro(MACRO-NAME)
# macros that are not involved in ordering constraints, to save m4
# processing.
m4_define([m4_defun],
-[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
[_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
# As m4_defun, but issues the EXPANSION only once, and warns if used
# several times.
m4_define([m4_defun_once],
-[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+[m4_define([m4_location($1)], m4_location)dnl
m4_define([$1],
[m4_provide_ifelse([$1],
[m4_warn([syntax], [$1 invoked multiple times])],
# it passes to `AC_LANG_COMPILER(C)'.
m4_define([_m4_require],
[m4_pushdef([_m4_expansion_stack],
- m4_defn([m4_location])[: $1 is required by...])dnl
+ m4_location[: $1 is required by...])dnl
ifdef([_m4_expanding($1)],
[m4_fatal([m4_require: circular dependency of $1])])dnl
ifndef([_m4_divert_dump],
First, second , third, [,quoted]
]])
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir -o-], 0, expout)
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o-], 0, expout)
+
+AT_CLEANUP()
+
+
+
+## --------- ##
+## m4_warn. ##
+## --------- ##
+
+AT_SETUP([m4_warn])
+
+# m4_text_wrap is used to display the help strings. Also, check that
+# commas are not swallowed. This can easily happen because of
+# m4-listification.
+
+AT_DATA(configure.in,
+[[m4_warn([foo], [foo])
+m4_warn([bar], [bar])
+m4_warn([syntax], [syntax])
+]])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o-],
+ 0, [],
+[configure.in:3: warning: syntax
+])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wall],
+ 0, [],
+[configure.in:1: warning: foo
+configure.in:2: warning: bar
+configure.in:3: warning: syntax
+])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar],
+ 0, [],
+[configure.in:2: warning: bar
+])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar,error],
+ 1, [],
+[configure.in:2: error: bar
+])
AT_CLEANUP()