diagnostics.c (permerror_at): Rename as permerror.

2008-08-18  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	* diagnostics.c (permerror_at): Rename as permerror.
	(permerror): Delete.
	* toplev.h: Likewise.
cp/	
	* typeck.c: Update all callers.
	* init.c: Likewise.
	* class.c: Likewise.
	* decl.c: Likewise.
	* call.c: Likewise.
	* except.c: Likewise.
	* cvt.c: Likewise.
	* typeck2.c: Likewise.
	* pt.c: Likewise.
	* semantics.c: Likewise.
	* name-lookup.c: Likewise.
	* lex.c: Likewise.
	* decl2.c: Likewise.
	* parser.c: Likewise.

From-SVN: r139193
This commit is contained in:
Manuel López-Ibáñez 2008-08-18 11:17:52 +00:00
parent 79a141784a
commit cbe5f3b371
18 changed files with 141 additions and 137 deletions

View File

@ -1,3 +1,9 @@
2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* diagnostics.c (permerror_at): Rename as permerror.
(permerror): Delete.
* toplev.h: Likewise.
2008-08-18 Richard Guenther <rguenther@suse.de>
* passes.c (init_optimization_passes): Remove cleanup_cfg1,

View File

@ -1,3 +1,20 @@
2008-08-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* typeck.c: Update all callers of permerror.
* init.c: Likewise.
* class.c: Likewise.
* decl.c: Likewise.
* call.c: Likewise.
* except.c: Likewise.
* cvt.c: Likewise.
* typeck2.c: Likewise.
* pt.c: Likewise.
* semantics.c: Likewise.
* name-lookup.c: Likewise.
* lex.c: Likewise.
* decl2.c: Likewise.
* parser.c: Likewise.
2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/34485

View File

