From patchwork Wed Jun 22 22:34:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1646804 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=nN1eu5nT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LSyrw4PqBz9sGp for ; Thu, 23 Jun 2022 08:35:43 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CAAC383067B for ; Wed, 22 Jun 2022 22:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CAAC383067B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1655937340; bh=d3bEMBUMl1+fYz5nb5evTderVNcCEvQ36ULMgE7W5WA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nN1eu5nTpKQCAeltLMHc3S8AlOk4Fgyof9il60bRX5FKSBE/MQH8GImjfFMvo6QWA n62lvro93ZKSxYjj1857KfJ2F9QVUT2NKhknxAt17qn+SlMO4caMfeJht/8YQeXyYJ mvrVbH0lqvkYFLT3QqTu2KLyOJmvOFViVZxz+zF4= 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 AD2CD3830666 for ; Wed, 22 Jun 2022 22:34:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AD2CD3830666 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-187-sk5s_WgLP2CLKWfNXcZ9qQ-1; Wed, 22 Jun 2022 18:34:49 -0400 X-MC-Unique: sk5s_WgLP2CLKWfNXcZ9qQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 113D98032EC for ; Wed, 22 Jun 2022 22:34:49 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id E26921121314; Wed, 22 Jun 2022 22:34:48 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH 03/12] Add more emit_diagnostic overloads Date: Wed, 22 Jun 2022 18:34:38 -0400 Message-Id: <20220622223447.2462880-4-dmalcolm@redhat.com> In-Reply-To: <20220622223447.2462880-1-dmalcolm@redhat.com> References: <20220622223447.2462880-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.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_LOW, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * diagnostic-core.h (emit_diagnostic): New overload. (emit_diagnostic_valist): New overload. * diagnostic.cc (emit_diagnostic): New overload. (emit_diagnostic_valist): New overload. Signed-off-by: David Malcolm --- gcc/diagnostic-core.h | 7 +++++++ gcc/diagnostic.cc | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index 286954ac2f8..53f39a110e4 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -114,8 +114,15 @@ extern bool emit_diagnostic (diagnostic_t, location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); extern bool emit_diagnostic (diagnostic_t, rich_location *, int, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); +extern bool emit_diagnostic (diagnostic_t, rich_location *, + const diagnostic_metadata *, int, + const char *, ...) ATTRIBUTE_GCC_DIAG(5,6); extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *, va_list *) ATTRIBUTE_GCC_DIAG (4,0); +extern bool emit_diagnostic_valist (diagnostic_t, rich_location *, + const diagnostic_metadata *, int, + const char *, va_list *) + ATTRIBUTE_GCC_DIAG (5,0); extern bool seen_error (void); #ifdef BUFSIZ diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 22f7b0b6d6e..8099f585bfb 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -1769,6 +1769,21 @@ emit_diagnostic (diagnostic_t kind, rich_location *richloc, int opt, return ret; } +/* As above, but with optional metadata. */ + +bool +emit_diagnostic (diagnostic_t kind, rich_location *richloc, + const diagnostic_metadata *metadata, int opt, + const char *gmsgid, ...) +{ + auto_diagnostic_group d; + va_list ap; + va_start (ap, gmsgid); + bool ret = diagnostic_impl (richloc, metadata, opt, gmsgid, &ap, kind); + va_end (ap); + return ret; +} + /* Wrapper around diagnostic_impl taking a va_list parameter. */ bool @@ -1779,6 +1794,16 @@ emit_diagnostic_valist (diagnostic_t kind, location_t location, int opt, return diagnostic_impl (&richloc, NULL, opt, gmsgid, ap, kind); } +/* As above, but with optional metadata. */ + +bool +emit_diagnostic_valist (diagnostic_t kind, rich_location *richloc, + const diagnostic_metadata *metadata, int opt, + const char *gmsgid, va_list *ap) +{ + return diagnostic_impl (richloc, metadata, opt, gmsgid, ap, kind); +} + /* An informative note at LOCATION. Use this for additional details on an error message. */ void