[PATCH] Make the pointer parameter to __gthread_setspecific non-const
Danny Smith
dansmister@gmail.com
Mon Aug 25 07:55:00 GMT 2008
On Sun, Aug 24, 2008 at 8:33 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sun, Aug 24, 2008 at 3:11 AM, Aaron W. LaFramboise
> <aaronavay62@aaronwl.com> wrote:
>> Richard Guenther wrote:
>>>
>>> On Sat, Aug 23, 2008 at 10:58 PM, Aaron W. LaFramboise
>>> <aaronavay62@aaronwl.com> wrote:
>>
>>>> If you do a clean bootstrap of i386-pc-mingw32 from svn or a snapshot, it
>>>> will fail in stage2 in a file that includes gthr-win32.h.
>>>
>>> Ok. I'd rather use the union trick then in gthr-win32.h.
>>
>> Alright. In that case, is the attached patch OK?
>>
>> As I mentioned, neither <system.h> nor <tsystem.h> are available here
>> because other top-level libraries that don't have those use this, so we have
>> to redefine this macro.
>>
>> I tested this on i386-pc-mingw32 with a bootstrap.
>
> This is ok.
>
> Thanks,
> Richard.
>
>> 2008-08-23 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
>>
>> * gcc/gthr-win32.h (__gthread_setspecific): Use CONST_CAST2.
>>
>> Index: gcc/gthr-win32.h
Also please make config/i386/gthr-win32.c consistent with this.
Thanks
Danny
>> ===================================================================
>> --- gcc/gthr-win32.h (revision 139510)
>> +++ gcc/gthr-win32.h (working copy)
>> +/* This is a copy of CONST_CAST2 from system.h */
>> +#ifndef CONST_CAST2
>> +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q;
>> \
>> + TOTYPE _nq;})(X))._nq)
>> +#endif
>> +
>> static inline int
>> __gthread_setspecific (__gthread_key_t key, const void *ptr)
>> {
>> - return (TlsSetValue (key, (void*) ptr) != 0) ? 0 : (int) GetLastError ();
>> + if (TlsSetValue (key, CONST_CAST2(void *, const void *, ptr)) != 0)
>> + return 0;
>> + else
>> + return GetLastError ();
>> }
>>
>> static inline void
>>
>>
>
More information about the Gcc-patches
mailing list