summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorpzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-01 09:56:41 +0000
committerpzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-01 09:56:41 +0000
commitc0ddc4f89b6f2502b6310b0699733eacca1f5e54 (patch)
tree3c8a51e597c7b2b45c9e3da4413201d7c7bea223 /gcc/diagnostic.c
parent9b407bc9896d8ca8ce1b3be8a548bee00349ceb9 (diff)
downloadgcc-c0ddc4f89b6f2502b6310b0699733eacca1f5e54.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157134 138bc75d-0d04-0410-961f-82ee72b054a4
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, ...)