From patchwork Mon Oct 14 23:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1997127 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QEio+pIL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XSD1l3fPKz1xv6 for ; Tue, 15 Oct 2024 10:28:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A340385AC30 for ; Mon, 14 Oct 2024 23:28:25 +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 ESMTP id 9B3823858C98 for ; Mon, 14 Oct 2024 23:28:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B3823858C98 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 9B3823858C98 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=1728948485; cv=none; b=SZpKINV7puHKSjk8xcz8edoMrFvuyABdvbX3HY2pN7TtR7zbwPc85opjKuLdL293F4K10pga9hv4UsiG/3mD11xrvT7DZDzENYJBL3lsFhtDYC1egWXw4ge4ET0t6V7JJ9bkqgJk9fC1mz6a/eKeI29AAhYmTl+R+9OxiBhM64A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728948485; c=relaxed/simple; bh=MeqoA/ZJdNTNUrd86fjceimL+HbxZiYyH4/vAwnR4yU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ALvxJu7s+X4P39CwZVeVMtBTPYKaVCv38kI/25CEwLxX2E4B9Dl01TNF7CaZPJDxrfFDM+LV27QiTuaeeFA3861dKF0R30qApce8Gf6+6ue9+P9R86Sj766RC+szCTNkoarRfPAMJQUd3/Nt7oYxDbazkix3CQGEV5kUGtNl1CI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728948483; 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; bh=UCB43ILU5hXPNocdhtUWLcW/uRgv9/Lwm3BVep2sKgE=; b=QEio+pILIxF21+xJeYq/eVs2b0eQtbKD2sFCt6hXKrxABit7W9D7G3Ly4foGPJhraGxHL3 /u8x2V0WrvLrZFNXMHwUL1rrdpum+AcPZQM4G7NuQgytv784gblR9DFEnrDrDYvsrg8r44 k7+v4TX6n7BJrK/Z5aRmIYVJI7xCBqc= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-647-ShAHFXDGN5uJgPA0zeK7qQ-1; Mon, 14 Oct 2024 19:28:02 -0400 X-MC-Unique: ShAHFXDGN5uJgPA0zeK7qQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 28FCE19560AB for ; Mon, 14 Oct 2024 23:28:01 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.65.14]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0FDE519560AA; Mon, 14 Oct 2024 23:27:59 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed: r15-4343] diagnostics: fix overload of emit_diagnostic [PR117109] Date: Mon, 14 Oct 2024 19:27:56 -0400 Message-ID: <20241014232756.467007-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.1 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_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP 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~incoming=patchwork.ozlabs.org@gcc.gnu.org I accidentally broke "make gcc.pot" in r15-4081 by adding a member function diagnostic_context::emit_diagnostic with a gmsgid in a different position to the existing emit_diagnostic functions, which exgettext's parser can't handle. Fixed thusly. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Manually verified that this fixes the "make gcc.pot" error seen in PR bootstrap/117109. Pushed to trunk as r15-4343-g23e7b702521aa5 gcc/ChangeLog: PR bootstrap/117109 * diagnostic-format-sarif.cc (diagnostic_output_format_init_sarif_file): Rename diagnostic_context::emit_diagnostic to diagnostic_context::emit_diagnostic_with_group. * diagnostic.cc (diagnostic_context::emit_diagnostic): Rename to... (diagnostic_context::emit_diagnostic_with_group): ...this. (diagnostic_context::emit_diagnostic_va): Rename to... (diagnostic_context::emit_diagnostic_with_group_va): ...this. * diagnostic.h (diagnostic_context::emit_diagnostic): Rename to... (diagnostic_context::emit_diagnostic_with_group): ...this. (diagnostic_context::emit_diagnostic_va): Rename to... (diagnostic_context::emit_diagnostic_with_group_va): ...this. Signed-off-by: David Malcolm --- gcc/diagnostic-format-sarif.cc | 12 +++++++----- gcc/diagnostic.cc | 26 ++++++++++++++------------ gcc/diagnostic.h | 20 ++++++++++---------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc index f053dec19205..70832513b6d9 100644 --- a/gcc/diagnostic-format-sarif.cc +++ b/gcc/diagnostic-format-sarif.cc @@ -3435,8 +3435,9 @@ diagnostic_output_format_init_sarif_file (diagnostic_context &context, if (!base_file_name) { rich_location richloc (line_maps, UNKNOWN_LOCATION); - context.emit_diagnostic (DK_ERROR, richloc, nullptr, 0, - "unable to determine filename for SARIF output"); + context.emit_diagnostic_with_group + (DK_ERROR, richloc, nullptr, 0, + "unable to determine filename for SARIF output"); return; } @@ -3447,9 +3448,10 @@ diagnostic_output_format_init_sarif_file (diagnostic_context &context, if (!outf) { rich_location richloc (line_maps, UNKNOWN_LOCATION); - context.emit_diagnostic (DK_ERROR, richloc, nullptr, 0, - "unable to open %qs for SARIF output: %m", - filename.get ()); + context.emit_diagnostic_with_group + (DK_ERROR, richloc, nullptr, 0, + "unable to open %qs for SARIF output: %m", + filename.get ()); return; } diagnostic_output_file output_file (outf, true, std::move (filename)); diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 9647e1382dd1..41656a607b81 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -1160,18 +1160,19 @@ diagnostic_context::warning_enabled_at (location_t loc, /* Emit a diagnostic within a diagnostic group on this context. */ bool -diagnostic_context::emit_diagnostic (diagnostic_t kind, - rich_location &richloc, - const diagnostic_metadata *metadata, - diagnostic_option_id option_id, - const char *gmsgid, ...) +diagnostic_context:: +emit_diagnostic_with_group (diagnostic_t kind, + rich_location &richloc, + const diagnostic_metadata *metadata, + diagnostic_option_id option_id, + const char *gmsgid, ...) { begin_group (); va_list ap; va_start (ap, gmsgid); - bool ret = emit_diagnostic_va (kind, richloc, metadata, option_id, - gmsgid, &ap); + bool ret = emit_diagnostic_with_group_va (kind, richloc, metadata, option_id, + gmsgid, &ap); va_end (ap); end_group (); @@ -1182,11 +1183,12 @@ diagnostic_context::emit_diagnostic (diagnostic_t kind, /* As above, but taking a va_list *. */ bool -diagnostic_context::emit_diagnostic_va (diagnostic_t kind, - rich_location &richloc, - const diagnostic_metadata *metadata, - diagnostic_option_id option_id, - const char *gmsgid, va_list *ap) +diagnostic_context:: +emit_diagnostic_with_group_va (diagnostic_t kind, + rich_location &richloc, + const diagnostic_metadata *metadata, + diagnostic_option_id option_id, + const char *gmsgid, va_list *ap) { begin_group (); diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 7ca9607707d2..83d73d2c4b70 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -505,17 +505,17 @@ public: return m_option_classifier.option_unspecified_p (option_id); } - bool emit_diagnostic (diagnostic_t kind, - rich_location &richloc, - const diagnostic_metadata *metadata, - diagnostic_option_id option_id, - const char *gmsgid, ...) + bool emit_diagnostic_with_group (diagnostic_t kind, + rich_location &richloc, + const diagnostic_metadata *metadata, + diagnostic_option_id option_id, + const char *gmsgid, ...) ATTRIBUTE_GCC_DIAG(6,7); - bool emit_diagnostic_va (diagnostic_t kind, - rich_location &richloc, - const diagnostic_metadata *metadata, - diagnostic_option_id option_id, - const char *gmsgid, va_list *ap) + bool emit_diagnostic_with_group_va (diagnostic_t kind, + rich_location &richloc, + const diagnostic_metadata *metadata, + diagnostic_option_id option_id, + const char *gmsgid, va_list *ap) ATTRIBUTE_GCC_DIAG(6,0); bool report_diagnostic (diagnostic_info *);