From patchwork Wed Aug 14 14:22:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 267137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 709CD2C01C7 for ; Thu, 15 Aug 2013 00:22:44 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=aydEcQDIdWmStL9I4s /rEofuTwNYPvYtfWogB09m3cGR563AUeJrlaZKLdEZSWdZ2MmsKo6+Ddu+f21gH+ KAdkgaFJhN/4ZfurPaAL3qQvbFXmk23ZryodW5117izWyJiQWK1zuae6yzY3NQaS lKXYjmNr20tWwHms+Yi9LXJsk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=ZvgBbsZNDQ32mZoOFRuGRCWm LM4=; b=d6toI4Y9sADiyCP9C6o773XCT8sE8vLbJRHmmHXTMzjnOVC8/w7DSwnp ZtG7Jd9qG6vncMCf7M4orjg8IDJh6knVVep2V5aja/U+12hxRsPMf0PRFYq1p8pn 8j+KXJ2gIKVKjvuELatHYC4uDgl7AASeurBY8W2CoN2JtkItPAc= Received: (qmail 22010 invoked by alias); 14 Aug 2013 14:22:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21989 invoked by uid 89); 14 Aug 2013 14:22:37 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-oa0-f53.google.com (HELO mail-oa0-f53.google.com) (209.85.219.53) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 14 Aug 2013 14:22:09 +0000 Received: by mail-oa0-f53.google.com with SMTP id k18so13404431oag.12 for ; Wed, 14 Aug 2013 07:22:07 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.128.42 with SMTP id nl10mr14825365obb.41.1376490127632; Wed, 14 Aug 2013 07:22:07 -0700 (PDT) Received: by 10.182.111.167 with HTTP; Wed, 14 Aug 2013 07:22:07 -0700 (PDT) In-Reply-To: References: <5202C08B.7060002@oracle.com> <20130814082909.GM1814@tucnak.redhat.com> Date: Wed, 14 Aug 2013 16:22:07 +0200 Message-ID: Subject: Re: [PATCH, libstdc++]: Avoid -Wcast-qual warnings in src/c++98/compatibility.cc From: Uros Bizjak To: Gabriel Dos Reis Cc: Jakub Jelinek , Paolo Carlini , "gcc-patches@gcc.gnu.org" , "libstdc++" X-Virus-Found: No On Wed, Aug 14, 2013 at 4:05 PM, Gabriel Dos Reis wrote: > I agree 'const void*' is preferable, and all the places you mention should > be covered too. I already installed my original patch, so attached incremental patch implements preferred solution. 2013-08-14 Uros Bizjak * src/c++98/compatibility.cc (_ZTIe): Use (const cast *) to avoid -Wcast-qual warnings. (_ZTIPe): Ditto. (ZTIPKe): Ditto. Tested on alphaev68-pc-linux-gnu and installed on mainline SVN. Is this solution also OK for other release branches? Uros. Index: src/c++98/compatibility.cc =================================================================== --- src/c++98/compatibility.cc (revision 201723) +++ src/c++98/compatibility.cc (working copy) @@ -516,18 +516,17 @@ extern __attribute__((used, weak)) const char _ZTSe[2] = "e"; extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe"; extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; -// const_casts are used to avoid -Wcast-qual warnings extern __attribute__((used, weak)) const void * const _ZTIe[2] - = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], - const_cast(_ZTSe) }; + = { (const void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], + (const void *) _ZTSe }; extern __attribute__((used, weak)) const void * const _ZTIPe[4] - = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - const_cast(_ZTSPe), (void *) 0L, - const_cast(_ZTIe) }; + = { (const void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], + (const void *) _ZTSPe, (const void *) 0L, + (const void *) _ZTIe }; extern __attribute__((used, weak)) const void * const _ZTIPKe[4] - = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - const_cast(_ZTSPKe), (void *) 1L, - const_cast(_ZTIe) }; + = { (const void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], + (const void *) _ZTSPKe, (const void *) 1L, + (const void *) _ZTIe }; #endif // _GLIBCXX_LONG_DOUBLE_COMPAT #ifdef _GLIBCXX_SYMVER_DARWIN