According to Eric Blake on 11/28/2009 2:56 PM: > At any rate, here's the patch I'm currently testing, to issue a syntax > warning when not using a named diversion, and to document the fallout from > this thread.
Testing didn't reveal any uses in libtool or gnulib that used unnamed diversions (and both of them do have instances of using named diversions). Now pushed, with a test squashed in: diff --git a/ChangeLog b/ChangeLog index 5edb895..e03604d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2009-11-30 Eric Blake <e...@byu.net> +2009-12-04 Eric Blake <e...@byu.net> Warn if using unnamed diversion. * lib/m4sugar/m4sugar.m4 (_m4_divert, m4_divert_push): Add @@ -7,11 +7,13 @@ (_m4_require_call): Adjust callers. * lib/m4sugar/m4sh.m4 (AS_REQUIRE): Likewise. * tests/m4sh.at (AT_DATA_LINENO): Avoid triggering the warning. - * tests/tools.at (autom4te and whitespace in file names) - (autoconf: the empty token): Likewise. * tests/m4sugar.at (AT_CHECK_M4SUGAR_TEXT, m4@&t...@_append) (m4@&t...@_text_wrap, recursion): Likewise. (m4@&t...@_warn, m4@&t...@_divert_stack): Adjust expected output. + * tests/tools.at (autom4te and whitespace in file names) + (autoconf: the empty token): Avoid triggering the warning. + (autoconf: AC_PRESERVE_HELP_ORDER): New test. + * tests/mktests.sh (ac_exclude_list): Retire prior test. * NEWS: Document the warning. * doc/autoconf.texi (Redefined M4 Macros) <m4_divert>, <m4_undivert>: Make even more explicit that using these directly diff --git a/doc/autoconf.texi b/doc/autoconf.texi index c9e570d..7d2c72e 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11409,9 +11409,10 @@ Diversion support early enough in @file{configure} that it is unsafe to expand any autoconf macros into this diversion. @item HELP_ENABLE -If @code{AC_PRESERVE_HELP_ORDER} was used, then it is safe to use -...@code{as_echo} in this diversion to insert additional text into the -...@option{--help} output of @file{configure}. +If @code{AC_PRESERVE_HELP_ORDER} was used, then text placed in this +diversion will be included as part of a quoted here-doc providing all of +the @option{--help} output of @file{configure} related to options +created by @code{AC_ARG_WITH} and @code{AC_ARG_ENABLE}. @item INIT_PREPARE This diversion occurs after all command line options have been parsed, but prior to the main body of the @file{configure} script. This diff --git a/tests/mktests.sh b/tests/mktests.sh index d44d6b9..9897599 100755 --- a/tests/mktests.sh +++ b/tests/mktests.sh @@ -138,6 +138,9 @@ ac_exclude_list=' # Already tested by AT_CHECK_MACRO. /^AC_OUTPUT$/ {next} + + # Tested alongside m4_divert_text. + /^AC_PRESERVE_HELP_ORDER$/ {next} ' diff --git a/tests/tools.at b/tests/tools.at index 751975f..aa3f258 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -535,6 +535,41 @@ AT_CLEANUP +# autoconf: AC_PRESERVE_HELP_ORDER +# -------------------------------- +AT_SETUP([autoconf: AC_PRESERVE_HELP_ORDER]) +AT_KEYWORDS([m4@&t...@_divert_text]) + +AT_DATA_AUTOCONF([configure.ac], +[[AC_INIT +AC_PRESERVE_HELP_ORDER +AC_ARG_WITH([one], [ --with-one]) +AC_ARG_ENABLE([two], [ --enable-two]) +m4_divert_text([HELP_ENABLE], [arbitrary $text]) +AC_ARG_WITH([three], [ --with-three]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([--help], [], [stdout]) +AT_CHECK([sed -n '/^Optional/,/^$/p' stdout], [], +[[Optional Features and Packages: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-one + --enable-two +arbitrary $text + --with-three + +]]) + +AT_CLEANUP + + + ## --------- ## ## ifnames. ## ## --------- ## -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net
signature.asc
Description: OpenPGP digital signature