diff options
author | pzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-01 09:56:41 +0000 |
---|---|---|
committer | pzhao <pzhao@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-01 09:56:41 +0000 |
commit | c0ddc4f89b6f2502b6310b0699733eacca1f5e54 (patch) | |
tree | 3c8a51e597c7b2b45c9e3da4413201d7c7bea223 | |
parent | 9b407bc9896d8ca8ce1b3be8a548bee00349ceb9 (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 | ||||
-rw-r--r-- | gcc/diagnostic.c | 34 | ||||
-rw-r--r-- | gcc/po/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/po/exgettext | 8 | ||||
-rw-r--r-- | gcc/toplev.h | 4 |
7 files changed, 66 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eff481ff22d..1e6ab7f51a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-03-01 Marco Poletti <poletti.marco@gmail.com> + + * toplev.h (inform_n, error_n): Declare. + * diagnostic.c (inform_n, error_n): New function. + 2010-03-01 Jakub Jelinek <jakub@redhat.com> * cfgexpand.c (expand_used_vars): If an artificial non-ignored var diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5c2725f4992..556c4ac39fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2010-03-01 Marco Poletti <poletti.marco@gmail.com> + + * pt.c (redeclare_class_template): Use error_n and inform_n. + 2010-02-27 Mark Mitchell <mark@codesourcery.com> PR c++/42748 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ef765738f74..f5d3851cab9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4661,10 +4661,14 @@ redeclare_class_template (tree type, tree parms) if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms)) { - error ("redeclared with %d template parameter(s)", - TREE_VEC_LENGTH (parms)); - inform (input_location, "previous declaration %q+D used %d template parameter(s)", - tmpl, TREE_VEC_LENGTH (tmpl_parms)); + error_n (input_location, TREE_VEC_LENGTH (parms), + "redeclared with %d template parameter", + "redeclared with %d template parameters", + TREE_VEC_LENGTH (parms)); + inform_n (input_location, TREE_VEC_LENGTH (tmpl_parms), + "previous declaration %q+D used %d template parameter", + "previous declaration %q+D used %d template parameters", + tmpl, TREE_VEC_LENGTH (tmpl_parms)); return false; } 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, ...) diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index fd96f1d0057..8a22b0c67a3 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2010-03-01 Shujing Zhao <pearly.zhao@oracle.com> + + * exgettext: Handle the functions that end with _n. + 2010-02-24 Joseph Myers <joseph@codesourcery.com> * zh_CN.po: Update. diff --git a/gcc/po/exgettext b/gcc/po/exgettext index 35f81a7d172..a85f705f820 100644 --- a/gcc/po/exgettext +++ b/gcc/po/exgettext @@ -113,9 +113,15 @@ function keyword_option(line) { format="c-format" if (n == 1) { keyword = "--keyword=" name } - else { keyword = "--keyword=" name ":" n } + else { + keyword = "--keyword=" name ":" n + if (name ~ /_n$/) + keyword = keyword "," (n + 1) + } if (format) { keyword=keyword "\n--flag=" name ":" n ":" format + if (name ~ /_n$/) + keyword = keyword "\n--flag=" name ":" (n + 1) ":" format } if (! keyword_seen[name]) { diff --git a/gcc/toplev.h b/gcc/toplev.h index 983022eff69..2b2a2918c26 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -63,6 +63,8 @@ extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool warning_at (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); 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); extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; @@ -72,6 +74,8 @@ extern bool pedwarn (location_t, int, const char *, ...) extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void inform_n (location_t, int, const char *, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); extern void rest_of_decl_compilation (tree, int, int); |