+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,
+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
/* 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);
}
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;
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;
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;
}
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);
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. */
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);
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);
}
}
msg = "conversion to non-const reference type %q#T from"
" rvalue of type %qT";
- permerror (msg, reftype, intype);
+ permerror (input_location, msg, reftype, intype);
}
}
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);
}
|| 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;
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
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
{
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
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)
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;
}
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)
{
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");
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)
{
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;
}
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))
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));
}
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);
}
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));
}
/* 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);
}
}
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);
explicitp = 2;
if (virtualp)
{
- permerror ("constructors cannot be declared virtual");
+ permerror (input_location, "constructors cannot be declared virtual");
virtualp = 0;
}
if (decl_context == FIELD
{
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);
}
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);
{
/* 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);
}
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;
}
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;
}
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;
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. */
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,
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)
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);
&& !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));
}
/* 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)
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;
}
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;
}
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);
&& 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);
}
}
}
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;
&& !(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);
/* 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
}
/* 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 "
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
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;
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);
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;
}
}
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);
}
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));
}
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;
}
}
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),
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)
}
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;
}
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))
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". */
{
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;
}
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;
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),
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;
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;
&& 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;
fns = OVL_NEXT (fns);
}
if (!fns)
- permerror ("%qD is not a template", decl);
+ permerror (input_location, "%qD is not a template", decl);
}
}
}
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;
}
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;
}
{
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;
}
{
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;
}
{
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;
}
{
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;
}
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. */
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
&& !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"),
{
/* 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;
}
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);
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;
}
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),
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;
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));
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
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;
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;
}
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;
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
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);