@ -4038,7 +4038,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
/* Look for an `operator++ (int)'. If they didn't have
one, then we fall back to the old way of doing things. */
if (flags & LOOKUP_COMPLAIN)
permerror ("no %<%D(int)%> declared for postfix %qs, "
permerror (input_location, "no %<%D(int)%> declared for postfix %qs, "
"trying prefix operator instead",
fnname,
operator_name_info[code].name);
@ -4535,9 +4535,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
}
if (complain & tf_error)
{
permerror ("invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
permerror (input_location, "invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn)
permerror (" initializing argument %P of %qD", argnum, fn);
permerror (input_location, " initializing argument %P of %qD", argnum, fn);
}
else
return error_mark_node;
@ -5191,7 +5191,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (convs[i]->bad_p)
{
if (complain & tf_error)
permerror ("passing %qT as %<this%> argument of %q#D discards qualifiers",
permerror (input_location, "passing %qT as %<this%> argument of %q#D discards qualifiers",
TREE_TYPE (argtype), fn);
else
return error_mark_node;

View File

@ -2497,10 +2497,10 @@ finish_struct_anon (tree t)
if (TREE_CODE (elt) != FIELD_DECL)
{
if (is_union)
permerror ("%q+#D invalid; an anonymous union can "
permerror (input_location, "%q+#D invalid; an anonymous union can "
"only have non-static data members", elt);
else
permerror ("%q+#D invalid; an anonymous struct can "
permerror (input_location, "%q+#D invalid; an anonymous struct can "
"only have non-static data members", elt);
continue;
}
@ -2508,16 +2508,16 @@ finish_struct_anon (tree t)
if (TREE_PRIVATE (elt))
{
if (is_union)
permerror ("private member %q+#D in anonymous union", elt);
permerror (input_location, "private member %q+#D in anonymous union", elt);
else
permerror ("private member %q+#D in anonymous struct", elt);
permerror (input_location, "private member %q+#D in anonymous struct", elt);
}
else if (TREE_PROTECTED (elt))
{
if (is_union)
permerror ("protected member %q+#D in anonymous union", elt);
permerror (input_location, "protected member %q+#D in anonymous union", elt);
else
permerror ("protected member %q+#D in anonymous struct", elt);
permerror (input_location, "protected member %q+#D in anonymous struct", elt);
}
TREE_PRIVATE (elt) = TREE_PRIVATE (field);
@ -3048,7 +3048,7 @@ check_field_decls (tree t, tree *access_decls,
user-declared constructor. */
if (constructor_name_p (DECL_NAME (x), t)
&& TYPE_HAS_USER_CONSTRUCTOR (t))
permerror ("field %q+#D with same name as class", x);
permerror (input_location, "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. */
@ -6171,7 +6171,7 @@ resolve_address_of_overloaded_function (tree target_type,
if (!(flags & tf_error))
return error_mark_node;
permerror ("assuming pointer to member %qD", fn);
permerror (input_location, "assuming pointer to member %qD", fn);
if (!explained)
{
inform ("(a pointer to member can only be formed with %<&%E%>)", fn);
@ -6534,8 +6534,8 @@ note_name_declared_in_class (tree name, tree decl)
A name N used in a class S shall refer to the same declaration
in its context and when re-evaluated in the completed scope of
S. */
permerror ("declaration of %q#D", decl);
permerror ("changes meaning of %qD from %q+#D",
permerror (input_location, "declaration of %q#D", decl);
permerror (input_location, "changes meaning of %qD from %q+#D",
DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
}
}

View File

@ -379,7 +379,7 @@ warn_ref_binding (tree reftype, tree intype, tree decl)
msg = "conversion to non-const reference type %q#T from"
" rvalue of type %qT";
permerror (msg, reftype, intype);
permerror (input_location, msg, reftype, intype);
}
}
@ -449,7 +449,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
if (! (convtype & CONV_CONST)
&& !at_least_as_qualified_p (ttl, ttr))
permerror ("conversion from %qT to %qT discards qualifiers",
permerror (input_location, "conversion from %qT to %qT discards qualifiers",
ttr, reftype);
}
@ -649,7 +649,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
|| TREE_CODE (intype) == POINTER_TYPE)
{
if (flags & LOOKUP_COMPLAIN)
permerror ("conversion from %q#T to %q#T", intype, type);
permerror (input_location, "conversion from %q#T to %q#T", intype, type);
if (!flag_permissive)
return error_mark_node;

View File

@ -1055,8 +1055,8 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl)
return;
name = DECL_ASSEMBLER_NAME (newdecl);
permerror ("%qD was declared %<extern%> and later %<static%>", newdecl);
permerror ("previous declaration of %q+D", olddecl);
permerror (input_location, "%qD was declared %<extern%> and later %<static%>", newdecl);
permerror (input_location, "previous declaration of %q+D", olddecl);
}
/* NEW_DECL is a redeclaration of OLD_DECL; both are functions or
@ -1539,9 +1539,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (1 == simple_cst_equal (TREE_PURPOSE (t1),
TREE_PURPOSE (t2)))
{
permerror ("default argument given for parameter %d of %q#D",
permerror (input_location, "default argument given for parameter %d of %q#D",
i, newdecl);
permerror ("after previous specification in %q+#D", olddecl);
permerror (input_location, "after previous specification in %q+#D", olddecl);
}
else
{
@ -2448,11 +2448,11 @@ static void
identify_goto (tree decl, const location_t *locus)
{
if (decl)
permerror ("jump to label %qD", decl);
permerror (input_location, "jump to label %qD", decl);
else
permerror ("jump to case label");
permerror (input_location, "jump to case label");
if (locus)
permerror ("%H from here", locus);
permerror (input_location, "%H from here", locus);
}
/* Check that a single previously seen jump to a newly defined label
@ -2494,7 +2494,7 @@ check_previous_goto_1 (tree decl, struct cp_binding_level* level, tree names,
if (problem > 1)
error (" crosses initialization of %q+#D", new_decls);
else
permerror (" enters scope of non-POD %q+#D", new_decls);
permerror (input_location, " enters scope of non-POD %q+#D", new_decls);
}
if (b == level)
@ -2590,8 +2590,8 @@ check_goto (tree decl)
if (ent->in_try_scope || ent->in_catch_scope
|| ent->in_omp_scope || ent->bad_decls)
{
permerror ("jump to label %q+D", decl);
permerror (" from here");
permerror (input_location, "jump to label %q+D", decl);
permerror (input_location, " from here");
identified = true;
}
@ -2609,7 +2609,7 @@ check_goto (tree decl)
else if (u > 1)
error (" skips initialization of %q+#D", b);
else
permerror (" enters scope of non-POD %q+#D", b);
permerror (input_location, " enters scope of non-POD %q+#D", b);
}
if (ent->in_try_scope)
@ -2630,8 +2630,8 @@ check_goto (tree decl)
{
if (!identified)
{
permerror ("jump to label %q+D", decl);
permerror (" from here");
permerror (input_location, "jump to label %q+D", decl);
permerror (input_location, " from here");
identified = true;
}
error (" exits OpenMP structured block");
@ -2683,7 +2683,7 @@ define_label (location_t location, tree name)
p->more_cleanups_ok = 0;
if (name == get_identifier ("wchar_t"))
permerror ("label named wchar_t");
permerror (input_location, "label named wchar_t");
if (DECL_INITIAL (decl) != NULL_TREE)
{
@ -3766,7 +3766,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
else if (declspecs->redefined_builtin_type)
{
if (!in_system_header)
permerror ("redeclaration of C++ built-in type %qT",
permerror (input_location, "redeclaration of C++ built-in type %qT",
declspecs->redefined_builtin_type);
return NULL_TREE;
}
@ -3780,7 +3780,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
else if (declspecs->type == error_mark_node)
error_p = true;
if (declared_type == NULL_TREE && ! saw_friend && !error_p)
permerror ("declaration does not declare anything");
permerror (input_location, "declaration does not declare anything");
/* Check for an anonymous union. */
else if (declared_type && RECORD_OR_UNION_CODE_P (TREE_CODE (declared_type))
&& TYPE_ANONYMOUS_P (declared_type))
@ -4056,7 +4056,7 @@ start_decl (const cp_declarator *declarator,
if (DECL_CONTEXT (field) != context)
{
if (!same_type_p (DECL_CONTEXT (field), context))
permerror ("ISO C++ does not permit %<%T::%D%> "
permerror (input_location, "ISO C++ does not permit %<%T::%D%> "
"to be defined as %<%T::%D%>",
DECL_CONTEXT (field), DECL_NAME (decl),
context, DECL_NAME (decl));
@ -4112,7 +4112,7 @@ start_decl (const cp_declarator *declarator,
}
if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
permerror ("declaration of %q#D outside of class is not definition",
permerror (input_location, "declaration of %q#D outside of class is not definition",
decl);
}
@ -6377,7 +6377,7 @@ check_class_member_definition_namespace (tree decl)
The definition for a static data member shall appear in a
namespace scope enclosing the member's class definition. */
if (!is_ancestor (current_namespace, DECL_CONTEXT (decl)))
permerror ("definition of %qD is not in namespace enclosing %qT",
permerror (input_location, "definition of %qD is not in namespace enclosing %qT",
decl, DECL_CONTEXT (decl));
}
@ -6611,16 +6611,16 @@ grokfndecl (tree ctype,
/* Allow this; it's pretty common in C. */;
else
{
permerror ("non-local function %q#D uses anonymous type",
permerror (input_location, "non-local function %q#D uses anonymous type",
decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
permerror ("%q+#D does not refer to the unqualified "
permerror (input_location, "%q+#D does not refer to the unqualified "
"type, so it is not used for linkage",
TYPE_NAME (t));
}
}
else
permerror ("non-local function %q#D uses local type %qT", decl, t);
permerror (input_location, "non-local function %q#D uses local type %qT", decl, t);
}
}
@ -7765,7 +7765,7 @@ grokdeclarator (const cp_declarator *declarator,
else if (in_system_header || flag_ms_extensions)
/* Allow it, sigh. */;
else if (! is_main)
permerror ("ISO C++ forbids declaration of %qs with no type", name);
permerror (input_location, "ISO C++ forbids declaration of %qs with no type", name);
else if (pedantic)
pedwarn (OPT_pedantic,
"ISO C++ forbids declaration of %qs with no type", name);
@ -8211,7 +8211,7 @@ grokdeclarator (const cp_declarator *declarator,
explicitp = 2;
if (virtualp)
{
permerror ("constructors cannot be declared virtual");
permerror (input_location, "constructors cannot be declared virtual");
virtualp = 0;
}
if (decl_context == FIELD
@ -8434,11 +8434,11 @@ grokdeclarator (const cp_declarator *declarator,
{
if (friendp)
{
permerror ("member functions are implicitly friends of their class");
permerror (input_location, "member functions are implicitly friends of their class");
friendp = 0;
}
else
permerror_at (declarator->id_loc,
permerror (declarator->id_loc,
"extra qualification %<%T::%> on member %qs",
ctype, name);
}
@ -8624,7 +8624,7 @@ grokdeclarator (const cp_declarator *declarator,
DECL_ABSTRACT (decl) = 1;
}
else if (constructor_name_p (unqualified_id, current_class_type))
permerror ("ISO C++ forbids nested type %qD with same name "
permerror (input_location, "ISO C++ forbids nested type %qD with same name "
"as enclosing class",
unqualified_id);
@ -8749,13 +8749,13 @@ grokdeclarator (const cp_declarator *declarator,
{
/* Don't allow friend declaration without a class-key. */
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
permerror ("template parameters cannot be friends");
permerror (input_location, "template parameters cannot be friends");
else if (TREE_CODE (type) == TYPENAME_TYPE)
permerror ("friend declaration requires class-key, "
permerror (input_location, "friend declaration requires class-key, "
"i.e. %<friend class %T::%D%>",
TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type));
else
permerror ("friend declaration requires class-key, "
permerror (input_location, "friend declaration requires class-key, "
"i.e. %<friend %#T%>",
type);
}
@ -9077,9 +9077,9 @@ grokdeclarator (const cp_declarator *declarator,
the rest of the compiler does not correctly
handle the initialization unless the member is
static so we make it static below. */
permerror ("ISO C++ forbids initialization of member %qD",
permerror (input_location, "ISO C++ forbids initialization of member %qD",
unqualified_id);
permerror ("making %qD static", unqualified_id);
permerror (input_location, "making %qD static", unqualified_id);
staticp = 1;
}
@ -9203,7 +9203,7 @@ grokdeclarator (const cp_declarator *declarator,
declaring main to be static. */
if (TREE_CODE (type) == METHOD_TYPE)
{
permerror ("cannot declare member function %qD to have "
permerror (input_location, "cannot declare member function %qD to have "
"static linkage", decl);
invalid_static = 1;
}
@ -9240,7 +9240,7 @@ grokdeclarator (const cp_declarator *declarator,
DECL_CONTEXT (decl) = ctype;
if (staticp == 1)
{
permerror ("%<static%> may not be used when defining "
permerror (input_location, "%<static%> may not be used when defining "
"(as opposed to declaring) a static data member");
staticp = 0;
storage_class = sc_none;

View File

@ -718,7 +718,7 @@ finish_static_data_member_decl (tree decl,
VEC_safe_push (tree, gc, pending_statics, decl);
if (LOCAL_CLASS_P (current_class_type))
permerror ("local class %q#T shall not have static data member %q#D",
permerror (input_location, "local class %q#T shall not have static data member %q#D",
current_class_type, decl);
/* Static consts need not be initialized in the class definition. */
@ -1260,15 +1260,15 @@ build_anon_union_vars (tree type, tree object)
continue;
if (TREE_CODE (field) != FIELD_DECL)
{
permerror ("%q+#D invalid; an anonymous union can only "
permerror (input_location, "%q+#D invalid; an anonymous union can only "
"have non-static data members", field);
continue;
}
if (TREE_PRIVATE (field))
permerror ("private member %q+#D in anonymous union", field);
permerror (input_location, "private member %q+#D in anonymous union", field);
else if (TREE_PROTECTED (field))
permerror ("protected member %q+#D in anonymous union", field);
permerror (input_location, "protected member %q+#D in anonymous union", field);
if (processing_template_decl)
ref = build_min_nt (COMPONENT_REF, object,
@ -1403,7 +1403,7 @@ coerce_new_type (tree type)
e = 2;
if (e == 2)
permerror ("%<operator new%> takes type %<size_t%> (%qT) "
permerror (input_location, "%<operator new%> takes type %<size_t%> (%qT) "
"as first parameter", size_type_node);
switch (e)

View File

@ -1028,7 +1028,7 @@ check_handlers (tree handlers)
if (tsi_end_p (i))
break;
if (TREE_TYPE (handler) == NULL_TREE)
permerror ("%H%<...%> handler must be the last handler for"
permerror (input_location, "%H%<...%> handler must be the last handler for"
" its try block", EXPR_LOCUS (handler));
else
check_handlers_1 (handler, i);

View File

@ -522,7 +522,7 @@ perform_member_init (tree member, tree init)
&& !type_has_user_provided_default_constructor (type))
/* TYPE_NEEDS_CONSTRUCTING can be set just because we have a
vtable; still give this diagnostic. */
permerror ("%Juninitialized member %qD with %<const%> type %qT",
permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
current_function_decl, member, type);
finish_expr_stmt (build_aggr_init (decl, init, 0,
tf_warning_or_error));
@ -542,10 +542,10 @@ perform_member_init (tree member, tree init)
}
/* member traversal: note it leaves init NULL */
else if (TREE_CODE (type) == REFERENCE_TYPE)
permerror ("%Juninitialized reference member %qD",
permerror (input_location, "%Juninitialized reference member %qD",
current_function_decl, member);
else if (CP_TYPE_CONST_P (type))
permerror ("%Juninitialized member %qD with %<const%> type %qT",
permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
current_function_decl, member, type);
}
else if (TREE_CODE (init) == TREE_LIST)
@ -2171,7 +2171,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
if (init)
{
if (complain & tf_error)
permerror ("ISO C++ forbids initialization in array new");
permerror (input_location, "ISO C++ forbids initialization in array new");
else
return error_mark_node;
}
@ -2387,7 +2387,7 @@ build_new (tree placement, tree type, tree nelts, tree init,
if (!build_expr_type_conversion (WANT_INT | WANT_ENUM, nelts, false))
{
if (complain & tf_error)
permerror ("size in array new must have integral type");
permerror (input_location, "size in array new must have integral type");
else
return error_mark_node;
}

View File

@ -481,7 +481,7 @@ unqualified_fn_lookup_error (tree name)
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
permerror ("there are no arguments to %qD that depend on a template "
permerror (input_location, "there are no arguments to %qD that depend on a template "
"parameter, so a declaration of %qD must be available",
name, name);

View File

@ -890,8 +890,8 @@ pushdecl_maybe_friend (tree x, bool is_friend)
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
permerror ("type mismatch with previous external decl of %q#D", x);
permerror ("previous external decl of %q+#D", decl);
permerror (input_location, "type mismatch with previous external decl of %q#D", x);
permerror (input_location, "previous external decl of %q+#D", decl);
}
}
@ -1217,10 +1217,10 @@ check_for_out_of_scope_variable (tree decl)
}
else
{
permerror ("name lookup of %qD changed for ISO %<for%> scoping",
permerror (input_location, "name lookup of %qD changed for ISO %<for%> scoping",
DECL_NAME (decl));
if (flag_permissive)
permerror (" using obsolete binding at %q+D", decl);
permerror (input_location, " using obsolete binding at %q+D", decl);
else
{
static bool hint;

View File

@ -4142,7 +4142,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
&& !(TREE_CODE (new_scope) == TYPENAME_TYPE
&& (TREE_CODE (TYPENAME_TYPE_FULLNAME (new_scope))
== TEMPLATE_ID_EXPR)))
permerror (TYPE_P (new_scope)
permerror (input_location, TYPE_P (new_scope)
? "%qT is not a template"
: "%qD is not a template",
new_scope);
@ -9046,8 +9046,8 @@ cp_parser_mem_initializer (cp_parser* parser)
/* Find out what is being initialized. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
permerror ("%Hanachronistic old-style base class initializer",
&token->location);
permerror (token->location,
"anachronistic old-style base class initializer");
mem_initializer_id = NULL_TREE;
}
else
@ -9980,8 +9980,8 @@ cp_parser_template_id (cp_parser *parser,
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
if (permerror ("%H%<<::%> cannot begin a template-argument list",
&next_token->location))
if (permerror (next_token->location,
"%<<::%> cannot begin a template-argument list"))
{
static bool hint = false;
inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
@ -11358,7 +11358,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl)
permerror ("using %<typename%> outside of template");
permerror (input_location, "using %<typename%> outside of template");
}
/* Otherwise it must be a class-key. */
else
@ -15031,7 +15031,7 @@ cp_parser_class_head (cp_parser* parser,
class member of a namespace outside of its namespace. */
if (scope == nested_name_specifier)
{
permerror ("%Hextra qualification not allowed",
permerror (input_location, "%Hextra qualification not allowed",
&nested_name_specifier_token_start->location);
nested_name_specifier = NULL_TREE;
num_templates = 0;
@ -18469,7 +18469,7 @@ static void
cp_parser_check_class_key (enum tag_types class_key, tree type)
{
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
permerror ("%qs tag used in naming %q#T",
permerror (input_location, "%qs tag used in naming %q#T",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
type);

View File

@ -710,8 +710,8 @@ check_specialization_namespace (tree tmpl)
return true;
else
{
permerror ("specialization of %qD in different namespace", tmpl);
permerror (" from definition of %q+#D", tmpl);
permerror (input_location, "specialization of %qD in different namespace", tmpl);
permerror (input_location, " from definition of %q+#D", tmpl);
return false;
}
}
@ -728,7 +728,7 @@ check_explicit_instantiation_namespace (tree spec)
namespace of its template. */
ns = decl_namespace_context (spec);
if (!is_ancestor (current_namespace, ns))
permerror ("explicit instantiation of %qD in namespace %qD "
permerror (input_location, "explicit instantiation of %qD in namespace %qD "
"(which does not enclose namespace %qD)",
spec, current_namespace, ns);
}
@ -811,8 +811,8 @@ maybe_process_partial_specialization (tree type)
if (current_namespace
!= decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
{
permerror ("specializing %q#T in different namespace", type);
permerror (" from definition of %q+#D",
permerror (input_location, "specializing %q#T in different namespace", type);
permerror (input_location, " from definition of %q+#D",
CLASSTYPE_TI_TEMPLATE (type));
}
@ -2002,8 +2002,8 @@ check_explicit_specialization (tree declarator,
for (; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
permerror
("default argument specified in explicit specialization");
permerror (input_location,
"default argument specified in explicit specialization");
break;
}
}
@ -4942,7 +4942,7 @@ convert_template_argument (tree parm,
if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
{
permerror ("to refer to a type member of a template parameter, "
permerror (input_location, "to refer to a type member of a template parameter, "
"use %<typename %E%>", orig_arg);
orig_arg = make_typename_type (TREE_OPERAND (arg, 0),
@ -14591,7 +14591,7 @@ do_decl_instantiation (tree decl, tree storage)
the first instantiation was `extern' and the second is not,
and EXTERN_P for the opposite case. */
if (DECL_NOT_REALLY_EXTERN (result) && !extern_p)
permerror ("duplicate explicit instantiation of %q#D", result);
permerror (input_location, "duplicate explicit instantiation of %q#D", result);
/* If an "extern" explicit instantiation follows an ordinary
explicit instantiation, the template is instantiated. */
if (extern_p)
@ -14604,7 +14604,7 @@ do_decl_instantiation (tree decl, tree storage)
}
else if (!DECL_TEMPLATE_INFO (result))
{
permerror ("explicit instantiation of non-template %q#D", result);
permerror (input_location, "explicit instantiation of non-template %q#D", result);
return;
}
@ -14756,7 +14756,7 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
if (!previous_instantiation_extern_p && !extern_p
&& (complain & tf_error))
permerror ("duplicate explicit instantiation of %q#T", t);
permerror (input_location, "duplicate explicit instantiation of %q#T", t);
/* If we've already instantiated the template, just return now. */
if (!CLASSTYPE_INTERFACE_ONLY (t))
@ -15200,8 +15200,8 @@ instantiate_decl (tree d, int defer_ok,
member function or static data member of a class template
shall be present in every translation unit in which it is
explicitly instantiated. */
permerror
("explicit instantiation of %qD but no definition available", d);
permerror (input_location, "explicit instantiation of %qD "
"but no definition available", d);
/* ??? Historically, we have instantiated inline functions, even
when marked as "extern template". */

View File

@ -2191,7 +2191,7 @@ finish_template_type_parm (tree aggr, tree identifier)
{
if (aggr != class_type_node)
{
permerror ("template type parameters must use the keyword %<class%> or %<typename%>");
permerror (input_location, "template type parameters must use the keyword %<class%> or %<typename%>");
aggr = class_type_node;
}

View File

@ -435,7 +435,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location,
else
{
if (complain & tf_error)
permerror ("%s between distinct pointer types %qT and %qT "
permerror (input_location, "%s between distinct pointer types %qT and %qT "
"lacks a cast",
location, t1, t2);
result_type = void_type_node;
@ -450,7 +450,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location,
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2))
&& (complain & tf_error))
permerror ("%s between distinct pointer types %qT and %qT "
permerror (input_location, "%s between distinct pointer types %qT and %qT "
"lacks a cast",
location, t1, t2);
result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
@ -1357,7 +1357,7 @@ cxx_sizeof_expr (tree e, tsubst_flags_t complain)
else if (is_overloaded_fn (e))
{
if (complain & tf_error)
permerror ("ISO C++ forbids applying %<sizeof%> to an expression of "
permerror (input_location, "ISO C++ forbids applying %<sizeof%> to an expression of "
"function type");
else
return error_mark_node;
@ -1417,7 +1417,7 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain)
else if (is_overloaded_fn (e))
{
if (complain & tf_error)
permerror ("ISO C++ forbids applying %<__alignof%> to an expression of "
permerror (input_location, "ISO C++ forbids applying %<__alignof%> to an expression of "
"function type");
else
return error_mark_node;
@ -2136,7 +2136,7 @@ check_template_keyword (tree decl)
&& TREE_CODE (decl) != TEMPLATE_ID_EXPR)
{
if (!is_overloaded_fn (decl))
permerror ("%qD is not a template", decl);
permerror (input_location, "%qD is not a template", decl);
else
{
tree fns;
@ -2156,7 +2156,7 @@ check_template_keyword (tree decl)
fns = OVL_NEXT (fns);
}
if (!fns)
permerror ("%qD is not a template", decl);
permerror (input_location, "%qD is not a template", decl);
}
}
}
@ -3235,7 +3235,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (t != error_mark_node)
{
if (complain & tf_error)
permerror ("assuming cast to type %qT from overloaded function",
permerror (input_location, "assuming cast to type %qT from overloaded function",
TREE_TYPE (t));
op0 = t;
}
@ -3246,7 +3246,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (t != error_mark_node)
{
if (complain & tf_error)
permerror ("assuming cast to type %qT from overloaded function",
permerror (input_location, "assuming cast to type %qT from overloaded function",
TREE_TYPE (t));
op1 = t;
}
@ -3521,7 +3521,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{
result_type = type0;
if (complain & tf_error)
permerror ("ISO C++ forbids comparison between pointer and integer");
permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
@ -3529,7 +3529,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{
result_type = type1;
if (complain & tf_error)
permerror ("ISO C++ forbids comparison between pointer and integer");
permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
@ -3709,7 +3709,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{
result_type = type0;
if (complain & tf_error)
permerror ("ISO C++ forbids comparison between pointer and integer");
permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
@ -3717,7 +3717,7 @@ cp_build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{
result_type = type1;
if (complain & tf_error)
permerror ("ISO C++ forbids comparison between pointer and integer");
permerror (input_location, "ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
@ -3930,11 +3930,11 @@ pointer_diff (tree op0, tree op1, tree ptrtype)
return error_mark_node;
if (TREE_CODE (target_type) == VOID_TYPE)
permerror ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
permerror (input_location, "ISO C++ forbids using pointer of type %<void *%> in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
permerror ("ISO C++ forbids using pointer to a function in subtraction");
permerror (input_location, "ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
permerror ("ISO C++ forbids using pointer to a method in subtraction");
permerror (input_location, "ISO C++ forbids using pointer to a method in subtraction");
/* First do the subtraction as integers;
then drop through to build the divide operator. */
@ -4299,7 +4299,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
if (TREE_CODE (argtype) == ENUMERAL_TYPE)
{
if (complain & tf_error)
permerror ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
permerror (input_location, (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
? G_("ISO C++ forbids incrementing an enum")
: G_("ISO C++ forbids decrementing an enum"));
else
@ -4327,7 +4327,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
&& !TYPE_PTROB_P (argtype))
{
if (complain & tf_error)
permerror ((code == PREINCREMENT_EXPR
permerror (input_location, (code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR)
? G_("ISO C++ forbids incrementing a pointer of type %qT")
: G_("ISO C++ forbids decrementing a pointer of type %qT"),
@ -4388,7 +4388,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
{
/* ARM $3.4 */
if (complain & tf_error)
permerror ("ISO C++ forbids taking address of function %<::main%>");
permerror (input_location, "ISO C++ forbids taking address of function %<::main%>");
else
return error_mark_node;
}
@ -4449,12 +4449,12 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
else if (current_class_type
&& TREE_OPERAND (arg, 0) == current_class_ref)
/* An expression like &memfn. */
permerror ("ISO C++ forbids taking the address of an unqualified"
permerror (input_location, "ISO C++ forbids taking the address of an unqualified"
" or parenthesized non-static member function to form"
" a pointer to member function. Say %<&%T::%D%>",
base, name);
else
permerror ("ISO C++ forbids taking the address of a bound member"
permerror (input_location, "ISO C++ forbids taking the address of a bound member"
" function to form a pointer to member function."
" Say %<&%T::%D%>",
base, name);
@ -4483,7 +4483,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
if (! lvalue_p (arg) && complain == tf_none)
{
if (complain & tf_error)
permerror ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
permerror (input_location, "ISO C++ forbids taking the address of a cast to a non-lvalue expression");
else
return error_mark_node;
}
@ -4820,7 +4820,7 @@ tree build_x_compound_expr_from_list (tree list, const char *msg)
if (TREE_CHAIN (list))
{
if (msg)
permerror ("%s expression list treated as compound expression", msg);
permerror (input_location, "%s expression list treated as compound expression", msg);
for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list))
expr = build_x_compound_expr (expr, TREE_VALUE (list),
@ -5372,7 +5372,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
{
if (complain & tf_error)
permerror ("cast from %qT to %qT loses precision",
permerror (input_location, "cast from %qT to %qT loses precision",
intype, type);
else
return error_mark_node;
@ -5649,7 +5649,7 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain)
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{
if (complain & tf_error)
permerror ("ISO C++ forbids casting to an array type %qT", type);
permerror (input_location, "ISO C++ forbids casting to an array type %qT", type);
else
return error_mark_node;
type = build_pointer_type (TREE_TYPE (type));
@ -6775,7 +6775,7 @@ check_return_expr (tree retval, bool *no_warning)
that's supposed to return a value. */
if (!retval && fn_returns_value_p)
{
permerror ("return-statement with no value, in function returning %qT",
permerror (input_location, "return-statement with no value, in function returning %qT",
valtype);
/* Clear this, so finish_function won't say that we reach the
end of a non-void function (which we don't, we gave a
@ -6796,7 +6796,7 @@ check_return_expr (tree retval, bool *no_warning)
its side-effects. */
finish_expr_stmt (retval);
else
permerror ("return-statement with a value, in function "
permerror (input_location, "return-statement with a value, in function "
"returning 'void'");
current_function_returns_null = 1;

View File

@ -777,7 +777,7 @@ digest_init_r (tree type, tree init, bool nested)
counted in the length of the constant, but in C++ this would
be invalid. */
if (size < TREE_STRING_LENGTH (init))
permerror ("initializer-string for array of chars is too long");
permerror (input_location, "initializer-string for array of chars is too long");
}
return init;
}

View File

@ -586,7 +586,7 @@ pedwarn (int opt, const char *gmsgid, ...)
Returns true if the warning was printed, false if it was inhibited. */
bool
permerror_at (location_t location, const char *gmsgid, ...)
permerror (location_t location, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
@ -599,23 +599,6 @@ permerror_at (location_t location, const char *gmsgid, ...)
return report_diagnostic (&diagnostic);
}
/* Equivalent to permerror_at (input_location, ...). */
bool
permerror (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
va_end (ap);
return report_diagnostic (&diagnostic);
}
/* A hard error: the code is definitely ill-formed, and an object file
will not be produced. */
void

View File

@ -67,9 +67,7 @@ extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
extern bool pedwarn (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern bool pedwarn_at (location_t, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
extern bool permerror (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern bool permerror_at (location_t, const char *, ...)
ATTRIBUTE_GCC_DIAG(2,3);
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 (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);