aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 8e39cca..d5144b4 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2327,3 +2327,36 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
#undef next_lang
#undef next_int
}
+
+/* Callback from cpp_error for PFILE to print diagnostics arising from
+ interpreting strings. The diagnostic is of type LEVEL; MSG is the
+ translated message and AP the arguments. */
+
+void
+cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
+ const char *msg, va_list ap)
+{
+ diagnostic_info diagnostic;
+ diagnostic_t dlevel;
+ switch (level)
+ {
+ case CPP_DL_WARNING:
+ case CPP_DL_WARNING_SYSHDR:
+ dlevel = DK_WARNING;
+ break;
+ case CPP_DL_PEDWARN:
+ dlevel = pedantic_error_kind ();
+ break;
+ case CPP_DL_ERROR:
+ dlevel = DK_ERROR;
+ break;
+ case CPP_DL_ICE:
+ dlevel = DK_ICE;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ diagnostic_set_info_translated (&diagnostic, msg, &ap,
+ input_location, dlevel);
+ report_diagnostic (&diagnostic);
+}