Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226219/?format=api
{ "id": 2226219, "url": "http://patchwork.ozlabs.org/api/patches/2226219/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.7@forge-stage.sourceware.org/", "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": "<bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.7@forge-stage.sourceware.org>", "list_archive_url": null, "date": "2026-04-22T10:25:16", "name": "[v1,07/12] libstdc++: Use RAII in _Hashtable", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "9338498feb389bc0c1b3b513e457ef319ff8337f", "submitter": { "id": 93210, "url": "http://patchwork.ozlabs.org/api/people/93210/?format=api", "name": "Jonathan Wakely via Sourceware Forge", "email": "forge-bot+redi@forge-stage.sourceware.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.7@forge-stage.sourceware.org/mbox/", "series": [ { "id": 500966, "url": "http://patchwork.ozlabs.org/api/series/500966/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500966", "date": "2026-04-22T10:25:11", "name": "WIP: libstdc++: Refactor hash table code", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500966/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226219/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226219/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org", "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0wmb5Lgbz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 20:43:11 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 99CBE4BB5919\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 10:43:09 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id D5D2C4BBCDB4\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:26:17 +0000 (GMT)", "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 152BC405A6\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:26:15 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 99CBE4BB5919", "OpenDKIM Filter v2.11.0 sourceware.org D5D2C4BBCDB4" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org D5D2C4BBCDB4", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org D5D2C4BBCDB4", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776853577; cv=none;\n b=Yny+3Q9BQA4lvyHMfVvVN1Tim1jaqYwu6/69iXsE/keReI80ySgq0d/rEY8CgvlNZj//UGL4lMwAamcWdQnQlOzJ4h3BMv8SkeAD0o/BKVpwH1JvQXyCY7sA6B7Lt9FlDmiIH+xHdXhNgON5YYuvgWHkl8i6c1EQpRJ0GFjboDo=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776853577; c=relaxed/simple;\n bh=/F4LivffhgArreI6j6Ced/dWT4rEACqZwRkA/2Tnows=;\n h=From:Date:Subject:MIME-Version:To:Message-ID;\n b=hOTHhaj3mpv+JM5kqXVF6CmqUhoalOHkDHV2TYkyTRDlJXFiBL2dIHckbkP6p2rZBszFXkxeL6Gj/TQSeXb3s64Fsn3nkHCnbyJ2xD724hgZVSkiePRlbTxZdUCVtqSh44e7mO+/DGgdoO4q1sbZd9TsRlgT1rASMzapAvhuaBM=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "Jonathan Wakely via Sourceware Forge\n <forge-bot+redi@forge-stage.sourceware.org>", "Date": "Wed, 22 Apr 2026 10:25:16 +0000", "Subject": "[PATCH v1 07/12] libstdc++: Use RAII in _Hashtable", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>", "Message-ID": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.7@forge-stage.sourceware.org>", "X-Mailer": "batrachomyomachia", "X-Requested-Reviewer": "fdumont", "X-Pull-Request-Organization": "gcc", "X-Pull-Request-Repository": "gcc-TEST", "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/15", "References": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhub8n5f78.gcc.gcc-TEST.redi.15.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/redi/gcc/commit/7b3dba81e0d90ff95396d8e334631e15783707a4", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>, redi@gcc.gnu.org", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: Jonathan Wakely <jwakely@redhat.com>\n\nUse scoped guard types to clean up if an exception is thrown. This\nallows some try-catch blocks to be removed.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/hashtable.h (operator=(const _Hashtable&)): Use\n\tRAII instead of try-catch.\n\t(_M_assign(_Ht&&, _NodeGenerator&)): Likewise.\n\nReviewed-by: François Dumont <fdumont@gcc.gnu.org>\n---\n libstdc++-v3/include/bits/hashtable.h | 99 +++++++++++++++------------\n 1 file changed, 55 insertions(+), 44 deletions(-)", "diff": "diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h\nindex f1c30896bcb0..a46a94e2ecd5 100644\n--- a/libstdc++-v3/include/bits/hashtable.h\n+++ b/libstdc++-v3/include/bits/hashtable.h\n@@ -1307,17 +1307,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t _M_bucket_count = __ht._M_bucket_count;\n \t _M_element_count = __ht._M_element_count;\n \t _M_rehash_policy = __ht._M_rehash_policy;\n-\t __try\n-\t\t{\n-\t\t _M_assign(__ht);\n-\t\t}\n-\t __catch(...)\n-\t\t{\n-\t\t // _M_assign took care of deallocating all memory. Now we\n-\t\t // must make sure this instance remains in a usable state.\n-\t\t _M_reset();\n-\t\t __throw_exception_again;\n-\t\t}\n+\n+\t struct _Guard\n+\t {\n+\t\t~_Guard() { if (_M_ht) _M_ht->_M_reset(); }\n+\t\t_Hashtable* _M_ht;\n+\t };\n+\t // If _M_assign exits via an exception it will have deallocated\n+\t // all memory. This guard will ensure *this is in a usable state.\n+\t _Guard __guard{this};\n+\t _M_assign(__ht);\n+\t __guard._M_ht = nullptr;\n \t return *this;\n \t }\n \t std::__alloc_on_copy(__this_alloc, __that_alloc);\n@@ -1390,46 +1390,57 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t\t _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::\n _M_assign(_Ht&& __ht, _NodeGenerator& __node_gen)\n {\n-\t__buckets_ptr __buckets = nullptr;\n-\tif (!_M_buckets)\n-\t _M_buckets = __buckets = _M_allocate_buckets(_M_bucket_count);\n+\tstruct _Guard\n+\t{\n+\t ~_Guard()\n+\t {\n+\t if (_M_ht)\n+\t {\n+\t\t_M_ht->clear();\n+\t\tif (_M_dealloc_buckets)\n+\t\t _M_ht->_M_deallocate_buckets();\n+\t }\n+\t }\n+\t _Hashtable* _M_ht = nullptr;\n+\t bool _M_dealloc_buckets = false;\n+\t};\n+\t_Guard __guard;\n \n-\t__try\n+\tif (!_M_buckets)\n \t {\n-\t if (!__ht._M_before_begin._M_nxt)\n-\t return;\n+\t _M_buckets = _M_allocate_buckets(_M_bucket_count);\n+\t __guard._M_dealloc_buckets = true;\n+\t }\n \n-\t using _FromVal = __conditional_t<is_lvalue_reference<_Ht>::value,\n-\t\t\t\t\t const value_type&, value_type&&>;\n+\tif (!__ht._M_before_begin._M_nxt)\n+\t return;\n \n-\t // First deal with the special first node pointed to by\n-\t // _M_before_begin.\n-\t __node_ptr __ht_n = __ht._M_begin();\n-\t __node_ptr __this_n\n-\t = __node_gen(static_cast<_FromVal>(__ht_n->_M_v()));\n-\t this->_M_copy_code(*__this_n, *__ht_n);\n-\t _M_update_bbegin(__this_n);\n+\t__guard._M_ht = this;\n \n-\t // Then deal with other nodes.\n-\t __node_ptr __prev_n = __this_n;\n-\t for (__ht_n = __ht_n->_M_next(); __ht_n; __ht_n = __ht_n->_M_next())\n-\t {\n-\t\t__this_n = __node_gen(static_cast<_FromVal>(__ht_n->_M_v()));\n-\t\t__prev_n->_M_nxt = __this_n;\n-\t\tthis->_M_copy_code(*__this_n, *__ht_n);\n-\t\tsize_type __bkt = _M_bucket_index(*__this_n);\n-\t\tif (!_M_buckets[__bkt])\n-\t\t _M_buckets[__bkt] = __prev_n;\n-\t\t__prev_n = __this_n;\n-\t }\n-\t }\n-\t__catch(...)\n+\tusing _FromVal = __conditional_t<is_lvalue_reference<_Ht>::value,\n+\t\t\t\t\t const value_type&, value_type&&>;\n+\n+\t// First deal with the special first node pointed to by\n+\t// _M_before_begin.\n+\t__node_ptr __ht_n = __ht._M_begin();\n+\t__node_ptr __this_n\n+\t = __node_gen(static_cast<_FromVal>(__ht_n->_M_v()));\n+\tthis->_M_copy_code(*__this_n, *__ht_n);\n+\t_M_update_bbegin(__this_n);\n+\n+\t// Then deal with other nodes.\n+\t__node_ptr __prev_n = __this_n;\n+\tfor (__ht_n = __ht_n->_M_next(); __ht_n; __ht_n = __ht_n->_M_next())\n \t {\n-\t clear();\n-\t if (__buckets)\n-\t _M_deallocate_buckets();\n-\t __throw_exception_again;\n+\t __this_n = __node_gen(static_cast<_FromVal>(__ht_n->_M_v()));\n+\t __prev_n->_M_nxt = __this_n;\n+\t this->_M_copy_code(*__this_n, *__ht_n);\n+\t size_type __bkt = _M_bucket_index(*__this_n);\n+\t if (!_M_buckets[__bkt])\n+\t _M_buckets[__bkt] = __prev_n;\n+\t __prev_n = __this_n;\n \t }\n+\t__guard._M_ht = nullptr;\n }\n \n template<typename _Key, typename _Value, typename _Alloc,\n", "prefixes": [ "v1", "07/12" ] }