From patchwork Mon Mar 12 13:53:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 146103 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]) by ozlabs.org (Postfix) with SMTP id E3A42B6ED0 for ; Tue, 13 Mar 2012 00:57:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332165425; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=z/XewA4jdoaztm5TTfaxdSKEy+U=; b=XWLr4bx3v9s9GU5 c96f6biwOC+I02bE1xJKl0SaPFe+a3F7OzNc4ov0w7AaoDh2kv21MqaUWGl7wLrL qnIeA3rz7qPkcdzCIhqWI2YkFEuPFxacjHqzP3uCYpdLAjTW3lUwsXa9K2F1Csbd oUEWV1s6VpyUfW+w/TobZeLVuvnY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=u+NR71NQNFFL4D0P8woUzFarmmGPclbfsQ9JyAR1HYZsUv1tXMaPwjgBBYD6ps 5SkAIPQ+ucyTf3vnzQOxAMMVr4lDO7hJsQAdRr9j0OzlwOff/lrOFKoP1wNTBfs9 r4xNxHKYiyU+WxHdlYuN4Ok0fauW2nqisDuZPXlPXi6Hk=; Received: (qmail 27767 invoked by alias); 12 Mar 2012 13:56:47 -0000 Received: (qmail 27474 invoked by uid 22791); 12 Mar 2012 13:56:43 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Mar 2012 13:56:29 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q2CDuRmd032038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Mar 2012 13:56:28 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q2CDuQHI012852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Mar 2012 13:56:27 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q2CDuP92024942; Mon, 12 Mar 2012 08:56:25 -0500 Received: from [192.168.1.4] (/79.17.190.137) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Mar 2012 06:56:25 -0700 Message-ID: <4F5DFFE9.3050603@oracle.com> Date: Mon, 12 Mar 2012 14:53:45 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] libstdc++/52562 X-IsSubscribed: yes 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 Hi, barring unexpected issues in mainline will go in 4.7.1 too. Tested x86_64-linux. Thanks, Paolo. /////////////////////////// 2012-03-12 Paolo Carlini PR libstdc++/52562 * libsupc++/typeinfo (type_info::name, before, operator==, operator!=): Mark noexcept in C++11 mode. * libsupc++/tinfo.cc (type_info::operator==): Adjust. * libsupc++/tinfo2.cc (type_info::before): Likewise. * testsuite/18_support/type_info/52562.cc: New. Index: libsupc++/tinfo2.cc =================================================================== --- libsupc++/tinfo2.cc (revision 185225) +++ libsupc++/tinfo2.cc (working copy) @@ -1,6 +1,7 @@ // Methods for type_info for -*- C++ -*- Run Time Type Identification. -// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2009 +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2009, +// 2012 // Free Software Foundation // // This file is part of GCC. @@ -32,7 +33,7 @@ #if !__GXX_TYPEINFO_EQUALITY_INLINE bool -type_info::before (const type_info &arg) const +type_info::before (const type_info &arg) const _GLIBCXX_NOEXCEPT { #if __GXX_MERGED_TYPEINFO_NAMES return name () < arg.name (); Index: libsupc++/tinfo.cc =================================================================== --- libsupc++/tinfo.cc (revision 185225) +++ libsupc++/tinfo.cc (working copy) @@ -1,6 +1,6 @@ // Methods for type_info for -*- C++ -*- Run Time Type Identification. // Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -// 2003, 2004, 2005, 2006, 2007, 2009 +// 2003, 2004, 2005, 2006, 2007, 2009, 2012 // Free Software Foundation // // This file is part of GCC. @@ -36,7 +36,7 @@ // We can't rely on common symbols being shared between shared objects. bool std::type_info:: -operator== (const std::type_info& arg) const +operator== (const std::type_info& arg) const _GLIBCXX_NOEXCEPT { #if __GXX_MERGED_TYPEINFO_NAMES return name () == arg.name (); Index: libsupc++/typeinfo =================================================================== --- libsupc++/typeinfo (revision 185225) +++ libsupc++/typeinfo (working copy) @@ -98,15 +98,15 @@ /** Returns an @e implementation-defined byte string; this is not * portable between compilers! */ - const char* name() const + const char* name() const _GLIBCXX_NOEXCEPT { return __name[0] == '*' ? __name + 1 : __name; } #if !__GXX_TYPEINFO_EQUALITY_INLINE // In old abi, or when weak symbols are not supported, there can // be multiple instances of a type_info object for one // type. Uniqueness must use the _name value, not object address. - bool before(const type_info& __arg) const; - bool operator==(const type_info& __arg) const; + bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT; + bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT; #else #if !__GXX_MERGED_TYPEINFO_NAMES /** Returns true if @c *this precedes @c __arg in the implementation's @@ -114,12 +114,12 @@ // Even with the new abi, on systems that support dlopen // we can run into cases where type_info names aren't merged, // so we still need to do string comparison. - bool before(const type_info& __arg) const + bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return (__name[0] == '*' && __arg.__name[0] == '*') ? __name < __arg.__name : __builtin_strcmp (__name, __arg.__name) < 0; } - bool operator==(const type_info& __arg) const + bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return ((__name == __arg.__name) || (__name[0] != '*' && @@ -128,14 +128,14 @@ #else // On some targets we can rely on type_info's NTBS being unique, // and therefore address comparisons are sufficient. - bool before(const type_info& __arg) const + bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return __name < __arg.__name; } - bool operator==(const type_info& __arg) const + bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return __name == __arg.__name; } #endif #endif - bool operator!=(const type_info& __arg) const + bool operator!=(const type_info& __arg) const _GLIBCXX_NOEXCEPT { return !operator==(__arg); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ Index: testsuite/18_support/type_info/52562.cc =================================================================== --- testsuite/18_support/type_info/52562.cc (revision 0) +++ testsuite/18_support/type_info/52562.cc (revision 0) @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2012 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +template T& lval() noexcept; + +// libstdc++/52562 +static_assert(noexcept(lval().name()), ""); +static_assert(noexcept(lval().before(lval())), +""); +static_assert(noexcept(lval() == lval()), ""); +static_assert(noexcept(lval() != lval()), "");