Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809593/?format=api
{ "id": 809593, "url": "http://patchwork.ozlabs.org/api/patches/809593/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/CAG4ZjN=teuigpysiMSm+tE+3S4dm+WM=7n7A80gXBDFpdqfhBQ@mail.gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<CAG4ZjN=teuigpysiMSm+tE+3S4dm+WM=7n7A80gXBDFpdqfhBQ@mail.gmail.com>", "list_archive_url": null, "date": "2017-09-04T10:31:49", "name": "[libstdc++/71500] make back reference work with icase", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e9f95597ea943d3a1201765b19efa33d12844d45", "submitter": { "id": 70597, "url": "http://patchwork.ozlabs.org/api/people/70597/?format=api", "name": "Li, Pan2 via Gcc-patches", "email": "gcc-patches@gcc.gnu.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/CAG4ZjN=teuigpysiMSm+tE+3S4dm+WM=7n7A80gXBDFpdqfhBQ@mail.gmail.com/mbox/", "series": [ { "id": 1352, "url": "http://patchwork.ozlabs.org/api/series/1352/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=1352", "date": "2017-09-04T10:31:49", "name": "[libstdc++/71500] make back reference work with icase", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1352/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809593/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809593/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461396-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461396-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"RoHSOJfP\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xm5kb466wz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 4 Sep 2017 20:32:06 +1000 (AEST)", "(qmail 98290 invoked by alias); 4 Sep 2017 10:31:58 -0000", "(qmail 97603 invoked by uid 89); 4 Sep 2017 10:31:57 -0000", "from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com)\n\t(74.125.83.51) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 04 Sep 2017 10:31:51 +0000", "by mail-pg0-f51.google.com with SMTP id t3so314628pgt.0 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 04 Sep 2017 03:31:51 -0700 (PDT)", "by 10.100.189.77 with HTTP; Mon, 4 Sep 2017 03:31:49 -0700 (PDT)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:reply-to:date:message-id:subject:to\n\t:content-type; q=dns; s=default; b=i9hM+iKnRAsKukQyntMsvhrZbU/8q\n\tHUt8PiA1+J0jH2LG4WwXj82NIFRRZeDbMfPBxpW8C0Y3qzm3jRj52lsGH0ORRAap\n\tNSmUqdvzmM+Od+VvKnP4dbym8SK7YGoaN7Oa4ni6Wfx5875LH/TZ/pihWO4RQ1LQ\n\ty9HYPQIPhdCKDU=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:reply-to:date:message-id:subject:to\n\t:content-type; s=default; bh=mpmo8ybbuIe1Fk0SS9YbnDwzQqo=; b=RoH\n\tSOJfP4lOaC336F+ntEcEy7ROz0y4iCHE6plLO079TgnXq+biHaF/MjUY0aMf1d0M\n\tekcHIDmaiKgL3xELwEto87g/mNqqNqnAiDA/FarJ/FwGJo2csZpWkF57edeaV/lw\n\tv5cEBoECSLTrSS3iWtX6OQbyH8m9hT12kP8Lw0Bc=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mail-pg0-f51.google.com", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n\tbh=3vNCv9DqBsOYTm1BTLVTa0acl+fXx5Q5FqUEoaDDAjU=;\n\tb=h7Kfg8uhDUeQi0vg2lDSLu7s1tBTrTOK8SG4RRDfm2zf5sv22XgaFtIHrD3wIjJksr\n\tkyLCqhSc7iNNODpu4S1o/fwPT3JGUrPRjvm8LsAZcYRbAbtf8skb6v5sMqCVrAvbPbf/\n\t5ZICRllCzf3Hiy1VGSK8Rh1VoDr+80A7hPQrdMYFvTNMg1LI6q75dsbA+vOhSWpvDJgL\n\tpCTxnxvStMMJcNX447gpEggc4SXOdt76ddzt+jGndE8wIO8SS79d/aCxb3rPAP+H2YFE\n\t+jLBRtzi9YgDBRMSzYjoAQKjijaZmUFl6c3J64kAu/THHAVIAOeVgm7ycW7qGj+0FHue\n\tDOyQ==", "X-Gm-Message-State": "AHPjjUjIdPwqQbBDnrG+jjSOGrqGi4xnIbPrVXGar/IZGxbrXJ3YOv7A\tNv+iQuRkFwCM2rj8bGMXXa+8YdqJ086B", "X-Google-Smtp-Source": "ADKCNb6lwLlGgoyzMS91jkpubN/mr1JP2nphEwjY/zboLLdUBAGR1pDya8MSH2+raRii+21+bTd/SZnwxNqmpLjbNbs=", "X-Received": "by 10.99.105.2 with SMTP id e2mr11533008pgc.410.1504521109759;\n\tMon, 04 Sep 2017 03:31:49 -0700 (PDT)", "MIME-Version": "1.0", "From": "\"Tim Shen via gcc-patches\" <gcc-patches@gcc.gnu.org>", "Reply-To": "Tim Shen <timshen@google.com>", "Date": "Mon, 4 Sep 2017 03:31:49 -0700", "Message-ID": "<CAG4ZjN=teuigpysiMSm+tE+3S4dm+WM=7n7A80gXBDFpdqfhBQ@mail.gmail.com>", "Subject": "[libstdc++/71500] make back reference work with icase", "To": "\"libstdc++\" <libstdc++@gcc.gnu.org>,\n\tgcc-patches <gcc-patches@gcc.gnu.org>", "Content-Type": "multipart/mixed; boundary=\"94eb2c13fcba4ee0df05585a9e7c\"" }, "content": "This fixes the follow-up comments in 71500.\n\nBack-reference matching is different from other matching, as the\ncontent the back-reference refers to is at \"run-time\", aka during\nregex_match(), not regex() compilation.\n\nFor compilation we do have an abstraction layer to catch all\ncomparison customizations, namely _M_translator in regex_compiler.h.\nUntil this patch, we don't have an abstraction for \"run-time\"\nmatching. I believe that back-reference is the only place that needs\nrun-time matching, so I just build a _Backref_matcher in\nregex_executot.tcc.\n\nTested on x86_64-linux-gnu.\n\nThanks!", "diff": "commit a97b7fecd319e031ffc489a956b8cf3dc63eeb26\nAuthor: Tim Shen <timshen@google.com>\nDate: Mon Sep 4 03:19:35 2017 -0700\n\n PR libstdc++/71500\n * include/bits/regex_executor.tcc: Support icase in\n regex_tratis<...> for back reference matches.\n * testsuite/28_regex/regression.cc: Test case.\n\ndiff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc\nindex 226e05856e1..f6149fecf9d 100644\n--- a/libstdc++-v3/include/bits/regex_executor.tcc\n+++ b/libstdc++-v3/include/bits/regex_executor.tcc\n@@ -335,6 +335,54 @@ namespace __detail\n \t _M_states._M_queue(__state._M_next, _M_cur_results);\n }\n \n+ template<typename _BiIter, typename _TraitsT>\n+ struct _Backref_matcher\n+ {\n+ _Backref_matcher(bool __icase, const _TraitsT& __traits)\n+ : _M_traits(__traits) { }\n+\n+ bool\n+ _M_apply(_BiIter __expected_begin,\n+\t _BiIter __expected_end, _BiIter __actual_begin,\n+\t _BiIter __actual_end)\n+ {\n+\treturn _M_traits.transform(__expected_begin, __expected_end)\n+\t == _M_traits.transform(__actual_begin, __actual_end);\n+ }\n+\n+ const _TraitsT& _M_traits;\n+ };\n+\n+ template<typename _BiIter, typename _CharT>\n+ struct _Backref_matcher<_BiIter, std::regex_traits<_CharT>>\n+ {\n+ using _TraitsT = std::regex_traits<_CharT>;\n+ _Backref_matcher(bool __icase, const _TraitsT& __traits)\n+ : _M_icase(__icase), _M_traits(__traits) { }\n+\n+ bool\n+ _M_apply(_BiIter __expected_begin,\n+\t _BiIter __expected_end, _BiIter __actual_begin,\n+\t _BiIter __actual_end)\n+ {\n+\tif (!_M_icase)\n+\t return std::equal(__expected_begin, __expected_end,\n+\t\t\t __actual_begin, __actual_end);\n+\ttypedef std::ctype<_CharT> __ctype_type;\n+\tconst auto& __fctyp = use_facet<__ctype_type>(_M_traits.getloc());\n+\treturn std::equal(__expected_begin, __expected_end,\n+\t\t\t __actual_begin, __actual_end,\n+\t\t\t [this, &__fctyp](_CharT __lhs, _CharT __rhs)\n+\t\t\t {\n+\t\t\t return __fctyp.tolower(__lhs)\n+\t\t\t\t== __fctyp.tolower(__rhs);\n+\t\t\t });\n+ }\n+\n+ bool _M_icase;\n+ const _TraitsT& _M_traits;\n+ };\n+\n // First fetch the matched result from _M_cur_results as __submatch;\n // then compare it with\n // (_M_current, _M_current + (__submatch.second - __submatch.first)).\n@@ -355,9 +403,10 @@ namespace __detail\n \t __last != _M_end && __tmp != __submatch.second;\n \t ++__tmp)\n \t++__last;\n- if (_M_re._M_automaton->_M_traits.transform(__submatch.first,\n-\t\t\t\t\t\t __submatch.second)\n-\t == _M_re._M_automaton->_M_traits.transform(_M_current, __last))\n+ if (_Backref_matcher<_BiIter, _TraitsT>(\n+\t _M_re.flags() & regex_constants::icase,\n+\t _M_re._M_automaton->_M_traits)._M_apply(\n+\t\t __submatch.first, __submatch.second, _M_current, __last))\n \t{\n \t if (__last != _M_current)\n \t {\ndiff --git a/libstdc++-v3/testsuite/28_regex/regression.cc b/libstdc++-v3/testsuite/28_regex/regression.cc\nindex ee4d3e1e6f8..3fa9022eac4 100644\n--- a/libstdc++-v3/testsuite/28_regex/regression.cc\n+++ b/libstdc++-v3/testsuite/28_regex/regression.cc\n@@ -93,6 +93,17 @@ test06()\n }\n }\n \n+// PR libstdc++/71500\n+void\n+test07()\n+{\n+ bool test [[gnu::unused]] = true;\n+\n+ VERIFY(regex_match_debug(\"abc abc\", regex(\"([a-z]+) \\\\1\", regex::icase)));\n+ VERIFY(regex_match_debug(\"Abc abc\", regex(\"([a-z]+) \\\\1\", regex::icase)));\n+ VERIFY(regex_match_debug(\"abc Abc\", regex(\"([a-z]+) \\\\1\", regex::icase)));\n+}\n+\n int\n main()\n {\n@@ -102,6 +113,7 @@ main()\n test04();\n test05();\n test06();\n+ test07();\n return 0;\n }\n \n", "prefixes": [ "libstdc++/71500" ] }