Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226676/?format=api
{ "id": 2226676, "url": "http://patchwork.ozlabs.org/api/patches/2226676/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.6@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.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.6@forge-stage.sourceware.org>", "list_archive_url": null, "date": "2026-04-22T18:21:54", "name": "[v1,06/13] c/c++: Add target_[version/clones] to decl diagnostics formatting.", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6dd78d1e733231d4c621aac34cde3e2bc802a745", "submitter": { "id": 93228, "url": "http://patchwork.ozlabs.org/api/people/93228/?format=api", "name": "\\\"alfie.richards via Sourceware Forge\\\"", "email": "forge-bot+alfie.richards@forge-stage.sourceware.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.6@forge-stage.sourceware.org/mbox/", "series": [ { "id": 501072, "url": "http://patchwork.ozlabs.org/api/series/501072/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501072", "date": "2026-04-22T18:21:54", "name": "FMV refactor and ACLE compliance for C++", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501072/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226676/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226676/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 4g170L5cp6z1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 04:24:02 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id EBBC5441F941\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 18:24:00 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 70ACE441F949\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:23:32 +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 774DD43459\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:23:30 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org EBBC5441F941", "OpenDKIM Filter v2.11.0 sourceware.org 70ACE441F949" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 70ACE441F949", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 70ACE441F949", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776882212; cv=none;\n b=hMyh4N/qH6DZr2vkMzX7UQkEWaNnxAc3uLfPGlAp2RWXRorhXa95uO5NftV5cI10zAX+I3yJdVtHYRvVHFEh1zpjIz8xPNcT30HA1QIq7CjL7vdkk+Lp8L+sOd1nN6tPOsshBEReiE5NglnJyDvgegcVvhnW1RcmpTaPSd9fy2M=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776882212; c=relaxed/simple;\n bh=VAnohUd29W3ePotiJYHO+k87wOHrjz1dQYppGJzZbmI=;\n h=From:Date:Subject:MIME-Version:To:Message-ID;\n b=gJYVY1BLyJOasvQDkT9+gZakDyq9W7016V1qWGfJf7gkNReEyhEv66Y76PgQHWeERGllR83d3HuFWYSjfKT9YXYeviXUGJLhlDI2ae1jmtmxOEV4puslAXGSVqJNISa/ZCfstIGTSlKR516mY3v5cUnrDQBCfOlDFfK93o3iawo=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "\"\\\"alfie.richards via Sourceware Forge\\\"\"\n <forge-bot+alfie.richards@forge-stage.sourceware.org>", "Date": "Wed, 22 Apr 2026 18:21:54 +0000", "Subject": "[PATCH v1 06/13] c/c++: Add target_[version/clones] to decl\n diagnostics formatting.", "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.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.6@forge-stage.sourceware.org>", "X-Mailer": "batrachomyomachia", "X-Requested-Reviewer": [ "rsandifo", "rearnsha" ], "X-Pull-Request-Organization": "gcc", "X-Pull-Request-Repository": "gcc-TEST", "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/49", "References": "\n <bmm.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhuodmon6a.gcc.gcc-TEST.alfie.richards.49.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/alfie.richards/gcc-TEST/commit/b908024daf18326cdb7b2fd463e6098beb0d8aa5", "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>,\n alfierichards@sourceware.org", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: Alfie Richards <alfie.richards@arm.com>\n\nAdds the target_version and target_clones attributes to diagnostic messages\nfor target_version semantics.\n\nThis is because the target_version/target_clones attributes affect the identity\nof the decls, so need to be represented in diagnostics for them.\n\nAfter this change diagnostics look like:\n\nc:\n```\ntest.c:6:8: error: redefinition of ‘foo [[target_version(\"sve\")]]’\n 6 | float foo () {return 1;}\n | ^~~\ntest.c:3:8: note: previous definition of ‘foo [[target_version(\"sve\")]]’ with type ‘float(void)’\n 3 | float foo () {return 2;}\n | ^~~\ntest.c:12:8: error: redefinition of ‘bar [[target_clones(\"sve\")]]’\n 12 | float bar () {return 1;}\n | ^~~\ntest.c:9:8: note: previous definition of ‘bar [[target_clones(\"sve\")]]’ with type ‘float(void)’\n 9 | float bar () {return 2;}\n | ^~~\n```\n\nc++:\n```\ntest.cpp:6:8: error: redefinition of ‘[[target_version(\"sve\")]] float foo()’\n 6 | float foo () {return 1;}\n | ^~~\ntest.cpp:3:8: note: ‘[[target_version(\"sve\")]] float foo()’ previously defined here\n 3 | float foo () {return 2;}\n | ^~~\ntest.cpp:12:8: error: redefinition of ‘[[target_clones(\"sve\")]] float bar()’\n 12 | float bar () {return 1;}\n | ^~~\ntest.cpp:9:8: note: ‘[[target_clones(\"sve\")]] float bar()’ previously defined here\n 9 | float bar () {return 2;}\n | ^~~\n```\n\nThis only affects targets which use target_version (aarch64 and riscv).\n\ngcc/c-family/ChangeLog:\n\n\t* c-pretty-print.cc (pp_c_function_target_version): New function.\n\t(pp_c_function_target_clones): New function.\n\t* c-pretty-print.h (pp_c_function_target_version): New function.\n\t(pp_c_function_target_clones): New function.\n\ngcc/c/ChangeLog:\n\n\t* c-objc-common.cc (c_tree_printer): Add printing of target_clone and\n\ttarget_version in decl diagnostics.\n\ngcc/cp/ChangeLog:\n\n\t* cxx-pretty-print.h (pp_cxx_function_target_version): New macro.\n\t(pp_cxx_function_target_clones): Ditto.\n\t* error.cc (dump_function_decl): Add printing of target_clone and\n\ttarget_version in decl diagnostics.\n---\n gcc/c-family/c-pretty-print.cc | 81 ++++++++++++++++++++++++++++++++++\n gcc/c-family/c-pretty-print.h | 2 +\n gcc/c/c-objc-common.cc | 6 +++\n gcc/cp/cxx-pretty-print.h | 4 ++\n gcc/cp/error.cc | 3 ++\n 5 files changed, 96 insertions(+)", "diff": "diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc\nindex fad6b5eb9b04..66653819a56f 100644\n--- a/gcc/c-family/c-pretty-print.cc\n+++ b/gcc/c-family/c-pretty-print.cc\n@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see\n #include \"function.h\"\n #include \"basic-block.h\"\n #include \"gimple.h\"\n+#include \"tm.h\"\n \n /* The pretty-printer code is primarily designed to closely follow\n (GNU) C and C++ grammars. That is to be contrasted with spaghetti\n@@ -3054,6 +3055,86 @@ pp_c_tree_decl_identifier (c_pretty_printer *pp, tree t)\n pp_c_identifier (pp, name);\n }\n \n+/* Prints \"[version: VERSION]\" for a versioned function decl.\n+ This will only print for targets with target_version semantics.\n+ If PREFIX is true (ie, this is printing the attribute prefixed to the\n+ identifier), whitespace will be added after the attribute. Otherwise,\n+ whitespace is added before the attribute. */\n+void\n+pp_c_function_target_version (c_pretty_printer *pp, tree t, bool prefix)\n+{\n+ if (TARGET_HAS_FMV_TARGET_ATTRIBUTE)\n+ return;\n+\n+ string_slice version = get_target_version (t);\n+ if (!version.is_valid ())\n+ return;\n+\n+ if (!prefix)\n+ pp_c_whitespace (pp);\n+\n+ pp_c_left_bracket (pp);\n+ pp_c_left_bracket (pp);\n+ pp_string (pp, \"target_version\");\n+ pp_c_left_paren (pp);\n+ pp_doublequote (pp);\n+ pp_string_n (pp, version.begin (), version.size ());\n+ pp_doublequote (pp);\n+ pp_c_right_paren (pp);\n+ pp_c_right_bracket (pp);\n+ pp_c_right_bracket (pp);\n+\n+ if (prefix)\n+ pp_c_whitespace (pp);\n+}\n+\n+/* Prints \"[clones: VERSION, +]\" for a versioned function decl.\n+ This only works for targets with target_version semantics.\n+ If PREFIX is true (ie, this is printing the attribute prefixed to the\n+ identifier), whitespace will be added after the attribute. Otherwise,\n+ whitespace is added before the attribute. */\n+void\n+pp_c_function_target_clones (c_pretty_printer *pp, tree t, bool prefix)\n+{\n+ /* Only print for target_version semantics.\n+ This is because for target FMV semantics a target_clone always defines\n+ the entire FMV set. target_version semantics can mix target_clone and\n+ target_version decls in the definition of a FMV set and so the\n+ target_clone becomes a part of the identity of the declaration. */\n+ if (TARGET_HAS_FMV_TARGET_ATTRIBUTE)\n+ return;\n+\n+ auto_vec<string_slice> versions = get_clone_versions (t, NULL, false);\n+ if (versions.is_empty ())\n+ return;\n+\n+ if (!prefix)\n+ pp_c_whitespace (pp);\n+\n+ string_slice final_version = versions.pop ();\n+ pp_c_left_bracket (pp);\n+ pp_c_left_bracket (pp);\n+ pp_string (pp, \"target_clones\");\n+ pp_c_left_paren (pp);\n+ for (string_slice version : versions)\n+ {\n+ pp_doublequote (pp);\n+ pp_string_n (pp, version.begin (), version.size ());\n+ pp_doublequote (pp);\n+ pp_string (pp, \",\");\n+ pp_c_whitespace (pp);\n+ }\n+ pp_doublequote (pp);\n+ pp_string_n (pp, final_version.begin (), final_version.size ());\n+ pp_doublequote (pp);\n+ pp_c_right_paren (pp);\n+ pp_c_right_bracket (pp);\n+ pp_c_right_bracket (pp);\n+\n+ if (prefix)\n+ pp_c_whitespace (pp);\n+}\n+\n #if CHECKING_P\n \n namespace selftest {\ndiff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h\nindex c8fb67899915..341db793d5fe 100644\n--- a/gcc/c-family/c-pretty-print.h\n+++ b/gcc/c-family/c-pretty-print.h\n@@ -138,6 +138,8 @@ void pp_c_ws_string (c_pretty_printer *, const char *);\n void pp_c_identifier (c_pretty_printer *, const char *);\n void pp_c_string_literal (c_pretty_printer *, tree);\n void pp_c_integer_constant (c_pretty_printer *, tree);\n+void pp_c_function_target_version (c_pretty_printer *, tree, bool = false);\n+void pp_c_function_target_clones (c_pretty_printer *, tree, bool = false);\n \n void print_c_tree (FILE *file, tree t, dump_flags_t);\n \ndiff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc\nindex 5c50983544d7..109a8cb33ee8 100644\n--- a/gcc/c/c-objc-common.cc\n+++ b/gcc/c/c-objc-common.cc\n@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see\n #include \"c-tree.h\"\n #include \"intl.h\"\n #include \"c-family/c-pretty-print.h\"\n+#include \"tree-core.h\"\n #include \"tree-pretty-print.h\"\n #include \"tree-pretty-print-markup.h\"\n #include \"gimple-pretty-print.h\"\n@@ -359,6 +360,11 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,\n if (DECL_NAME (t))\n \t{\n \t pp_identifier (cpp, lang_hooks.decl_printable_name (t, 2));\n+\t if (TREE_CODE (t) == FUNCTION_DECL)\n+\t {\n+\t pp_c_function_target_version (cpp, t);\n+\t pp_c_function_target_clones (cpp, t);\n+\t }\n \t return true;\n \t}\n break;\ndiff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h\nindex 86e0ce7d85f2..5d16dddd39a7 100644\n--- a/gcc/cp/cxx-pretty-print.h\n+++ b/gcc/cp/cxx-pretty-print.h\n@@ -83,6 +83,10 @@ public:\n #define pp_cxx_identifier(PP, I)\tpp_c_identifier (PP, I)\n #define pp_cxx_tree_identifier(PP, T) \\\n pp_c_tree_identifier (PP, T)\n+#define pp_cxx_function_target_version(PP, T) \\\n+ pp_c_function_target_version (PP, T, true)\n+#define pp_cxx_function_target_clones(PP, T) \\\n+ pp_c_function_target_clones (PP, T, true)\n \n void pp_cxx_begin_template_argument_list (cxx_pretty_printer *);\n void pp_cxx_end_template_argument_list (cxx_pretty_printer *);\ndiff --git a/gcc/cp/error.cc b/gcc/cp/error.cc\nindex cd35c7ae0415..78678b55ca44 100644\n--- a/gcc/cp/error.cc\n+++ b/gcc/cp/error.cc\n@@ -1953,6 +1953,9 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags)\n \t}\n }\n \n+ pp_cxx_function_target_version (pp, t);\n+ pp_cxx_function_target_clones (pp, t);\n+\n if (DECL_NAME (t) && LAMBDA_FUNCTION_P (t))\n return dump_lambda_function (pp, t, template_parms, template_args, flags);\n \n", "prefixes": [ "v1", "06/13" ] }