[PATCH] parsers: fix typing and sign issues

Henrik Stuart hg at hstuart.dk
Wed Sep 10 01:34:58 CDT 2014

On 2014-09-09 22:58, Matt Mackall wrote:
> On Sat, 2014-09-06 at 22:25 +0200, Henrik Stuart wrote:
>> # HG changeset patch
>> # User Henrik Stuart <hg at hstuart.dk>
>> # Date 1410029932 -7200
>> #      Sat Sep 06 20:58:52 2014 +0200
>> # Node ID 41abcba2e5d08ac00abf2df5f6cbe2fe3a7e2e6e
>> # Parent  c5df4af17110838b713d6c9ec3b824fb0b6c1b33
>> parsers: fix typing and sign issues
>> Normalized the use of types in the parser to avoid signed/unsigned 
>> mismatches
>> and normalized const-ness call to free to omit warnings with both 
>> gcc and
>> Microsoft Visual C++.
>> -		free(self->offsets);
>> +		free((char**)self->offsets);
> Bleck. I can't get GCC to give a warning about this, can you?

Not for const char**, but it'll happily warn about it with const char*, 
enough. I believe gcc is wrong in this regard.

> It might just be better to remove the const on self->offsets, as the 
> C
> standard really isn't up to the task of handling const-correctness on
> doubly-indirect pointers and people like me are inclined to remove
> apparently useless casts like this on sight.

Sounds like a reasonable solution. I'll post a V3 of this fix. The 
remainder of the
V2 series for parsers should still be good to be queued, I reckon.

Kind regards,
   Henrik Stuart

More information about the Mercurial-devel mailing list