From: Paul Eggert Date: Sat, 6 Apr 2024 20:01:12 +0000 (-0700) Subject: Improve “possibly undefined macro” diagnostic X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a6347d1d785ee26f205154fdadf7f6f81797f92;p=thirdparty%2Fautoconf.git Improve “possibly undefined macro” diagnostic Simplified version of a suggestion by Reuben Thomas in: https://lists.gnu.org/r/bug-autoconf/2024-04/msg00021.html * bin/autom4te.in (warn_forbidden): Change message wording. * tests/tools.at (autom4te and whitespace in file names) (forbidden tokens, exceptions): Adjust tests to match new behavior. --- diff --git a/bin/autom4te.in b/bin/autom4te.in index 2e5209b67..e9fa18863 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -541,7 +541,7 @@ sub handle_m4 ($@) # warn_forbidden ($WHERE, $WORD, %FORBIDDEN) # ------------------------------------------ # $WORD is forbidden. Warn with a dedicated error message if in -# %FORBIDDEN, otherwise a simple 'error: possibly undefined macro' +# %FORBIDDEN, otherwise a simple 'error: undefined or overquoted macro' # will do. my $first_warn_forbidden = 1; sub warn_forbidden ($$%) @@ -557,7 +557,7 @@ sub warn_forbidden ($$%) last; } } - $message ||= "possibly undefined macro: $word"; + $message ||= "undefined or overquoted macro: $word"; warn "$where: error: $message\n"; if ($first_warn_forbidden) { diff --git a/tests/tools.at b/tests/tools.at index c42f1ea9e..37fe14660 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -192,7 +192,7 @@ END rm -rf "$outfile" "$cachedir" AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar -o "$outfile" "$file"], [1], [], [stderr]) - AT_CHECK([grep 'possibly undefined macro' stderr], [], [ignore]) + AT_CHECK([grep 'undefined or overquoted macro' stderr], [], [ignore]) cat >"$file" <<'END' [m4@&t@_init[]m4@&t@_include(foo.m4) @@ -465,13 +465,13 @@ AT_MTIME_DELAY AT_CHECK_AUTOCONF([], 1, [], [[trailer.m4: warning: AC_INIT was never used trailer.m4: warning: AC_OUTPUT was never used -configure.ac:2: error: possibly undefined macro: m4@&t@_foo +configure.ac:2: error: undefined or overquoted macro: m4@&t@_foo If this token and others are legitimate, please use m4@&t@_pattern_allow. See the Autoconf documentation. -configure.ac:3: error: possibly undefined macro: _m4@&t@_bar -configure.ac:4: error: possibly undefined macro: AS@&t@_FOO -configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR -configure.ac:6: error: possibly undefined macro: d@&t@nl +configure.ac:3: error: undefined or overquoted macro: _m4@&t@_bar +configure.ac:4: error: undefined or overquoted macro: AS@&t@_FOO +configure.ac:5: error: undefined or overquoted macro: _AS@&t@_BAR +configure.ac:6: error: undefined or overquoted macro: d@&t@nl ]]) # On a file system with coarse timestamp resolution (1 or 2s), @@ -481,7 +481,7 @@ configure.ac:6: error: possibly undefined macro: d@&t@nl AT_MTIME_DELAY touch configure -# Since warnings are replicated from the cache but "possibly undefined +# Since warnings are replicated from the cache but "undefined or overquoted # macro" errors are not, a second run, without --force, should succeed # and should yield only the warnings about AC_INIT and AC_OUTPUT. AT_CHECK_M4([autoconf], 0, [], @@ -521,13 +521,13 @@ It would be very bad if Autoconf forgot to expand [AS_]INIT! AT_CHECK_AUTOCONF([], 1, [], [[trailer.m4: warning: AC_INIT was never used trailer.m4: warning: AC_OUTPUT was never used -configure.ac:1: error: possibly undefined macro: AS@&t@_INIT +configure.ac:1: error: undefined or overquoted macro: AS@&t@_INIT If this token and others are legitimate, please use m4@&t@_pattern_allow. See the Autoconf documentation. -configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT -configure.ac:10: error: possibly undefined macro: FORBIDDEN -configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID -configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO +configure.ac:7: error: undefined or overquoted macro: AS@&t@_ALLOWED_NOT +configure.ac:10: error: undefined or overquoted macro: FORBIDDEN +configure.ac:14: error: undefined or overquoted macro: AS@&t@_THIS_IS_INVALID +configure.ac:14: error: undefined or overquoted macro: _AS@&t@_THIS_IS_INVALID_TOO ]]) AT_CLEANUP