aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-09-20 05:06:26 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-09-20 03:06:26 +0000
commit26e82579383ea5d8fcf2149eaba65708893f58dc (patch)
tree2944385c8add22c4bd448d6f39c1915d60932eaf /gcc/diagnostic.c
parent1acc55917e1afae9eed569f45653a122fd99af99 (diff)
downloadgcc-26e82579383ea5d8fcf2149eaba65708893f58dc.zip
gcc-26e82579383ea5d8fcf2149eaba65708893f58dc.tar.gz
gcc-26e82579383ea5d8fcf2149eaba65708893f58dc.tar.bz2
diagnostic.c (warning_n): New function.
* diagnostic.c (warning_n): New function. * diagnostic-core.h (warning_n): Declare. * ipa-devirt.c (ipa_devirt): Handle singulars correctly; output dynamic counts when available. From-SVN: r215416
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 73666d6..881da0b 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -997,6 +997,28 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
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. */
+
+bool
+warning_n (location_t location, int opt, int n, const char *singular_gmsgid,
+ const char *plural_gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+ bool ret;
+
+ va_start (ap, plural_gmsgid);
+ diagnostic_set_info_translated (&diagnostic,
+ ngettext (singular_gmsgid, plural_gmsgid, n),
+ &ap, location, DK_WARNING);
+ diagnostic.option_index = opt;
+ ret = report_diagnostic (&diagnostic);
+ va_end (ap);
+ return ret;
+}
+
/* A "pedantic" warning at LOCATION: 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