[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: 01-possibly-undefined-tokens.patch
From: |
Akim Demaille |
Subject: |
FYI: 01-possibly-undefined-tokens.patch |
Date: |
03 Aug 2001 11:09:30 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor) |
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/m4sugar/m4sugar.m4 (m4_init): Also forbid `_m4_*' tokens.
(m4_divert_pop): Dump the whole diversion stack when a diversion
mismatch happens.
* bin/autom4te.in (&handle_output): Remember of the first
occurrence of a possibly undefined macro, not the last.
Complain about the possibly undefined macros in the same order as
the appear in the output.
* lib/autoconf/Makefile.am (autoconf.m4f): List its dependencies.
* tests/tools.at (autoconf: forbidden tokens, basic)
(autoconf: forbidden tokens, exceptions): No longer sort
autoconf's stderr, as it is now deterministic.
Check that `dnl' is caught.
Index: bin/autom4te.in
--- bin/autom4te.in Wed, 01 Aug 2001 23:34:52 +0200 akim (ace/c/10_autom4te.i
1.13 644)
+++ bin/autom4te.in Thu, 02 Aug 2001 00:36:28 +0200 akim (ace/c/10_autom4te.i
1.13 644)
@@ -532,7 +532,7 @@ sub handle_output ($)
foreach (split (/\W+/))
{
$prohibited{$_} = $oline
- if /$forbidden/ && !/$allowed/;
+ if /$forbidden/ && !/$allowed/ && ! exists $prohibited{$_};
}
}
@@ -566,7 +566,7 @@ sub handle_output ($)
}
}
warn "$output:$prohibited{$_}: error: possibly undefined macro: $_\n"
- foreach (keys %prohibited);
+ foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited);
}
Index: lib/m4sugar/m4sugar.m4
--- lib/m4sugar/m4sugar.m4 Fri, 27 Jul 2001 20:21:13 +0200 akim
(ace/b/27_libm4.m4 1.59 644)
+++ lib/m4sugar/m4sugar.m4 Thu, 02 Aug 2001 00:42:26 +0200 akim
(ace/b/27_libm4.m4 1.59 644)
@@ -728,7 +728,8 @@ m4_define([m4_divert_push],
m4_define([m4_divert_pop],
[m4_ifval([$1],
[m4_if(_m4_divert([$1]), m4_divnum, [],
- [m4_fatal([$0($1): unexpected current diversion: ]m4_divnum)])])dnl
+ [m4_fatal([$0($1): diversion mismatch: ]
+m4_defn([m4_divert_stack]))])])dnl
m4_popdef([_m4_divert_diversion])dnl
dnl m4_ifndef([_m4_divert_diversion],
dnl [m4_fatal([too many m4_divert_pop])])dnl
@@ -1724,14 +1725,14 @@ m4_define([m4_init],
m4_ifndef([m4_tmpdir],
[m4_define([m4_tmpdir], [/tmp])])
-# M4sugar reserves `m4_[A-Za-z0-9_]*'. We'd need \b and +,
-# but they are not portable.
-m4_pattern_forbid([^m4_])
+# All the M4sugar macros start with `m4_', except `dnl' kept as is
+# for sake of simplicity.
+m4_pattern_forbid([^_?m4_])
m4_pattern_forbid([^dnl$])
# Check the divert push/pop perfect balance.
m4_wrap([m4_ifdef([_m4_divert_diversion],
- [m4_fatal([$0: unbalanced m4_divert_push:]
+ [m4_fatal([$0: unbalanced m4_divert_push:]
m4_defn([m4_divert_stack]))])[]])
m4_divert_push([KILL])
Index: tests/tools.at
--- tests/tools.at Wed, 01 Aug 2001 23:34:52 +0200 akim (ace/b/30_tools.m4 1.42
666)
+++ tests/tools.at Thu, 02 Aug 2001 19:45:49 +0200 akim (ace/b/30_tools.m4 1.42
666)
@@ -208,7 +208,7 @@ m4_define([TRACE2], [[$2], $1])
AT_SETUP([autoconf: forbidden tokens, basic])
AT_DATA([configure.ac],
-[[AC_PLAIN_SCRIPT()dnl
+[[AC_PLAIN_SCRIPT()
AC_FOO
_AC_BAR
m4_foo
@@ -217,21 +217,21 @@ m4_define([TRACE2], [[$2], $1])
B_AC_FOO
AS_FOO
_AS_BAR
+[dnl]
]])
-AT_CHECK_AUTOCONF([], 1, [], [stderr])
-# The output of autoconf is not deterministic here because it
-# uses `for (ind in array)'. So be sure to have a unique representation.
-AT_CHECK([sort stderr], 0,
+AT_CHECK_AUTOCONF([], 1, [],
[[configure.ac:2: error: possibly undefined macro: AC_FOO
configure.ac:3: error: possibly undefined macro: _AC_BAR
configure.ac:4: error: possibly undefined macro: m4_foo
+configure.ac:5: error: possibly undefined macro: _m4_bar
configure.ac:7: error: possibly undefined macro: B_AC_FOO
configure.ac:8: error: possibly undefined macro: AS_FOO
configure.ac:9: error: possibly undefined macro: _AS_BAR
+configure.ac:10: error: possibly undefined macro: dnl
]])
-AT_CLEANUP(configure)
+AT_CLEANUP
# autoconf: forbidden tokens, exceptions
@@ -260,20 +260,17 @@ m4_define([TRACE2], [[$2], $1])
It would be very bad if Autoconf forgot to expand [AC_]OUTPUT!
]])
-AT_CHECK_AUTOCONF([], 1, [], [stderr])
-# The output of autoconf is not deterministic here because it
-# uses `for (ind in array)'. So be sure to have a unique representation.
-AT_CHECK([sort stderr], 0,
-[[configure.ac:10: error: possibly undefined macro: FORBIDDEN
+AT_CHECK_AUTOCONF([], 1, [],
+[[configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED
+configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT
+configure.ac:10: error: possibly undefined macro: FORBIDDEN
configure.ac:14: error: possibly undefined macro: AC_THIS_IS_INVALID
configure.ac:14: error: possibly undefined macro: _AC_THIS_IS_INVALID_TOO
configure.ac:15: error: possibly undefined macro: ALTHOUGH_AC_THIS_IS
-configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT
-configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED
configure:18: error: possibly undefined macro: AC_OUTPUT
]])
-AT_CLEANUP(configure err)
+AT_CLEANUP
Index: lib/autoconf/Makefile.am
--- lib/autoconf/Makefile.am Sun, 29 Jul 2001 09:44:07 +0200 akim
+++ lib/autoconf/Makefile.am Thu, 02 Aug 2001 19:52:24 +0200 akim
@@ -69,7 +69,21 @@ .m4.m4f:
rm -f freeze.log; \
fi
-autoconf.m4f: $(m4sources)
+# Some day we should explain to Automake how to use autom4te to compute
+# the dependencies...
+srclibdir = $(top_srcdir)/lib
+autoconf.m4f: $(srclibdir)/m4sugar/m4sugar.m4 \
+ $(srclibdir)/m4sugar/m4sh.m4 \
+ $(srclibdir)/autoconf/autoconf.m4 \
+ $(srclibdir)/autoconf/general.m4 \
+ $(srclibdir)/autoconf/oldnames.m4 \
+ $(srclibdir)/autoconf/specific.m4 \
+ $(srclibdir)/autoconf/lang.m4 \
+ $(srclibdir)/autoconf/c.m4 \
+ $(srclibdir)/autoconf/fortran.m4 \
+ $(srclibdir)/autoconf/functions.m4 \
+ $(srclibdir)/autoconf/headers.m4 \
+ $(srclibdir)/autoconf/types.m4
# Files that should be removed, but which Automake does not know.
CLEANFILES = autoconf.m4f
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: 01-possibly-undefined-tokens.patch,
Akim Demaille <=