m4-patches
[Top][All Lists]
Advanced

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

Re: [SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.16-


From: Eric Blake
Subject: Re: [SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.16-3-gfb132bf
Date: Sat, 30 Apr 2011 07:18:49 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On 04/30/2011 01:16 AM, Gary V. Vaughan wrote:
> Hi Eric,
> 
>>     
>>     argc is an int, therefore by definition, it is <= INT_MAX.
>>     
>> -  assert (0 < argc && argc <= INT_MAX);
>> +  assert (0 < argc);
>>    for (i = 1; i < (unsigned) argc; i++)
>>      {
>>        const char *arg = ARG((int) i);
> 
> Since argc is immediately cast to an unsigned int, I think the test was
> supposed to be:
> 
>   assert (0 < argc && argc <= UINT_MAX);

Except that INT_MAX  < UINT_MAX, so that's also redundant.  The real
trick was that gcc was issuing spurious warnings if it didn't have proof
that argc was positive, so all we really needed was the (0 < argc) term;
my mistake in the earlier patch was adding a redundant term at the same
time.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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