aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-20 03:06:26 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-20 03:06:26 +0000
commit1b35579354b822bd5d2a440693b2f0e211d5b1d5 (patch)
tree2944385c8add22c4bd448d6f39c1915d60932eaf /gcc/diagnostic.c
parent38889e9875adacc954b5885f2f2f98d718a04ca5 (diff)
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215416 138bc75d-0d04-0410-961f-82ee72b054a4
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 73666d62fc7..881da0b8045 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