From patchwork Tue Nov 4 02:52:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 406423 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E4B6C140081 for ; Tue, 4 Nov 2014 15:47:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=n+6WhndRUD7O93e0+ Lw6Dg9wzwJZpR/5GWGFYDwJQ5jjcExs7fWwwxdQw6zTLrM5d8dhuukmJLcDotOXH 4DKcVt2uaoYQeQ+pmA+n8irED4Z0OewNofGBBQWyuEimmVlLbH6SZu4373nt0cFZ RpOxKBRLv9kg036m+fW68wT0F4= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=PaG2LXrefje+/Wpp7AAt+VK XQ1g=; b=nhw6oMALjm5duhBTVdwEjKGUMtOCnMCUR3k1pclMZohLo9FzKybZ/M6 53N4gvrZfDEqbC0LV+dE9AOMbUIyXmpnNUvJnYojp+LlCMGjLRCHyRI6Z29G19Jr bWwJdjRSf3ch/1HCeesY3kiPdFWf5J2RQjd0Q7XX+2TyutTWlvZs= Received: (qmail 25324 invoked by alias); 4 Nov 2014 02:52:21 -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 25190 invoked by uid 89); 4 Nov 2014 02:52:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 04 Nov 2014 02:52:19 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA42qHFt007126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Nov 2014 21:52:17 -0500 Received: from localhost (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA42qGTs018835; Mon, 3 Nov 2014 21:52:17 -0500 Date: Tue, 4 Nov 2014 02:52:15 +0000 From: Jonathan Wakely To: Jonathan Wakely Cc: Tim Shen , libstdc++ , gcc-patches@gcc.gnu.org Subject: Re: [patch] LWG 2019 - std::isblank(C, const std::locale&) Message-ID: <20141104025215.GD3961@redhat.com> References: <20141017094122.GR4197@redhat.com> <20141020123459.GD3033@redhat.com> <20141021122619.GJ3033@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141021122619.GJ3033@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On 21/10/14 13:26 +0100, Jonathan Wakely wrote: >On 20/10/14 23:08 +0100, Jonathan Wakely wrote: >>On 20 October 2014 18:40, Tim Shen wrote: >>>On Mon, Oct 20, 2014 at 5:34 AM, Jonathan Wakely wrote: >>>>Committed to trunk. >>> >>>Yay, I think it's the time to remove regex_traits::_RegexMask? >> >>Yes, I wanted to get isblank in first, and see how many targets I >>broke, then revisit regex. > >I don't think we can remove _RegexMask entirely, as we still need >special handling for the "w" class, so maybe something like the >attached. > >Alternatively we could replace _M_extended with bool _M_under and not >need to do any bitwise operations like _M_extended & _S_valid_mask. I've committed the attached. Tested x86_64-linux. commit 5afff08e352c971f2658d056a1b1b78a4db99fce Author: Jonathan Wakely Date: Mon Nov 3 15:02:24 2014 +0000 Use ctype_base::blank in regex_traits. * include/bits/regex.h (regex_traits::_RegexMask): Remove _S_blank and adjust _S_valid_mask. * include/bits/regex.tcc (regex_traits::lookup_classname): Use ctype_base::blank. diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 4244f2e..30189e3 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -97,14 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: struct _RegexMask { - typedef typename std::ctype::mask _BaseType; + typedef std::ctype_base::mask _BaseType; _BaseType _M_base; unsigned char _M_extended; static constexpr unsigned char _S_under = 1 << 0; - // FIXME: _S_blank should be removed in the future, - // when locale's complete. - static constexpr unsigned char _S_blank = 1 << 1; - static constexpr unsigned char _S_valid_mask = 0x3; + static constexpr unsigned char _S_valid_mask = 0x1; constexpr _RegexMask(_BaseType __base = 0, unsigned char __extended = 0) diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index 3322379..94cbbfa 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -335,7 +335,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION {"s", ctype_base::space}, {"alnum", ctype_base::alnum}, {"alpha", ctype_base::alpha}, - {"blank", {0, _RegexMask::_S_blank}}, + {"blank", ctype_base::blank}, {"cntrl", ctype_base::cntrl}, {"digit", ctype_base::digit}, {"graph", ctype_base::graph}, @@ -377,11 +377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __fctyp.is(__f._M_base, __c) // [[:w:]] || ((__f._M_extended & _RegexMask::_S_under) - && __c == __fctyp.widen('_')) - // [[:blank:]] - || ((__f._M_extended & _RegexMask::_S_blank) - && (__c == __fctyp.widen(' ') - || __c == __fctyp.widen('\t'))); + && __c == __fctyp.widen('_')); } template