[PATCH]: Change CONST_CAST macro to accept a TYPE argument

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Mon Sep 3 17:26:00 GMT 2007


On Mon, 3 Sep 2007, Paolo Bonzini wrote:

>
> > So you couldn't issue the above statement because TREE_STRING_POINTER's
> > are not generally writable.  Here, we know that it is safe because we just
> > allocated the space for it a few lines above.
> >
> > In order to write to it, you must cast away the const-ness, but doing so
> > prompts warnings from -Wcast-qual, hence the need for the CONST_CAST().
>
> Or, you can just write
>
>    memcpy (s->string.str, str, len);
>    s->string.str[len] = '\0';
>

Good idea thanks.  After a make, to ensure there were no typos, (and
waiting 24 hours, per Richard G) that's what I checked in.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu



More information about the Gcc-patches mailing list