From: David Malcolm <dmalcolm@redhat.com>
To: Arthur Cohen <arthur.cohen@embecosm.com>, gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org
Subject: Re: [PATCH 1/2] diagnostics: add error_meta
Date: Wed, 06 Sep 2023 10:12:18 -0400 [thread overview]
Message-ID: <7439d81e420de0081658509755a3aa3e55375d39.camel@redhat.com> (raw)
In-Reply-To: <20230906135303.3643659-2-arthur.cohen@embecosm.com>
On Wed, 2023-09-06 at 15:53 +0200, Arthur Cohen wrote:
> From: David Malcolm <dmalcolm@redhat.com>
I guess I can review this patch :)
Needs a ChangeLog entry, so here's one:
gcc/ChangeLog
* diagnostic-core.h (error_meta): New decl.
* diagnostic.cc (error_meta): New.
Also, needs a signed-off-by, so here's one:
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
OK for trunk with those added.
Thanks
Dave
>
> ---
> 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 7334c79e8e6..c9e27fd2e6e 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 c523f215bae..65c0cfbf11a 100644
> --- a/gcc/diagnostic.cc
> +++ b/gcc/diagnostic.cc
> @@ -2108,6 +2108,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. */
next prev parent reply other threads:[~2023-09-06 14:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 13:53 [PATCHSET] Add error metadata to diagnostics Arthur Cohen
2023-09-06 13:53 ` [PATCH 1/2] diagnostics: add error_meta Arthur Cohen
2023-09-06 14:12 ` David Malcolm [this message]
2023-09-06 14:24 ` Arthur Cohen
2023-09-06 13:53 ` [PATCH 2/2] Experiment with adding an error code to an error Arthur Cohen
2023-09-06 14:19 ` David Malcolm
2023-09-07 9:39 ` [PATCHSET] Add error metadata to diagnostics Arthur Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7439d81e420de0081658509755a3aa3e55375d39.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=arthur.cohen@embecosm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-rust@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).