summaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@gcc.gnu.org>2005-07-02 11:55:32 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2005-07-02 11:55:32 +0100
commitdee158440e16ef7272d823b9bd5e6d414968fd8a (patch)
tree3bc7f52a01952579e89d69c80d985e655c418278 /gcc/cp/error.c
parent77008252819720c987f11b3dade670e2b3ba09b8 (diff)
downloadgcc-dee158440e16ef7272d823b9bd5e6d414968fd8a.tar.gz
toplev.c (default_tree_printer): Handle setting location with '+' flag.
2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c125
1 files changed, 2 insertions, 123 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index fd222be914e..6d80fc6b290 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -88,7 +88,6 @@ static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
static bool cp_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool);
-static tree locate_error (const char *, va_list);
static location_t location_of (tree);
void
@@ -1943,6 +1942,8 @@ lang_decl_name (tree decl, int v)
return pp_formatted_text (cxx_pp);
}
+/* Return the location of a tree passed to %+ formats. */
+
static location_t
location_of (tree t)
{
@@ -2311,125 +2312,3 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
#undef next_lang
#undef next_int
}
-
-/* These are temporary wrapper functions which handle the historic
- behavior of cp_*_at. */
-
-static tree
-locate_error (const char *gmsgid, va_list ap)
-{
- tree here = 0, t;
- int plus = 0;
- const char *f;
-
- for (f = gmsgid; *f; f++)
- {
- plus = 0;
- if (*f == '%')
- {
- if (*++f == 'q')
- ++f; /* ignore quoting flag. */
-
- if (*f == '+')
- {
- ++f;
- plus = 1;
- }
- if (*f == '#')
- f++;
-
- switch (*f)
- {
- /* Just ignore these possibilities. */
- case '%': break;
- case 'P':
- case 'd': (void) va_arg (ap, int); break;
- case 's': (void) va_arg (ap, char *); break;
- case 'L': (void) va_arg (ap, enum languages); break;
- case 'C':
- case 'O':
- case 'Q': (void) va_arg (ap, enum tree_code); break;
-
- /* These take a tree, which may be where the error is
- located. */
- case 'A':
- case 'D':
- case 'E':
- case 'F':
- case 'T':
- case 'V':
- t = va_arg (ap, tree);
- if (!here || plus)
- here = t;
- break;
-
- default:
- errorcount = 0; /* damn ICE suppression */
- internal_error ("unexpected letter %qc in locate_error\n", *f);
- }
- }
- }
-
- if (here == 0)
- here = va_arg (ap, tree);
-
- return here;
-}
-
-
-void
-cp_error_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- input_location, DK_ERROR);
- cp_diagnostic_starter (global_dc, &diagnostic);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), DK_ERROR);
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
-
-void
-cp_warning_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), DK_WARNING);
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
-
-void
-cp_pedwarn_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), pedantic_error_kind());
- report_diagnostic (&diagnostic);
- va_end (ap);
-}