[PATCH] Make the pointer parameter to __gthread_setspecific non-const

Aaron W. LaFramboise aaronavay62@aaronwl.com
Sat Aug 23 21:22:00 GMT 2008


Richard Guenther wrote:
> On Sat, Aug 23, 2008 at 8:46 PM, Aaron W. LaFramboise
> <aaronavay62@aaronwl.com> wrote:
>> Richard Guenther wrote:
>>> On Sat, Aug 23, 2008 at 7:14 PM, Aaron W. LaFramboise
>>> <aaronavay62@aaronwl.com> wrote:
>>>> Currently on i386-pc-mingw32, casting away constness in
>>>> __gthread_setspecific causes a bootstrap failure with --enable-werror.
>>>> This
>>>> must be true for a number of other targets which do the same thing.

>>> Why not add an explicit cast for the mingw32 case?
>> An explicit cast does not kill the warning.  The union trick is the only way
>> to get rid of it, and the encapsulation for this trick, CONST_CAST, is not
>> available to gthr.h.
> 
> An explicit cast kills the warning for me for
> 
> void foo(void *);
> void bar (const void *p)
> {
>   foo(p);
> }
> 
> how is your situation different?

stage2 and stage3 of the bootstrap use -Wcast-qual which warns about 
specifically this case.  -Wcast-qual is not in -Wall or -Wextra.



More information about the Gcc-patches mailing list