From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 4616638582BF; Wed, 31 Aug 2022 10:40:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4616638582BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661942455; bh=fSfaHsBDs21QHqiAxM2+8Xs+6DnqFIKlYYqDt7EK3vw=; h=From:To:Subject:Date:From; b=HQtCHdFoqSA09E/NewzQsSeX3yyZI4vtOLv2kt8emyLsc9JqOjibunXuTqPvtnZTO R3Eblrcq1/2sSx/wvPrKUSOSQY/e4xsFeBSFY0owKkulQEk/6sH1q4/SC2mQ2zviHO jAxkohZ0Whe1nyOk/FrVv1ItunFyTJA4H7bhm16c= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] diagnostics: add error_meta X-Act-Checkin: gcc X-Git-Author: David Malcolm X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 64c7a90934f03630356c76d7aa9ba6978ee4e9e6 X-Git-Newrev: 05f1f87274a4ed13c0ab84de77d4253776b46637 Message-Id: <20220831104055.4616638582BF@sourceware.org> Date: Wed, 31 Aug 2022 10:40:55 +0000 (GMT) List-Id: https://gcc.gnu.org/g:05f1f87274a4ed13c0ab84de77d4253776b46637 commit 05f1f87274a4ed13c0ab84de77d4253776b46637 Author: David Malcolm Date: Thu Jul 21 18:35:01 2022 -0400 diagnostics: add error_meta Diff: --- gcc/diagnostic-core.h | 3 +++ gcc/diagnostic.cc | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index 286954ac2f8..ff74994a62e 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -92,6 +92,9 @@ extern void error_n (location_t, unsigned HOST_WIDE_INT, const char *, extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void error_at (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void error_meta (rich_location *, const diagnostic_metadata &, + const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the second parameter. */ diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 22f7b0b6d6e..0461b325efb 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -2050,6 +2050,21 @@ error_at (rich_location *richloc, const char *gmsgid, ...) va_end (ap); } +/* Same as above, but with metadata. */ + +void +error_meta (rich_location *richloc, const diagnostic_metadata &metadata, + const char *gmsgid, ...) +{ + gcc_assert (richloc); + + auto_diagnostic_group d; + va_list ap; + va_start (ap, gmsgid); + diagnostic_impl (richloc, &metadata, -1, gmsgid, &ap, DK_ERROR); + va_end (ap); +} + /* "Sorry, not implemented." Use for a language feature which is required by the relevant specification but not implemented by GCC. An object file will not be produced. */