PATCH PING: fix three libgcov warnings

Ben Elliston bje@au1.ibm.com
Tue Jan 20 08:28:00 GMT 2009


Hi Nathan,

(Re-sending, as I think this message was lost.)

> sorry, I looked at this before, but got confused.  I don't understand how the
> type of execl's (char *[]) argument is relevant to the initialization of one of
> the elements of that array.  You're not changing the execl calls.

I probably spent more effort on that part of my explanation than was
necessary.  The point I was trying to make is that the cast cannot be
eliminated because the prototypes of the execl* and execv* functions
make it necessary to discard the const qualifier; no way around it.

The warning is produced because the existing cast to char * discards the
qualifier.  We need a cleverer way of discarding the const qualifier,
hence:

> -  args[0] = (char *) arg;
> +  args[0] = (void *) (intptr_t) arg;

I'm open to suggestions :-) (including adding a comment).

Cheers, Ben



More information about the Gcc-patches mailing list