From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24431 invoked by alias); 24 Aug 2008 01:12:33 -0000 Received: (qmail 24420 invoked by uid 22791); 24 Aug 2008 01:12:32 -0000 X-Spam-Check-By: sourceware.org Received: from aaronwl.com (HELO aaronwl.com) (68.228.0.128) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 24 Aug 2008 01:11:28 +0000 Received: from [172.16.42.2] (stormy.internal.aaronwl.com [172.16.42.2]) by aaronwl.com (8.12.11/8.12.11) with ESMTP id m7O1BNt7013123; Sat, 23 Aug 2008 20:11:26 -0500 Message-ID: <48B0B525.2060002@aaronwl.com> Date: Sun, 24 Aug 2008 04:23:00 -0000 From: "Aaron W. LaFramboise" User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Richard Guenther CC: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Make the pointer parameter to __gthread_setspecific non-const 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> In-Reply-To: <84fc9c000808231410t73284a7aw27fe4ae072609af@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------050606000801030801080406" 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/msg01777.txt.bz2 This is a multi-part message in MIME format. --------------050606000801030801080406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 595 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. --------------050606000801030801080406 Content-Type: text/plain; name="gcc-4.4.0-20080823-gthr2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gcc-4.4.0-20080823-gthr2.patch" Content-length: 786 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 --------------050606000801030801080406--