From patchwork Fri Oct 26 14:11:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Smith-Rowland <3dw4rd@verizon.net> X-Patchwork-Id: 194488 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 4A7D92C0098 for ; Sat, 27 Oct 2012 01:12:02 +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=1351865522; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-id:Date:From:User-Agent:MIME-version:To:Subject: Content-type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=xDjtuxo 0iTpTn3Jsl2+IBPYZvkc=; b=F6F7k6+dSEIvBXMRQhkiHaQjMuLkUFYNEpRP5ZD pGyqhJ0mqmLKpMsGXXgH0jD10pthFuSIm4t/MBsjQYfqd96eSSdlJR2q2wzknCXs X4oBgv4p0Vp8rVzW/xdpfKeDKrmZu7FVIS805HrCkIjDETzcFLrfxB9XDoQ8rkSM PMOM= 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:Message-id:Date:From:User-Agent:MIME-version:To:Subject:Content-type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=a7lua3a+RxYKKMg6f14qIcRtEW4T4wfets6wNLNbgqUHvrYrF2Xo2aEdmQTnVU np6Uuss7ryKJSfP7kS/zz+IrTEkDhSqCojtJCB5pYIrnX+/RLJNK4NpqZdiQbxIU uoAKZ7Fkv+qj46ioJs3a7YA7lQOHaOHT4mG+disLnoib0=; Received: (qmail 5500 invoked by alias); 26 Oct 2012 14:11:52 -0000 Received: (qmail 5483 invoked by uid 22791); 26 Oct 2012 14:11:50 -0000 X-SWARE-Spam-Status: No, hits=4.4 required=5.0 tests=AWL, BAYES_00, BOTNET, HDRS_LCASE, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_MANY_HDRS_LCASE X-Spam-Check-By: sourceware.org Received: from vms173021pub.verizon.net (HELO vms173021pub.verizon.net) (206.46.173.21) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Oct 2012 14:11:44 +0000 Received: from [192.168.1.8] ([unknown] [96.234.174.152]) by vms173021.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0MCI00CIP7F04H10@vms173021.mailsrvcs.net>; Fri, 26 Oct 2012 09:11:25 -0500 (CDT) Message-id: <508A9A0D.8040305@verizon.net> Date: Fri, 26 Oct 2012 10:11:25 -0400 From: Ed Smith-Rowland <3dw4rd@verizon.net> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-version: 1.0 To: gcc-patches , "libstdc++@gcc.gnu.org" Subject: Add C++11 const char* overloads for exception classes. Content-type: multipart/mixed; boundary=------------090104030102010405090803 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 Committed. 2012-10-26 Edward Smith-Rowland <3dw4rd@verizon.net> * include/std/system_error (system_error(error_code, const char*), system_error(int, const error_category&, const char*)): New. * include/std/stdexcept ( logic_error(const char*), domain_error(const char*), invalid_argument(const char*), length_error(const char*), out_of_range(const char*), runtime_error(const char*), range_error(const char*), overflow_error(const char*), underflow_error(const char*)): New. * config/abi/pre/gnu.ver: Add symbols for logic_error const char* ctors. Index: include/std/system_error =================================================================== --- include/std/system_error (revision 192755) +++ include/std/system_error (working copy) @@ -1,6 +1,7 @@ // -*- C++ -*- -// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2007-2012 +// Free Software Foundation, Inc. // // 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 @@ -318,17 +319,13 @@ system_error(error_code __ec, const string& __what) : runtime_error(__what + ": " + __ec.message()), _M_code(__ec) { } - /* - * TODO: Add const char* ctors to all exceptions. - * - * system_error(error_code __ec, const char* __what) - * : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { } - * - * system_error(int __v, const error_category& __ecat, const char* __what) - * : runtime_error(__what + (": " + __ec.message())), - * _M_code(error_code(__v, __ecat)) { } - */ + system_error(error_code __ec, const char* __what) + : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { } + system_error(int __v, const error_category& __ecat, const char* __what) + : runtime_error(__what + (": " + error_code(__v, __ecat).message())), + _M_code(__v, __ecat) { } + system_error(int __v, const error_category& __ecat) : runtime_error(error_code(__v, __ecat).message()), _M_code(__v, __ecat) { } Index: include/std/stdexcept =================================================================== --- include/std/stdexcept (revision 192755) +++ include/std/stdexcept (working copy) @@ -1,6 +1,6 @@ // Standard exception classes -*- C++ -*- -// Copyright (C) 2001, 2002, 2005, 2007, 2009, 2010, 2011 +// Copyright (C) 2001, 2002, 2005, 2007, 2009-2012 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -59,8 +59,11 @@ public: /** Takes a character string describing the error. */ - explicit - logic_error(const string& __arg); + explicit logic_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit logic_error(const char* __arg) + : logic_error(string(__arg)) { } +#endif virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT; @@ -76,6 +79,10 @@ { public: explicit domain_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit domain_error(const char* __arg) + : domain_error(string(__arg)) { } +#endif virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -84,6 +91,10 @@ { public: explicit invalid_argument(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit invalid_argument(const char* __arg) + : invalid_argument(string(__arg)) { } +#endif virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT; }; @@ -93,6 +104,10 @@ { public: explicit length_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit length_error(const char* __arg) + : length_error(string(__arg)) { } +#endif virtual ~length_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -102,6 +117,10 @@ { public: explicit out_of_range(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit out_of_range(const char* __arg) + : out_of_range(string(__arg)) { } +#endif virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT; }; @@ -116,8 +135,11 @@ public: /** Takes a character string describing the error. */ - explicit - runtime_error(const string& __arg); + explicit runtime_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit runtime_error(const char* __arg) + : runtime_error(string(__arg)) { } +#endif virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT; @@ -132,6 +154,10 @@ { public: explicit range_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit range_error(const char* __arg) + : range_error(string(__arg)) { } +#endif virtual ~range_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -140,6 +166,10 @@ { public: explicit overflow_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit overflow_error(const char* __arg) + : overflow_error(string(__arg)) { } +#endif virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -148,6 +178,10 @@ { public: explicit underflow_error(const string& __arg); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit underflow_error(const char* __arg) + : underflow_error(string(__arg)) { } +#endif virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT; }; Index: config/abi/pre/gnu.ver =================================================================== --- config/abi/pre/gnu.ver (revision 192755) +++ config/abi/pre/gnu.ver (working copy) @@ -1339,6 +1339,10 @@ # construction vtable _ZTCSt*; + # const char* ctors for logic_error. + _ZNSt11logic_errorC1EPKc; + _ZNSt11logic_errorC2EPKc; + } GLIBCXX_3.4.17; # Symbols in the support library (libsupc++) have their own tag.