-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 9/14/2009 6:07 AM: > But I do see an issue with using m4_toupper - it does not quote its > result, so if the result resembles a macro name, that macro will be > expanded before anything else gets a chance to use the result of the > upper-casing. I don't think we can change the semantics of this (there > may be existing code relying on this), but we probably need to add safer > counterparts that return a quoted string. Actually, I only found one existing clients that needed changing due to returning a quoted string; and it specifically WANTED the quoting; there are several other clients throughout autoconf itself that were working only because the word with a case change happened to not be a macro name, which are now more robust. I will probably apply this, after rerunning the testsuite successfully: - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@xxxxxxx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkquQREACgkQ84KuGfSFAYAbswCg123UOzkSyCy5hIZcc6F11I5o 4cAAoIdeR0QxDgY1phVLF0C25Ebu8YtI =dHGS -----END PGP SIGNATURE-----
>From c10de07812688263d3e91e9667b41c25b96fd45a Mon Sep 17 00:00:00 2001 From: Eric Blake <ebb9@xxxxxxx> Date: Mon, 14 Sep 2009 06:58:51 -0600 Subject: [PATCH] Quote result of m4_toupper and m4_tolower. * lib/m4sugar/m4sugar.m4 (m4_tolower, m4_toupper): Quote result. * lib/autotest/general.m4 (AT_KEYWORDS): Adjust caller. * tests/m4sugar.at (m4@&t@_toupper and m4@&t@_tolower): New test. * NEWS: Document this. * THANKS: Update. Reported by Sam Steingold. Signed-off-by: Eric Blake <ebb9@xxxxxxx> --- ChangeLog | 10 ++++++++++ NEWS | 3 +++ lib/autotest/general.m4 | 4 ++-- lib/m4sugar/m4sugar.m4 | 8 ++++---- tests/m4sugar.at | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 568e48a..cd2cd70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-09-14 Eric Blake <ebb9@xxxxxxx> + + Quote result of m4_toupper and m4_tolower. + * lib/m4sugar/m4sugar.m4 (m4_tolower, m4_toupper): Quote result. + * lib/autotest/general.m4 (AT_KEYWORDS): Adjust caller. + * tests/m4sugar.at (m4@&t@_toupper and m4@&t@_tolower): New test. + * NEWS: Document this. + * THANKS: Update. + Reported by Sam Steingold. + 2009-09-13 Ralf Wildenhues <Ralf.Wildenhues@xxxxxx> * bin/autoupdate.in: Fix typos in comments. diff --git a/NEWS b/NEWS index 262be0c..01bc094 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ GNU Autoconf NEWS - User visible changes. ** The following documented autotest macros are new: AT_CHECK_EUNIT +** The following m4sugar macros now quote their expansion: + m4_toupper m4_tolower + ** The `$tmp' temporary directory used in config.status is documented for public use now. diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 2c164b5..33218fd 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -1814,8 +1814,8 @@ m4_case([$1], # Since the -k option is case-insensitive, the list is stored in lower case # to avoid duplicates that differ only by case. _AT_DEFINE_SETUP([AT_KEYWORDS], -[m4_append_uniq_w([AT_keywords], m4_tolower(m4_dquote(_m4_expand([$1 -]))))]) +[m4_append_uniq_w([AT_keywords], m4_tolower(_m4_expand([$1 +])))]) # AT_CAPTURE_FILE(FILE) diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 7bc72b6..2e53ea3 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -2266,11 +2266,11 @@ m4_defn([m4_re_string])dnl # # Rather than expand the m4_defn each time, we inline them up front. m4_define([m4_tolower], -[m4_translit([$1], ]m4_dquote(m4_defn([m4_cr_LETTERS]))[, - ]m4_dquote(m4_defn([m4_cr_letters]))[)]) +[m4_translit([[$1]], ]m4_dquote(m4_defn([m4_cr_LETTERS]))[, + ]m4_dquote(m4_defn([m4_cr_letters]))[)]) m4_define([m4_toupper], -[m4_translit([$1], ]m4_dquote(m4_defn([m4_cr_letters]))[, - ]m4_dquote(m4_defn([m4_cr_LETTERS]))[)]) +[m4_translit([[$1]], ]m4_dquote(m4_defn([m4_cr_letters]))[, + ]m4_dquote(m4_defn([m4_cr_LETTERS]))[)]) # m4_split(STRING, [REGEXP]) diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 87c303f..d37681b 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -1292,6 +1292,43 @@ AB AT_CLEANUP +## ------------------------ ## +## m4_toupper, m4_tolower. ## +## ------------------------ ## + +AT_SETUP([m4@&t@_toupper and m4@&t@_tolower]) + +AT_CHECK_M4SUGAR_TEXT( +[[m4_define([abc], [hI])m4_define([ABC], [Hi]) +m4_toupper(abc aBc ABC) +m4_tolower(abc aBc ABC) +m4_toupper([abc aBc ABC]) +m4_tolower([abc aBc ABC]) +m4_echo(m4_toupper(abc aBc ABC)) +m4_echo(m4_tolower(abc aBc ABC)) +m4_echo(m4_toupper([abc aBc ABC])) +m4_echo(m4_tolower([abc aBc ABC])) +m4_do(m4_toupper(abc aBc ABC)) +m4_do(m4_tolower(abc aBc ABC)) +m4_do(m4_toupper([abc aBc ABC])) +m4_do(m4_tolower([abc aBc ABC])) +]], [[ +HI ABC HI +hi abc hi +ABC ABC ABC +abc abc abc +HI ABC HI +hi abc hi +ABC ABC ABC +abc abc abc +HI Hi HI +hi hI hi +Hi Hi Hi +hI hI hI +]]) + +AT_CLEANUP + ## --------------- ## ## m4_bpatsubsts. ## ## --------------- ## -- 1.6.5.rc1
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf