summaryrefslogtreecommitdiffstats
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 5a6aaee914d..c6500d81d26 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -299,13 +299,14 @@ void
diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
+ location_t location = diagnostic->location;
bool maybe_print_warnings_as_errors_message = false;
const char *saved_format_spec;
/* Give preference to being able to inhibit warnings, before they
get reclassified to something else. */
if (diagnostic->kind == DK_WARNING
- && !diagnostic_report_warnings_p ())
+ && !diagnostic_report_warnings_p (location))
return;
if (context->lock > 0)
@@ -470,8 +471,8 @@ inform (const char *gmsgid, ...)
va_end (ap);
}
-/* A warning. Use this for code which is correct according to the
- relevant language specification but is likely to be buggy anyway. */
+/* A warning at INPUT_LOCATION. Use this for code which is correct according
+ to the relevant language specification but is likely to be buggy anyway. */
void
warning (int opt, const char *gmsgid, ...)
{
@@ -498,6 +499,22 @@ warning0 (const char *gmsgid, ...)
va_end (ap);
}
+/* A warning at LOCATION. Use this for code which is correct according to the
+ relevant language specification but is likely to be buggy anyway. */
+void
+warning_at (location_t location, int opt, const char *gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
+ diagnostic.option_index = opt;
+
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}
+
/* A "pedantic" warning: issues a warning unless -pedantic-errors was
given on the command line, in which case it issues an error. Use
this for diagnostics required by the relevant language standard,
OpenPOWER on IntegriCloud