From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 445 invoked by alias); 24 Aug 2008 08:34:03 -0000 Received: (qmail 437 invoked by uid 22791); 24 Aug 2008 08:34:02 -0000 X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 24 Aug 2008 08:33:28 +0000 Received: by fg-out-1718.google.com with SMTP id e21so775534fga.28 for ; Sun, 24 Aug 2008 01:33:25 -0700 (PDT) Received: by 10.187.237.12 with SMTP id o12mr258479far.56.1219566805373; Sun, 24 Aug 2008 01:33:25 -0700 (PDT) Received: by 10.187.174.3 with HTTP; Sun, 24 Aug 2008 01:33:25 -0700 (PDT) Message-ID: <84fc9c000808240133pa3f4489jbbeb87d3d6b577ba@mail.gmail.com> Date: Sun, 24 Aug 2008 10:33:00 -0000 From: "Richard Guenther" To: "Aaron W. LaFramboise" Subject: Re: [PATCH] Make the pointer parameter to __gthread_setspecific non-const Cc: gcc-patches@gcc.gnu.org In-Reply-To: <48B0B525.2060002@aaronwl.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> <48B0456D.7090602@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> 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/msg01787.txt.bz2 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 > =================================================================== > --- 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 > >