+2008-06-21 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * typeck.c (composite_pointer_type_r, cxx_sizeof_expr,
+ cxx_alignof_expr, check_template_keyword, cp_build_binary_op,
+ pointer_diff, cp_build_unary_op, build_x_compound_expr_from_list,
+ build_reinterpret_cast_1, cp_build_c_cast, check_return_expr): Change
+ pedwarn to permerror.
+ * init.c (perform_member_init, build_new_1, build_new): Likewise.
+ * decl.c (warn_extern_redeclared_static, duplicate_decls,
+ * identify_goto, check_previous_goto_1, check_goto, define_label,
+ check_tag_decl, start_decl, check_class_member_definition_namespace,
+ grokfndecl, grokdeclarator): Likewise.
+ * except.c (check_handlers): Likewise.
+ * typeck2.c (digest_init): Likewise.
+ * pt.c (check_specialization_namespace,
+ check_explicit_instantiation_namespace,
+ maybe_process_partial_specialization, check_explicit_specialization,
+ convert_template_argument, do_decl_instantiation,
+ do_type_instantiation, instantiate_decl): Likewise.
+ * semantics.c (finish_template_type_parm): Likewise.
+ * name-lookup.c (pushdecl_maybe_friend,
+ check_for_out_of_scope_variable): Likewise.
+ * decl2.c (finish_static_data_member_decl, build_anon_union_vars,
+ coerce_new_type): Likewise.
+ * parser.c (cp_parser_nested_name_specifier_opt,
+ cp_parser_mem_initializer, cp_parser_elaborated_type_specifier,
+ cp_parser_class_head, cp_parser_check_class_key): Likewise.
+ (cp_parser_parameter_declaration): Check flag_permissive instead of
+ flag_pedantic_errors.
+ * call.c (joust): Change pedwarn to warning.
+ * friend.c (make_friend_class): Likewise.
+
2008-06-16 Jan Hubicka <jh@suse.cz>
* method.c: Include cgraph.h.
{
if (warn)
{
- pedwarn ("\
-ISO C++ says that these are ambiguous, even \
-though the worst conversion for the first is better than \
-the worst conversion for the second:");
+ warning (0,
+ "ISO C++ says that these are ambiguous, even "
+ "though the worst conversion for the first is better than "
+ "the worst conversion for the second:");
print_z_candidate (_("candidate 1:"), w);
print_z_candidate (_("candidate 2:"), l);
}
return;
name = DECL_ASSEMBLER_NAME (newdecl);
- pedwarn ("%qD was declared %<extern%> and later %<static%>", newdecl);
- pedwarn ("previous declaration of %q+D", olddecl);
+ permerror ("%qD was declared %<extern%> and later %<static%>", newdecl);
+ permerror ("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)))
{
- pedwarn ("default argument given for parameter %d of %q#D",
- i, newdecl);
- pedwarn ("after previous specification in %q+#D", olddecl);
+ permerror ("default argument given for parameter %d of %q#D",
+ i, newdecl);
+ permerror ("after previous specification in %q+#D", olddecl);
}
else
{
identify_goto (tree decl, const location_t *locus)
{
if (decl)
- pedwarn ("jump to label %qD", decl);
+ permerror ("jump to label %qD", decl);
else
- pedwarn ("jump to case label");
+ permerror ("jump to case label");
if (locus)
- pedwarn ("%H from here", locus);
+ permerror ("%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
- pedwarn (" enters scope of non-POD %q+#D", new_decls);
+ permerror (" 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)
{
- pedwarn ("jump to label %q+D", decl);
- pedwarn (" from here");
+ permerror ("jump to label %q+D", decl);
+ permerror (" from here");
identified = true;
}
else if (u > 1)
error (" skips initialization of %q+#D", b);
else
- pedwarn (" enters scope of non-POD %q+#D", b);
+ permerror (" enters scope of non-POD %q+#D", b);
}
if (ent->in_try_scope)
{
if (!identified)
{
- pedwarn ("jump to label %q+D", decl);
- pedwarn (" from here");
+ permerror ("jump to label %q+D", decl);
+ permerror (" from here");
identified = true;
}
error (" exits OpenMP structured block");
p->more_cleanups_ok = 0;
if (name == get_identifier ("wchar_t"))
- pedwarn ("label named wchar_t");
+ permerror ("label named wchar_t");
if (DECL_INITIAL (decl) != NULL_TREE)
{
else if (declspecs->redefined_builtin_type)
{
if (!in_system_header)
- pedwarn ("redeclaration of C++ built-in type %qT",
- declspecs->redefined_builtin_type);
+ permerror ("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)
- pedwarn ("declaration does not declare anything");
+ permerror ("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))
- pedwarn ("ISO C++ does not permit %<%T::%D%> "
- "to be defined as %<%T::%D%>",
- DECL_CONTEXT (field), DECL_NAME (decl),
- context, DECL_NAME (decl));
+ permerror ("ISO C++ does not permit %<%T::%D%> "
+ "to be defined as %<%T::%D%>",
+ DECL_CONTEXT (field), DECL_NAME (decl),
+ context, DECL_NAME (decl));
DECL_CONTEXT (decl) = DECL_CONTEXT (field);
}
if (processing_specialization
}
if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
- pedwarn ("declaration of %q#D outside of class is not definition",
- decl);
+ permerror ("declaration of %q#D outside of class is not definition",
+ decl);
}
was_public = TREE_PUBLIC (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)))
- pedwarn ("definition of %qD is not in namespace enclosing %qT",
- decl, DECL_CONTEXT (decl));
+ permerror ("definition of %qD is not in namespace enclosing %qT",
+ decl, DECL_CONTEXT (decl));
}
/* Build a PARM_DECL for the "this" parameter. TYPE is the
/* Allow this; it's pretty common in C. */;
else
{
- pedwarn ("non-local function %q#D uses anonymous type",
+ permerror ("non-local function %q#D uses anonymous type",
decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
- pedwarn ("%q+#D does not refer to the unqualified "
- "type, so it is not used for linkage",
- TYPE_NAME (t));
+ permerror ("%q+#D does not refer to the unqualified "
+ "type, so it is not used for linkage",
+ TYPE_NAME (t));
}
}
else
- pedwarn ("non-local function %q#D uses local type %qT", decl, t);
+ permerror ("non-local function %q#D uses local type %qT", decl, t);
}
}
/* We've already issued an error, don't complain more. */;
else if (in_system_header || flag_ms_extensions)
/* Allow it, sigh. */;
- else if (pedantic || ! is_main)
+ else if (! is_main)
+ permerror ("ISO C++ forbids declaration of %qs with no type", name);
+ else if (pedantic)
pedwarn ("ISO C++ forbids declaration of %qs with no type", name);
else
warning (OPT_Wreturn_type,
explicitp = 2;
if (virtualp)
{
- pedwarn ("constructors cannot be declared virtual");
+ permerror ("constructors cannot be declared virtual");
virtualp = 0;
}
if (decl_context == FIELD
{
if (friendp)
{
- pedwarn ("member functions are implicitly friends of their class");
+ permerror ("member functions are implicitly friends of their class");
friendp = 0;
}
else
- pedwarn ("extra qualification %<%T::%> on member %qs",
- ctype, name);
+ permerror ("extra qualification %<%T::%> on member %qs",
+ ctype, name);
}
else if (/* If the qualifying type is already complete, then we
can skip the following checks. */
DECL_ABSTRACT (decl) = 1;
}
else if (constructor_name_p (unqualified_id, current_class_type))
- pedwarn ("ISO C++ forbids nested type %qD with same name "
- "as enclosing class",
- unqualified_id);
+ permerror ("ISO C++ forbids nested type %qD with same name "
+ "as enclosing class",
+ unqualified_id);
/* If the user declares "typedef struct {...} foo" then the
struct will have an anonymous name. Fill that name in now.
{
/* Don't allow friend declaration without a class-key. */
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
- pedwarn ("template parameters cannot be friends");
+ permerror ("template parameters cannot be friends");
else if (TREE_CODE (type) == TYPENAME_TYPE)
- pedwarn ("friend declaration requires class-key, "
- "i.e. %<friend class %T::%D%>",
- TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type));
+ permerror ("friend declaration requires class-key, "
+ "i.e. %<friend class %T::%D%>",
+ TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type));
else
- pedwarn ("friend declaration requires class-key, "
- "i.e. %<friend %#T%>",
- type);
+ permerror ("friend declaration requires class-key, "
+ "i.e. %<friend %#T%>",
+ type);
}
/* Only try to do this stuff if we didn't already give up. */
{
/* Friends are treated specially. */
if (ctype == current_class_type)
- ; /* We already issued a pedwarn. */
+ ; /* We already issued a permerror. */
else if (decl && DECL_NAME (decl))
{
if (template_class_depth (current_class_type) == 0)
the rest of the compiler does not correctly
handle the initialization unless the member is
static so we make it static below. */
- pedwarn ("ISO C++ forbids initialization of member %qD",
- unqualified_id);
- pedwarn ("making %qD static", unqualified_id);
+ permerror ("ISO C++ forbids initialization of member %qD",
+ unqualified_id);
+ permerror ("making %qD static", unqualified_id);
staticp = 1;
}
declaring main to be static. */
if (TREE_CODE (type) == METHOD_TYPE)
{
- pedwarn ("cannot declare member function %qD to have "
- "static linkage", decl);
+ permerror ("cannot declare member function %qD to have "
+ "static linkage", decl);
invalid_static = 1;
}
else if (current_function_decl)
DECL_CONTEXT (decl) = ctype;
if (staticp == 1)
{
- pedwarn ("%<static%> may not be used when defining "
- "(as opposed to declaring) a static data member");
+ permerror ("%<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))
- pedwarn ("local class %q#T shall not have static data member %q#D",
- current_class_type, decl);
+ permerror ("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. */
if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
continue;
if (TREE_CODE (field) != FIELD_DECL)
{
- pedwarn ("%q+#D invalid; an anonymous union can only "
- "have non-static data members", field);
+ permerror ("%q+#D invalid; an anonymous union can only "
+ "have non-static data members", field);
continue;
}
if (TREE_PRIVATE (field))
- pedwarn ("private member %q+#D in anonymous union", field);
+ permerror ("private member %q+#D in anonymous union", field);
else if (TREE_PROTECTED (field))
- pedwarn ("protected member %q+#D in anonymous union", field);
+ permerror ("protected member %q+#D in anonymous union", field);
if (processing_template_decl)
ref = build_min_nt (COMPONENT_REF, object,
e = 2;
if (e == 2)
- pedwarn ("%<operator new%> takes type %<size_t%> (%qT) "
- "as first parameter", size_type_node);
+ permerror ("%<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)
- pedwarn ("%H%<...%> handler must be the last handler for"
- " its try block", EXPR_LOCUS (handler));
+ permerror ("%H%<...%> handler must be the last handler for"
+ " its try block", EXPR_LOCUS (handler));
else
check_handlers_1 (handler, i);
}
else if (same_type_p (type, friend_type))
{
if (complain)
- pedwarn ("class %qT is implicitly friends with itself",
+ warning (0, "class %qT is implicitly friends with itself",
type);
return;
}
}
/* member traversal: note it leaves init NULL */
else if (TREE_CODE (type) == REFERENCE_TYPE)
- pedwarn ("%Juninitialized reference member %qD",
- current_function_decl, member);
+ permerror ("%Juninitialized reference member %qD",
+ current_function_decl, member);
else if (CP_TYPE_CONST_P (type))
- pedwarn ("%Juninitialized member %qD with %<const%> type %qT",
- current_function_decl, member, type);
+ permerror ("%Juninitialized member %qD with %<const%> type %qT",
+ current_function_decl, member, type);
}
else if (TREE_CODE (init) == TREE_LIST)
/* There was an explicit member initialization. Do some work
else if (init)
{
if (complain & tf_error)
- pedwarn ("ISO C++ forbids initialization in array new");
+ permerror ("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)
- pedwarn ("size in array new must have integral type");
+ permerror ("size in array new must have integral type");
else
return error_mark_node;
}
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
- pedwarn ("type mismatch with previous external decl of %q#D", x);
- pedwarn ("previous external decl of %q+#D", decl);
+ permerror ("type mismatch with previous external decl of %q#D", x);
+ permerror ("previous external decl of %q+#D", decl);
}
}
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
- error ("name lookup of %qD changed for new ISO %<for%> scoping",
+ error ("name lookup of %qD changed for ISO %<for%> scoping",
DECL_NAME (decl));
error (" cannot use obsolete binding at %q+D because "
"it has a destructor", decl);
}
else
{
- pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping",
- DECL_NAME (decl));
- pedwarn (" using obsolete binding at %q+D", decl);
+ permerror ("name lookup of %qD changed for ISO %<for%> scoping",
+ DECL_NAME (decl));
+ if (flag_permissive)
+ permerror (" using obsolete binding at %q+D", decl);
+ else
+ {
+ static bool hint;
+ if (!hint)
+ {
+ inform ("(if you use %<-fpermissive%> G++ will accept your code)");
+ hint = true;
+ }
+ }
}
return decl;
&& !(TREE_CODE (new_scope) == TYPENAME_TYPE
&& (TREE_CODE (TYPENAME_TYPE_FULLNAME (new_scope))
== TEMPLATE_ID_EXPR)))
- pedwarn (TYPE_P (new_scope)
- ? "%qT is not a template"
- : "%qD is not a template",
- new_scope);
+ permerror (TYPE_P (new_scope)
+ ? "%qT is not a template"
+ : "%qD is not a template",
+ new_scope);
/* If it is a class scope, try to complete it; we are about to
be looking up names inside the class. */
if (TYPE_P (new_scope)
/* Find out what is being initialized. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
- pedwarn ("anachronistic old-style base class initializer");
+ permerror ("anachronistic old-style base class initializer");
mem_initializer_id = NULL_TREE;
}
else
static bool hint;
if (!hint)
{
- inform ("(if you use -fpermissive G++ will accept your code)");
+ inform ("(if you use %<-fpermissive%> G++ will accept your code)");
hint = true;
}
}
tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl)
- pedwarn ("using %<typename%> outside of template");
+ permerror ("using %<typename%> outside of template");
}
/* Otherwise it must be a class-key. */
else
if (!parser->default_arg_ok_p)
{
- if (!flag_pedantic_errors)
+ if (flag_permissive)
warning (0, "deprecated use of default argument for parameter of non-function");
else
{
class member of a namespace outside of its namespace. */
if (scope == nested_name_specifier)
{
- pedwarn ("extra qualification ignored");
+ permerror ("extra qualification not allowed");
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))
- pedwarn ("%qs tag used in naming %q#T",
+ permerror ("%qs tag used in naming %q#T",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
type);
return true;
else
{
- pedwarn ("specialization of %qD in different namespace", tmpl);
- pedwarn (" from definition of %q+#D", tmpl);
+ permerror ("specialization of %qD in different namespace", tmpl);
+ permerror (" from definition of %q+#D", tmpl);
return false;
}
}
namespace of its template. */
ns = decl_namespace_context (spec);
if (!is_ancestor (current_namespace, ns))
- pedwarn ("explicit instantiation of %qD in namespace %qD "
- "(which does not enclose namespace %qD)",
- spec, current_namespace, ns);
+ permerror ("explicit instantiation of %qD in namespace %qD "
+ "(which does not enclose namespace %qD)",
+ spec, current_namespace, ns);
}
/* The TYPE is being declared. If it is a template type, that means it
if (current_namespace
!= decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
{
- pedwarn ("specializing %q#T in different namespace", type);
- pedwarn (" from definition of %q+#D",
- CLASSTYPE_TI_TEMPLATE (type));
+ permerror ("specializing %q#T in different namespace", type);
+ permerror (" from definition of %q+#D",
+ CLASSTYPE_TI_TEMPLATE (type));
}
/* Check for invalid specialization after instantiation:
for (; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
- pedwarn
+ permerror
("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)
{
- pedwarn ("to refer to a type member of a template parameter, "
- "use %<typename %E%>", orig_arg);
+ permerror ("to refer to a type member of a template parameter, "
+ "use %<typename %E%>", orig_arg);
orig_arg = make_typename_type (TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1),
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)
- pedwarn ("duplicate explicit instantiation of %q#D", result);
+ permerror ("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))
{
- pedwarn ("explicit instantiation of non-template %q#D", result);
+ permerror ("explicit instantiation of non-template %q#D", result);
return;
}
if (!previous_instantiation_extern_p && !extern_p
&& (complain & tf_error))
- pedwarn ("duplicate explicit instantiation of %q#T", t);
+ permerror ("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. */
- pedwarn
+ permerror
("explicit instantiation of %qD but no definition available", d);
/* ??? Historically, we have instantiated inline functions, even
{
if (aggr != class_type_node)
{
- pedwarn ("template type parameters must use the keyword %<class%> or %<typename%>");
+ permerror ("template type parameters must use the keyword %<class%> or %<typename%>");
aggr = class_type_node;
}
else
{
if (complain & tf_error)
- pedwarn ("%s between distinct pointer types %qT and %qT "
- "lacks a cast",
- location, t1, t2);
+ permerror ("%s between distinct pointer types %qT and %qT "
+ "lacks a cast",
+ location, t1, t2);
result_type = void_type_node;
}
result_type = cp_build_qualified_type (result_type,
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2))
&& (complain & tf_error))
- pedwarn ("%s between distinct pointer types %qT and %qT "
- "lacks a cast",
- location, t1, t2);
+ permerror ("%s between distinct pointer types %qT and %qT "
+ "lacks a cast",
+ location, t1, t2);
result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
result_type);
}
else if (is_overloaded_fn (e))
{
if (complain & tf_error)
- pedwarn ("ISO C++ forbids applying %<sizeof%> to an expression of "
- "function type");
+ permerror ("ISO C++ forbids applying %<sizeof%> to an expression of "
+ "function type");
else
return error_mark_node;
e = char_type_node;
else if (is_overloaded_fn (e))
{
if (complain & tf_error)
- pedwarn ("ISO C++ forbids applying %<__alignof%> to an expression of "
- "function type");
+ permerror ("ISO C++ forbids applying %<__alignof%> to an expression of "
+ "function type");
else
return error_mark_node;
if (TREE_CODE (e) == FUNCTION_DECL)
&& TREE_CODE (decl) != TEMPLATE_ID_EXPR)
{
if (!is_overloaded_fn (decl))
- pedwarn ("%qD is not a template", decl);
+ permerror ("%qD is not a template", decl);
else
{
tree fns;
fns = OVL_NEXT (fns);
}
if (!fns)
- pedwarn ("%qD is not a template", decl);
+ permerror ("%qD is not a template", decl);
}
}
}
if (t != error_mark_node)
{
if (complain & tf_error)
- pedwarn ("assuming cast to type %qT from overloaded function",
- TREE_TYPE (t));
+ permerror ("assuming cast to type %qT from overloaded function",
+ TREE_TYPE (t));
op0 = t;
}
}
if (t != error_mark_node)
{
if (complain & tf_error)
- pedwarn ("assuming cast to type %qT from overloaded function",
- TREE_TYPE (t));
+ permerror ("assuming cast to type %qT from overloaded function",
+ TREE_TYPE (t));
op1 = t;
}
}
{
result_type = type0;
if (complain & tf_error)
- pedwarn ("ISO C++ forbids comparison between pointer and integer");
+ permerror ("ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
{
result_type = type1;
if (complain & tf_error)
- pedwarn ("ISO C++ forbids comparison between pointer and integer");
+ permerror ("ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
{
result_type = type0;
if (complain & tf_error)
- pedwarn ("ISO C++ forbids comparison between pointer and integer");
+ permerror ("ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
{
result_type = type1;
if (complain & tf_error)
- pedwarn ("ISO C++ forbids comparison between pointer and integer");
+ permerror ("ISO C++ forbids comparison between pointer and integer");
else
return error_mark_node;
}
if (pedantic || warn_pointer_arith)
{
if (TREE_CODE (target_type) == VOID_TYPE)
- pedwarn ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
+ permerror ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
- pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
+ permerror ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
- pedwarn ("ISO C++ forbids using pointer to a method in subtraction");
+ permerror ("ISO C++ forbids using pointer to a method in subtraction");
}
/* First do the subtraction as integers;
if (TREE_CODE (argtype) == ENUMERAL_TYPE)
{
if (complain & tf_error)
- pedwarn ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
- ? G_("ISO C++ forbids incrementing an enum")
- : G_("ISO C++ forbids decrementing an enum"));
+ permerror ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
+ ? G_("ISO C++ forbids incrementing an enum")
+ : G_("ISO C++ forbids decrementing an enum"));
else
return error_mark_node;
}
&& !TYPE_PTROB_P (argtype))
{
if (complain & tf_error)
- pedwarn ((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"),
- argtype);
+ permerror ((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"),
+ argtype);
else
return error_mark_node;
}
{
/* ARM $3.4 */
if (complain & tf_error)
- pedwarn ("ISO C++ forbids taking address of function %<::main%>");
+ permerror ("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. */
- pedwarn ("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);
+ permerror ("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
- pedwarn ("ISO C++ forbids taking the address of a bound member"
- " function to form a pointer to member function."
- " Say %<&%T::%D%>",
- base, name);
+ permerror ("ISO C++ forbids taking the address of a bound member"
+ " function to form a pointer to member function."
+ " Say %<&%T::%D%>",
+ base, name);
}
arg = build_offset_ref (base, fn, /*address_p=*/true);
}
if (! lvalue_p (arg) && (pedantic || complain == tf_none))
{
if (complain & tf_error)
- pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
+ permerror ("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)
- pedwarn ("%s expression list treated as compound expression", msg);
+ permerror ("%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)
- pedwarn ("cast from %qT to %qT loses precision",
- intype, type);
+ permerror ("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)
- pedwarn ("ISO C++ forbids casting to an array type %qT", type);
+ permerror ("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)
{
- pedwarn ("return-statement with no value, in function returning %qT",
- valtype);
+ permerror ("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
return!). */
its side-effects. */
finish_expr_stmt (retval);
else
- pedwarn ("return-statement with a value, in function "
- "returning 'void'");
+ permerror ("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))
- pedwarn ("initializer-string for array of chars is too long");
+ permerror ("initializer-string for array of chars is too long");
}
return init;
}