get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2227413/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2227413,
    "url": "http://patchwork.ozlabs.org/api/patches/2227413/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260423165422.1725245-1-polacek@redhat.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": "<20260423165422.1725245-1-polacek@redhat.com>",
    "list_archive_url": null,
    "date": "2026-04-23T16:54:22",
    "name": "c++: introduce lookup_annotation",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "90cb600d5f6005781d0c65553e5abc490b91b099",
    "submitter": {
        "id": 14370,
        "url": "http://patchwork.ozlabs.org/api/people/14370/?format=api",
        "name": "Marek Polacek",
        "email": "polacek@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260423165422.1725245-1-polacek@redhat.com/mbox/",
    "series": [
        {
            "id": 501221,
            "url": "http://patchwork.ozlabs.org/api/series/501221/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501221",
            "date": "2026-04-23T16:54:22",
            "name": "c++: introduce lookup_annotation",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501221/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2227413/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2227413/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\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=NhJbNPpq;\n\tdkim-atps=neutral",
            "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;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=NhJbNPpq",
            "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "sourceware.org; spf=pass smtp.mailfrom=redhat.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"
        ],
        "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 4g1hzQ4DcRz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 02:55:14 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id C17454BAE7E7\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 16:55:12 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 1677D4BA2E14\n for <gcc-patches@gcc.gnu.org>; Thu, 23 Apr 2026 16:54:33 +0000 (GMT)",
            "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-SDQPsXgdP8KkDB4kxCQ0Bw-1; Thu,\n 23 Apr 2026 12:54:31 -0400",
            "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 2C65A19560B4\n for <gcc-patches@gcc.gnu.org>; Thu, 23 Apr 2026 16:54:30 +0000 (UTC)",
            "from pdp-11.redhat.com (unknown [10.22.65.46])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 75880300070A; Thu, 23 Apr 2026 16:54:29 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org C17454BAE7E7",
            "OpenDKIM Filter v2.11.0 sourceware.org 1677D4BA2E14"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 1677D4BA2E14",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 1677D4BA2E14",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776963273; cv=none;\n b=snNb8co/SlPPW9t35n0707RkZGwZw0ICS4Mv+WsC9KBZCxR78WRVpI/ZGt2xVC0wg2OXFcN00mWazOC2tU4/Bk8ePQEyQIxNI3Pz0ZE873WSxlr831TmATRrSsPEXfYgV0BkkmKQl7lelD8K9UF3Stlf5V4VGbV2WWvjzANvaRw=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776963273; c=relaxed/simple;\n bh=oZdnW5GEBoiseq9li1wjEml7wcypJdJJQInIUDk65Ek=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=nq828KqGZxY2i4XiTHi36ppvUibLBTlmPud+8HYN0mb+rQipvvWHdaevh8IaqYcPBIrtyezTAzpKfdlvy8uPaWPG5RF3jveuPhbRRdE+z+UGJkV+SqFdpa3/9AYKaMGD8WJjVu1i8PwXheS1eH5vN+bUkgmAvpBQzxxhFi/23tQ=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776963272;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=CF4HYY+B4xaiLBb4yH1o23+TrWOGIBgGFPq0vRmfWBA=;\n b=NhJbNPpqTYwgyUMXNFErpXc3IhTJAD0rCgSOl4KaO4WBr+d0LWPsiCxNOK6/dV3TBgt2bV\n VqtOn4TEg46/8zIe1/ZYA6oRZbJ5KkwArOAUwBlAMcJrWoWV4xcJ9v7a4z3vml5urhU1vF\n 6heZwv+gU7k9K18DLQDqZWPOhiG8Q5k=",
        "X-MC-Unique": "SDQPsXgdP8KkDB4kxCQ0Bw-1",
        "X-Mimecast-MFC-AGG-ID": "SDQPsXgdP8KkDB4kxCQ0Bw_1776963270",
        "From": "Marek Polacek <polacek@redhat.com>",
        "To": "GCC Patches <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>,\n Jakub Jelinek <jakub@redhat.com>, Patrick Palka <ppalka@redhat.com>",
        "Subject": "[PATCH] c++: introduce lookup_annotation",
        "Date": "Thu, 23 Apr 2026 12:54:22 -0400",
        "Message-ID": "<20260423165422.1725245-1-polacek@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "i1oAq9s0ccEPCFXyv4c_Kb6aoioW4f2k_y5VHRZ1wmQ_1776963270",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n\n-- >8 --\nThis patch introduces a new helper for looking up annotations.\n\ngcc/cp/ChangeLog:\n\n\t* cp-tree.h (lookup_annotation): Declare.\n\t* decl.cc (grokfndecl): Use lookup_annotation.\n\t(grokdeclarator): Likewise.\n\t* name-lookup.cc (push_local_extern_decl_alias): Likewise.\n\t* parser.cc (cp_parser_decomposition_declaration): Likewise.\n\t* reflect.cc (eval_annotations_of): Likewise.\n\t* tree.cc (lookup_annotation): New.\n---\n gcc/cp/cp-tree.h      |  1 +\n gcc/cp/decl.cc        | 14 +++++---------\n gcc/cp/name-lookup.cc |  6 ++----\n gcc/cp/parser.cc      |  2 +-\n gcc/cp/reflect.cc     |  3 ++-\n gcc/cp/tree.cc        |  8 ++++++++\n 6 files changed, 19 insertions(+), 15 deletions(-)\n\n\nbase-commit: 8b110daf57a8b9966a07ce5f18a2fbb1949a434e",
    "diff": "diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex 3d1f6f99aad..70132b586d8 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -8808,6 +8808,7 @@ extern tree cxx_copy_lang_qualifiers\t\t(const_tree, const_tree);\n extern void cxx_print_statistics\t\t(void);\n extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);\n extern bool annotation_p\t\t\t(tree) ATTRIBUTE_PURE;\n+extern tree lookup_annotation\t\t\t(tree);\n \n /* in ptree.cc */\n extern void cxx_print_xnode\t\t\t(FILE *, tree, int);\ndiff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc\nindex c3d589e8c23..6415f0b4bc2 100644\n--- a/gcc/cp/decl.cc\n+++ b/gcc/cp/decl.cc\n@@ -12232,7 +12232,7 @@ grokfndecl (tree ctype,\n \t  && initialized == SD_INITIALIZED\n \t  && DECL_ATTRIBUTES (t))\n \tfor (tree a = DECL_ATTRIBUTES (t);\n-\t     (a = lookup_attribute (\"internal \", \"annotation \", a));\n+\t     (a = lookup_annotation (a));\n \t     a = TREE_CHAIN (a))\n \t  {\n \t    gcc_checking_assert (TREE_CODE (TREE_VALUE (a)) == TREE_LIST);\n@@ -15938,10 +15938,9 @@ grokdeclarator (const cp_declarator *declarator,\n \t{\n \t  if (flag_reflection\n \t      && declarator->std_attributes != error_mark_node\n-\t      && lookup_attribute (\"internal \", \"annotation \",\n-\t\t\t\t   declarator->std_attributes)\n+\t      && lookup_annotation (declarator->std_attributes)\n \t      && *attrlist != error_mark_node\n-\t      && lookup_attribute (\"internal \", \"annotation \", *attrlist))\n+\t      && lookup_annotation (*attrlist))\n \t    /* If there are annotations in both lists, ensure\n \t       declarator->std_attributes go after *attrlist.  See\n \t       PR124399.  */\n@@ -16663,9 +16662,7 @@ grokdeclarator (const cp_declarator *declarator,\n \t  {\n \t    if (flag_reflection && !funcdef_flag && decl)\n \t      {\n-\t\tif (attrlist\n-\t\t    && lookup_attribute (\"internal \", \"annotation \",\n-\t\t\t\t\t *attrlist))\n+\t\tif (attrlist && lookup_annotation (*attrlist))\n \t\t  {\n \t\t    /* Remove the annotations to avoid spurious warning\n \t\t       below.  */\n@@ -16676,8 +16673,7 @@ grokdeclarator (const cp_declarator *declarator,\n \t\t  }\n \t\tfor (tree arg = DECL_ARGUMENTS (decl);\n \t\t     arg; arg = DECL_CHAIN (arg))\n-\t\t  if (lookup_attribute (\"internal \", \"annotation \",\n-\t\t\t\t\tDECL_ATTRIBUTES (arg)))\n+\t\t  if (lookup_annotation (DECL_ATTRIBUTES (arg)))\n \t\t    error_at (DECL_SOURCE_LOCATION (arg),\n \t\t\t      \"annotation applied to parameter %qD of \"\n \t\t\t      \"non-defining friend declaration\", arg);\ndiff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc\nindex 568e615918c..ef844088381 100644\n--- a/gcc/cp/name-lookup.cc\n+++ b/gcc/cp/name-lookup.cc\n@@ -3692,15 +3692,13 @@ push_local_extern_decl_alias (tree decl)\n {\n   if (flag_reflection)\n     {\n-      if (lookup_attribute (\"internal \", \"annotation \",\n-\t\t\t    DECL_ATTRIBUTES (decl)))\n+      if (lookup_annotation (DECL_ATTRIBUTES (decl)))\n \terror_at (DECL_SOURCE_LOCATION (decl),\n \t\t  \"annotation applied to block scope extern %qD\",\n \t\t  decl);\n       if (TREE_CODE (decl) == FUNCTION_DECL)\n \tfor (tree arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg))\n-\t  if (lookup_attribute (\"internal \", \"annotation \",\n-\t\t\t\tDECL_ATTRIBUTES (arg)))\n+\t  if (lookup_annotation (DECL_ATTRIBUTES (arg)))\n \t    error_at (DECL_SOURCE_LOCATION (arg),\n \t\t      \"annotation applied to parameter %qD of block scope \"\n \t\t      \"extern\", arg);\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex d07dc01650f..dc67cfd9f7c 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -18327,7 +18327,7 @@ cp_parser_decomposition_declaration (cp_parser *parser,\n \t      attr = NULL_TREE;\n \t    if (attr && first_attr == -1)\n \t      first_attr = v.length ();\n-\t    if (lookup_attribute (\"internal \", \"annotation \", attr))\n+\t    if (lookup_annotation (attr))\n \t      error (\"annotation on structured binding\");\n \t  }\n \tv.safe_push (e);\ndiff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex 09e99b5ef83..27e1efee106 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -3966,7 +3966,8 @@ eval_annotations_of (location_t loc, const constexpr_ctx *ctx, tree r,\n   else\n     gcc_unreachable ();\n   vec<constructor_elt, va_gc> *elts = nullptr;\n-  for (tree a = r; (a = lookup_attribute (\"internal \", \"annotation \", a));\n+  for (tree a = r;\n+       (a = lookup_annotation (a));\n        a = TREE_CHAIN (a))\n     {\n       gcc_checking_assert (TREE_CODE (TREE_VALUE (a)) == TREE_LIST);\ndiff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc\nindex d3e202e8b04..c510a5bf2d0 100644\n--- a/gcc/cp/tree.cc\n+++ b/gcc/cp/tree.cc\n@@ -7086,6 +7086,14 @@ annotation_p (tree attr)\n   return is_attribute_p (\"annotation \", get_attribute_name (attr));\n }\n \n+/* Lookup the annotation in ATTR, if present.  */\n+\n+tree\n+lookup_annotation (tree attr)\n+{\n+  return lookup_attribute (\"internal \", \"annotation \", attr);\n+}\n+\n \f\n /* Release memory we no longer need after parsing.  */\n void\n",
    "prefixes": []
}