ATTRIBUTE_GCC_DIAG(3,4);
extern bool warning_at_rich_loc (rich_location *, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
+extern bool warning_at_rich_loc_n (rich_location *, int, int, const char *,
+ const char *, ...)
+ ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void error_n (location_t, int, const char *, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
static bool diagnostic_n_impl (location_t, int, int, const char *,
const char *, va_list *,
diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
+static bool diagnostic_n_impl_richloc (rich_location *, int, int, const char *,
+ const char *, va_list *,
+ diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
+
static void error_recursion (diagnostic_context *) ATTRIBUTE_NORETURN;
static void real_abort (void) ATTRIBUTE_NORETURN;
return report_diagnostic (&diagnostic);
}
+/* Same as diagonostic_n_impl taking rich_location instead of location_t. */
+static bool
+diagnostic_n_impl_richloc (rich_location *richloc, int opt, int n,
+ const char *singular_gmsgid,
+ const char *plural_gmsgid,
+ va_list *ap, diagnostic_t kind)
+{
+ diagnostic_info diagnostic;
+ diagnostic_set_info_translated (&diagnostic,
+ ngettext (singular_gmsgid, plural_gmsgid, n),
+ ap, richloc, kind);
+ if (kind == DK_WARNING)
+ diagnostic.option_index = opt;
+ return report_diagnostic (&diagnostic);
+}
+
/* Implement inform_n, warning_n, and error_n, as documented and
defined below. */
static bool
const char *plural_gmsgid,
va_list *ap, diagnostic_t kind)
{
- diagnostic_info diagnostic;
rich_location richloc (line_table, location);
- diagnostic_set_info_translated (&diagnostic,
- ngettext (singular_gmsgid, plural_gmsgid, n),
- ap, &richloc, kind);
- if (kind == DK_WARNING)
- diagnostic.option_index = opt;
- return report_diagnostic (&diagnostic);
+ return diagnostic_n_impl_richloc (&richloc, opt, n,
+ singular_gmsgid, plural_gmsgid, ap, kind);
}
bool
return ret;
}
+/* Same as warning_at_rich_loc but for plural variant. */
+
+bool
+warning_at_rich_loc_n (rich_location *richloc, int opt, int n,
+ const char *singular_gmsgid, const char *plural_gmsgid, ...)
+{
+ va_list ap;
+ va_start (ap, plural_gmsgid);
+ bool ret = diagnostic_n_impl_richloc (richloc, opt, n,
+ singular_gmsgid, plural_gmsgid,
+ &ap, DK_WARNING);
+ va_end (ap);
+ return ret;
+}
+
/* A warning at LOCATION. Use this for code which is correct according to the
relevant language specification but is likely to be buggy anyway.
Returns true if the warning was printed, false if it was inhibited. */