]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostics: add error_meta
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 21 Jul 2022 22:35:01 +0000 (18:35 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 7 Sep 2023 09:31:55 +0000 (11:31 +0200)
gcc/ChangeLog:

* diagnostic-core.h (error_meta): New decl.
* diagnostic.cc (error_meta): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic-core.h
gcc/diagnostic.cc

index 7334c79e8e6ad06a03657c91a02930413968bed9..c9e27fd2e6e1a90168862a8f77d77f8b081f926d 100644 (file)
@@ -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.  */
index c523f215baec25370dc4ef91b705306e687d18db..65c0cfbf11a5aee82f1b42ca0ad62812cc4841b9 100644 (file)
@@ -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.  */