From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14363 invoked by alias); 25 Aug 2008 05:44:01 -0000 Received: (qmail 14352 invoked by uid 22791); 25 Aug 2008 05:44:00 -0000 X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Aug 2008 05:43:22 +0000 Received: by rv-out-0708.google.com with SMTP id c5so1220902rvf.56 for ; Sun, 24 Aug 2008 22:43:20 -0700 (PDT) Received: by 10.114.195.19 with SMTP id s19mr3002700waf.110.1219643000170; Sun, 24 Aug 2008 22:43:20 -0700 (PDT) Received: by 10.114.198.11 with HTTP; Sun, 24 Aug 2008 22:43:20 -0700 (PDT) Message-ID: <9c03c2dd0808242243x4d3bcd0dtd6ce84b41ff06ec0@mail.gmail.com> Date: Mon, 25 Aug 2008 07:55:00 -0000 From: "Danny Smith" To: "Aaron W. LaFramboise" , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Make the pointer parameter to __gthread_setspecific non-const In-Reply-To: <84fc9c000808240133pa3f4489jbbeb87d3d6b577ba@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48768624.4090608@aaronwl.com> <84fc9c000808231026y50f9201g85f5aa45d230bf29@mail.gmail.com> <48B05B22.8010001@aaronwl.com> <84fc9c000808231212v771e8950taa5fddf1472e5fc7@mail.gmail.com> <48B0700D.8060000@aaronwl.com> <84fc9c000808231326y49bce6f2hc65fdb40a8cf874c@mail.gmail.com> <48B079F4.60401@aaronwl.com> <84fc9c000808231410t73284a7aw27fe4ae072609af@mail.gmail.com> <48B0B525.2060002@aaronwl.com> <84fc9c000808240133pa3f4489jbbeb87d3d6b577ba@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg01831.txt.bz2 On Sun, Aug 24, 2008 at 8:33 PM, Richard Guenther wrote: > On Sun, Aug 24, 2008 at 3:11 AM, Aaron W. LaFramboise > wrote: >> Richard Guenther wrote: >>> >>> On Sat, Aug 23, 2008 at 10:58 PM, Aaron W. LaFramboise >>> 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 nor 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 >> >> * 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 >> >> >