From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25281 invoked by alias); 10 Jul 2008 22:20:10 -0000 Received: (qmail 25272 invoked by uid 22791); 10 Jul 2008 22:20:09 -0000 X-Spam-Check-By: sourceware.org Received: from caip.rutgers.edu (HELO caip.rutgers.edu) (128.6.236.16) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Jul 2008 22:19:49 +0000 Received: from caipclassic.rutgers.edu (caipclassic.rutgers.edu [128.6.237.54]) by caip.rutgers.edu (8.13.8/8.13.8) with ESMTP id m6AMJk3f023059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 Jul 2008 18:19:46 -0400 Date: Fri, 11 Jul 2008 04:29:00 -0000 From: "Kaveh R. GHAZI" To: "Aaron W. LaFramboise" cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix const pointer warning in gthr-win32.h In-Reply-To: <48768624.4090608@aaronwl.com> Message-ID: References: <48768624.4090608@aaronwl.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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-07/txt/msg00832.txt.bz2 On Thu, 10 Jul 2008, Aaron W. LaFramboise wrote: > --- gcc/tsystem.h (revision 137703) > +++ gcc/tsystem.h (working copy) > @@ -131,6 +131,16 @@ extern int errno; > unreachable default case of a switch. Do not use gcc_assert(0). */ > #define gcc_unreachable() (abort ()) > > +/* This is a copy of CONST_CAST from system.h */ > + > +#if defined(__GNUC__) && GCC_VERSION != 4000 > +/* GCC 4.0.x has a bug where it may ICE on this expression. */ > +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq) > +#else > +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X)) > +#endif > +#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (X)) > + > /* Filename handling macros. */ > #include "filenames.h" Files including tsystem.h are always compiled with the latest GCC you just built. So only the first CONST_CAST2 is needed, you can get rid of the #ifdef wrapping for version 4.0.