From patchwork Mon Nov 6 19:49:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 162152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2890516vqu; Mon, 6 Nov 2023 11:50:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeMO+bQ3h35SWwpalod05Pmaw+8+LTmhSoMyCCxBg0jLXV5ZSwpCTYQlTASBI2feLAstB3 X-Received: by 2002:a05:622a:1113:b0:41c:cda8:9981 with SMTP id e19-20020a05622a111300b0041ccda89981mr36618602qty.64.1699300206634; Mon, 06 Nov 2023 11:50:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699300206; cv=pass; d=google.com; s=arc-20160816; b=BM776jtq1BnLGThvxplyl4VMf4SxhN//224ut1v9X+3kVtSvlOw9C8MehXWeRHH/uc 2HMO5I1FZOgXiNAaH670pXyd899fW2Nz8M6NGwf8Q6N4ZpodQEJg9LuA8aVgRSW13o3E LnnJPsTWG8RxqvqT+X561JKEPVZMT24PT2vq7iVZW8CVZQo7CZc/YFJl1VRsyX0ItpJT FtU9/+rlP+x7Kt9e7MXhRWdOn2C5hV8Dhu+x4Lx35QCcaTIPgRjbx+7hJ0B8dwFx7gPI Rzw/l7gl4qGgVT1/Z4rBKOxPcNG/o6XfGicCG39OAoB6ErgNVZkKotI/n1hBvTOL9Faw wsRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=h2YiQ9p3vgE6XyoaQTnOROuPiJXA4mHvkEaVDezzd5M=; fh=NXemEfxTRbZtBxUkxR2ehQUaYlcDfMdzPkO8MChVQE4=; b=0Lmzyz0Dr7xvGaLSeoF6VkJu/BO11Flz35gvfuxuJVklM6X4nVhy0x6sYrw1U4Rqvo XIE1Ohcykf4d/y98Xpxk8JkJ5m5eBJmJSvAM59eVrIozIm5IfxZyAi+pGPj84edUDWpT Tfxb7GnZ/VuLZo5VxgZ9JLSFqgRgwi7BjiCjinaueId4JdjZse75o+yE1iS3D5oCxE8C DX03I6RUMaFRCbWSERwVe7Fjs7dTGk/QlYu5op28UVGHjvru6tj1BUab6IfgEFXbsgZc heG6e2a8/rpgPlq2kQCN8uvv2rB/uRITMBRjWzobWLEoXOiwUrWEseffiS+zPP6GyqV7 EfFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E8ugu9iS; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y9-20020a05622a164900b004181a080726si6284371qtj.659.2023.11.06.11.50.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:50:06 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E8ugu9iS; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14249385B527 for ; Mon, 6 Nov 2023 19:50:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6AA393858C54 for ; Mon, 6 Nov 2023 19:49:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AA393858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AA393858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699300181; cv=none; b=oPSE14cGdN9tAPx0EIGfYJU4fuYLr4GkUvzx2Zijlj1rrx+iLW/lUYD/X52/oZLXNMaXSZXNG+vg22NtAa3Utu3sxFF2hRosJdbPxKAjNQ+5+qZO+UUEvzq/hBvl/NHIlPCyWuPxI5gsBssCM7Y9eMhaXr+7rLTcNyjRamto79Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699300181; c=relaxed/simple; bh=zeuFf5r3tV7w7+Kjeir/06f+Zn5T02YD0xbTllzjguY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=f2OBXNh6IC6ftoSspye3KfXPpetyyaGlg/AM2Swc2c6asRiAub5s/qrPKDx+uZi4T9FMi3GabQEIPR3OgvZLNqx6tZXyCCvH9MNERwEW4ad3biMEF1QvfCNNEyLnOCNlZ7Tou6BfzdVwi1wPi3CTP2Jn5Bv2SuT1JFmHf02YZPk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699300180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h2YiQ9p3vgE6XyoaQTnOROuPiJXA4mHvkEaVDezzd5M=; b=E8ugu9iSxpSOqn7mv3cqWcHcCliLUYOEEnMLJwoR8ABlw88/aPc7MZ0W2HNDsGYBDHB0WE o2fInMEa6vQ8AVlIlCvAVCza2nqAsRMIHAooaougGH4S4pNVTMaq4jak0a2/FcK8BhoROA gcbR2SF1+NTQwu+NR9qj6Q8OeehRBeM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-Ao75o3oRP_6ngZ623AqL7g-1; Mon, 06 Nov 2023 14:49:38 -0500 X-MC-Unique: Ao75o3oRP_6ngZ623AqL7g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A43F3C23FC6 for ; Mon, 6 Nov 2023 19:49:38 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.8.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23C9A25C0; Mon, 6 Nov 2023 19:49:38 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed 2/4] diagnostics: make diagnostic_context::m_urlifier private Date: Mon, 6 Nov 2023 14:49:33 -0500 Message-Id: <20231106194935.2693735-2-dmalcolm@redhat.com> In-Reply-To: <20231106194935.2693735-1-dmalcolm@redhat.com> References: <20231106194935.2693735-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781845413706469442 X-GMAIL-MSGID: 1781845413706469442 No functional change intended. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-5167-ga526cc6ff32e22. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::set_urlifier): New. * diagnostic.h (diagnostic_context::set_urlifier): New decl. (diagnostic_context::m_urlifier): Make private. * gcc.cc (driver::global_initializations): Use set_urlifier rather than directly setting field. * toplev.cc (general_init): Likewise. --- gcc/diagnostic.cc | 8 ++++++++ gcc/diagnostic.h | 3 +++ gcc/gcc.cc | 2 +- gcc/toplev.cc | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 90103e150f7..c617b34f02b 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -373,6 +373,14 @@ diagnostic_context::set_client_data_hooks (diagnostic_client_data_hooks *hooks) m_client_data_hooks = hooks; } +void +diagnostic_context::set_urlifier (urlifier *urlifier) +{ + /* Ideally we'd use a std::unique_ptr here. */ + delete m_urlifier; + m_urlifier = urlifier; +} + void diagnostic_context::create_edit_context () { diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 4ef031b5d1c..f9950ec2cf8 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -297,6 +297,7 @@ public: void set_output_format (diagnostic_output_format *output_format); void set_text_art_charset (enum diagnostic_text_art_charset charset); void set_client_data_hooks (diagnostic_client_data_hooks *hooks); + void set_urlifier (urlifier *); void create_edit_context (); void set_warning_as_error_requested (bool val) { @@ -518,10 +519,12 @@ public: particular option. */ char *(*m_get_option_url) (diagnostic_context *, int); +private: /* An optional hook for adding URLs to quoted text strings in diagnostics. Only used for the main diagnostic message. */ urlifier *m_urlifier; +public: void (*m_print_path) (diagnostic_context *, const diagnostic_path *); json::value *(*m_make_json_for_path) (diagnostic_context *, const diagnostic_path *); diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 02464958f36..51120c1489e 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -8292,7 +8292,7 @@ driver::global_initializations () diagnostic_initialize (global_dc, 0); diagnostic_color_init (global_dc); diagnostic_urls_init (global_dc); - global_dc->m_urlifier = make_gcc_urlifier (); + global_dc->set_urlifier (make_gcc_urlifier ()); #ifdef GCC_DRIVER_HOST_INITIALIZATION /* Perform host dependent initialization when needed. */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index e39162a3e49..d8e8978dd55 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -1049,7 +1049,7 @@ general_init (const char *argv0, bool init_signals) global_dc->m_option_state = &global_options; global_dc->m_option_name = option_name; global_dc->m_get_option_url = get_option_url; - global_dc->m_urlifier = make_gcc_urlifier (); + global_dc->set_urlifier (make_gcc_urlifier ()); if (init_signals) {