[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02-m4-warnings.patch
From: |
Akim Demaille |
Subject: |
02-m4-warnings.patch |
Date: |
27 Oct 2000 09:39:13 +0200 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
Index: ChangeLog
from Akim Demaille <address@hidden>
Move the handling of classified warnings into M4sugar.
* m4sugar.m4 (m4_diagnose): Remove.
(m4_warnings): New.
* acgeneral.m4 (AC_WARNING_IFELSE, _AC_WARNING_IFELSE)
(_AC_WARNING_ERROR_IFELSE, __AC_WARNING_ERROR_IFELSE)
(_AC_DIAGNOSE, AC_DIAGNOSE): Rename as...
* m4sugar.m4 (m4_warning_ifelse, _m4_warning_ifelse)
(_m4_warning_error_ifelse, __m4_warning_error_ifelse)
(_m4_warn, m4_warn): these.
* autoconf.m4: Define `m4_warnings' instead of `_AC_WARNINGS'.
Index: acgeneral.m4
--- acgeneral.m4 Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/27_acgeneral.
1.169.8.74 666)
+++ acgeneral.m4 Thu, 26 Oct 2000 22:26:20 +0200 akim (ace/27_acgeneral.
1.169.8.74 666)
@@ -509,7 +509,7 @@ define([_AC_EXPANSION_STACK_DUMP],
[m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
popdef([_AC_EXPANSION_STACK])dnl
_AC_EXPANSION_STACK_DUMP()],
- [m4_diagnose([the top level])])])
+ [m4_errprint(m4_location[: the top level])])])
# _AC_DEFUN_PRO(MACRO-NAME)
@@ -564,14 +564,14 @@ define([$1],
define([AC_DEFUN_ONCE],
[define([$1],
[AC_PROVIDE_IFELSE([$1],
- [AC_DIAGNOSE([syntax], [$1 invoked multiple times])],
+ [m4_warn([syntax], [$1 invoked multiple times])],
[_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])])
# AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
# ------------------------------------------
define([AC_OBSOLETE],
-[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])])
+[m4_warn([obsolete], [$1 is obsolete$2])])
@@ -585,7 +585,7 @@ define([AC_OBSOLETE],
# AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)
# ---------------------------------------------
define([AC_BEFORE],
-[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
+[AC_PROVIDE_IFELSE([$2], [m4_warn([syntax], [$2 was called before $1])])])
# _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
@@ -632,8 +632,8 @@ define([_AC_REQUIRE],
m4_divert_pop()])dnl
AC_PROVIDE_IFELSE([$1],
[],
- [AC_DIAGNOSE([syntax],
- [$1 is AC_REQUIRE'd but is not AC_DEFUN'd])])dnl
+ [m4_warn([syntax],
+ [$1 is AC_REQUIRE'd but is not AC_DEFUN'd])])dnl
popdef([_AC_EXPANSION_STACK])dnl
])
@@ -703,7 +703,7 @@ define([AU_DEFINE],
# See `acobsolete.m4' for a longer description.
define([AU_DEFUN],
[AU_DEFINE([$1],
- [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete.
+ [m4_warn([obsolete], [The macro `$1' is obsolete.
You should run autoupdate.])dnl
$2],
[$3])dnl
@@ -2462,7 +2462,7 @@ define([AC_CACHE_SAVE],
# Should be dnl'ed. Try to catch common mistakes.
define([AC_CACHE_VAL],
[ifelse(regexp([$2], [AC_DEFINE]), [-1], [],
- [AC_DIAGNOSE(syntax,
+ [m4_warn([syntax],
[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
[where no actions should be taken])])dnl
AC_VAR_SET_IFELSE([$1],
@@ -2578,81 +2578,17 @@ define([AC_SUBST_FILE],
# between AC_FATAL and AC_MSG_ERROR.
-# AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE)
-# ----------------------------------------------
-# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
-# IF-FALSE.
-#
-# The variable `_AC_WARNINGS' contains a comma separated list of
-# warnings which order is the converse from the one specified by
-# the user, i.e., if she specified `-W error,none,obsolete',
-# `_AC_WARNINGS' is `obsolete,none,error'. We read it from left to
-# right, and:
-# - if none or noCATEGORY is met, run IF-FALSE
-# - if all or CATEGORY is met, run IF-TRUE
-# - if there is nothing left, run IF-FALSE.
-define([AC_WARNING_IFELSE],
-[_AC_WARNING_IFELSE([$1], [$2], [$3], _AC_WARNINGS)])
-
-
-# _AC_WARNING_IFELSE(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
-# --------------------------------------------------------------
-# Implementation of the loop described above.
-define([_AC_WARNING_IFELSE],
-[ifelse([$4], [$1], [$2],
- [$4], [all], [$2],
- [$4], [], [$3],
- [$4], [none], [$3],
- [$4], [no-$1], [$3],
- [$0([$1], [$2], [$3], m4_shiftn(4, $@))])])
-
-
-# _AC_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# -------------------------------------------
-# The same as AC_WARNING_IFELSE, but scan for `error' only.
-define([_AC_WARNING_ERROR_IFELSE],
-[__AC_WARNING_ERROR_IFELSE([$1], [$2], _AC_WARNINGS)])
-
-
-# __AC_WARNING_ERROR_IFELSE(IF-TRUE, IF-FALSE)
-# --------------------------------------------
-# The same as _AC_WARNING_IFELSE, but scan for `error' only.
-define([__AC_WARNING_ERROR_IFELSE],
-[ifelse([$3], [error], [$1],
- [$3], [], [$2],
- [$3], [no-error], [$2],
- [$0([$1], [$2], m4_shiftn(3, $@))])])
-
-
-
-# _AC_DIAGNOSE(MESSAGE)
-# ---------------------
-# Report MESSAGE as a warning, unless the user requested -W error,
-# in which case report a fatal error.
-define([_AC_DIAGNOSE],
-[_AC_WARNING_ERROR_IFELSE([m4_fatal([$1])],
- [m4_warn([$1])])])
-
-
-# AC_DIAGNOSE(CATEGORY, MESSAGE)
-# ------------------------------
-# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
-# is requested (in fact, not disabled).
-define([AC_DIAGNOSE],
-[AC_WARNING_IFELSE([$1], [_AC_DIAGNOSE([$2])])])
-
-
# AC_WARNING(MESSAGE)
# -------------------
# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
# specified.
-define([AC_WARNING], [AC_DIAGNOSE([syntax], [$1])])
+define([AC_WARNING], [m4_warn([syntax], [$1])])
# AC_FATAL(MESSAGE, [EXIT-STATUS])
# --------------------------------
define([AC_FATAL],
-[m4_diagnose([$1])
+[m4_errprint(m4_location[: $1])
_AC_EXPANSION_STACK_DUMP()
m4exit(m4_default([$2], [1]))])
@@ -2690,7 +2626,7 @@ define([_AC_SH_QUOTE_IFELSE],
define([_AC_SH_QUOTE],
[_AC_SH_QUOTE_IFELSE([$1],
[patsubst([$1], [\([`""]\)], [\\\1])],
- [AC_DIAGNOSE([obsolete],
+ [m4_warn([obsolete],
[backquotes and double quotes should not be backslashed in: $1])dnl
$1])])
@@ -3472,8 +3408,8 @@ AC_DEFUN([AC_RUN_IFELSE],
# --------------------------------------------------------
AC_DEFUN([AC_TRY_RUN],
[ifval([$4], [],
- [AC_DIAGNOSE([cross],
- [$0 called without default to allow cross compiling])])dnl
+ [m4_warn([cross],
+ [$0 called without default to allow cross compiling])])dnl
if test "$cross_compiling" = yes; then
m4_default([$4],
[AC_MSG_ERROR(cannot run test program while cross compiling)])
@@ -3532,8 +3468,8 @@ AC_DEFUN([AC_CHECK_HEADERS],
#
# Check for the existence of FILE.
AC_DEFUN([AC_CHECK_FILE],
-[AC_DIAGNOSE([cross],
- [Cannot check for file existence when cross compiling])dnl
+[m4_warn([cross],
+ [Cannot check for file existence when cross compiling])dnl
AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
AC_CACHE_CHECK([for $1], ac_File,
[test "$cross_compiling" = yes &&
@@ -3634,8 +3570,8 @@ define([_AC_LIBOBJ],
# We don't use AC_SUBST/2 because it forces an unneeded eol.
define([AC_LIBOBJ],
[_AC_LIBOBJ([$1],
- [AC_DIAGNOSE(syntax,
- [$0($1): you should use literals])])dnl
+ [m4_warn([syntax],
+ [$0($1): you should use literals])])dnl
])
@@ -3891,7 +3827,8 @@ AC_DEFUN([AC_CHECK_TYPE],
_AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
[_AC_CHECK_TYPE_OLD($@)],
_AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
- [m4_warn([$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
+ [m4_warn([syntax],
+ [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
[_AC_CHECK_TYPE_NEW($@)])[]dnl
])# AC_CHECK_TYPE
@@ -4286,8 +4223,8 @@ AC_DEFUN([AC_CONFIG_SUBDIRS],
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
m4_append([_AC_LIST_SUBDIRS], [ $1])dnl
AC_VAR_INDIR_IFELSE([$1],
- [AC_DIAGNOSE(syntax,
- [$0: you should use literals])])
+ [m4_warn([syntax],
+ [$0: you should use literals])])
m4_divert([DEFAULTS], [ac_subdirs_all="$ac_subdirs_all $1"])
AC_SUBST(subdirs, "$subdirs $1")dnl
])
Index: aclang.m4
--- aclang.m4 Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/b/32_aclang.m4 1.5.3.41
666)
+++ aclang.m4 Thu, 26 Oct 2000 22:26:50 +0200 akim (ace/b/32_aclang.m4 1.5.3.41
666)
@@ -143,8 +143,8 @@ define([AC_LANG_POP],
# ------------
# Save the current language, but don't change language.
AU_DEFUN([AC_LANG_SAVE],
-[AC_DIAGNOSE([obsolete],
- [instead of using `AC_LANG', `AC_LANG_SAVE',
+[m4_warn([obsolete],
+ [instead of using `AC_LANG', `AC_LANG_SAVE',
and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
pushdef([_AC_LANG], _AC_LANG)])
Index: acspecific.m4
--- acspecific.m4 Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/25_acspecific 1.107
666)
+++ acspecific.m4 Thu, 26 Oct 2000 22:09:26 +0200 akim (ace/25_acspecific 1.107
666)
@@ -293,7 +293,7 @@ AC_DEFUN([AC_PROG_LN_S],
# ------
# I don't know what it used to do, but it no longer does.
AU_DEFUN([AC_RSH],
-[AC_DIAGNOSE([obsolete], [$0: is no longer supported.
+[m4_warn([obsolete], [$0: is no longer supported.
Remove this warning when you adjust the code.])])
@@ -610,7 +610,8 @@ AC_DEFUN([AC_HEADER_TIOCGWINSZ],
# ----------
# Define `USG' if string functions are in strings.h.
AU_DEFUN([AC_USG],
-[AC_DIAGNOSE([obsolete], [$0: Remove `AC_MSG_CHECKING', `AC_TRY_LINK' and this
`AC_WARNING'
+[m4_warn([obsolete],
+[$0: Remove `AC_MSG_CHECKING', `AC_TRY_LINK' and this `AC_WARNING'
when you ajust your code to use HAVE_STRING_H.])dnl
AC_MSG_CHECKING([for BSD string and memory functions])
AC_TRY_LINK(address@hidden:@include <strings.h>], [rindex(0, 0); bzero(0, 0);],
@@ -636,7 +637,7 @@ AC_DEFUN([AC_HEADER_TIOCGWINSZ],
# But it is better to check for both headers, and alias NEED_MEMORY_H to
# HAVE_MEMORY_H.
AU_DEFUN([AC_MEMORY_H],
-[AC_DIAGNOSE([obsolete], [$0: Remove this warning and
+[m4_warn([obsolete], [$0: Remove this warning and
`AC_CHECK_HEADER(memory.h, AC_DEFINE(...))' when you ajust your code to
use and HAVE_STRING_H and HAVE_MEMORY_H, not NEED_MEMORY_H.])dnl
AC_CHECK_HEADER(memory.h,
@@ -654,7 +655,7 @@ AC_DEFUN([AC_HEADER_TIOCGWINSZ],
AU_DEFUN([AC_DIR_HEADER],
[AC_HEADER_DIRENT
AC_FUNC_CLOSEDIR_VOID
-AC_DIAGNOSE([obsolete],
+m4_warn([obsolete],
[$0: Remove this warning and the four `AC_DEFINE' when you
ajust your code to use `AC_HEADER_DIRENT'.])
test ac_cv_header_dirent_dirent_h &&
@@ -749,7 +750,7 @@ AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYP
# What a great name :)
AU_DEFUN([AC_INT_16_BITS],
[AC_CHECK_SIZEOF([int])
-AC_DIAGNOSE([obsolete], [$0:
+m4_warn([obsolete], [$0:
your code should no longer depend upon `INT_16_BITS', but upon
`SIZEOF_INT'. Remove this warning and the `AC_DEFINE' when you
adjust the code.])dnl
@@ -763,7 +764,7 @@ AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYP
# -------------------
AU_DEFUN([AC_LONG_64_BITS],
[AC_CHECK_SIZEOF([long int])
-AC_DIAGNOSE([obsolete], [$0:
+m4_warn([obsolete], [$0:
your code should no longer depend upon `LONG_64_BITS', but upon
`SIZEOF_LONG_INT'. Remove this warning and the `AC_DEFINE' when
you adjust the code.])dnl
@@ -869,7 +870,7 @@ AC_DEFUN([AC_STRUCT_TIMEZONE],
# AC_STRUCT_ST_BLKSIZE
# --------------------
AU_DEFUN([AC_STRUCT_ST_BLKSIZE],
-[AC_DIAGNOSE([obsolete], [$0:
+[m4_warn([obsolete], [$0:
your code should no longer depend upon `HAVE_ST_BLKSIZE', but
`HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning and
the `AC_DEFINE' when you adjust the code.])
@@ -914,7 +915,7 @@ AC_DEFUN([AC_STRUCT_ST_BLOCKS],
# AC_STRUCT_ST_RDEV
# -----------------
AU_DEFUN([AC_STRUCT_ST_RDEV],
-[AC_DIAGNOSE([obsolete], [$0:
+[m4_warn([obsolete], [$0:
your code should no longer depend upon `HAVE_ST_RDEV', but
`HAVE_STRUCT_STAT_ST_RDEV'. Remove this warning and
the `AC_DEFINE' when you adjust the code.])
@@ -958,13 +959,13 @@ AC_DEFUN([AC_SYS_INTERPRETER],
AU_DEFUN([AC_HAVE_POUNDBANG],
[AC_SYS_INTERPRETER
-AC_DIAGNOSE([obsolete],
+m4_warn([obsolete],
[$0: Remove this warning when you adjust your code to use
`AC_SYS_INTERPRETER'.])])
AU_DEFUN([AC_ARG_ARRAY],
-[AC_DIAGNOSE([obsolete],
+[m4_warn([obsolete],
[$0: no longer implemented: don't do unportable things
with arguments. Remove this warning when you adjust your code.])])
Index: autoconf.sh
--- autoconf.sh Thu, 26 Oct 2000 21:03:04 +0200 akim (ace/17_autoconf.s
1.31.8.24 666)
+++ autoconf.sh Thu, 26 Oct 2000 22:16:00 +0200 akim (ace/17_autoconf.s
1.31.8.24 666)
@@ -224,12 +224,12 @@
# Set them in the order expected by the M4 macros: the converse.
alphabet='abcdefghijklmnopqrstuvwxyz'
ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-_ac_warnings=
+m4_warnings=
for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
tr $ALPHABET $alphabet`
do
test -n $warning || continue
- _ac_warnings="$warning"`test -n "$_ac_warnings" && echo ",$_ac_warnings"`
+ m4_warnings="$warning"`test -n "$m4_warnings" && echo ",$m4_warnings"`
done
@@ -301,7 +301,7 @@
## --------------------------------- ##
script)
# M4 expansion.
- $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure ||
+ $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure ||
{ (exit 1); exit; }
# You can add your own prefixes to pattern if you want to check for
Index: m4sugar.m4
--- m4sugar.m4 Thu, 26 Oct 2000 21:17:01 +0200 akim (ace/b/27_libm4.m4 1.22 644)
+++ m4sugar.m4 Thu, 26 Oct 2000 22:25:23 +0200 akim (ace/b/27_libm4.m4 1.22 644)
@@ -98,24 +98,18 @@ 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)
-# ------------
+# m4_warning(MSG)
+# ---------------
# Warn the user.
-define([m4_warn], [m4_diagnose([warning: $1])])
+define([m4_warning],
+[m4_errprint(m4_location[: warning: $1])])
# m4_fatal(MSG, [EXIT-STATUS])
# ----------------------------
# Fatal the user. :)
define([m4_fatal],
-[m4_diagnose([error: $1])dnl
+[m4_errprint(m4_location[: error: $1])dnl
m4exit(ifelse([$2],, 1, [$2]))])
@@ -129,8 +123,78 @@ define([m4_assert],
[])])
+## ------------- ##
+## 3. Warnings. ##
+## ------------- ##
+
+
+# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE)
+# ----------------------------------------------
+# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise
+# IF-FALSE.
+#
+# The variable `m4_warnings' contains a comma separated list of
+# warnings which order is the converse from the one specified by
+# the user, i.e., if she specified `-W error,none,obsolete',
+# `m4_warnings' is `obsolete,none,error'. We read it from left to
+# right, and:
+# - if none or noCATEGORY is met, run IF-FALSE
+# - if all or CATEGORY is met, run IF-TRUE
+# - if there is nothing left, run IF-FALSE.
+define([m4_warning_ifelse],
+[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)])
+
+
+# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...)
+# --------------------------------------------------------------
+# Implementation of the loop described above.
+define([_m4_warning_ifelse],
+[ifelse([$4], [$1], [$2],
+ [$4], [all], [$2],
+ [$4], [], [$3],
+ [$4], [none], [$3],
+ [$4], [no-$1], [$3],
+ [$0([$1], [$2], [$3], m4_shiftn(4, $@))])])
+
+
+# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# The same as m4_warning_ifelse, but scan for `error' only.
+define([_m4_warning_error_ifelse],
+[__m4_warning_error_ifelse([$1], [$2], m4_warnings)])
+
+
+# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE)
+# --------------------------------------------
+# The same as _m4_warning_ifelse, but scan for `error' only.
+define([__m4_warning_error_ifelse],
+[ifelse([$3], [error], [$1],
+ [$3], [], [$2],
+ [$3], [no-error], [$2],
+ [$0([$1], [$2], m4_shiftn(3, $@))])])
+
+
+
+# _m4_warn(MESSAGE)
+# -----------------
+# Report MESSAGE as a warning, unless the user requested -W error,
+# in which case report a fatal error.
+define([_m4_warn],
+[_m4_warning_error_ifelse([m4_fatal([$1])],
+ [m4_warning([$1])])])
+
+
+# m4_warn(CATEGORY, MESSAGE)
+# --------------------------
+# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
+# is requested (in fact, not disabled).
+define([m4_warn],
+[m4_warning_ifelse([$1], [_m4_warn([$2])])])
+
+
+
## ------------------- ##
-## 3. File inclusion. ##
+## 4. File inclusion. ##
## ------------------- ##
@@ -177,7 +241,7 @@ define([m4_sinclude],
## ------------------------------------ ##
-## 4. Additional branching constructs. ##
+## 5. Additional branching constructs. ##
## ------------------------------------ ##
# Both `ifval' and `ifset' tests against the empty string. The
@@ -279,7 +343,7 @@ define([m4_match],
## ---------------------------------------- ##
-## 5. Enhanced version of some primitives. ##
+## 6. Enhanced version of some primitives. ##
## ---------------------------------------- ##
# m4_do(STRING, ...)
@@ -364,7 +428,7 @@ define([m4_noquote],
## -------------------------- ##
-## 6. Implementing m4 loops. ##
+## 7. Implementing m4 loops. ##
## -------------------------- ##
@@ -499,7 +563,7 @@ define([_m4_foreach],
## --------------------------- ##
-## 7. More diversion support. ##
+## 8. More diversion support. ##
## --------------------------- ##
@@ -545,7 +609,7 @@ define([m4_divert],
## -------------------- ##
-## 8. Text processing. ##
+## 9. Text processing. ##
## -------------------- ##
# m4_tolower(STRING)
@@ -770,9 +834,9 @@ define([m4_Separator], [ ])])dnl
-## ---------------------- ##
-## 9. Number processing. ##
-## ---------------------- ##
+## ----------------------- ##
+## 10. Number processing. ##
+## ----------------------- ##
# m4_sign(A)
# ----------
@@ -818,7 +882,7 @@ define([m4_list_cmp],
## ------------------------ ##
-## 10. Version processing. ##
+## 11. Version processing. ##
## ------------------------ ##
- 02-m4-warnings.patch,
Akim Demaille <=