This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH PING: fix three libgcov warnings
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, ian at airs dot com, jh at suse dot cz
- Date: Tue, 20 Jan 2009 09:34:10 +1100
- Subject: Re: PATCH PING: fix three libgcov warnings
- References: <1232328171.15009.1.camel@helios> <49742B84.4050305@codesourcery.com>
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