diff options
author | Joseph Myers <jsm28@gcc.gnu.org> | 2005-07-02 11:55:32 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-07-02 11:55:32 +0100 |
commit | dee158440e16ef7272d823b9bd5e6d414968fd8a (patch) | |
tree | 3bc7f52a01952579e89d69c80d985e655c418278 /gcc/cp | |
parent | 77008252819720c987f11b3dade670e2b3ba09b8 (diff) | |
download | gcc-dee158440e16ef7272d823b9bd5e6d414968fd8a.zip gcc-dee158440e16ef7272d823b9bd5e6d414968fd8a.tar.gz gcc-dee158440e16ef7272d823b9bd5e6d414968fd8a.tar.bz2 |
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')
-rw-r--r-- | gcc/cp/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 | ||||
-rw-r--r-- | gcc/cp/class.c | 108 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 134 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 23 | ||||
-rw-r--r-- | gcc/cp/error.c | 125 | ||||
-rw-r--r-- | gcc/cp/friend.c | 4 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 30 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 44 | ||||
-rw-r--r-- | gcc/cp/search.c | 21 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 9 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 18 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 67 |
16 files changed, 232 insertions, 384 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e67ed48..530b0e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2005-07-02 Zack Weinberg <zack@codesourcery.com> + Joseph S. Myers <joseph@codesourcery.com> + + * 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_. + 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * decl.c (require_complete_types_for_parms): Call relayout_decl diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d3cd467..382d6ea 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2388,9 +2388,9 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate) else if (TYPE_P (candidate->fn)) inform ("%s %T <conversion>", msgstr, candidate->fn); else if (candidate->viable == -1) - inform ("%J%s %+#D <near match>", candidate->fn, msgstr, candidate->fn); + inform ("%s %+#D <near match>", msgstr, candidate->fn); else - inform ("%J%s %+#D", candidate->fn, msgstr, candidate->fn); + inform ("%s %+#D", msgstr, candidate->fn); } static void @@ -4052,11 +4052,11 @@ enforce_access (tree basetype_path, tree decl) if (!accessible_p (basetype_path, decl, true)) { if (TREE_PRIVATE (decl)) - cp_error_at ("%q+#D is private", decl); + error ("%q+#D is private", decl); else if (TREE_PROTECTED (decl)) - cp_error_at ("%q+#D is protected", decl); + error ("%q+#D is protected", decl); else - cp_error_at ("%q+#D is inaccessible", decl); + error ("%q+#D is inaccessible", decl); error ("within this context"); return false; } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b58a501..4af7412 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1029,15 +1029,15 @@ add_method (tree type, tree method, tree using_decl) /* Defer to the local function. */ return; if (DECL_CONTEXT (fn) == DECL_CONTEXT (method)) - cp_error_at ("repeated using declaration %qD", using_decl); + error ("repeated using declaration %q+D", using_decl); else - cp_error_at ("using declaration %qD conflicts with a previous using declaration", - using_decl); + error ("using declaration %q+D conflicts with a previous using declaration", + using_decl); } else { - cp_error_at ("%q#D cannot be overloaded", method); - cp_error_at ("with %q#D", fn); + error ("%q+#D cannot be overloaded", method); + error ("with %q+#D", fn); } /* We don't call duplicate_decls here to merge the @@ -1092,8 +1092,8 @@ alter_access (tree t, tree fdecl, tree access) if (TREE_VALUE (elem) != access) { if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL) - cp_error_at ("conflicting access specifications for method" - " %qD, ignored", TREE_TYPE (fdecl)); + error ("conflicting access specifications for method" + " %q+D, ignored", TREE_TYPE (fdecl)); else error ("conflicting access specifications for field %qE, ignored", DECL_NAME (fdecl)); @@ -1156,16 +1156,16 @@ handle_using_decl (tree using_decl, tree t) the same name already present in the current class. */; else { - cp_error_at ("%qD invalid in %q#T", using_decl, t); - cp_error_at (" because of local method %q#D with same name", - OVL_CURRENT (old_value)); + error ("%q+D invalid in %q#T", using_decl, t); + error (" because of local method %q+#D with same name", + OVL_CURRENT (old_value)); return; } } else if (!DECL_ARTIFICIAL (old_value)) { - cp_error_at ("%qD invalid in %q#T", using_decl, t); - cp_error_at (" because of local member %q#D with same name", old_value); + error ("%q+D invalid in %q#T", using_decl, t); + error (" because of local member %q+#D with same name", old_value); return; } @@ -2383,8 +2383,8 @@ warn_hidden (tree t) while (base_fndecls) { /* Here we know it is a hider, and no overrider exists. */ - cp_warning_at ("%qD was hidden", TREE_VALUE (base_fndecls)); - cp_warning_at (" by %qD", fns); + warning (0, "%q+D was hidden", TREE_VALUE (base_fndecls)); + warning (0, " by %q+D", fns); base_fndecls = TREE_CHAIN (base_fndecls); } } @@ -2425,18 +2425,15 @@ finish_struct_anon (tree t) if (TREE_CODE (elt) != FIELD_DECL) { - cp_pedwarn_at ("%q#D invalid; an anonymous union can " - "only have non-static data members", - elt); + pedwarn ("%q+#D invalid; an anonymous union can " + "only have non-static data members", elt); continue; } if (TREE_PRIVATE (elt)) - cp_pedwarn_at ("private member %q#D in anonymous union", - elt); + pedwarn ("private member %q+#D in anonymous union", elt); else if (TREE_PROTECTED (elt)) - cp_pedwarn_at ("protected member %q#D in anonymous union", - elt); + pedwarn ("protected member %q+#D in anonymous union", elt); TREE_PRIVATE (elt) = TREE_PRIVATE (field); TREE_PROTECTED (elt) = TREE_PROTECTED (field); @@ -2602,7 +2599,7 @@ check_bitfield_decl (tree field) if (DECL_INITIAL (field) && ! INTEGRAL_TYPE_P (TREE_TYPE (field))) { - cp_error_at ("bit-field %q#D with non-integral type", field); + error ("bit-field %q+#D with non-integral type", field); w = error_mark_node; } @@ -2619,24 +2616,23 @@ check_bitfield_decl (tree field) if (TREE_CODE (w) != INTEGER_CST) { - cp_error_at ("bit-field %qD width not an integer constant", - field); + error ("bit-field %q+D width not an integer constant", field); w = error_mark_node; } else if (tree_int_cst_sgn (w) < 0) { - cp_error_at ("negative width in bit-field %qD", field); + error ("negative width in bit-field %q+D", field); w = error_mark_node; } else if (integer_zerop (w) && DECL_NAME (field) != 0) { - cp_error_at ("zero width for bit-field %qD", field); + error ("zero width for bit-field %q+D", field); w = error_mark_node; } else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0 && TREE_CODE (type) != ENUMERAL_TYPE && TREE_CODE (type) != BOOLEAN_TYPE) - cp_warning_at ("width of %qD exceeds its type", field); + warning (0, "width of %q+D exceeds its type", field); else if (TREE_CODE (type) == ENUMERAL_TYPE && (0 > compare_tree_int (w, min_precision (TYPE_MIN_VALUE (type), @@ -2645,8 +2641,7 @@ check_bitfield_decl (tree field) min_precision (TYPE_MAX_VALUE (type), TYPE_UNSIGNED (type))))) - cp_warning_at ("%qD is too small to hold all values of %q#T", - field, type); + warning (0, "%q+D is too small to hold all values of %q#T", field, type); } /* Remove the bit-field width indicator so that the rest of the @@ -2705,14 +2700,13 @@ check_field_decl (tree field, if (TREE_CODE (t) == UNION_TYPE) { if (TYPE_NEEDS_CONSTRUCTING (type)) - cp_error_at ("member %q#D with constructor not allowed in union", - field); + error ("member %q+#D with constructor not allowed in union", + field); if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) - cp_error_at ("member %q#D with destructor not allowed in union", - field); + error ("member %q+#D with destructor not allowed in union", field); if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) - cp_error_at ("member %q#D with copy assignment operator not allowed in union", - field); + error ("member %q+#D with copy assignment operator not allowed in union", + field); } else { @@ -2794,8 +2788,9 @@ check_field_decls (tree t, tree *access_decls, if (TYPE_PACKED (t)) { if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x))) - cp_warning_at - ("ignoring packed attribute on unpacked non-POD field %q#D", + warning + (0, + "ignoring packed attribute on unpacked non-POD field %q+#D", x); else DECL_PACKED (x) = 1; @@ -2855,33 +2850,33 @@ check_field_decls (tree t, tree *access_decls, reference type, the program is ill-formed. */ if (TREE_CODE (x) == VAR_DECL) { - cp_error_at ("%qD may not be static because it is a member of a union", x); + error ("%q+D may not be static because it is a member of a union", x); continue; } if (TREE_CODE (type) == REFERENCE_TYPE) { - cp_error_at ("%qD may not have reference type %qT because" - " it is a member of a union", - x, type); + error ("%q+D may not have reference type %qT because" + " it is a member of a union", + x, type); continue; } } /* ``A local class cannot have static data members.'' ARM 9.4 */ if (current_function_decl && TREE_STATIC (x)) - cp_error_at ("field %qD in local class cannot be static", x); + error ("field %q+D in local class cannot be static", x); /* Perform error checking that did not get done in grokdeclarator. */ if (TREE_CODE (type) == FUNCTION_TYPE) { - cp_error_at ("field %qD invalidly declared function type", x); + error ("field %q+D invalidly declared function type", x); type = build_pointer_type (type); TREE_TYPE (x) = type; } else if (TREE_CODE (type) == METHOD_TYPE) { - cp_error_at ("field %qD invalidly declared method type", x); + error ("field %q+D invalidly declared method type", x); type = build_pointer_type (type); TREE_TYPE (x) = type; } @@ -2913,7 +2908,7 @@ check_field_decls (tree t, tree *access_decls, if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t) && extra_warnings) - cp_warning_at ("non-static reference %q#D in class without a constructor", x); + warning (0, "non-static reference %q+#D in class without a constructor", x); } type = strip_array_types (type); @@ -2960,7 +2955,7 @@ check_field_decls (tree t, tree *access_decls, if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t) && extra_warnings) - cp_warning_at ("non-static const member %q#D in class without a constructor", x); + warning (0, "non-static const member %q+#D in class without a constructor", x); } /* A field that is pseudo-const makes the structure likewise. */ else if (CLASS_TYPE_P (type)) @@ -2975,7 +2970,7 @@ check_field_decls (tree t, tree *access_decls, different name from the class iff the class has a user-defined constructor. */ if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t)) - cp_pedwarn_at ("field %q#D with same name as class", x); + pedwarn ("field %q+#D with same name as class", x); /* We set DECL_C_BIT_FIELD in grokbitfield. If the type and width are valid, we'll also set DECL_BIT_FIELD. */ @@ -3644,7 +3639,7 @@ check_methods (tree t) { check_for_override (x, t); if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x)) - cp_error_at ("initializer specified for non-virtual method %qD", x); + error ("initializer specified for non-virtual method %q+D", x); /* The name of the field is the original field name Save this in auxiliary field for later overloading. */ if (DECL_VINDEX (x)) @@ -4662,9 +4657,8 @@ layout_class_type (tree t, tree *virtuals_p) && !integer_zerop (size_binop (TRUNC_MOD_EXPR, DECL_FIELD_BIT_OFFSET (field), bitsize_unit_node))) - cp_warning_at ("offset of %qD is not ABI-compliant and may " - "change in a future version of GCC", - field); + warning (0, "offset of %q+D is not ABI-compliant and may " + "change in a future version of GCC", field); /* G++ used to use DECL_FIELD_OFFSET as if it were the byte offset of the field. */ @@ -4672,10 +4666,9 @@ layout_class_type (tree t, tree *virtuals_p) && !tree_int_cst_equal (DECL_FIELD_OFFSET (field), byte_position (field)) && contains_empty_class_p (TREE_TYPE (field))) - cp_warning_at ("%qD contains empty classes which may cause base " - "classes to be placed at different locations in a " - "future version of GCC", - field); + warning (0, "%q+D contains empty classes which may cause base " + "classes to be placed at different locations in a " + "future version of GCC", field); /* If we needed additional padding after this field, add it now. */ @@ -6249,9 +6242,8 @@ note_name_declared_in_class (tree name, tree decl) in its context and when re-evaluated in the completed scope of S. */ error ("declaration of %q#D", decl); - cp_error_at ("changes meaning of %qD from %q+#D", - DECL_NAME (OVL_CURRENT (decl)), - (tree) n->value); + error ("changes meaning of %qD from %q+#D", + DECL_NAME (OVL_CURRENT (decl)), (tree) n->value); } } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f661952f..2cef234 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4375,8 +4375,4 @@ extern void cp_genericize (tree); #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m) #endif -extern void cp_error_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2); -extern void cp_warning_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2); -extern void cp_pedwarn_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2); - #endif /* ! GCC_CP_TREE_H */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5eebd81..6e1dad1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -352,7 +352,7 @@ pop_label (tree label, tree old_value) { location_t location; - cp_error_at ("label %qD used but not defined", label); + error ("label %q+D used but not defined", label); #ifdef USE_MAPPED_LOCATION location = input_location; /* FIXME want (input_filename, (line)0) */ #else @@ -363,7 +363,7 @@ pop_label (tree label, tree old_value) define_label (location, DECL_NAME (label)); } else if (warn_unused_label && !TREE_USED (label)) - cp_warning_at ("label %qD defined but not used", label); + warning (0, "label %q+D defined but not used", label); } SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value); @@ -557,7 +557,7 @@ poplevel (int keep, int reverse, int functionbody) && ! TREE_USED (decl) && ! DECL_IN_SYSTEM_HEADER (decl) && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl)) - warning (0, "%Junused variable %qD", decl, decl); + warning (0, "unused variable %q+D", decl); /* Remove declarations for all the DECLs in this level. */ for (link = decls; link; link = TREE_CHAIN (link)) @@ -997,7 +997,7 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl) name = DECL_ASSEMBLER_NAME (newdecl); pedwarn ("%qD was declared %<extern%> and later %<static%>", newdecl); - cp_pedwarn_at ("previous declaration of %qD", olddecl); + pedwarn ("previous declaration of %q+D", olddecl); } /* If NEWDECL is a redeclaration of OLDDECL, merge the declarations. @@ -1045,19 +1045,19 @@ duplicate_decls (tree newdecl, tree olddecl) && DECL_UNINLINABLE (olddecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) { - warning (OPT_Wattributes, "%Jfunction %qD redeclared as inline", - newdecl, newdecl); - warning (OPT_Wattributes, "%Jprevious declaration of %qD " - "with attribute noinline", olddecl, olddecl); + warning (OPT_Wattributes, "function %q+D redeclared as inline", + newdecl); + warning (OPT_Wattributes, "previous declaration of %q+D " + "with attribute noinline", olddecl); } else if (DECL_DECLARED_INLINE_P (olddecl) && DECL_UNINLINABLE (newdecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) { - warning (OPT_Wattributes, "%Jfunction %qD redeclared with " - "attribute noinline", newdecl, newdecl); - warning (OPT_Wattributes, "%Jprevious declaration of %qD was inline", - olddecl, olddecl); + warning (OPT_Wattributes, "function %q+D redeclared with " + "attribute noinline", newdecl); + warning (OPT_Wattributes, "previous declaration of %q+D was inline", + olddecl); } } @@ -1218,7 +1218,7 @@ duplicate_decls (tree newdecl, tree olddecl) error ("%q#D redeclared as different kind of symbol", newdecl); if (TREE_CODE (olddecl) == TREE_LIST) olddecl = TREE_VALUE (olddecl); - cp_error_at ("previous declaration of %q#D", olddecl); + error ("previous declaration of %q+#D", olddecl); return error_mark_node; } @@ -1238,8 +1238,7 @@ duplicate_decls (tree newdecl, tree olddecl) || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) { error ("declaration of template %q#D", newdecl); - cp_error_at ("conflicts with previous declaration %q#D", - olddecl); + error ("conflicts with previous declaration %q+#D", olddecl); } else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL && TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL @@ -1253,7 +1252,7 @@ duplicate_decls (tree newdecl, tree olddecl) TREE_TYPE (TREE_TYPE (olddecl)))) { error ("new declaration %q#D", newdecl); - cp_error_at ("ambiguates old declaration %q#D", olddecl); + error ("ambiguates old declaration %q+#D", olddecl); } return NULL_TREE; } @@ -1263,13 +1262,13 @@ duplicate_decls (tree newdecl, tree olddecl) { error ("declaration of C function %q#D conflicts with", newdecl); - cp_error_at ("previous declaration %q#D here", olddecl); + error ("previous declaration %q+#D here", olddecl); } else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { error ("new declaration %q#D", newdecl); - cp_error_at ("ambiguates old declaration %q#D", olddecl); + error ("ambiguates old declaration %q+#D", olddecl); } else return NULL_TREE; @@ -1277,8 +1276,7 @@ duplicate_decls (tree newdecl, tree olddecl) else { error ("conflicting declaration %q#D", newdecl); - cp_error_at ("%qD has a previous declaration as %q#D", - olddecl, olddecl); + error ("%q+D has a previous declaration as %q#D", olddecl, olddecl); return error_mark_node; } } @@ -1331,7 +1329,7 @@ duplicate_decls (tree newdecl, tree olddecl) declared as the name of any other entity in any global scope of the program. */ error ("declaration of namespace %qD conflicts with", newdecl); - cp_error_at ("previous declaration of namespace %qD here", olddecl); + error ("previous declaration of namespace %q+D here", olddecl); return error_mark_node; } else @@ -1341,10 +1339,9 @@ duplicate_decls (tree newdecl, tree olddecl) { error (errmsg, newdecl); if (DECL_NAME (olddecl) != NULL_TREE) - cp_error_at ((DECL_INITIAL (olddecl) - && namespace_bindings_p ()) - ? "%q#D previously defined here" - : "%q#D previously declared here", olddecl); + error ((DECL_INITIAL (olddecl) && namespace_bindings_p ()) + ? "%q+#D previously defined here" + : "%q+#D previously declared here", olddecl); return error_mark_node; } else if (TREE_CODE (olddecl) == FUNCTION_DECL @@ -1353,7 +1350,7 @@ duplicate_decls (tree newdecl, tree olddecl) && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE) { /* Prototype decl follows defn w/o prototype. */ - cp_warning_at ("prototype for %q#D", newdecl); + warning (0, "prototype for %q+#D", newdecl); warning (0, "%Jfollows non-prototype definition here", olddecl); } else if (TREE_CODE (olddecl) == FUNCTION_DECL @@ -1366,8 +1363,8 @@ duplicate_decls (tree newdecl, tree olddecl) SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); else { - cp_error_at ("previous declaration of %q#D with %qL linkage", - olddecl, DECL_LANGUAGE (olddecl)); + error ("previous declaration of %q+#D with %qL linkage", + olddecl, DECL_LANGUAGE (olddecl)); error ("conflicts with new declaration with %qL linkage", DECL_LANGUAGE (newdecl)); } @@ -1393,14 +1390,13 @@ duplicate_decls (tree newdecl, tree olddecl) { pedwarn ("default argument given for parameter %d of %q#D", i, newdecl); - cp_pedwarn_at ("after previous specification in %q#D", - olddecl); + pedwarn ("after previous specification in %q+#D", olddecl); } else { error ("default argument given for parameter %d of %q#D", i, newdecl); - cp_error_at ("after previous specification in %q#D", + error ("after previous specification in %q+#D", olddecl); } } @@ -1463,7 +1459,7 @@ duplicate_decls (tree newdecl, tree olddecl) && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl))) { warning (0, "redundant redeclaration of %qD in same scope", newdecl); - cp_warning_at ("previous declaration of %qD", olddecl); + warning (0, "previous declaration of %q+D", olddecl); } } @@ -1558,7 +1554,7 @@ duplicate_decls (tree newdecl, tree olddecl) { error ("declaration of %qF throws different exceptions", newdecl); - cp_error_at ("than previous declaration %qF", olddecl); + error ("than previous declaration %q+F", olddecl); } } TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype; @@ -1798,8 +1794,8 @@ duplicate_decls (tree newdecl, tree olddecl) && DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) { - warning (OPT_Wattributes, "%J%qD: visibility attribute ignored " - "because it", newdecl, newdecl); + warning (OPT_Wattributes, "%q+D: visibility attribute ignored " + "because it", newdecl); warning (OPT_Wattributes, "%Jconflicts with previous " "declaration here", olddecl); } @@ -2151,11 +2147,9 @@ check_previous_goto_1 (tree decl, } if (problem > 1) - cp_error_at (" crosses initialization of %q#D", - new_decls); + error (" crosses initialization of %q+#D", new_decls); else - cp_pedwarn_at (" enters scope of non-POD %q#D", - new_decls); + pedwarn (" enters scope of non-POD %q+#D", new_decls); } if (b == level) @@ -2253,7 +2247,7 @@ check_goto (tree decl) if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls) && !identified) { - cp_pedwarn_at ("jump to label %qD", decl); + pedwarn ("jump to label %q+D", decl); pedwarn (" from here"); identified = 1; } @@ -2267,9 +2261,9 @@ check_goto (tree decl) /* Can't skip init of __exception_info. */ error ("%J enters catch block", b); else if (u > 1) - cp_error_at (" skips initialization of %q#D", b); + error (" skips initialization of %q+#D", b); else - cp_pedwarn_at (" enters scope of non-POD %q#D", b); + pedwarn (" enters scope of non-POD %q+#D", b); } if (lab->in_try_scope) @@ -2677,7 +2671,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list, if (complain & tf_error) { error ("template parameters do not match template"); - cp_error_at ("%qD declared here", tmpl); + error ("%q+D declared here", tmpl); } return error_mark_node; } @@ -3367,17 +3361,14 @@ fixup_anonymous_aggr (tree t) if (CLASS_TYPE_P (type)) { if (TYPE_NEEDS_CONSTRUCTING (type)) - cp_error_at ("member %q#D with constructor not allowed " - "in anonymous aggregate", - field); + error ("member %q+#D with constructor not allowed " + "in anonymous aggregate", field); if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) - cp_error_at ("member %q#D with destructor not allowed " - "in anonymous aggregate", - field); + error ("member %q+#D with destructor not allowed " + "in anonymous aggregate", field); if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) - cp_error_at ("member %q#D with copy assignment operator " - "not allowed in anonymous aggregate", - field); + error ("member %q+#D with copy assignment operator " + "not allowed in anonymous aggregate", field); } } } @@ -3503,10 +3494,9 @@ shadow_tag (cp_decl_specifier_seq *declspecs) if (declspecs->attributes) { - cp_warning_at ("attribute ignored in declaration of %q#T", t); - cp_warning_at ("attribute for %q#T must follow the %qs keyword", - t, - class_key_or_enum_as_string (t)); + warning (0, "attribute ignored in declaration of %q+#T", t); + warning (0, "attribute for %q+#T must follow the %qs keyword", + t, class_key_or_enum_as_string (t)); } @@ -3661,7 +3651,7 @@ start_decl (const cp_declarator *declarator, && DECL_DECLARED_INLINE_P (decl) && DECL_UNINLINABLE (decl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) - warning (0, "%Jinline function %qD given attribute noinline", decl, decl); + warning (0, "inline function %q+D given attribute noinline", decl); if (context && COMPLETE_TYPE_P (complete_type (context))) { @@ -4045,9 +4035,9 @@ maybe_commonize_var (tree decl) be merged. */ TREE_PUBLIC (decl) = 0; DECL_COMMON (decl) = 0; - cp_warning_at ("sorry: semantics of inline function static " - "data %q#D are wrong (you'll wind up " - "with multiple copies)", decl); + warning (0, "sorry: semantics of inline function static " + "data %q+#D are wrong (you'll wind up " + "with multiple copies)", decl); warning (0, "%J you can work around this by removing " "the initializer", decl); @@ -5446,13 +5436,13 @@ bad_specifiers (tree object, "%qD invalid in %s declaration", object, type); if (friendp) - cp_error_at ("%qD declared as a friend", object); + error ("%q+D declared as a friend", object); if (raises && (TREE_CODE (object) == TYPE_DECL || (!TYPE_PTRFN_P (TREE_TYPE (object)) && !TYPE_REFFN_P (TREE_TYPE (object)) && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object))))) - cp_error_at ("%qD declared with an exception specification", object); + error ("%q+D declared with an exception specification", object); } /* CTYPE is class type, or null if non-class. @@ -5579,9 +5569,9 @@ grokfndecl (tree ctype, pedwarn ("non-local function %q#D uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) - cp_pedwarn_at ("%q#D does not refer to the unqualified " - "type, so it is not used for linkage", - TYPE_NAME (t)); + pedwarn ("%q+#D does not refer to the unqualified " + "type, so it is not used for linkage", + TYPE_NAME (t)); } } else @@ -5915,9 +5905,9 @@ grokvardecl (tree type, warning (0, "non-local variable %q#D uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) - cp_warning_at ("%q#D does not refer to the unqualified " - "type, so it is not used for linkage", - TYPE_NAME (t)); + warning (0, "%q+#D does not refer to the unqualified " + "type, so it is not used for linkage", + TYPE_NAME (t)); } } else @@ -9017,7 +9007,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, && tag_code != typename_type) { error ("using typedef-name %qD after %qs", decl, tag_name (tag_code)); - cp_error_at ("%qD has a previous declaration here", decl); + error ("%q+D has a previous declaration here", decl); return error_mark_node; } else if (TREE_CODE (type) != RECORD_TYPE @@ -9026,7 +9016,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, && tag_code != typename_type) { error ("%qT referred to as %qs", type, tag_name (tag_code)); - cp_error_at ("%qT has a previous declaration here", type); + error ("%q+T has a previous declaration here", type); return error_mark_node; } else if (TREE_CODE (type) != ENUMERAL_TYPE @@ -9034,7 +9024,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, && tag_code != typename_type) { error ("%qT referred to as enum", type); - cp_error_at ("%qT has a previous declaration here", type); + error ("%q+T has a previous declaration here", type); return error_mark_node; } else if (!allow_template_p @@ -9918,7 +9908,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) if (DECL_DECLARED_INLINE_P (decl1) && lookup_attribute ("noinline", attrs)) - warning (0, "%Jinline function %qD given attribute noinline", decl1, decl1); + warning (0, "inline function %q+D given attribute noinline", decl1); if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1)) /* This is a constructor, we must ensure that any default args diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c5fb47a..2abf30c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA. */ #include "cgraph.h" #include "tree-inline.h" #include "c-pragma.h" +#include "intl.h" extern cpp_reader *parse_in; @@ -690,12 +691,12 @@ check_classfn (tree ctype, tree function, tree template_parms) is_conv_op = false; } if (format) - format = " %#D"; + format = " %+#D"; else if (fndecls) - format = "candidates are: %#D"; + format = N_("candidates are: %+#D"); else - format = "candidate is: %#D"; - cp_error_at (format, fndecl); + format = N_("candidate is: %+#D"); + error (format, fndecl); } } else if (!COMPLETE_TYPE_P (ctype)) @@ -1085,16 +1086,15 @@ build_anon_union_vars (tree type, tree object) continue; if (TREE_CODE (field) != FIELD_DECL) { - cp_pedwarn_at ("%q#D invalid; an anonymous union can only " - "have non-static data members", - field); + pedwarn ("%q+#D invalid; an anonymous union can only " + "have non-static data members", field); continue; } if (TREE_PRIVATE (field)) - cp_pedwarn_at ("private member %q#D in anonymous union", field); + pedwarn ("private member %q+#D in anonymous union", field); else if (TREE_PROTECTED (field)) - cp_pedwarn_at ("protected member %q#D in anonymous union", field); + pedwarn ("protected member %q+#D in anonymous union", field); if (processing_template_decl) ref = build_min_nt (COMPONENT_REF, object, @@ -3061,7 +3061,7 @@ cp_finish_file (void) already verified there was a definition. */ && !DECL_EXPLICIT_INSTANTIATION (decl)) { - cp_warning_at ("inline function %qD used but never defined", decl); + warning (0, "inline function %q+D used but never defined", decl); /* This symbol is effectively an "extern" declaration now. This is not strictly necessary, but removes a duplicate warning. */ @@ -3212,8 +3212,7 @@ check_default_args (tree x) saw_def = true; else if (saw_def) { - cp_error_at ("default argument missing for parameter %P of %q+#D", - i, x); + error ("default argument missing for parameter %P of %q+#D", i, x); break; } } diff --git a/gcc/cp/error.c b/gcc/cp/error.c index fd222be..6d80fc6 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); -} diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index dec90a1..4e1a209 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -314,7 +314,7 @@ make_friend_class (tree type, tree friend_type, bool complain) { error ("%qT is not a member class template of %qT", name, ctype); - cp_error_at ("%qD declared here", decl); + error ("%q+D declared here", decl); return; } if (!template_member_p && (TREE_CODE (decl) != TYPE_DECL @@ -322,7 +322,7 @@ make_friend_class (tree type, tree friend_type, bool complain) { error ("%qT is not a nested class of %qT", name, ctype); - cp_error_at ("%qD declared here", decl); + error ("%q+D declared here", decl); return; } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 2d2daac..05491c4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -522,13 +522,13 @@ sort_mem_initializers (tree t, tree mem_inits) if (warn_reorder && !subobject_init) { if (TREE_CODE (TREE_PURPOSE (next_subobject)) == FIELD_DECL) - cp_warning_at ("%qD will be initialized after", - TREE_PURPOSE (next_subobject)); + warning (0, "%q+D will be initialized after", + TREE_PURPOSE (next_subobject)); else warning (0, "base %qT will be initialized after", TREE_PURPOSE (next_subobject)); if (TREE_CODE (subobject) == FIELD_DECL) - cp_warning_at (" %q#D", subobject); + warning (0, " %q+#D", subobject); else warning (0, " base %qT", subobject); warning (0, "%J when initialized here", current_function_decl); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 658b701..50a92ca 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -505,7 +505,7 @@ supplement_binding (cxx_binding *binding, tree decl) else { error ("declaration of %q#D", decl); - cp_error_at ("conflicts with previous declaration %q#D", bval); + error ("conflicts with previous declaration %q+#D", bval); ok = false; } @@ -721,7 +721,7 @@ pushdecl (tree x) [basic.start.main] This function shall not be overloaded. */ - cp_error_at ("invalid redeclaration of %qD", t); + error ("invalid redeclaration of %q+D", t); error ("as %qD", x); /* We don't try to push this declaration since that causes a crash. */ @@ -811,7 +811,7 @@ pushdecl (tree x) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) { pedwarn ("type mismatch with previous external decl of %q#D", x); - cp_pedwarn_at ("previous external decl of %q#D", decl); + pedwarn ("previous external decl of %q+#D", decl); } } @@ -894,7 +894,7 @@ pushdecl (tree x) else { warning (0, "extern declaration of %q#D doesn't match", x); - cp_warning_at ("global declaration %q#D", oldglobal); + warning (0, "global declaration %q+#D", oldglobal); } } /* If we have a local external declaration, @@ -1092,9 +1092,9 @@ check_for_out_of_scope_variable (tree decl) if (!DECL_ERROR_REPORTED (decl)) { warning (0, "name lookup of %qD changed", DECL_NAME (decl)); - cp_warning_at (" matches this %qD under ISO standard rules", - shadowed); - cp_warning_at (" matches this %qD under old rules", decl); + warning (0, " matches this %q+D under ISO standard rules", + shadowed); + warning (0, " matches this %q+D under old rules", decl); DECL_ERROR_REPORTED (decl) = 1; } return shadowed; @@ -1114,15 +1114,15 @@ check_for_out_of_scope_variable (tree decl) { error ("name lookup of %qD changed for new ISO %<for%> scoping", DECL_NAME (decl)); - cp_error_at (" cannot use obsolete binding at %qD because " - "it has a destructor", decl); + error (" cannot use obsolete binding at %q+D because " + "it has a destructor", decl); return error_mark_node; } else { pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping", DECL_NAME (decl)); - cp_pedwarn_at (" using obsolete binding at %qD", decl); + pedwarn (" using obsolete binding at %q+D", decl); } return decl; @@ -1895,7 +1895,7 @@ push_overloaded_decl (tree decl, int flags) old = NULL_TREE; else { - cp_error_at ("previous non-function declaration %q#D", old); + error ("previous non-function declaration %q+#D", old); error ("conflicts with function declaration %q#D", decl); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); } @@ -3386,9 +3386,9 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new, if (old->value != error_mark_node) { error ("use of %qD is ambiguous", name); - cp_error_at (" first declared as %q#D here", old->value); + error (" first declared as %q+#D here", old->value); } - cp_error_at (" also declared as %q#D here", val); + error (" also declared as %q+#D here", val); } old->value = error_mark_node; } @@ -4165,8 +4165,8 @@ add_function (struct arg_lookup *k, tree fn) { fn = f1; f1 = f2; f2 = fn; } - cp_error_at ("%qD is not a function,", f1); - cp_error_at (" conflict with %qD", f2); + error ("%q+D is not a function,", f1); + error (" conflict with %q+D", f2); error (" in call to %qD", k->name); return true; } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0a64193..2d17cde 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -13058,7 +13058,7 @@ cp_parser_class_head (cp_parser* parser, if (type != error_mark_node && COMPLETE_TYPE_P (type)) { error ("redefinition of %q#T", type); - cp_error_at ("previous definition of %q#T", type); + error ("previous definition of %q+#T", type); type = NULL_TREE; goto done; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cae8da1..3b4c588 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -667,7 +667,7 @@ check_specialization_namespace (tree tmpl) else { pedwarn ("specialization of %qD in different namespace", tmpl); - cp_pedwarn_at (" from definition of %q#D", tmpl); + pedwarn (" from definition of %q+#D", tmpl); return false; } } @@ -736,8 +736,8 @@ maybe_process_partial_specialization (tree type) != decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type))) { pedwarn ("specializing %q#T in different namespace", type); - cp_pedwarn_at (" from definition of %q#D", - CLASSTYPE_TI_TEMPLATE (type)); + pedwarn (" from definition of %q+#D", + CLASSTYPE_TI_TEMPLATE (type)); } /* Check for invalid specialization after instantiation: @@ -1284,7 +1284,7 @@ print_candidates (tree fns) tree f; for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f)) - cp_error_at ("%s %+#D", str, OVL_CURRENT (f)); + error ("%s %+#D", str, OVL_CURRENT (f)); str = " "; } } @@ -1533,17 +1533,16 @@ determine_specialization (tree template_id, if (templates == NULL_TREE && candidates == NULL_TREE) { - cp_error_at ("template-id %qD for %q+D does not match any template " - "declaration", - template_id, decl); + error ("template-id %qD for %q+D does not match any template " + "declaration", template_id, decl); return error_mark_node; } else if ((templates && TREE_CHAIN (templates)) || (candidates && TREE_CHAIN (candidates)) || (templates && candidates)) { - cp_error_at ("ambiguous template specialization %qD for %q+D", - template_id, decl); + error ("ambiguous template specialization %qD for %q+D", + template_id, decl); chainon (candidates, templates); print_candidates (candidates); return error_mark_node; @@ -2197,8 +2196,8 @@ check_template_shadow (tree decl) || TEMPLATE_PARMS_FOR_INLINE (current_template_parms)) return; - cp_error_at ("declaration of %q#D", decl); - cp_error_at (" shadows template parm %q#D", olddecl); + error ("declaration of %q+#D", decl); + error (" shadows template parm %q+#D", olddecl); } /* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL, @@ -3219,7 +3218,7 @@ redeclare_class_template (tree type, tree parms) if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms)) { - cp_error_at ("previous declaration %qD", tmpl); + error ("previous declaration %q+D", tmpl); error ("used %d template parameter(s) instead of %d", TREE_VEC_LENGTH (tmpl_parms), TREE_VEC_LENGTH (parms)); @@ -3239,7 +3238,7 @@ redeclare_class_template (tree type, tree parms) || (TREE_CODE (tmpl_parm) != TYPE_DECL && !same_type_p (TREE_TYPE (tmpl_parm), TREE_TYPE (parm)))) { - cp_error_at ("template parameter %q#D", tmpl_parm); + error ("template parameter %q+#D", tmpl_parm); error ("redeclared here as %q#D", parm); return; } @@ -3960,7 +3959,7 @@ coerce_template_parms (tree parms, nargs, nparms); if (in_decl) - cp_error_at ("provided for %qD", in_decl); + error ("provided for %q+D", in_decl); } return error_mark_node; @@ -4347,7 +4346,7 @@ lookup_template_class (tree d1, { error ("non-template type %qT used as a template", d1); if (in_decl) - cp_error_at ("for template declaration %qD", in_decl); + error ("for template declaration %q+D", in_decl); } POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); } @@ -5441,7 +5440,7 @@ instantiate_class_template (tree type) { if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args)) { - cp_error_at ("%s %+#T", str, TREE_TYPE (t)); + error ("%s %+#T", str, TREE_TYPE (t)); str = " "; } } @@ -6547,7 +6546,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) complain, in_decl); TREE_CHAIN (r) = NULL_TREE; if (VOID_TYPE_P (type)) - cp_error_at ("instantiation of %qD as type %qT", r, type); + error ("instantiation of %q+D as type %qT", r, type); } break; @@ -6723,7 +6722,7 @@ tsubst_arg_types (tree arg_types, { error ("invalid parameter type %qT", type); if (in_decl) - cp_error_at ("in declaration %qD", in_decl); + error ("in declaration %q+D", in_decl); } return error_mark_node; } @@ -11624,11 +11623,10 @@ instantiate_pending_templates (int retries) to avoid infinite loop. */ if (pending_templates && retries >= max_tinst_depth) { - cp_error_at ("template instantiation depth exceeds maximum of %d" - " (use -ftemplate-depth-NN to increase the maximum)" - " instantiating %q+D, possibly from virtual table" - " generation", - max_tinst_depth, TREE_VALUE (pending_templates)); + error ("template instantiation depth exceeds maximum of %d" + " instantiating %q+D, possibly from virtual table generation" + " (use -ftemplate-depth-NN to increase the maximum)", + max_tinst_depth, TREE_VALUE (pending_templates)); return; } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 77d63da..795e8c2 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1839,9 +1839,9 @@ check_final_overrider (tree overrider, tree basefn) fail = 2; else { - cp_warning_at ("deprecated covariant return type for %q#D", + warning (0, "deprecated covariant return type for %q+#D", overrider); - cp_warning_at (" overriding %q#D", basefn); + warning (0, " overriding %q+#D", basefn); } } else @@ -1855,14 +1855,13 @@ check_final_overrider (tree overrider, tree basefn) { if (fail == 1) { - cp_error_at ("invalid covariant return type for %q#D", overrider); - cp_error_at (" overriding %q#D", basefn); + error ("invalid covariant return type for %q+#D", overrider); + error (" overriding %q+#D", basefn); } else { - cp_error_at ("conflicting return type specified for %q#D", - overrider); - cp_error_at (" overriding %q#D", basefn); + error ("conflicting return type specified for %q+#D", overrider); + error (" overriding %q+#D", basefn); } DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; @@ -1871,8 +1870,8 @@ check_final_overrider (tree overrider, tree basefn) /* Check throw specifier is at least as strict. */ if (!comp_except_specs (base_throw, over_throw, 0)) { - cp_error_at ("looser throw specifier for %q#F", overrider); - cp_error_at (" overriding %q#F", basefn); + error ("looser throw specifier for %q+#F", overrider); + error (" overriding %q+#F", basefn); DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; } @@ -1965,8 +1964,8 @@ look_for_overrides_r (tree type, tree fndecl) { /* A static member function cannot match an inherited virtual member function. */ - cp_error_at ("%q#D cannot be declared", fndecl); - cp_error_at (" since %q#D declared in base class", fn); + error ("%q+#D cannot be declared", fndecl); + error (" since %q+#D declared in base class", fn); } else { diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 4f9a03a..3d99c5d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1342,10 +1342,9 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) { if (current_function_decl && DECL_STATIC_FUNCTION_P (current_function_decl)) - cp_error_at ("invalid use of member %qD in static member function", - decl); + error ("invalid use of member %q+D in static member function", decl); else - cp_error_at ("invalid use of non-static data member %qD", decl); + error ("invalid use of non-static data member %q+D", decl); error ("from this location"); return error_mark_node; @@ -1384,7 +1383,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) if (!access_type) { - cp_error_at ("object missing in reference to %qD", decl); + error ("object missing in reference to %q+D", decl); error ("from this location"); return error_mark_node; } @@ -2789,7 +2788,7 @@ finish_id_expression (tree id_expression, error (TREE_CODE (decl) == VAR_DECL ? "use of %<auto%> variable from containing function" : "use of parameter from containing function"); - cp_error_at (" %q#D declared here", decl); + error (" %q+#D declared here", decl); return error_mark_node; } } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 32d3f04..c6989ee 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2560,8 +2560,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags) { if (fndecl) { - cp_error_at ("too many arguments to %s %q+#D", called_thing, - fndecl); + error ("too many arguments to %s %q+#D", called_thing, fndecl); error ("at this point in file"); } else @@ -2663,8 +2662,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags) { if (fndecl) { - cp_error_at ("too few arguments to %s %q+#D", - called_thing, fndecl); + error ("too few arguments to %s %q+#D", called_thing, fndecl); error ("at this point in file"); } else @@ -6018,9 +6016,9 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags, if (fndecl) { if (warningcount > savew) - cp_warning_at ("in passing argument %P of %q+D", parmnum, fndecl); + warning (0, "in passing argument %P of %q+D", parmnum, fndecl); else if (errorcount > savee) - cp_error_at ("in passing argument %P of %q+D", parmnum, fndecl); + error ("in passing argument %P of %q+D", parmnum, fndecl); } return rhs; } @@ -6089,11 +6087,11 @@ maybe_warn_about_returning_address_of_local (tree retval) || TREE_PUBLIC (whats_returned))) { if (TREE_CODE (valtype) == REFERENCE_TYPE) - cp_warning_at ("reference to local variable %qD returned", - whats_returned); + warning (0, "reference to local variable %q+D returned", + whats_returned); else - cp_warning_at ("address of local variable %qD returned", - whats_returned); + warning (0, "address of local variable %q+D returned", + whats_returned); return; } } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 516116d..4244088 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -214,7 +214,7 @@ complete_type_check_abstract (tree type) /* Tweak input_location so that the diagnostic appears at the correct location. Notice that this is only needed if the decl is an - IDENTIFIER_NODE, otherwise cp_error_at. */ + IDENTIFIER_NODE. */ input_location = pat->locus; abstract_virtuals_error (pat->decl, pat->type); pat = pat->next; @@ -289,27 +289,24 @@ abstract_virtuals_error (tree decl, tree type) return 0; if (TREE_CODE (decl) == VAR_DECL) - cp_error_at ("cannot declare variable %q+D to be of abstract " - "type %qT", decl, type); + error ("cannot declare variable %q+D to be of abstract " + "type %qT", decl, type); else if (TREE_CODE (decl) == PARM_DECL) - cp_error_at ("cannot declare parameter %q+D to be of abstract " - "type %qT", decl, type); + error ("cannot declare parameter %q+D to be of abstract type %qT", + decl, type); else if (TREE_CODE (decl) == FIELD_DECL) - cp_error_at ("cannot declare field %q+D to be of abstract " - "type %qT", decl, type); + error ("cannot declare field %q+D to be of abstract type %qT", + decl, type); else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE) - cp_error_at ("invalid abstract return type for member function %q+#D", - decl); + error ("invalid abstract return type for member function %q+#D", decl); else if (TREE_CODE (decl) == FUNCTION_DECL) - cp_error_at ("invalid abstract return type for function %q+#D", - decl); + error ("invalid abstract return type for function %q+#D", decl); else if (TREE_CODE (decl) == IDENTIFIER_NODE) - /* Here we do not have location information, so use error instead - of cp_error_at. */ + /* Here we do not have location information. */ error ("invalid abstract type %qT for %qE", type, decl); else - cp_error_at ("invalid abstract type for %q+D", decl); + error ("invalid abstract type for %q+D", decl); } else error ("cannot allocate an object of abstract type %qT", type); @@ -324,7 +321,7 @@ abstract_virtuals_error (tree decl, tree type) "within %qT:", TYPE_MAIN_DECL (type), type); for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++) - inform ("%J\t%#D", fn, fn); + inform ("\t%+#D", fn); /* Now truncate the vector. This leaves it non-null, so we know there are pure virtuals, but empty so we don't list them out again. */ @@ -348,23 +345,13 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) { int decl = 0; void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2); - void (*p_msg_at) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2); if (diag_type == 1) - { - p_msg = warning0; - p_msg_at = cp_warning_at; - } + p_msg = warning0; else if (diag_type == 2) - { - p_msg = pedwarn; - p_msg_at = cp_pedwarn_at; - } + p_msg = pedwarn; else - { - p_msg = error; - p_msg_at = cp_error_at; - } + p_msg = error; /* Avoid duplicate error message. */ if (TREE_CODE (type) == ERROR_MARK) @@ -374,7 +361,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) || TREE_CODE (value) == PARM_DECL || TREE_CODE (value) == FIELD_DECL)) { - (*p_msg_at) ("%qD has incomplete type", value); + p_msg ("%q+D has incomplete type", value); decl = 1; } retry: @@ -386,15 +373,15 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) case UNION_TYPE: case ENUMERAL_TYPE: if (!decl) - (*p_msg) ("invalid use of undefined type %q#T", type); + p_msg ("invalid use of undefined type %q#T", type); if (!TYPE_TEMPLATE_INFO (type)) - (*p_msg_at) ("forward declaration of %q#T", type); + p_msg ("forward declaration of %q+#T", type); else - (*p_msg_at) ("declaration of %q#T", type); + p_msg ("declaration of %q+#T", type); break; case VOID_TYPE: - (*p_msg) ("invalid use of %qT", type); + p_msg ("invalid use of %qT", type); break; case ARRAY_TYPE: @@ -403,28 +390,28 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) type = TREE_TYPE (type); goto retry; } - (*p_msg) ("invalid use of array with unspecified bounds"); + p_msg ("invalid use of array with unspecified bounds"); break; case OFFSET_TYPE: bad_member: - (*p_msg) ("invalid use of member (did you forget the %<&%> ?)"); + p_msg ("invalid use of member (did you forget the %<&%> ?)"); break; case TEMPLATE_TYPE_PARM: - (*p_msg) ("invalid use of template type parameter"); + p_msg ("invalid use of template type parameter"); break; case UNKNOWN_TYPE: if (value && TREE_CODE (value) == COMPONENT_REF) goto bad_member; else if (value && TREE_CODE (value) == ADDR_EXPR) - (*p_msg) ("address of overloaded function with no contextual " - "type information"); + p_msg ("address of overloaded function with no contextual " + "type information"); else if (value && TREE_CODE (value) == OVERLOAD) - (*p_msg) ("overloaded function with no contextual type information"); + p_msg ("overloaded function with no contextual type information"); else - (*p_msg) ("insufficient contextual information to determine type"); + p_msg ("insufficient contextual information to determine type"); break; default: |