summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorShujing Zhao <pzhao@gcc.gnu.org>2010-03-01 09:56:41 +0000
committerShujing Zhao <pzhao@gcc.gnu.org>2010-03-01 09:56:41 +0000
commit894e2652e19f83190daab172efb846d568fb5e11 (patch)
tree3c8a51e597c7b2b45c9e3da4413201d7c7bea223 /gcc/diagnostic.c
parentfef06326e1d9b67939f0fdff8b36e2c1dd9eaa2d (diff)
downloadgcc-894e2652e19f83190daab172efb846d568fb5e11.tar.gz
toplev.h (inform_n, error_n): Declare.
gcc/ 2010-03-01 Marco Poletti <poletti.marco@gmail.com> * toplev.h (inform_n, error_n): Declare. * diagnostic.c (inform_n, error_n): New function. gcc/cp/ 2010-03-01 Marco Poletti <poletti.marco@gmail.com> * pt.c (redeclare_class_template): Use error_n and inform_n. gcc/po 2010-03-01 Shujing Zhao <pearly.zhao@oracle.com> * exgettext: Handle the functions that end with _n. From-SVN: r157134
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 4322d654935..2bdeb881858 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -520,6 +520,23 @@ inform (location_t location, const char *gmsgid, ...)
va_end (ap);
}
+/* An informative note at LOCATION. Use this for additional details on an
+ error message. */
+void
+inform_n (location_t location, int n, const char *singular_gmsgid,
+ const char *plural_gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, plural_gmsgid);
+ diagnostic_set_info_translated (&diagnostic,
+ ngettext (singular_gmsgid, plural_gmsgid, n),
+ &ap, location, DK_NOTE);
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}
+
/* 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.
Returns true if the warning was printed, false if it was inhibited. */
@@ -615,6 +632,23 @@ error (const char *gmsgid, ...)
va_end (ap);
}
+/* A hard error: the code is definitely ill-formed, and an object file
+ will not be produced. */
+void
+error_n (location_t location, int n, const char *singular_gmsgid,
+ const char *plural_gmsgid, ...)
+{
+ diagnostic_info diagnostic;
+ va_list ap;
+
+ va_start (ap, plural_gmsgid);
+ diagnostic_set_info_translated (&diagnostic,
+ ngettext (singular_gmsgid, plural_gmsgid, n),
+ &ap, location, DK_ERROR);
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}
+
/* Same as ebove, but use location LOC instead of input_location. */
void
error_at (location_t loc, const char *gmsgid, ...)