[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc -Wall warning for minmax.h

From: Derek Price
Subject: Re: gcc -Wall warning for minmax.h
Date: Fri, 10 Jun 2005 12:19:27 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Stepan Kasal wrote:

>After that fix, we could also remove the AS_LITERAL_IF with m4_fatal.

I'm not sure what you were referring to here so I've attached a patch to
document AS_LITERAL_IF as you requested a few days ago.  I will commit
it in a few days if there are no objections.  It looks like m4_fatal and
friends are going to require their own section and I don't have time for
that, so I did not try.

>If gl_CACHE_VAR expanded to
>       `echo "xyz-xyz" | sed ...`
>then you get something like:
>eval "test \"\${gl_CACHE_VAR+set}\" = set"
>eval "test \"\${`echo "xyz-xyz" | sed ...`+set}\" = set"
>And this construct is not portable, see the first paragraph of node
>"Shell Substitutions".
>This can be fixed: AS_VAR_TEST_SET could in this case expand to
>       as_var=`echo "xyz-xyz" | sed ...`
>       eval "test \"\${$as_var+set}\" = set"

I've attached a patch to fix this, but I'm not sure I completely
understood your problem, so it still requires tests.  It is passing the
existing tests here.  I'm not going to try to commit this, but anyone
with time to write the tests is welcome to commit it themselves, as far
as I am concerned.


Index: doc/autoconf.texi
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.910
diff -u -p -r1.910 autoconf.texi
--- doc/autoconf.texi   8 Jun 2005 20:27:20 -0000       1.910
+++ doc/autoconf.texi   10 Jun 2005 15:39:22 -0000
@@ -8954,6 +8954,18 @@ RUN-IF-TRUE, else run shell code RUN-IF-
 RUN-IF-TRUE or RUN-IF-FALSE is empty.
 @end defmac
address@hidden AS_LITERAL_IF (@var{expression}, @ovar{RUN-IF-LIT}, 
+If @var{expression} is a shell literal, expand to @ovar{RUN-IF-LIT}, otherwise,
+when @var{expression} contains shell metacharacters, expand to
address@hidden  For example:
+AS_LITERAL_IF(MACRO, m4_translit(MACRO, [[a-f]], [[A-F]]),
+  [`echo "MACRO" |sed 'y/abcdef/ABCDEF/'`])
address@hidden example
address@hidden defmac
 @defmac AS_MKDIR_P (@var{file-name})
 Make the directory @var{file-name}, including intervening directories
Index: lib/m4sugar/m4sh.m4
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.144
diff -u -p -r1.144 m4sh.m4
--- lib/m4sugar/m4sh.m4 27 May 2005 22:21:44 -0000      1.144
+++ lib/m4sugar/m4sh.m4 10 Jun 2005 16:11:00 -0000
@@ -1210,8 +1210,8 @@ m4_define([AS_VAR_GET],
 # is set.  Polymorphic.  Should be dnl'ed.
-              [test "${$1+set}" = set],
-              [eval "test \"\${$1+set}\" = set"])])
+   [test "${$1+set}" = set],
+   [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }])])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]