Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229948/?format=api
{ "id": 2229948, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229948/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260428232733.1953841-1-dmalcolm@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/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 }, "msgid": "<20260428232733.1953841-1-dmalcolm@redhat.com>", "date": "2026-04-28T23:27:33", "name": "[pushed:,r17-172-g2bb5e43f9c0444] diagnostics: use label_text in diagnostics::option_id_manager", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d0ceb1b9edf94d3c65b18b42035d0845b77b2059", "submitter": { "id": 24465, "url": "http://patchwork.ozlabs.org/api/1.1/people/24465/?format=api", "name": "David Malcolm", "email": "dmalcolm@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260428232733.1953841-1-dmalcolm@redhat.com/mbox/", "series": [ { "id": 501957, "url": "http://patchwork.ozlabs.org/api/1.1/series/501957/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501957", "date": "2026-04-28T23:27:33", "name": "[pushed:,r17-172-g2bb5e43f9c0444] diagnostics: use label_text in diagnostics::option_id_manager", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501957/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229948/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229948/checks/", "tags": {}, "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=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=dZ4HO0Id;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=dZ4HO0Id", "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 [38.145.34.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 4g4xW10rMcz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 09:30:21 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4FD884BBC0DB\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 23:30:19 +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 87E7E4BBC0E9\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 23:27:39 +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-632-iEAjvvtGNH68qNtHVXw9qw-1; Tue,\n 28 Apr 2026 19:27:37 -0400", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\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 6554719560B2\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 23:27:36 +0000 (UTC)", "from t14s.localdomain.com (unknown [10.22.65.168])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id D8880180047F; Tue, 28 Apr 2026 23:27:35 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 4FD884BBC0DB", "OpenDKIM Filter v2.11.0 sourceware.org 87E7E4BBC0E9" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 87E7E4BBC0E9", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 87E7E4BBC0E9", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777418859; cv=none;\n b=UqXxQulPL5qb3cX6XVH2BUiDzDr+Kx1IpM6i/wbEzamFdrg1/ZEFo4xpRVXK6GpUXl3Fzl8OD42eiyQhfCjCM4hZifvtIS6fW0BW35R6BrvFSLUs0xiJgyf//RbRDQkKMAv3giwEbF4fC1ePIqPopCbIvWJNme6wD+butfLS3iw=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777418859; c=relaxed/simple;\n bh=gFWKFtVKHFd5duOL4tPlV3x7H1e/Y7UOHdZbvGLe5tk=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=L4iuWm4PJJIBLbVcy+48+czh/YaYmABreoBF6Ux1p9fQ825v9aorTTHjyoU3ackzDzBqCO4PV56oHZr1THvq0PlLcdgS4q5SyPbYfgRE5YUONYnxCVyF4RyRPRyNKVHNiaD4jEvLzuSSbJOE8mBOE3DQ0SFV+fxoFzWikNljNc8=", "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=1777418859;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=1bNaqbxltEYM5m9T4hFtajVljoIv5Hr7lMqdsS8nsFI=;\n b=dZ4HO0IdDDhl0zi4ynpE4u98ivmHjTQH4f5KDColWlpmH8ddIFSqK6I8fHtWq3IEeihLnx\n sjxbi5a3vkH4DOjfx++jzReLMwlNQ4u2OqJk1LDJUM2ftKV0piSzY78VXHANq86dFI+FXH\n wDDOK8H7aWmUkgBsrHFxjBNIou+jsEE=", "X-MC-Unique": "iEAjvvtGNH68qNtHVXw9qw-1", "X-Mimecast-MFC-AGG-ID": "iEAjvvtGNH68qNtHVXw9qw_1777418857", "From": "David Malcolm <dmalcolm@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "David Malcolm <dmalcolm@redhat.com>", "Subject": "[pushed: r17-172-g2bb5e43f9c0444] diagnostics: use label_text in\n diagnostics::option_id_manager", "Date": "Tue, 28 Apr 2026 19:27:33 -0400", "Message-ID": "<20260428232733.1953841-1-dmalcolm@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "w5bnEdJap8bDp2ApZSKLWrH-4V6O34jBKV6pjd7NP7Q_1777418857", "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": "Eliminate some manual memory management.\n\nSuccessfully bootstrapped & regrtested on powerpc64le-unknown-linux-gnu\n(albeit without ada,cobol,d, and possibly missing some optional test dependencies)\nPushed to trunk as r17-172-g2bb5e43f9c0444.\n\ngcc/ChangeLog:\n\t* diagnostics/context.h (diagnostics::context::make_option_name):\n\tConvert return type from char * to label_text, and rename to...\n\t(diagnostics::context::get_option_name): ...this.\n\t(diagnostics::context::make_option_url): Likewise, renaming to...\n\t(diagnostics::context::get_option_url): ...this.\n\t* diagnostics/html-sink.cc\n\t(html_builder::make_element_for_diagnostic): Update for above\n\tchanges.\n\t* diagnostics/lazy-paths.cc (selftest::all_warnings_disabled):\n\tUpdate for above changes.\n\t* diagnostics/option-id-manager.h\n\t(diagnostics::option_id_manager::make_option_name): Convert return\n\ttype from char * to label_text, and rename to...\n\t(diagnostics::option_id_manager::get_option_name): ...this.\n\t(diagnostics::option_id_manager::make_option_url): Likewise,\n\trenaming to...\n\t(diagnostics::option_id_manager::get_option_url): ...this.\n\t* diagnostics/sarif-sink.cc: Add #define INCLUDE_SET.\n\t(sarif_builder::m_rule_id_set): Convert from\n\thash_set <free_string_hash> to std::set<std::string>.\n\t(sarif_builder::make_result_object): Update for above changes,\n\tremoving manual memory management.\n\t(sarif_builder::make_reporting_descriptor_object_for_warning):\n\tLikewise.\n\t* diagnostics/text-sink.cc (text_sink::print_option_information):\n\tLikewise.\n\t* lto-wrapper.cc (print_lto_docs_link): Likewise.\n\t(lto_diagnostic_option_id_manager::make_option_name): Convert\n\treturn type from char * to label_text, and rename to...\n\t(lto_diagnostic_option_id_manager::get_option_name): ...this.\n\t* opts-diagnostic.h (gcc_diagnostic_option_id_manager): Update for\n\tabove changes.\n\t* opts.cc\n\t(compiler_diagnostic_option_id_manager::make_option_name): Update\n\tas above, renaming to...\n\t(compiler_diagnostic_option_id_manager::get_option_name): ...this.\n\t(gcc_diagnostic_option_id_manager::make_option_url): Likewise,\n\trenaming to...\n\t(gcc_diagnostic_option_id_manager::get_option_url): ...this.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/diagnostics/context.h | 20 ++++++-------\n gcc/diagnostics/html-sink.cc | 12 ++++----\n gcc/diagnostics/lazy-paths.cc | 16 +++++++----\n gcc/diagnostics/option-id-manager.h | 17 ++++++-----\n gcc/diagnostics/sarif-sink.cc | 28 +++++++++---------\n gcc/diagnostics/text-sink.cc | 25 ++++++++--------\n gcc/lto-wrapper.cc | 11 ++++----\n gcc/opts-diagnostic.h | 12 ++++----\n gcc/opts.cc | 44 +++++++++++++++--------------\n 9 files changed, 94 insertions(+), 91 deletions(-)", "diff": "diff --git a/gcc/diagnostics/context.h b/gcc/diagnostics/context.h\nindex dcfb80760b6..ad1192e93a3 100644\n--- a/gcc/diagnostics/context.h\n+++ b/gcc/diagnostics/context.h\n@@ -485,22 +485,22 @@ public:\n return m_option_id_mgr->option_enabled_p (opt_id);\n }\n \n- inline char *make_option_name (option_id opt_id,\n-\t\t\t\t enum kind orig_diag_kind,\n-\t\t\t\t enum kind diag_kind) const\n+ inline label_text get_option_name (option_id opt_id,\n+\t\t\t\t enum kind orig_diag_kind,\n+\t\t\t\t enum kind diag_kind) const\n {\n if (!m_option_id_mgr)\n- return nullptr;\n- return m_option_id_mgr->make_option_name (opt_id,\n-\t\t\t\t\t orig_diag_kind,\n-\t\t\t\t\t diag_kind);\n+ return label_text ();\n+ return m_option_id_mgr->get_option_name (opt_id,\n+\t\t\t\t\t orig_diag_kind,\n+\t\t\t\t\t diag_kind);\n }\n \n- inline char *make_option_url (option_id opt_id) const\n+ inline label_text get_option_url (option_id opt_id) const\n {\n if (!m_option_id_mgr)\n- return nullptr;\n- return m_option_id_mgr->make_option_url (opt_id);\n+ return label_text ();\n+ return m_option_id_mgr->get_option_url (opt_id);\n }\n \n void\ndiff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc\nindex 58442e9a62b..5c13150f719 100644\n--- a/gcc/diagnostics/html-sink.cc\n+++ b/gcc/diagnostics/html-sink.cc\n@@ -1052,13 +1052,13 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,\n \n // Add any option as a suffix to the message\n \n- label_text option_text = label_text::take\n- (m_context.make_option_name (diagnostic.m_option_id,\n-\t\t\t\t orig_diag_kind, diagnostic.m_kind));\n- if (option_text.get ())\n+ label_text option_text\n+ = m_context.get_option_name (diagnostic.m_option_id,\n+\t\t\t\t orig_diag_kind, diagnostic.m_kind);\n+if (option_text.get ())\n {\n- label_text option_url = label_text::take\n-\t(m_context.make_option_url (diagnostic.m_option_id));\n+ label_text option_url\n+\t= m_context.get_option_url (diagnostic.m_option_id);\n \n xp.add_text (\" \");\n auto option_span = make_span (\"gcc-option\");\ndiff --git a/gcc/diagnostics/lazy-paths.cc b/gcc/diagnostics/lazy-paths.cc\nindex 6d4c676efb3..0320110e360 100644\n--- a/gcc/diagnostics/lazy-paths.cc\n+++ b/gcc/diagnostics/lazy-paths.cc\n@@ -137,15 +137,19 @@ public:\n /* Treat all options as disabled. */\n return 0;\n }\n- char *make_option_name (diagnostics::option_id,\n-\t\t\t enum kind,\n-\t\t\t enum kind) const final override\n+\n+ label_text\n+ get_option_name (diagnostics::option_id,\n+\t\t enum kind,\n+\t\t enum kind) const final override\n {\n- return nullptr;\n+ return label_text ();\n }\n- char *make_option_url (diagnostics::option_id) const final override\n+\n+ label_text\n+ get_option_url (diagnostics::option_id) const final override\n {\n- return nullptr;\n+ return label_text ();\n }\n };\n \ndiff --git a/gcc/diagnostics/option-id-manager.h b/gcc/diagnostics/option-id-manager.h\nindex 55c7c429a2b..0d997eecbfa 100644\n--- a/gcc/diagnostics/option-id-manager.h\n+++ b/gcc/diagnostics/option-id-manager.h\n@@ -35,20 +35,19 @@ public:\n (or if the value is unknown, typically set later in target). */\n virtual int option_enabled_p (option_id opt_id) const = 0;\n \n- /* Return malloced memory for the name of the option OPT_ID\n- which enabled a diagnostic, originally of type ORIG_DIAG_KIND but\n- possibly converted to DIAG_KIND by options such as -Werror.\n+ /* Return the name of the option OPT_ID which enabled a diagnostic,\n+ originally of type ORIG_DIAG_KIND but possibly converted to DIAG_KIND\n+ by options such as -Werror.\n May return NULL if no name is to be printed.\n May be passed 0 as well as the index of a particular option. */\n- virtual char *make_option_name (option_id opt_id,\n-\t\t\t\t enum kind orig_diag_kind,\n-\t\t\t\t enum kind diag_kind) const = 0;\n+ virtual label_text get_option_name (option_id opt_id,\n+\t\t\t\t enum kind orig_diag_kind,\n+\t\t\t\t enum kind diag_kind) const = 0;\n \n- /* Return malloced memory for a URL describing the option that controls\n- a diagnostic.\n+ /* Return a URL describing the option that controls a diagnostic.\n May return NULL if no URL is available.\n May be passed 0 as well as the index of a particular option. */\n- virtual char *make_option_url (option_id opt_id) const = 0;\n+ virtual label_text get_option_url (option_id opt_id) const = 0;\n };\n \n } // namespace diagnostics\ndiff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc\nindex 1e25b459c64..f601dbe7c5f 100644\n--- a/gcc/diagnostics/sarif-sink.cc\n+++ b/gcc/diagnostics/sarif-sink.cc\n@@ -37,6 +37,7 @@ struct sockaddr_un {\n \n #define INCLUDE_LIST\n #define INCLUDE_MAP\n+#define INCLUDE_SET\n #define INCLUDE_STRING\n #define INCLUDE_VECTOR\n #include \"system.h\"\n@@ -1012,7 +1013,7 @@ private:\n \t\t sarif_artifact *> m_filename_to_artifact_map;\n \n bool m_seen_any_relative_paths;\n- hash_set <free_string_hash> m_rule_id_set;\n+ std::set<std::string> m_rule_id_set;\n std::unique_ptr<json::array> m_rules_arr;\n \n /* The set of all CWE IDs we've seen, if any. */\n@@ -2067,25 +2068,24 @@ sarif_builder::make_result_object (const diagnostic_info &diagnostic,\n \n /* \"ruleId\" property (SARIF v2.1.0 section 3.27.5). */\n /* Ideally we'd have an option_name for these. */\n- if (char *option_text\n-\t= m_context.make_option_name (diagnostic.m_option_id,\n-\t\t\t\t orig_diag_kind, diagnostic.m_kind))\n+ label_text option_text\n+ = m_context.get_option_name (diagnostic.m_option_id,\n+\t\t\t\t orig_diag_kind, diagnostic.m_kind);\n+ if (option_text.get ())\n {\n /* Lazily create reportingDescriptor objects for and add to m_rules_arr.\n \t Set ruleId referencing them. */\n- result_obj->set_string (\"ruleId\", option_text);\n- if (m_rule_id_set.contains (option_text))\n-\tfree (option_text);\n- else\n+ result_obj->set_string (\"ruleId\", option_text.get ());\n+ if (m_rule_id_set.find (option_text.get ()) == m_rule_id_set.end ())\n \t{\n \t /* This is the first time we've seen this ruleId. */\n \t /* Add to set, taking ownership. */\n-\t m_rule_id_set.add (option_text);\n+\t m_rule_id_set.insert (option_text.get ());\n \n \t m_rules_arr->append<sarif_reporting_descriptor>\n \t (make_reporting_descriptor_object_for_warning (diagnostic,\n \t\t\t\t\t\t\t orig_diag_kind,\n-\t\t\t\t\t\t\t option_text));\n+\t\t\t\t\t\t\t option_text.get ()));\n \t}\n }\n else\n@@ -2191,11 +2191,9 @@ make_reporting_descriptor_object_for_warning (const diagnostic_info &diagnostic,\n it seems redundant compared to \"id\". */\n \n /* \"helpUri\" property (SARIF v2.1.0 section 3.49.12). */\n- if (char *option_url = m_context.make_option_url (diagnostic.m_option_id))\n- {\n- reporting_desc->set_string (\"helpUri\", option_url);\n- free (option_url);\n- }\n+ label_text option_url = m_context.get_option_url (diagnostic.m_option_id);\n+ if (option_url.get ())\n+ reporting_desc->set_string (\"helpUri\", option_url.get ());\n \n return reporting_desc;\n }\ndiff --git a/gcc/diagnostics/text-sink.cc b/gcc/diagnostics/text-sink.cc\nindex d1bdd15bee3..6f97ca54329 100644\n--- a/gcc/diagnostics/text-sink.cc\n+++ b/gcc/diagnostics/text-sink.cc\n@@ -552,28 +552,25 @@ void\n text_sink::print_option_information (const diagnostic_info &diagnostic,\n \t\t\t\t enum kind orig_diag_kind)\n {\n- if (char *option_text\n- = m_context.make_option_name (diagnostic.m_option_id,\n-\t\t\t\t orig_diag_kind, diagnostic.m_kind))\n+ label_text option_text\n+ = m_context.get_option_name (diagnostic.m_option_id,\n+\t\t\t\t orig_diag_kind, diagnostic.m_kind);\n+ if (option_text.get ())\n {\n- char *option_url = nullptr;\n+ label_text option_url;\n pretty_printer * const pp = get_printer ();\n if (pp->supports_urls_p ())\n-\toption_url = m_context.make_option_url (diagnostic.m_option_id);\n+\toption_url = m_context.get_option_url (diagnostic.m_option_id);\n pp_string (pp, \" [\");\n const char *kind_color = get_color_for_kind (diagnostic.m_kind);\n pp_string (pp, colorize_start (pp_show_color (pp), kind_color));\n- if (option_url)\n-\tpp_begin_url (pp, option_url);\n- pp_string (pp, option_text);\n- if (option_url)\n-\t{\n-\t pp_end_url (pp);\n-\t free (option_url);\n-\t}\n+ if (option_url.get ())\n+\tpp_begin_url (pp, option_url.get ());\n+ pp_string (pp, option_text.get ());\n+ if (option_url.get ())\n+\tpp_end_url (pp);\n pp_string (pp, colorize_stop (pp_show_color (pp)));\n pp_character (pp, ']');\n- free (option_text);\n }\n }\n \ndiff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc\nindex c300655b1d8..a8abbf22c6b 100644\n--- a/gcc/lto-wrapper.cc\n+++ b/gcc/lto-wrapper.cc\n@@ -1381,7 +1381,7 @@ init_num_threads (void)\n void\n print_lto_docs_link ()\n {\n- label_text url = label_text::take (global_dc->make_option_url (OPT_flto));\n+ label_text url = global_dc->get_option_url (OPT_flto);\n inform (UNKNOWN_LOCATION,\n \t \"see the %{%<-flto%> option documentation%} for more information\",\n \t url.get ());\n@@ -2282,11 +2282,12 @@ public:\n {\n return true;\n }\n- char *make_option_name (diagnostics::option_id,\n-\t\t\t enum diagnostics::kind,\n-\t\t\t enum diagnostics::kind) const final override\n+ label_text\n+ get_option_name (diagnostics::option_id,\n+\t\t enum diagnostics::kind,\n+\t\t enum diagnostics::kind) const final override\n {\n- return nullptr;\n+ return label_text::borrow (nullptr);\n }\n };\n \ndiff --git a/gcc/opts-diagnostic.h b/gcc/opts-diagnostic.h\nindex d0a8beddd81..6c2b25d6342 100644\n--- a/gcc/opts-diagnostic.h\n+++ b/gcc/opts-diagnostic.h\n@@ -27,7 +27,8 @@ along with GCC; see the file COPYING3. If not see\n class gcc_diagnostic_option_id_manager : public diagnostics::option_id_manager\n {\n public:\n- char *make_option_url (diagnostics::option_id option_id) const final override;\n+ label_text\n+ get_option_url (diagnostics::option_id option_id) const final override;\n \n protected:\n gcc_diagnostic_option_id_manager (unsigned lang_mask)\n@@ -53,10 +54,11 @@ public:\n }\n \n int option_enabled_p (diagnostics::option_id option_id) const final override;\n- char *\n- make_option_name (diagnostics::option_id option_id,\n-\t\t enum diagnostics::kind orig_diag_kind,\n-\t\t enum diagnostics::kind diag_kind) const final override;\n+\n+ label_text\n+ get_option_name (diagnostics::option_id option_id,\n+\t\t enum diagnostics::kind orig_diag_kind,\n+\t\t enum diagnostics::kind diag_kind) const final override;\n \n private:\n const diagnostics::context &m_context;\ndiff --git a/gcc/opts.cc b/gcc/opts.cc\nindex 6658b6acd37..09baa411cfd 100644\n--- a/gcc/opts.cc\n+++ b/gcc/opts.cc\n@@ -3812,16 +3812,15 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask,\n free (new_option);\n }\n \n-/* Return malloced memory for the name of the option OPTION_INDEX\n- which enabled a diagnostic, originally of type\n- ORIG_DIAG_KIND but possibly converted to DIAG_KIND by options such\n- as -Werror. */\n+/* Return the name of the option OPTION_INDEX which enabled a diagnostic,\n+ originally of type ORIG_DIAG_KIND but possibly converted to DIAG_KIND by\n+ options such as -Werror. Can return null if OPTION_ID is zero. */\n \n-char *\n+label_text\n compiler_diagnostic_option_id_manager::\n-make_option_name (diagnostics::option_id option_id,\n-\t\t enum diagnostics::kind orig_diag_kind,\n-\t\t enum diagnostics::kind diag_kind) const\n+get_option_name (diagnostics::option_id option_id,\n+\t\t enum diagnostics::kind orig_diag_kind,\n+\t\t enum diagnostics::kind diag_kind) const\n {\n if (option_id.m_idx)\n {\n@@ -3829,22 +3828,24 @@ make_option_name (diagnostics::option_id option_id,\n if ((orig_diag_kind == diagnostics::kind::warning\n \t || orig_diag_kind == diagnostics::kind::pedwarn)\n \t && diag_kind == diagnostics::kind::error)\n-\treturn concat (cl_options[OPT_Werror_].opt_text,\n-\t\t /* Skip over \"-W\". */\n-\t\t cl_options[option_id.m_idx].opt_text + 2,\n-\t\t NULL);\n+\treturn label_text::take\n+\t (concat (cl_options[OPT_Werror_].opt_text,\n+\t\t /* Skip over \"-W\". */\n+\t\t cl_options[option_id.m_idx].opt_text + 2,\n+\t\t NULL));\n /* A warning with option. */\n else\n-\treturn xstrdup (cl_options[option_id.m_idx].opt_text);\n+\treturn label_text::take\n+\t (xstrdup (cl_options[option_id.m_idx].opt_text));\n }\n /* A warning without option classified as an error. */\n else if ((orig_diag_kind == diagnostics::kind::warning\n \t || orig_diag_kind == diagnostics::kind::pedwarn\n \t || diag_kind == diagnostics::kind::warning)\n \t && m_context.warning_as_error_requested_p ())\n- return xstrdup (cl_options[OPT_Werror].opt_text);\n+ return label_text::borrow (cl_options[OPT_Werror].opt_text);\n else\n- return NULL;\n+ return label_text ();\n }\n \n /* Get the page within the documentation for this option. */\n@@ -3893,22 +3894,23 @@ get_option_url_suffix (int option_index, unsigned lang_mask)\n return label_text ();\n }\n \n-/* Return malloced memory for a URL describing the option OPTION_INDEX\n- which enabled a diagnostic. */\n+/* Return a URL describing the option OPTION_INDEX which enabled\n+ a diagnostic, or null. */\n \n-char *\n+label_text\n gcc_diagnostic_option_id_manager::\n-make_option_url (diagnostics::option_id option_id) const\n+get_option_url (diagnostics::option_id option_id) const\n {\n if (option_id.m_idx)\n {\n label_text url_suffix = get_option_url_suffix (option_id.m_idx,\n \t\t\t\t\t\t m_lang_mask);\n if (url_suffix.get ())\n-\treturn concat (DOCUMENTATION_ROOT_URL, url_suffix.get (), nullptr);\n+\treturn label_text::take\n+\t (concat (DOCUMENTATION_ROOT_URL, url_suffix.get (), nullptr));\n }\n \n- return nullptr;\n+ return label_text ();\n }\n \n /* Return a heap allocated producer with command line options. */\n", "prefixes": [ "pushed:", "r17-172-g2bb5e43f9c0444" ] }