From patchwork Wed Aug 7 20:48:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 265610 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 3FBEE2C0084 for ; Thu, 8 Aug 2013 06:49:00 +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:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=gvbT1iLKlM9ICmrhmFP4/1gu5eX7RFTfd7lEzmpN6Kn IlCxiTiR9m7C2r5xO5RpWaYgJlLNX1wXDY+lgk4Yok3lyTffGrtxsWx1mxzlvYlD UpC6QwrnGaklLQvndiis7JLly9qTWvadxXV+gYDMK1fh2o7R/Lvd3qYeFLcVRrkw = 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:date:message-id:subject:from:to:cc:content-type; s=default; bh=+IUk01i4DRHcWUS37P6X/10o/Ws=; b=sCuNGBxLhZ1POSB+Z 1YLceQPSRckE+F07+voUAGe6+eMAqKCmx0RZXEhLmmrn5LjaVjhFAF75cEABzwFX oZ+Z2dsKWeVC/WcJBgXdVzyd8U35VVl9vzp0gl50aoo454rQU3tT/y1j0Lj39tPN 8SGjX2QarGNUclwxlLBnjUBo58= Received: (qmail 9821 invoked by alias); 7 Aug 2013 20:48:53 -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 9789 invoked by uid 89); 7 Aug 2013 20:48:53 -0000 X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS autolearn=no version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from Unknown (HELO mail-oa0-f51.google.com) (209.85.219.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 07 Aug 2013 20:48:24 +0000 Received: by mail-oa0-f51.google.com with SMTP id h1so4139026oag.24 for ; Wed, 07 Aug 2013 13:48:16 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.120.132 with SMTP id lc4mr4061427obb.22.1375908496557; Wed, 07 Aug 2013 13:48:16 -0700 (PDT) Received: by 10.182.111.167 with HTTP; Wed, 7 Aug 2013 13:48:16 -0700 (PDT) Date: Wed, 7 Aug 2013 22:48:16 +0200 Message-ID: Subject: [PATCH, libstdc++]: Avoid -Wcast-qual warnings in src/c++98/compatibility.cc From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" Cc: libstdc++@gcc.gnu.org X-Virus-Found: No Hello! Attached patch avoids a bunch of -Wcast-qual warnings when building libstdc++ on alpha-linux-gnu, a _GLIBCXX_LONG_DOUBLE_COMPAT target: ../../../../gcc-svn/trunk/libstdc++-v3/src/c++98/compatibility.cc:521:16: warning: cast from type ‘const char*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] (void *) _ZTSe }; ^ ../../../../gcc-svn/trunk/libstdc++-v3/src/c++98/compatibility.cc:524:16: warning: cast from type ‘const char*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; ^ ../../../../gcc-svn/trunk/libstdc++-v3/src/c++98/compatibility.cc:524:46: warning: cast from type ‘const void* const*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; ^ ../../../../gcc-svn/trunk/libstdc++-v3/src/c++98/compatibility.cc:527:16: warning: cast from type ‘const char*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; ^ ../../../../gcc-svn/trunk/libstdc++-v3/src/c++98/compatibility.cc:527:47: warning: cast from type ‘const void* const*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; 2013-08-07 Uros Bizjak * src/c++98/compatibility.cc (_ZTIe): Use const_cast to avoid warning. (_ZTIPe): Ditto. (ZTIPKe): Ditto. The patch was bootstrapped on alpha-linux-gnu, regression test is still running. OK for mainline if regtest shows no problems? Also for 4.8? Uros. Index: src/c++98/compatibility.cc =================================================================== --- src/c++98/compatibility.cc (revision 201568) +++ src/c++98/compatibility.cc (working copy) @@ -518,13 +518,15 @@ extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; extern __attribute__((used, weak)) const void * const _ZTIe[2] = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], - (void *) _ZTSe }; + const_cast(_ZTSe) }; extern __attribute__((used, weak)) const void * const _ZTIPe[4] = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; + const_cast(_ZTSPe), (void *) 0L, + const_cast(_ZTIe) }; extern __attribute__((used, weak)) const void * const _ZTIPKe[4] = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; + const_cast(_ZTSPKe), (void *) 1L, + const_cast(_ZTIe) }; #endif // _GLIBCXX_LONG_DOUBLE_COMPAT #ifdef _GLIBCXX_SYMVER_DARWIN