revert error reporting patch

From-SVN: r22310
This commit is contained in:
Jason Merrill 1998-09-07 10:25:35 -04:00
parent 5db17173c6
commit 8251199e44
29 changed files with 2323 additions and 2471 deletions

View File

@ -1,63 +1,3 @@
1998-09-07 Mark Mitchell <mark@markmitchell.com>
and Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-tree.h (cp_error): Prototype.
(cp_error_at): Likewise.
(cp_warning): Likewise.
(cp_warning_at): Likewise.
(cp_pedwarn): Likewise.
(cp_pedwarn_at): Likewise.
(cp_compiler_error): Likewise.
(cp_sprintf): Likewise.
(cp_enable_warning): Likewise.
* errfn.c: Remove hack to avoid error-function prototypes when
including cp-tree.h.
1998-09-06 Mark Mitchell <mark@markmitchell.com>
* cp-error.def: New file.
* Make-lang.in (cc1plus): Add dependency on it.
* Makefile.in (CXX_TREE_H): Likewise.
* cp-tree.h (error_code): New type.
Include cp-error.def to get error codes. Make it possible to
include cp-tree.h in errfn.c.
(enable_warning): New function.
(flag_diag_codes): New variable.
* errfn.c: Include cp-tree.h.
(cp_err_msg): New type. Include cp-error.def to define it.
(err_msgs): New variable.
(is_warning_enabled): New function.
(cp_thing): Take an error_code, not a format string. Output the
diagnostic code if flag_diag_codes.
(cp_error, cp_compiler_error, cp_sprintf, cp_error_at): Take
error_codes, not format strings.
(cp_warning, cp_pedwarn, cp_warning_at, cp_pedwarn_at): Likewise.
Call is_warning_enabled.
* decl2.c (flag_diag_codes): New variable.
(lang_decode_option): Handle -fdiag-codes and -Wnumber.
* lang-options.h: Add -fdiag-codes, -fno-diag-codes, and
-W-number-, and -Wno-number.
* class.c: Update all calls to error-functions.
* cvt.c: Likewise.
* decl.c: Likewise.
* decl2.c: Likewise.
* except.c: Likewise.
* expr.c: Likewise.
* friend.c: Likewise.
* lex.c: Likewise.
* parse.y: Likewise.
* pt.c: Likewise.
* repo.c: Likewise.
* rtti.c: Likewise.
* search.c: Likewise.
* semantics.c: Likewise.
* sig.c: Likewise.
* tree.c: Likewise.
* typeck.c: Likewise.
* typeck2.c: Likewise.
* xref.c: Likewise.
Sun Sep 6 00:00:51 1998 Jeffrey A Law (law@cygnus.com)
* Makefile.in (INCLUDES): Update after recent toplevel gcc

View File

@ -125,7 +125,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
$(srcdir)/cp/repo.c $(srcdir)/cp/semantics.c
cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o \
$(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def $(srcdir)/cp/cp-error.def
$(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def
cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
#
# Build hooks:

View File

@ -208,7 +208,7 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def cp-error.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
PARSE_H = $(srcdir)/parse.h
PARSE_C = $(srcdir)/parse.c
EXPR_H = $(srcdir)/../expr.h ../insn-codes.h

View File

@ -132,7 +132,7 @@ build_field_call (basetype_path, instance_ptr, name, parms)
if (field == NULL_TREE)
{
cp_error (ec_this_has_no_member_named, name);
cp_error ("`this' has no member named `%D'", name);
return error_mark_node;
}
@ -203,7 +203,7 @@ build_field_call (basetype_path, instance_ptr, name, parms)
}
else if (TREE_CODE (ftype) == METHOD_TYPE)
{
cp_error (ec_invalid_call_via_pointertomember_function);
error ("invalid call via pointer-to-member function");
return error_mark_node;
}
else
@ -421,7 +421,7 @@ build_scoped_method_call (exp, basetype, name, parms)
return build_method_call (exp, name, parms, NULL_TREE, LOOKUP_NORMAL);
if (! check_dtor_name (basetype, name))
cp_error (ec_qualified_type_does_not_match_destructor_name,
cp_error ("qualified type `%T' does not match destructor name `~%T'",
basetype, TREE_OPERAND (name, 0));
/* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note
@ -430,7 +430,7 @@ build_scoped_method_call (exp, basetype, name, parms)
if (! IS_AGGR_TYPE (basetype))
{
if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype))
cp_error (ec_type_of_does_not_match_destructor_type_type_was,
cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')",
exp, basetype, type);
return cp_convert (void_type_node, exp);
@ -442,7 +442,7 @@ build_scoped_method_call (exp, basetype, name, parms)
if (! IS_AGGR_TYPE (type))
{
cp_error (ec_base_object_of_scoped_method_call_is_of_nonaggregate_type,
cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
exp, type);
return error_mark_node;
}
@ -661,14 +661,15 @@ build_method_call (instance, name, parms, basetype_path, flags)
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
if (parms)
cp_error (ec_destructors_take_no_parameters);
error ("destructors take no parameters");
basetype = TREE_TYPE (instance);
if (TREE_CODE (basetype) == REFERENCE_TYPE)
basetype = TREE_TYPE (basetype);
if (! check_dtor_name (basetype, name))
cp_error (ec_destructor_name_does_not_match_type,
TREE_OPERAND (name, 0), basetype);
cp_error
("destructor name `~%T' does not match type `%T' of expression",
TREE_OPERAND (name, 0), basetype);
if (! TYPE_HAS_DESTRUCTOR (complete_type (basetype)))
return cp_convert (void_type_node, instance);
@ -2018,20 +2019,20 @@ print_z_candidates (candidates)
if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
{
if (candidates->fn == ansi_opname [COND_EXPR])
cp_error (ec_builtin_3, str, candidates->fn,
cp_error ("%s %D(%T, %T, %T) <builtin>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 2)));
else if (TREE_VEC_LENGTH (candidates->convs) == 2)
cp_error (ec_builtin_2, str, candidates->fn,
cp_error ("%s %D(%T, %T) <builtin>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)));
else
cp_error (ec_builtin_1, str, candidates->fn,
cp_error ("%s %D(%T) <builtin>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)));
}
else
cp_error_at (ec_candidate_1, str, candidates->fn,
cp_error_at ("%s %+D%s", str, candidates->fn,
candidates->viable == -1 ? " <near match>" : "");
str = " ";
}
@ -2168,7 +2169,7 @@ build_user_type_conversion_1 (totype, expr, flags)
if (candidates && ! candidates->next)
/* say why this one won't work or try to be loose */;
else
cp_error (ec_no_viable_candidates);
cp_error ("no viable candidates");
}
#endif
@ -2182,7 +2183,7 @@ build_user_type_conversion_1 (totype, expr, flags)
{
if (flags & LOOKUP_COMPLAIN)
{
cp_error (ec_conversion_from_to_is_ambiguous,
cp_error ("conversion from `%T' to `%T' is ambiguous",
fromtype, totype);
print_z_candidates (candidates);
}
@ -2248,7 +2249,7 @@ resolve_args (args)
return error_mark_node;
else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE)
{
cp_error (ec_invalid_use_of_void_expression);
error ("invalid use of void expression");
return error_mark_node;
}
else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF)
@ -2301,7 +2302,7 @@ build_new_function_call (fn, args)
{
if (candidates && ! candidates->next)
return build_function_call (candidates->fn, args);
cp_error (ec_no_matching_function_for_call_to,
cp_error ("no matching function for call to `%D (%A)'",
DECL_NAME (OVL_FUNCTION (fn)), args);
if (candidates)
print_z_candidates (candidates);
@ -2312,7 +2313,7 @@ build_new_function_call (fn, args)
if (cand == 0)
{
cp_error (ec_call_of_overloaded_is_ambiguous,
cp_error ("call of overloaded `%D (%A)' is ambiguous",
DECL_NAME (OVL_FUNCTION (fn)), args);
print_z_candidates (candidates);
return error_mark_node;
@ -2347,8 +2348,8 @@ build_object_call (obj, args)
{
/* It's no good looking for an overloaded operator() on a
pointer-to-member-function. */
cp_error (ec_pointertomember_function_cannot_be_called, obj);
cp_error (ec_without_an_object_consider_using_or);
cp_error ("pointer-to-member function %E cannot be called", obj);
cp_error ("without an object; consider using .* or ->*");
return error_mark_node;
}
@ -2418,7 +2419,7 @@ build_object_call (obj, args)
if (! any_viable (candidates))
{
cp_error (ec_no_match_for_call_to, TREE_TYPE (obj), args);
cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
print_z_candidates (candidates);
return error_mark_node;
}
@ -2428,7 +2429,7 @@ build_object_call (obj, args)
if (cand == 0)
{
cp_error (ec_call_of_is_ambiguous, TREE_TYPE (obj), args);
cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
print_z_candidates (candidates);
return error_mark_node;
}
@ -2454,23 +2455,23 @@ op_error (code, code2, arg1, arg2, arg3, problem)
switch (code)
{
case COND_EXPR:
cp_error (ec_for_1, problem,
cp_error ("%s for `%T ? %T : %T'", problem,
error_type (arg1), error_type (arg2), error_type (arg3));
break;
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
cp_error (ec_for_2, problem, error_type (arg1), opname);
cp_error ("%s for `%T%s'", problem, error_type (arg1), opname);
break;
case ARRAY_REF:
cp_error (ec_for_3, problem,
cp_error ("%s for `%T[%T]'", problem,
error_type (arg1), error_type (arg2));
break;
default:
if (arg2)
cp_error (ec_for_4, problem,
cp_error ("%s for `%T %s %T'", problem,
error_type (arg1), opname, error_type (arg2));
else
cp_error (ec_for_5, problem, opname, error_type (arg1));
cp_error ("%s for `%s%T'", problem, opname, error_type (arg1));
}
}
@ -2495,7 +2496,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
undeclared_template<1, 5, 72>a; */
if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL)
{
cp_error (ec_must_be_declared_before_use, arg1);
cp_error ("`%D' must be declared before use", arg1);
return error_mark_node;
}
@ -2712,7 +2713,7 @@ build_new_op (code, flags, arg1, arg2, 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)
cp_pedwarn (ec_no_int_declared_for_postfix_s_trying_prefix_operator_instead,
cp_pedwarn ("no `%D (int)' declared for postfix `%s', trying prefix operator instead",
fnname, opname_tab [code]);
if (code == POSTINCREMENT_EXPR)
code = PREINCREMENT_EXPR;
@ -2758,9 +2759,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
&& candidates->next
&& ! candidates->next->next)
{
cp_warning (ec_using_synthesized_for_copy_assignment,
cp_warning ("using synthesized `%#D' for copy assignment",
cand->fn);
cp_warning_at (ec_where_cfront_would_use,
cp_warning_at (" where cfront would use `%#D'",
cand == candidates
? candidates->next->fn
: candidates->fn);
@ -2795,7 +2796,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
&& (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
{
cp_warning (ec_comparison_between_and,
cp_warning ("comparison between `%#T' and `%#T'",
TREE_TYPE (arg1), TREE_TYPE (arg2));
}
break;
@ -3022,7 +3023,7 @@ build_op_delete_call (code, addr, size, flags, placement)
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
cp_error (ec_no_suitable_operator_delete_for, type);
cp_error ("no suitable operator delete for `%T'", type);
return error_mark_node;
}
@ -3037,17 +3038,17 @@ enforce_access (basetype_path, decl)
if (access == access_private_node)
{
cp_error_at (ec_access_is_1, decl,
cp_error_at ("`%+#D' is %s", decl,
TREE_PRIVATE (decl) ? "private"
: "from private base class");
cp_error (ec_within_this_context);
error ("within this context");
}
else if (access == access_protected_node)
{
cp_error_at (ec_access_is_2, decl,
cp_error_at ("`%+#D' %s", decl,
TREE_PROTECTED (decl) ? "is protected"
: "has protected accessibility");
cp_error (ec_within_this_context);
error ("within this context");
}
}
@ -3150,11 +3151,11 @@ convert_like (convs, expr)
if (comptypes (TREE_TYPE (expr), TREE_TYPE (convs), 1))
incomplete_type_error (expr, TREE_TYPE (expr));
else
cp_error (ec_could_not_convert_with_incomplete_type_to,
cp_error ("could not convert `%E' (with incomplete type `%T') to `%T'",
expr, TREE_TYPE (expr), TREE_TYPE (convs));
}
else
cp_error (ec_could_not_convert_to,
cp_error ("could not convert `%E' to `%T'",
expr, TREE_TYPE (convs));
return error_mark_node;
}
@ -3195,7 +3196,7 @@ convert_arg_to_ellipsis (arg)
arg = cp_convert (double_type_node, arg);
else if (IS_AGGR_TYPE (TREE_TYPE (arg))
&& ! TYPE_HAS_TRIVIAL_INIT_REF (TREE_TYPE (arg)))
cp_warning (ec_cannot_pass_objects_of_type_through,
cp_warning ("cannot pass objects of type `%T' through `...'",
TREE_TYPE (arg));
else
/* Convert `short' and `char' to full-size `int'. */
@ -3295,7 +3296,7 @@ build_over_call (cand, args, flags)
char *p = (dv && dc ? "const and volatile"
: dc ? "const" : dv ? "volatile" : "");
cp_pedwarn (ec_passing_as_this_argument_of_discards_s,
cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards %s",
TREE_TYPE (argtype), fn, p);
}
/* [class.mfct.nonstatic]: If a nonstatic member function of a class
@ -3347,7 +3348,7 @@ build_over_call (cand, args, flags)
/* Issue warnings about peculiar, but legal, uses of NULL. */
if (ARITHMETIC_TYPE_P (TREE_VALUE (parm))
&& TREE_VALUE (arg) == null_node)
cp_warning (ec_converting_null_to_nonpointer_type);
cp_warning ("converting NULL to non-pointer type");
val = convert_like (conv, TREE_VALUE (arg));
}
@ -3597,7 +3598,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
|| IS_SIGNATURE_REFERENCE (basetype))))
{
if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
cp_error (ec_request_for_member_in_which_is_of_nonaggregate_type,
cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
name, instance, basetype);
return error_mark_node;
@ -3688,7 +3689,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
/* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
cp_error (ec_no_matching_function_for_call_to_member, basetype,
cp_error ("no matching function for call to `%T::%D (%A)%V'", basetype,
pretty_name, user_args, TREE_TYPE (TREE_TYPE (instance_ptr)));
print_z_candidates (candidates);
return error_mark_node;
@ -3698,7 +3699,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
if (cand == 0)
{
cp_error (ec_call_of_overloaded_is_ambiguous_2, pretty_name,
cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
user_args);
print_z_candidates (candidates);
return error_mark_node;
@ -3709,11 +3710,11 @@ build_new_method_call (instance, name, args, basetype_path, flags)
&& DECL_CONSTRUCTOR_P (current_function_decl)
&& ! (flags & LOOKUP_NONVIRTUAL)
&& value_member (cand->fn, get_abstract_virtuals (basetype)))
cp_error (ec_abstract_virtual_called_from_constructor, cand->fn);
cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& TREE_CODE (instance_ptr) == NOP_EXPR
&& TREE_OPERAND (instance_ptr, 0) == error_mark_node)
cp_error (ec_cannot_call_member_function_without_object, cand->fn);
cp_error ("cannot call member function `%D' without object", cand->fn);
if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL)
&& ((instance == current_class_ref && (dtor_label || ctor_label))
@ -4326,9 +4327,9 @@ joust (cand1, cand2, warn)
if (warn)
{
cp_warning (ec_passing_chooses_over,
cp_warning ("passing `%T' chooses `%T' over `%T'",
type, type1, type2);
cp_warning (ec_in_call_to, w->fn);
cp_warning (" in call to `%D'", w->fn);
}
else
add_warning (w, l);
@ -4367,10 +4368,10 @@ joust (cand1, cand2, warn)
tree source = source_type (TREE_VEC_ELT (w->convs, 0));
if (! DECL_CONSTRUCTOR_P (w->fn))
source = TREE_TYPE (source);
cp_warning (ec_choosing_over, w->fn, l->fn);
cp_warning (ec_for_conversion_from_to,
cp_warning ("choosing `%D' over `%D'", w->fn, l->fn);
cp_warning (" for conversion from `%T' to `%T'",
source, TREE_TYPE (w->second_conv));
cp_warning (ec_because_conversion_sequence_for_the_argument_is_better);
cp_warning (" because conversion sequence for the argument is better");
}
else
add_warning (w, l);

View File

@ -285,7 +285,7 @@ build_vbase_path (code, type, expr, path, nonnull)
}
else
{
cp_error (ec_cannot_cast_up_from_virtual_baseclass,
cp_error ("cannot cast up from virtual baseclass `%T'",
last_virtual);
return error_mark_node;
}
@ -859,7 +859,7 @@ prepare_fresh_vtable (binfo, for_type)
ensure that the binfo is from for_type's binfos, not from any
base type's. We can remove all this code after a while. */
if (binfo1 != binfo)
cp_warning (ec_internal_inconsistency_binfo_offset_error_for_rtti);
warning ("internal inconsistency: binfo offset error for rtti");
offset = BINFO_OFFSET (binfo1);
}
@ -925,7 +925,7 @@ modify_vtable_entry (old_entry_in_list, new_entry, fndecl)
tree base_fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (old_entry_in_list)), 0);
#ifdef NOTQUITE
cp_warning (ec_replaced_with, DECL_ASSEMBLER_NAME (base_fndecl),
cp_warning ("replaced %D with %D", DECL_ASSEMBLER_NAME (base_fndecl),
DECL_ASSEMBLER_NAME (fndecl));
#endif
TREE_VALUE (old_entry_in_list) = new_entry;
@ -980,10 +980,10 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t)
#ifndef DUMB_USER
if (current_class_type == 0)
cp_warning (ec_internal_problem_current_class_type_is_zero_when_adding_please_report,
cp_warning ("internal problem, current_class_type is zero when adding `%D', please report",
fndecl);
if (current_class_type && t != current_class_type)
cp_warning (ec_internal_problem_current_class_type_differs_when_adding_please_report,
cp_warning ("internal problem, current_class_type differs when adding `%D', please report",
fndecl);
#endif
@ -1218,17 +1218,17 @@ delete_duplicate_fields_1 (field, fields)
{
if (TREE_CODE (field) == CONST_DECL
&& TREE_CODE (x) == CONST_DECL)
cp_error_at (ec_duplicate_enum_value, x);
cp_error_at ("duplicate enum value `%D'", x);
else if (TREE_CODE (field) == CONST_DECL
|| TREE_CODE (x) == CONST_DECL)
cp_error_at (ec_duplicate_field_as_enum_and_nonenum,
cp_error_at ("duplicate field `%D' (as enum and non-enum)",
x);
else if (DECL_DECLARES_TYPE_P (field)
&& DECL_DECLARES_TYPE_P (x))
{
if (comptypes (TREE_TYPE (field), TREE_TYPE (x), 1))
continue;
cp_error_at (ec_duplicate_nested_type, x);
cp_error_at ("duplicate nested type `%D'", x);
}
else if (DECL_DECLARES_TYPE_P (field)
|| DECL_DECLARES_TYPE_P (x))
@ -1239,11 +1239,11 @@ delete_duplicate_fields_1 (field, fields)
|| (TREE_CODE (x) == TYPE_DECL
&& DECL_ARTIFICIAL (x)))
continue;
cp_error_at (ec_duplicate_field_as_type_and_nontype,
cp_error_at ("duplicate field `%D' (as type and non-type)",
x);
}
else
cp_error_at (ec_duplicate_member, x);
cp_error_at ("duplicate member `%D'", x);
if (prev == 0)
fields = TREE_CHAIN (fields);
else
@ -1281,9 +1281,9 @@ alter_access (t, binfo, fdecl, access)
if (TREE_VALUE (elem) != access)
{
if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
cp_error_at (ec_conflicting_access_specifications_for_method_ignored, TREE_TYPE (fdecl));
cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl));
else
cp_error (ec_conflicting_access_specifications_for_field_s_ignored,
error ("conflicting access specifications for field `%s', ignored",
IDENTIFIER_POINTER (DECL_NAME (fdecl)));
}
else
@ -1332,13 +1332,13 @@ handle_using_decl (using_decl, t, method_vec, fields)
if (name == constructor_name (ctype)
|| name == constructor_name_full (ctype))
cp_error_at (ec_usingdeclaration_for_constructor, using_decl);
cp_error_at ("using-declaration for constructor", using_decl);
fdecl = lookup_member (binfo, name, 0, 0);
if (!fdecl)
{
cp_error_at (ec_no_members_matching_in, using_decl, ctype);
cp_error_at ("no members matching `%D' in `%#T'", using_decl, ctype);
return;
}
@ -1362,8 +1362,8 @@ handle_using_decl (using_decl, t, method_vec, fields)
if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
== name)
{
cp_error (ec_cannot_adjust_access_to_in, fdecl, t);
cp_error_at (ec_because_of_local_method_with_same_name,
cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
cp_error_at (" because of local method `%#D' with same name",
OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
return;
}
@ -1375,8 +1375,8 @@ handle_using_decl (using_decl, t, method_vec, fields)
for (tmp = fields; tmp; tmp = TREE_CHAIN (tmp))
if (DECL_NAME (tmp) == name)
{
cp_error (ec_cannot_adjust_access_to_in, fdecl, t);
cp_error_at (ec_because_of_local_field_with_same_name, tmp);
cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
cp_error_at (" because of local field `%#D' with same name", tmp);
return;
}
@ -1606,7 +1606,7 @@ finish_base_struct (t, b)
dtor is handled in finish_struct_1. */
if (warn_ecpp && ! TYPE_VIRTUAL_P (basetype)
&& TYPE_HAS_DESTRUCTOR (basetype))
cp_warning (ec_base_class_has_a_nonvirtual_destructor, basetype);
cp_warning ("base class `%#T' has a non-virtual destructor", basetype);
/* If the type of basetype is incomplete, then
we already complained about that fact
@ -1634,9 +1634,9 @@ finish_base_struct (t, b)
b->cant_have_default_ctor = 1;
if (! TYPE_HAS_CONSTRUCTOR (t))
{
cp_pedwarn (ec_base_with_only_nondefault_constructor,
cp_pedwarn ("base `%T' with only non-default constructor",
basetype);
cp_pedwarn (ec_in_class_without_a_constructor);
cp_pedwarn ("in class without a constructor");
}
}
@ -2037,7 +2037,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
}
if (nonprivate_method == 0
&& warn_ctor_dtor_privacy)
cp_warning (ec_all_member_functions_in_class_are_private, t);
cp_warning ("all member functions in class `%T' are private", t);
}
/* Warn if all destructors are private (in which case this class is
@ -2053,7 +2053,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
&& CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
&& DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE
&& warn_ctor_dtor_privacy)
cp_warning (ec_only_defines_a_private_destructor_and_has_no_friends,
cp_warning ("`%#T' only defines a private destructor and has no friends",
t);
}
@ -2091,8 +2091,8 @@ void
duplicate_tag_error (t)
tree t;
{
cp_error (ec_redefinition_of, t);
cp_error_at (ec_previous_definition_here, t);
cp_error ("redefinition of `%#T'", t);
cp_error_at ("previous definition here", t);
/* Pretend we haven't defined this type. */
@ -2247,9 +2247,9 @@ get_class_offset_1 (parent, binfo, context, t, fndecl)
&& ! tree_int_cst_equal (nrval, rval))
{
/* Only give error if the two offsets are different */
cp_error (ec_every_virtual_function_must_have_a_unique_final_overrider);
cp_error (ec_found_two_or_more_class_subobjects_in, context, t);
cp_error (ec_with_virtual_from_virtual_base_class, fndecl);
error ("every virtual function must have a unique final overrider");
cp_error (" found two (or more) `%T' class subobjects in `%T'", context, t);
cp_error (" with virtual `%D' from virtual base class", fndecl);
return rval;
}
rval = nrval;
@ -2396,7 +2396,7 @@ modify_one_vtable (binfo, t, fndecl, pfn)
}
#ifdef NOTQUITE
cp_warning (ec_in, DECL_NAME (BINFO_VTABLE (binfo)));
cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo)));
#endif
modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
build_vtable_entry (this_offset, pfn),
@ -2829,9 +2829,9 @@ check_for_override (decl, ctype)
path to its virtual baseclass. */
if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
{
cp_error_at (ec_method_may_not_be_declared_static,
cp_error_at ("method `%D' may not be declared static",
decl);
cp_error_at (ec_since_declared_virtual_in_base_class,
cp_error_at ("(since `%D' declared virtual in base class.)",
tmp);
break;
}
@ -2932,8 +2932,8 @@ warn_hidden (t)
TREE_PURPOSE (base_fndecls)))
{
/* Here we know it is a hider, and no overrider exists. */
cp_warning_at (ec_was_hidden, TREE_VALUE (base_fndecls));
cp_warning_at (ec_by, TREE_PURPOSE (base_fndecls));
cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls));
}
base_fndecls = TREE_CHAIN (base_fndecls);
@ -2966,10 +2966,10 @@ finish_struct_anon (t)
continue;
if (TREE_PRIVATE (*uelt))
cp_pedwarn_at (ec_private_member_in_anonymous_union,
cp_pedwarn_at ("private member `%#D' in anonymous union",
*uelt);
else if (TREE_PROTECTED (*uelt))
cp_pedwarn_at (ec_protected_member_in_anonymous_union,
cp_pedwarn_at ("protected member `%#D' in anonymous union",
*uelt);
TREE_PRIVATE (*uelt) = TREE_PRIVATE (field);
@ -3049,12 +3049,12 @@ finish_struct_1 (t, warn_anon)
int has_pointers = 0;
if (warn_anon && code != UNION_TYPE && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
cp_pedwarn (ec_anonymous_class_type_not_used_to_declare_any_objects);
pedwarn ("anonymous class type not used to declare any objects");
if (TYPE_SIZE (t))
{
if (IS_AGGR_TYPE (t))
cp_error (ec_redefinition_of, t);
cp_error ("redefinition of `%#T'", t);
else
my_friendly_abort (172);
popclass (0);
@ -3161,7 +3161,7 @@ finish_struct_1 (t, warn_anon)
check_for_override (x, t);
if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x))
cp_error_at (ec_initializer_specified_for_nonvirtual_method, x);
cp_error_at ("initializer specified for non-virtual method `%D'", x);
/* The name of the field is the original field name
Save this in auxiliary field for later overloading. */
@ -3218,24 +3218,24 @@ finish_struct_1 (t, warn_anon)
/* ``A local class cannot have static data members.'' ARM 9.4 */
if (current_function_decl && TREE_STATIC (x))
cp_error_at (ec_field_in_local_class_cannot_be_static, x);
cp_error_at ("field `%D' in local class cannot be static", x);
/* Perform error checking that did not get done in
grokdeclarator. */
if (TREE_CODE (TREE_TYPE (x)) == FUNCTION_TYPE)
{
cp_error_at (ec_field_invalidly_declared_function_type,
cp_error_at ("field `%D' invalidly declared function type",
x);
TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
}
else if (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE)
{
cp_error_at (ec_field_invalidly_declared_method_type, x);
cp_error_at ("field `%D' invalidly declared method type", x);
TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
}
else if (TREE_CODE (TREE_TYPE (x)) == OFFSET_TYPE)
{
cp_error_at (ec_field_invalidly_declared_offset_type, x);
cp_error_at ("field `%D' invalidly declared offset type", x);
TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
}
@ -3260,7 +3260,7 @@ finish_struct_1 (t, warn_anon)
{
if (TREE_CODE (t) == UNION_TYPE)
/* Unions cannot have static members. */
cp_error_at (ec_field_declared_static_in_union, x);
cp_error_at ("field `%D' declared static in union", x);
continue;
}
@ -3287,9 +3287,9 @@ finish_struct_1 (t, warn_anon)
if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
{
if (DECL_NAME (x))
cp_warning_at (ec_nonstatic_reference_name_in_class_without_a_constructor, x);
cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
else
cp_warning_at (ec_nonstatic_reference_in_class_without_a_constructor, x);
cp_warning_at ("non-static reference in class without a constructor", x);
}
}
@ -3314,9 +3314,9 @@ finish_struct_1 (t, warn_anon)
&& extra_warnings)
{
if (DECL_NAME (x))
cp_warning_at (ec_nonstatic_const_member_name_in_class_without_a_constructor, x);
cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
else
cp_warning_at (ec_nonstatic_const_member_in_class_without_a_constructor, x);
cp_warning_at ("non-static const member in class without a constructor", x);
}
}
else
@ -3346,7 +3346,7 @@ finish_struct_1 (t, warn_anon)
if (DECL_INITIAL (x)
&& ! INTEGRAL_TYPE_P (TREE_TYPE (x)))
{
cp_error_at (ec_bitfield_with_nonintegral_type, x);
cp_error_at ("bit-field `%#D' with non-integral type", x);
DECL_INITIAL (x) = NULL;
}
@ -3367,7 +3367,7 @@ finish_struct_1 (t, warn_anon)
if (TREE_CODE (w) != INTEGER_CST)
{
cp_error_at (ec_bitfield_width_not_an_integer_constant,
cp_error_at ("bit-field `%D' width not an integer constant",
x);
DECL_INITIAL (x) = NULL_TREE;
}
@ -3375,12 +3375,12 @@ finish_struct_1 (t, warn_anon)
width < 0)
{
DECL_INITIAL (x) = NULL;
cp_error_at (ec_negative_width_in_bitfield, x);
cp_error_at ("negative width in bit-field `%D'", x);
}
else if (width == 0 && DECL_NAME (x) != 0)
{
DECL_INITIAL (x) = NULL;
cp_error_at (ec_zero_width_for_bitfield, x);
cp_error_at ("zero width for bit-field `%D'", x);
}
else if (width
> TYPE_PRECISION (long_long_unsigned_type_node))
@ -3390,13 +3390,13 @@ finish_struct_1 (t, warn_anon)
DECL_INITIAL (x) = NULL;
sorry ("bit-fields larger than %d bits",
TYPE_PRECISION (long_long_unsigned_type_node));
cp_error_at (ec_in_declaration_of, x);
cp_error_at (" in declaration of `%D'", x);
}
else if (width > TYPE_PRECISION (TREE_TYPE (x))
&& TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE
&& TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE)
{
cp_warning_at (ec_width_of_exceeds_its_type, x);
cp_warning_at ("width of `%D' exceeds its type", x);
}
else if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
&& ((min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
@ -3404,7 +3404,7 @@ finish_struct_1 (t, warn_anon)
|| (min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
TREE_UNSIGNED (TREE_TYPE (x))) > width)))
{
cp_warning_at (ec_is_too_small_to_hold_all_values_of,
cp_warning_at ("`%D' is too small to hold all values of `%#T'",
x, TREE_TYPE (x));
}
@ -3460,7 +3460,7 @@ finish_struct_1 (t, warn_anon)
else if (TYPE_HAS_REAL_ASSIGNMENT (type))
fie = "assignment operator";
if (fie)
cp_error_at (ec_member_with_s_not_allowed_in_union, x,
cp_error_at ("member `%#D' with %s not allowed in union", x,
fie);
}
else
@ -3486,10 +3486,10 @@ finish_struct_1 (t, warn_anon)
if (! TYPE_HAS_CONSTRUCTOR (t))
{
if (DECL_NAME (x))
cp_pedwarn_at (ec_member_decl_with_only_nondefault_constructor, x);
cp_pedwarn_at ("member `%#D' with only non-default constructor", x);
else
cp_pedwarn_at (ec_member_with_only_nondefault_constructor, x);
cp_pedwarn_at (ec_in_class_without_a_constructor,
cp_pedwarn_at ("member with only non-default constructor", x);
cp_pedwarn_at ("in class without a constructor",
x);
}
#endif
@ -3500,7 +3500,7 @@ finish_struct_1 (t, warn_anon)
/* `build_class_init_list' does not recognize
non-FIELD_DECLs. */
if (code == UNION_TYPE && any_default_members != 0)
cp_error_at (ec_multiple_fields_in_union_initialized);
cp_error_at ("multiple fields in union `%T' initialized");
any_default_members = 1;
}
}
@ -3548,16 +3548,16 @@ finish_struct_1 (t, warn_anon)
if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t)
&& ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
{
cp_warning (ec_has_pointer_data_members, t);
cp_warning ("`%#T' has pointer data members", t);
if (! TYPE_HAS_INIT_REF (t))
{
cp_warning (ec_but_does_not_override_const, t, t);
cp_warning (" but does not override `%T(const %T&)'", t, t);
if (! TYPE_HAS_ASSIGN_REF (t))
cp_warning (ec_or_operatorconst, t);
cp_warning (" or `operator=(const %T&)'", t);
}
else if (! TYPE_HAS_ASSIGN_REF (t))
cp_warning (ec_but_does_not_override_operatorconst, t);
cp_warning (" but does not override `operator=(const %T&)'", t);
}
TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t);
@ -3630,7 +3630,7 @@ finish_struct_1 (t, warn_anon)
}
if (nonprivate_ctor == 0 && warn_ctor_dtor_privacy)
cp_warning (ec_only_defines_private_constructors_and_has_no_friends,
cp_warning ("`%#T' only defines private constructors and has no friends",
t);
}
}
@ -3727,8 +3727,8 @@ finish_struct_1 (t, warn_anon)
if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
== name)
{
cp_error_at (ec_data_member_conflicts_with, x);
cp_error_at (ec_function_member,
cp_error_at ("data member `%#D' conflicts with", x);
cp_error_at ("function member `%#D'",
OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
break;
}
@ -3845,7 +3845,7 @@ finish_struct_1 (t, warn_anon)
}
#ifdef NOTQUITE
cp_warning (ec_oing_hard_virtuals_for, t);
cp_warning ("Doing hard virtuals for %T...", t);
#endif
if (has_virtual > max_has_virtual)
@ -4075,7 +4075,7 @@ finish_struct_1 (t, warn_anon)
if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (t)
&& DECL_VINDEX (TREE_VEC_ELT (method_vec, 1)) == NULL_TREE)
cp_warning (ec_has_virtual_functions_but_nonvirtual_destructor,
cp_warning ("`%#T' has virtual functions but non-virtual destructor",
t);
}
@ -4242,9 +4242,9 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
&& !(TREE_CODE (icv) == TYPE_DECL
&& DECL_CONTEXT (icv) == t))
{
cp_pedwarn_at (ec_declaration_of_identifier_as,
cp_pedwarn_at ("declaration of identifier `%D' as `%+#D'",
name, x);
cp_pedwarn_at (ec_conflicts_with_other_use_in_class_as,
cp_pedwarn_at ("conflicts with other use in class as `%#D'",
icv);
}
}
@ -4347,7 +4347,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
if (current_class_type)
popclass (0);
else
cp_error (ec_trying_to_finish_struct_but_kicked_out_due_to_previous_parse_errors);
error ("trying to finish struct, but kicked out due to previous parse errors.");
return t;
}
@ -4787,7 +4787,7 @@ push_lang_context (name)
current_lang_name = name;
}
else
cp_error (ec_language_string_not_recognized, IDENTIFIER_POINTER (name));
error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
}
/* Get out of the current language scope. */
@ -4821,7 +4821,7 @@ validate_lhs (lhstype, complain)
else
{
if (complain)
cp_error (ec_invalid_type_combination_for_overload);
error ("invalid type combination for overload");
return error_mark_node;
}
}
@ -4849,7 +4849,7 @@ instantiate_type (lhstype, rhs, complain)
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
if (complain)
cp_error (ec_not_enough_type_information);
error ("not enough type information");
return error_mark_node;
}
@ -4858,7 +4858,7 @@ instantiate_type (lhstype, rhs, complain)
if (comptypes (lhstype, TREE_TYPE (rhs), 1))
return rhs;
if (complain)
cp_error (ec_argument_of_type_does_not_match,
cp_error ("argument of type `%T' does not match `%T'",
TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
@ -4960,14 +4960,14 @@ instantiate_type (lhstype, rhs, complain)
if (field)
{
if (complain)
cp_error (ec_ambiguous_overload_for_requested);
error ("ambiguous overload for COMPONENT_REF requested");
return error_mark_node;
}
}
else
{
if (complain)
cp_error (ec_no_appropriate_overload_exists_for);
error ("no appropriate overload exists for COMPONENT_REF");
return error_mark_node;
}
#endif
@ -5004,8 +5004,9 @@ instantiate_type (lhstype, rhs, complain)
&& TREE_CODE (lhstype) != METHOD_TYPE)
{
if (complain)
cp_error (ec_cannot_resolve_overloaded_function,
DECL_NAME (OVL_FUNCTION (rhs)));
cp_error("cannot resolve overloaded function `%D' "
"based on non-function type",
DECL_NAME (OVL_FUNCTION (rhs)));
return error_mark_node;
}
@ -5047,7 +5048,7 @@ instantiate_type (lhstype, rhs, complain)
{
if (save_elem)
{
cp_error (ec_ambiguous_template_instantiation_converting_to, lhstype);
cp_error ("ambiguous template instantiation converting to `%#T'", lhstype);
return error_mark_node;
}
save_elem = instantiate_template (elem, t);
@ -5091,10 +5092,11 @@ instantiate_type (lhstype, rhs, complain)
{
if (complain)
{
cp_error (ec_cannot_resolve_overload_to_target_type,
cp_error
("cannot resolve overload to target type `%#T'",
lhstype);
cp_error_at (ec_ambiguity_between, save_elem);
cp_error_at (ec_and_at_least, elem);
cp_error_at (" ambiguity between `%#D'", save_elem);
cp_error_at (" and `%#D', at least", elem);
}
return error_mark_node;
}
@ -5106,8 +5108,9 @@ instantiate_type (lhstype, rhs, complain)
/* We failed to find a match. */
if (complain)
{
cp_error (ec_cannot_resolve_overload_to_target_type, lhstype);
cp_error (ec_because_no_suitable_overload_of_function_exists,
cp_error ("cannot resolve overload to target type `%#T'", lhstype);
cp_error
(" because no suitable overload of function `%D' exists",
DECL_NAME (OVL_FUNCTION (rhs)));
}
return error_mark_node;
@ -5176,7 +5179,7 @@ instantiate_type (lhstype, rhs, complain)
if (elem)
{
if (complain)
cp_error (ec_ambiguous_overload_for_overloaded_method_requested);
error ("ambiguous overload for overloaded method requested");
return error_mark_node;
}
mark_used (save_elem);
@ -5201,7 +5204,7 @@ instantiate_type (lhstype, rhs, complain)
#endif
}
if (complain)
cp_error (ec_no_compatible_member_functions_named, name);
cp_error ("no compatible member functions named `%D'", name);
return error_mark_node;
}
@ -5259,7 +5262,7 @@ instantiate_type (lhstype, rhs, complain)
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
if (complain)
cp_error (ec_invalid_operation_on_uninstantiated_type);
error ("invalid operation on uninstantiated type");
return error_mark_node;
case TRUTH_AND_EXPR:
@ -5275,14 +5278,14 @@ instantiate_type (lhstype, rhs, complain)
case TRUTH_ORIF_EXPR:
case TRUTH_NOT_EXPR:
if (complain)
cp_error (ec_not_enough_type_information);
error ("not enough type information");
return error_mark_node;
case COND_EXPR:
if (type_unknown_p (TREE_OPERAND (rhs, 0)))
{
if (complain)
cp_error (ec_not_enough_type_information);
error ("not enough type information");
return error_mark_node;
}
TREE_OPERAND (rhs, 1)
@ -5312,7 +5315,7 @@ instantiate_type (lhstype, rhs, complain)
else if (TREE_CODE (lhstype) != POINTER_TYPE)
{
if (complain)
cp_error (ec_type_for_resolving_address_of_overloaded_function_must_be_pointer_type);
error ("type for resolving address of overloaded function must be pointer type");
return error_mark_node;
}
{

View File

@ -493,16 +493,6 @@ enum cplus_tree_code {
};
#undef DEFTREECODE
/* Error codes. */
typedef enum error_code {
#undef DEFERROR
#undef DEFERRORNUM
#define DEFERROR(code, string) code,
#define DEFERRORNUM(code, string, num) DEFERROR(code, string)
#include "cp-error.def"
ec_last_error_code
} error_code;
enum languages { lang_c, lang_cplusplus, lang_java };
/* Macros to make error reporting functions' lives easier. */
@ -2250,9 +2240,6 @@ extern int flag_new_abi;
extern int flag_honor_std;
/* Nonzero means show diagnostic codes when printing error messages. */
extern int flag_diag_codes;
/* Nonzero if we're done parsing and into end-of-file activities. */
extern int at_eof;
@ -2640,15 +2627,14 @@ extern tree handle_class_head PROTO((tree, tree, tree));
extern tree lookup_arg_dependent PROTO((tree, tree, tree));
/* in errfn.c */
extern void cp_error PVPROTO((error_code, ...));
extern void cp_error_at PVPROTO((error_code, ...));
extern void cp_warning PVPROTO((error_code, ...));
extern void cp_warning_at PVPROTO((error_code, ...));
extern void cp_pedwarn PVPROTO((error_code, ...));
extern void cp_pedwarn_at PVPROTO((error_code, ...));
extern void cp_compiler_error PVPROTO((error_code, ...));
extern void cp_sprintf PVPROTO((error_code, ...));
extern void cp_enable_warning PROTO((int, int));
extern void cp_error ();
extern void cp_error_at ();
extern void cp_warning ();
extern void cp_warning_at ();
extern void cp_pedwarn ();
extern void cp_pedwarn_at ();
extern void cp_compiler_error ();
extern void cp_sprintf ();
/* in error.c */
extern void init_error PROTO((void));

View File

@ -80,7 +80,7 @@ cp_convert_to_pointer (type, expr)
intype = complete_type (intype);
if (TYPE_SIZE (intype) == NULL_TREE)
{
cp_error (ec_cant_convert_from_incomplete_type_to,
cp_error ("can't convert from incomplete type `%T' to `%T'",
intype, type);
return error_mark_node;
}
@ -89,7 +89,7 @@ cp_convert_to_pointer (type, expr)
if (rval)
{
if (rval == error_mark_node)
cp_error (ec_conversion_of_from_to_is_ambiguous,
cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous",
expr, intype, type);
return rval;
}
@ -134,7 +134,7 @@ cp_convert_to_pointer (type, expr)
{
if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE)
if (pedantic || warn_pmf2ptr)
cp_pedwarn (ec_converting_from_to, TREE_TYPE (expr),
cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
type);
return build1 (NOP_EXPR, type, expr);
}
@ -223,7 +223,7 @@ cp_convert_to_pointer (type, expr)
|| (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
{
cp_error (ec_cannot_convert_from_type_to_type,
cp_error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
@ -262,7 +262,7 @@ cp_convert_to_pointer (type, expr)
return convert_to_pointer (type, expr);
}
cp_error (ec_cannot_convert_from_type_to_type,
cp_error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
@ -311,7 +311,7 @@ convert_to_pointer_force (type, expr)
if (distance == -2)
{
ambig:
cp_error (ec_type_is_ambiguous_baseclass_of_s,
cp_error ("type `%T' is ambiguous baseclass of `%s'",
TREE_TYPE (type),
TYPE_NAME_STRING (TREE_TYPE (intype)));
return error_mark_node;
@ -454,19 +454,19 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
{
if (decl)
/* Ensure semantics of [dcl.init.ref] */
cp_pedwarn (ec_initialization_of_nonconst_reference_from_rvalue,
cp_pedwarn ("initialization of non-const reference `%#T' from rvalue `%T'",
reftype, intype);
else
cp_pedwarn (ec_conversion_to_nonconst_from_rvalue,
cp_pedwarn ("conversion to non-const `%T' from rvalue `%T'",
reftype, intype);
}
else if (! (convtype & CONV_CONST))
{
if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
cp_pedwarn (ec_conversion_from_to_discards_const,
cp_pedwarn ("conversion from `%T' to `%T' discards const",
ttr, reftype);
else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
cp_pedwarn (ec_conversion_from_to_discards_volatile,
cp_pedwarn ("conversion from `%T' to `%T' discards volatile",
ttr, reftype);
}
}
@ -485,7 +485,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
meant. */
if (TREE_CODE (intype) == POINTER_TYPE
&& (comptypes (TREE_TYPE (intype), type, -1)))
cp_warning (ec_casting_to_does_not_dereference_pointer,
cp_warning ("casting `%T' to `%T' does not dereference pointer",
intype, reftype);
rval = build_unary_op (ADDR_EXPR, expr, 0);
@ -504,7 +504,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
rval = build_up_reference (reftype, rval, flags, 1);
if (rval && ! TYPE_READONLY (TREE_TYPE (reftype)))
cp_pedwarn (ec_initializing_nonconst_with_will_use_a_temporary,
cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary",
reftype, intype);
}
@ -517,7 +517,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189);
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_cannot_convert_type_to_type, intype, reftype);
cp_error ("cannot convert type `%T' to type `%T'", intype, reftype);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
@ -592,11 +592,11 @@ convert_pointer_to_real (binfo, expr)
but if it is, give them an error message that they can read. */
if (distance < 0)
{
cp_error (ec_cannot_convert_a_pointer_of_type_to_a_pointer_of_type,
cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'",
intype, type);
if (distance == -2)
cp_error (ec_because_is_an_ambiguous_base_class, type);
cp_error ("because `%T' is an ambiguous base class", type);
return error_mark_node;
}
@ -704,7 +704,7 @@ ocp_convert (type, expr, convtype, flags)
&& ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
|| (TREE_CODE (intype) == POINTER_TYPE)))
{
cp_pedwarn (ec_conversion_from_to, intype, type);
cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type);
if (flag_pedantic_errors)
return error_mark_node;
@ -716,7 +716,7 @@ ocp_convert (type, expr, convtype, flags)
if (rval)
return rval;
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_used_where_a_was_expected, intype, type);
cp_error ("`%#T' used where a `%T' was expected", intype, type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
return error_mark_node;
@ -726,7 +726,7 @@ ocp_convert (type, expr, convtype, flags)
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
if (TREE_CODE (expr) == FUNCTION_DECL)
cp_warning (ec_the_address_of_will_always_be_true, expr);
cp_warning ("the address of `%D', will always be `true'", expr);
return truthvalue_conversion (e);
}
return fold (convert_to_integer (type, e));
@ -744,7 +744,7 @@ ocp_convert (type, expr, convtype, flags)
return rval;
else
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_used_where_a_floating_point_value_was_expected,
cp_error ("`%#T' used where a floating point value was expected",
TREE_TYPE (e));
}
if (code == REAL_TYPE)
@ -818,7 +818,7 @@ ocp_convert (type, expr, convtype, flags)
return e;
if (flags & LOOKUP_COMPLAIN)
cp_error (ec_conversion_from_to_nonscalar_type_requested,
cp_error ("conversion from `%T' to non-scalar type `%T' requested",
TREE_TYPE (expr), type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
@ -948,7 +948,7 @@ build_expr_type_conversion (desires, expr, complain)
if (expr == null_node
&& (desires & WANT_INT)
&& !(desires & WANT_NULL))
cp_warning (ec_converting_null_to_nonpointer_type);
cp_warning ("converting NULL to non-pointer type");
if (TREE_CODE (basetype) == OFFSET_TYPE)
expr = resolve_offset_ref (expr);
@ -1021,9 +1021,9 @@ build_expr_type_conversion (desires, expr, complain)
{
if (complain)
{
cp_error (ec_ambiguous_default_type_conversion_from,
cp_error ("ambiguous default type conversion from `%T'",
basetype);
cp_error (ec_candidate_conversions_include_and,
cp_error (" candidate conversions include `%D' and `%D'",
winner, cand);
}
return error_mark_node;

File diff suppressed because it is too large Load Diff

View File

@ -181,9 +181,6 @@ int flag_init_priority = 1;
int flag_init_priority;
#endif
/* Nonzero means show diagnostic codes when printing error messages. */
int flag_diag_codes;
/* Nonzero means warn about implicit declarations. */
int warn_implicit = 1;
@ -490,8 +487,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"check-new", &flag_check_new, 1},
{"repo", &flag_use_repository, 1},
{"for-scope", &flag_new_for_scope, 2},
{"weak", &flag_weak, 1},
{"diag-codes", &flag_diag_codes, 1}
{"weak", &flag_weak, 1}
};
/* Decode the string P as a language-specific option.
@ -534,7 +530,7 @@ lang_decode_option (argc, argv)
if (!strcmp (p, "handle-exceptions")
|| !strcmp (p, "no-handle-exceptions"))
cp_warning (ec_fhandleexceptions_has_been_renamed_to_fexceptions_and_is_now_on_by_default);
warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
if (!strcmp (p, "memoize-lookups")
|| !strcmp (p, "no-memoize-lookups")
@ -553,7 +549,7 @@ lang_decode_option (argc, argv)
|| !strcmp (p, "no-nonnull-objects")
|| !strcmp (p, "no-ansi-overloading"))
{
cp_warning (ec_fs_is_no_longer_supported, p);
warning ("-f%s is no longer supported", p);
found = 1;
}
else if (! strcmp (p, "alt-external-templates"))
@ -606,7 +602,7 @@ lang_decode_option (argc, argv)
endp++;
else
{
cp_error (ec_invalid_option_s, p - 2);
error ("Invalid option `%s'", p - 2);
goto template_depth_lose;
}
}
@ -622,7 +618,7 @@ lang_decode_option (argc, argv)
endp++;
else
{
cp_error (ec_invalid_option_s, p - 2);
error ("Invalid option `%s'", p - 2);
goto mangling_version_lose;
}
}
@ -715,25 +711,6 @@ lang_decode_option (argc, argv)
warn_unknown_pragmas = setting * 2;
else if (!strcmp (p, "non-template-friend"))
warn_nontemplate_friend = setting;
else if (!strncmp (p, "number-", strlen ("number-")))
{
char *endp = p + strlen ("number-");
while (*endp)
{
if (*endp >= '0' && *endp <= '9')
endp++;
else
{
cp_error (ec_invalid_option_s, p - 2);
endp = 0;
}
}
if (endp)
{
int warning_number = atoi (p + strlen ("number-"));
cp_enable_warning (warning_number, setting);
}
}
else if (!strcmp (p, "comment"))
; /* cpp handles this one. */
else if (!strcmp (p, "comments"))
@ -804,7 +781,7 @@ grok_method_quals (ctype, function, quals)
if (TREE_VALUE (quals) == ridpointers[(int)RID_CONST])
{
if (TYPE_READONLY (ctype))
cp_error (ec_duplicate_s_s,
error ("duplicate `%s' %s",
IDENTIFIER_POINTER (TREE_VALUE (quals)),
(TREE_CODE (function) == FUNCTION_DECL
? "for member function" : "in type declaration"));
@ -814,7 +791,7 @@ grok_method_quals (ctype, function, quals)
else if (TREE_VALUE (quals) == ridpointers[(int)RID_VOLATILE])
{
if (TYPE_VOLATILE (ctype))
cp_error (ec_duplicate_s_s,
error ("duplicate `%s' %s",
IDENTIFIER_POINTER (TREE_VALUE (quals)),
(TREE_CODE (function) == FUNCTION_DECL
? "for member function" : "in type declaration"));
@ -860,13 +837,13 @@ warn_if_unknown_interface (decl)
lineno = til->line;
input_filename = til->file;
}
cp_warning (ec_template_instantiated_in_file_without_pragma_interface,
cp_warning ("template `%#D' instantiated in file without #pragma interface",
decl);
lineno = sl;
input_filename = sf;
}
else
cp_warning_at (ec_template_defined_in_file_without_pragma_interface,
cp_warning_at ("template `%#D' defined in file without #pragma interface",
decl);
}
@ -889,7 +866,7 @@ grok_x_components (specs, components)
if (t == NULL_TREE)
{
cp_error (ec_error_in_component_specification);
error ("error in component specification");
return NULL_TREE;
}
@ -956,7 +933,7 @@ grok_x_components (specs, components)
q = &TREE_CHAIN (*q);
}
if (TYPE_METHODS (t))
cp_error (ec_an_anonymous_union_cannot_have_function_members);
error ("an anonymous union cannot have function members");
p = &pending_inlines;
for (; *p; *p = (*p)->next)
@ -978,7 +955,7 @@ grok_x_components (specs, components)
default:
if (t != void_type_node)
cp_error (ec_empty_component_declaration);
error ("empty component declaration");
return NULL_TREE;
}
}
@ -1075,7 +1052,7 @@ grokclassfn (ctype, cname, function, flags, quals)
if (fn_name == NULL_TREE)
{
cp_error (ec_name_missing_for_member_function);
error ("name missing for member function");
fn_name = get_identifier ("<anonymous>");
DECL_NAME (function) = fn_name;
}
@ -1145,7 +1122,7 @@ grok_alignof (expr)
if (TREE_CODE (expr) == COMPONENT_REF
&& DECL_BIT_FIELD (TREE_OPERAND (expr, 1)))
cp_error (ec_alignof_applied_to_a_bitfield);
error ("`__alignof__' applied to a bit-field");
if (TREE_CODE (expr) == INDIRECT_REF)
{
@ -1197,7 +1174,7 @@ grok_array_decl (array_expr, index_exp)
{
/* Something has gone very wrong. Assume we are mistakenly reducing
an expression instead of a declaration. */
cp_error (ec_parser_may_be_lost_is_there_a_missing_somewhere);
error ("parser may be lost: is there a '{' missing somewhere?");
return NULL_TREE;
}
@ -1228,7 +1205,7 @@ grok_array_decl (array_expr, index_exp)
i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0);
if ((p1 && i2) && (i1 && p2))
cp_error (ec_ambiguous_conversion_for_array_subscript);
error ("ambiguous conversion for array subscript");
if (p1 && i2)
array_expr = p1, index_exp = i2;
@ -1236,13 +1213,13 @@ grok_array_decl (array_expr, index_exp)
array_expr = p2, index_exp = i1;
else
{
cp_error (ec_invalid_types_for_array_subscript,
cp_error ("invalid types `%T[%T]' for array subscript",
type, TREE_TYPE (index_exp));
return error_mark_node;
}
if (array_expr == error_mark_node || index_exp == error_mark_node)
cp_error (ec_ambiguous_conversion_for_array_subscript);
error ("ambiguous conversion for array subscript");
return build_array_ref (array_expr, index_exp);
}
@ -1284,7 +1261,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
if (t == NULL_TREE || t == error_mark_node)
{
cp_error (ec_type_argument_given_to_delete_expected_pointer,
cp_error ("type `%#T' argument given to `delete', expected pointer",
TREE_TYPE (exp));
return error_mark_node;
}
@ -1292,7 +1269,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
if (doing_vec == 2)
{
maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node, 1);
cp_pedwarn (ec_anachronistic_use_of_array_size_in_vector_delete);
pedwarn ("anachronistic use of array size in vector delete");
}
type = TREE_TYPE (t);
@ -1302,7 +1279,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
/* You can't delete functions. */
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{
cp_error (ec_cannot_delete_a_function);
error ("cannot delete a function");
return error_mark_node;
}
@ -1310,7 +1287,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
if (TREE_CODE (t) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == ARRAY_TYPE)
cp_warning (ec_deleting_array, TREE_OPERAND (t, 0));
cp_warning ("deleting array `%#D'", TREE_OPERAND (t, 0));
/* Deleting a pointer with the value zero is valid and has no effect. */
if (integer_zerop (t))
@ -1357,7 +1334,7 @@ check_member_template (tmpl)
/* 14.5.2.2 [temp.mem]
A local class shall not have member templates. */
cp_error (ec_declaration_of_member_template_in_local_class,
cp_error ("declaration of member template `%#D' in local class",
decl);
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
@ -1365,7 +1342,8 @@ check_member_template (tmpl)
/* 14.5.2.3 [temp.mem]
A member function template shall not be virtual. */
cp_error (ec_invalid_use_of_virtual_in_template_declaration_of,
cp_error
("invalid use of `virtual' in template declaration of `%#D'",
decl);
DECL_VIRTUAL_P (decl) = 0;
}
@ -1375,7 +1353,7 @@ check_member_template (tmpl)
DECL_IGNORED_P (tmpl) = 1;
}
else
cp_error (ec_template_declaration_of, decl);
cp_error ("template declaration of `%#D'", decl);
}
/* Return true iff TYPE is a valid Java parameter or return type. */
@ -1425,7 +1403,7 @@ check_java_method (ctype, method)
tree ret_type = TREE_TYPE (TREE_TYPE (method));
if (! acceptable_java_type (ret_type))
{
cp_error (ec_ava_method_has_nonava_return_type,
cp_error ("Java method '%D' has non-Java return type `%T'",
method, ret_type);
jerr++;
}
@ -1434,7 +1412,7 @@ check_java_method (ctype, method)
tree type = TREE_VALUE (arg_types);
if (! acceptable_java_type (type))
{
cp_error (ec_ava_method_has_nonava_parameter_type,
cp_error ("Java method '%D' has non-Java parameter type `%T'",
method, type);
jerr++;
}
@ -1548,17 +1526,17 @@ check_classfn (ctype, function)
if (methods != end)
{
tree fndecl = *methods;
cp_error (ec_prototype_for_does_not_match_any_in_class,
cp_error ("prototype for `%#D' does not match any in class `%T'",
function, ctype);
cp_error_at (ec_candidates, OVL_NEXT (fndecl) ? "s are" : " is",
cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is",
OVL_CURRENT (fndecl));
while (fndecl = OVL_NEXT (fndecl), fndecl)
cp_error_at (ec_candidate_2, OVL_CURRENT(fndecl));
cp_error_at (" %#D", OVL_CURRENT(fndecl));
}
else
{
methods = 0;
cp_error (ec_no_member_function_declared_in_class,
cp_error ("no `%#D' member function declared in class `%T'",
function, ctype);
}
@ -1638,7 +1616,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (DECL_NAME (value) != NULL_TREE
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
cp_error (ec_member_conflicts_with_virtual_function_table_field_name,
cp_error ("member `%D' conflicts with virtual function table field name",
value);
/* Stash away type declarations. */
@ -1663,13 +1641,13 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (IS_SIGNATURE (current_class_type)
&& TREE_CODE (value) != FUNCTION_DECL)
{
cp_error (ec_field_declaration_not_allowed_in_signature);
error ("field declaration not allowed in signature");
return void_type_node;
}
if (DECL_IN_AGGR_P (value))
{
cp_error (ec_is_already_defined_in_the_class, value,
cp_error ("`%D' is already defined in the class %T", value,
DECL_CONTEXT (value));
return void_type_node;
}
@ -1682,7 +1660,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (IS_SIGNATURE (current_class_type)
&& TREE_CODE (value) == FUNCTION_DECL)
{
cp_error (ec_function_declarations_cannot_have_initializers_in_signature);
error ("function declarations cannot have initializers in signature");
init = NULL_TREE;
}
else if (TREE_CODE (value) == FUNCTION_DECL)
@ -1728,7 +1706,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
&& (TREE_CODE_CLASS (TREE_CODE (init)) != 'd'
|| DECL_EXTERNAL (init) == 0)))
{
cp_error (ec_field_initializer_is_not_constant);
error ("field initializer is not constant");
init = error_mark_node;
}
}
@ -1750,8 +1728,8 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
tree olddecl = IDENTIFIER_LOCAL_VALUE (declarator);
if (decl_template_parm_p (olddecl))
{
cp_error (ec_redeclaration_of_template_parameter, declarator);
cp_error_at (ec_previously_declared_here, olddecl);
cp_error ("redeclaration of template parameter `%T'", declarator);
cp_error_at (" previously declared here `%#D'", olddecl);
}
}
@ -1783,9 +1761,9 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
{
static int explanation = 0;
cp_error (ec_initializer_invalid_for_static_member_with_constructor);
error ("initializer invalid for static member with constructor");
if (explanation++ == 0)
cp_error (ec_you_really_want_to_initialize_it_separately);
error ("(you really want to initialize it separately)");
init = 0;
}
/* Force the compiler to know when an uninitialized static
@ -1834,7 +1812,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
#if 0 /* Just because a fn is declared doesn't mean we'll try to define it. */
if (current_function_decl && ! IS_SIGNATURE (current_class_type))
cp_error (ec_method_of_local_class_must_be_defined_in_class_body,
cp_error ("method `%#D' of local class must be defined in class body",
value);
#endif
@ -1864,7 +1842,7 @@ grokbitfield (declarator, declspecs, width)
if (TREE_CODE (value) == TYPE_DECL)
{
cp_error (ec_cannot_declare_to_be_a_bitfield_type, value);
cp_error ("cannot declare `%D' to be a bitfield type", value);
return NULL_TREE;
}
@ -1874,20 +1852,20 @@ grokbitfield (declarator, declspecs, width)
check here. */
if (TREE_CODE (value) == FUNCTION_DECL)
{
cp_error (ec_cannot_declare_bitfield_with_funcion_type,
cp_error ("cannot declare bitfield `%D' with funcion type",
DECL_NAME (value));
return NULL_TREE;
}
if (IS_SIGNATURE (current_class_type))
{
cp_error (ec_field_declaration_not_allowed_in_signature);
error ("field declaration not allowed in signature");
return void_type_node;
}
if (DECL_IN_AGGR_P (value))
{
cp_error (ec_is_already_defined_in_the_class, value,
cp_error ("`%D' is already defined in the class %T", value,
DECL_CONTEXT (value));
return void_type_node;
}
@ -1896,7 +1874,7 @@ grokbitfield (declarator, declspecs, width)
if (TREE_STATIC (value))
{
cp_error (ec_static_member_cannot_be_a_bitfield, value);
cp_error ("static member `%D' cannot be a bitfield", value);
return NULL_TREE;
}
cp_finish_decl (value, NULL_TREE, NULL_TREE, 0, 0);
@ -1987,11 +1965,11 @@ grok_function_init (decl, init)
tree type = TREE_TYPE (decl);
if (TREE_CODE (type) == FUNCTION_TYPE)
cp_error (ec_initializer_specified_for_nonmember_function, decl);
cp_error ("initializer specified for non-member function `%D'", decl);
#if 0
/* We'll check for this in finish_struct_1. */
else if (DECL_VINDEX (decl) == NULL_TREE)
cp_error (ec_initializer_specified_for_nonvirtual_method, decl);
cp_error ("initializer specified for non-virtual method `%D'", decl);
#endif
else if (integer_zerop (init))
{
@ -2019,7 +1997,7 @@ grok_function_init (decl, init)
}
}
else
cp_error (ec_invalid_initializer_for_virtual_method, decl);
cp_error ("invalid initializer for virtual method `%D'", decl);
}
void
@ -2242,9 +2220,9 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
continue;
if (TREE_PRIVATE (field))
cp_pedwarn_at (ec_private_member_in_anonymous_union, field);
cp_pedwarn_at ("private member `%#D' in anonymous union", field);
else if (TREE_PROTECTED (field))
cp_pedwarn_at (ec_protected_member_in_anonymous_union, field);
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
if (DECL_NAME (field) == NULL_TREE
&& TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
@ -2314,7 +2292,7 @@ finish_anon_union (anon_union_decl)
if (public_p)
{
cp_error (ec_global_anonymous_unions_must_be_declared_static);
error ("global anonymous unions must be declared static");
return;
}
@ -2330,7 +2308,7 @@ finish_anon_union (anon_union_decl)
}
else
{
cp_warning (ec_anonymous_union_with_no_members);
warning ("anonymous union with no members");
return;
}
}
@ -2390,15 +2368,15 @@ coerce_new_type (type)
if (TREE_CODE (type) == METHOD_TYPE)
type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
if (TREE_TYPE (type) != ptr_type_node)
e1 = 1, cp_error (ec_operator_new_must_return_type_void);
e1 = 1, error ("`operator new' must return type `void *'");
/* Technically the type must be `size_t', but we may not know
what that is. */
if (TYPE_ARG_TYPES (type) == NULL_TREE)
e1 = 1, cp_error (ec_operator_new_takes_type_size_t_parameter);
e1 = 1, error ("`operator new' takes type `size_t' parameter");
else if (TREE_CODE (TREE_VALUE (TYPE_ARG_TYPES (type))) != INTEGER_TYPE
|| TYPE_PRECISION (TREE_VALUE (TYPE_ARG_TYPES (type))) != TYPE_PRECISION (sizetype))
e2 = 1, cp_error (ec_operator_new_takes_type_size_t_as_first_parameter);
e2 = 1, error ("`operator new' takes type `size_t' as first parameter");
if (e2)
type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type))));
else if (e1)
@ -2423,11 +2401,11 @@ coerce_delete_type (type)
}
if (TREE_TYPE (type) != void_type_node)
e1 = 1, cp_error (ec_operator_delete_must_return_type_void);
e1 = 1, error ("`operator delete' must return type `void'");
if (arg_types == NULL_TREE
|| TREE_VALUE (arg_types) != ptr_type_node)
e2 = 1, cp_error (ec_operator_delete_takes_type_void_as_first_parameter);
e2 = 1, error ("`operator delete' takes type `void *' as first parameter");
#if 0
if (arg_types
@ -2439,14 +2417,14 @@ coerce_delete_type (type)
tree t2 = TREE_VALUE (TREE_CHAIN (arg_types));
if (TREE_CODE (t2) != INTEGER_TYPE
|| TYPE_PRECISION (t2) != TYPE_PRECISION (sizetype))
e3 = 1, cp_error (ec_second_argument_to_operator_delete_must_be_of_type_size_t);
e3 = 1, error ("second argument to `operator delete' must be of type `size_t'");
else if (TREE_CHAIN (TREE_CHAIN (arg_types)) != void_list_node)
{
e3 = 1;
if (TREE_CHAIN (TREE_CHAIN (arg_types)))
cp_error (ec_too_many_arguments_in_declaration_of_operator_delete);
error ("too many arguments in declaration of `operator delete'");
else
cp_error (ec_invalid_in_specification_of_operator_delete);
error ("`...' invalid in specification of `operator delete'");
}
}
@ -3003,7 +2981,7 @@ setup_initp ()
if (! flag_init_priority)
{
for (t = static_aggregates_initp; t; t = TREE_CHAIN (t))
cp_warning (ec_init_priority_for_ignored_without_finitpriority,
cp_warning ("init_priority for `%#D' ignored without -finit-priority",
TREE_VALUE (t));
return;
}
@ -3684,7 +3662,7 @@ reparse_absdcl_as_casts (decl, expr)
if (IS_SIGNATURE (type))
{
cp_error (ec_cast_specifies_signature_type);
error ("cast specifies signature type");
return error_mark_node;
}
@ -3705,7 +3683,7 @@ reparse_absdcl_as_casts (decl, expr)
}
if (warn_old_style_cast)
cp_warning (ec_use_of_oldstyle_cast);
warning ("use of old-style cast");
return expr;
}
@ -4046,7 +4024,7 @@ check_cp_case_value (value)
if (TREE_CODE (value) != INTEGER_CST
&& value != error_mark_node)
{
cp_error (ec_case_label_does_not_reduce_to_an_integer_constant,
cp_error ("case label `%E' does not reduce to an integer constant",
value);
value = error_mark_node;
}
@ -4210,10 +4188,10 @@ ambiguous_decl (name, old, new, flags)
/* Some declarations are functions, some are not. */
if (flags & LOOKUP_COMPLAIN)
{
cp_error (ec_use_of_is_ambiguous, name);
cp_error_at (ec_first_declared_as_here,
cp_error ("use of `%D' is ambiguous", name);
cp_error_at (" first declared as `%#D' here",
BINDING_VALUE (old));
cp_error_at (ec_also_declared_as_here, val);
cp_error_at (" also declared as `%#D' here", val);
}
return error_mark_node;
}
@ -4228,9 +4206,9 @@ ambiguous_decl (name, old, new, flags)
{
if (flags & LOOKUP_COMPLAIN)
{
cp_error (ec_denotes_an_ambiguous_type,name);
cp_error_at (ec_first_type_here, BINDING_TYPE (old));
cp_error_at (ec_other_type_here, type);
cp_error ("`%D' denotes an ambiguous type",name);
cp_error_at (" first type here", BINDING_TYPE (old));
cp_error_at (" other type here", type);
}
}
return old;
@ -4317,7 +4295,7 @@ set_decl_namespace (decl, scope)
scope = ORIGINAL_NAMESPACE (scope);
if (!is_namespace_ancestor (current_namespace, scope))
cp_error (ec_declaration_of_not_in_a_namespace_surrounding,
cp_error ("declaration of `%D' not in a namespace surrounding `%D'",
decl, scope);
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
if (scope != current_namespace)
@ -4342,7 +4320,7 @@ set_decl_namespace (decl, scope)
else
return;
complain:
cp_error (ec_should_have_been_declared_inside,
cp_error ("`%D' should have been declared inside `%D'",
decl, scope);
}
@ -4445,9 +4423,9 @@ add_function (k, fn)
{
fn = f1; f1 = f2; f2 = fn;
}
cp_error_at (ec_is_not_a_function, f1);
cp_error_at (ec_conflict_with, f2);
cp_error (ec_in_call_to, k->name);
cp_error_at ("`%D' is not a function,", f1);
cp_error_at (" conflict with `%D'", f2);
cp_error (" in call to `%D'", k->name);
return 1;
}
else
@ -4715,7 +4693,7 @@ do_namespace_alias (alias, namespace)
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
/* The parser did not find it, so it's not there. */
cp_error (ec_unknown_namespace, namespace);
cp_error ("unknown namespace `%D'", namespace);
return;
}
@ -4777,7 +4755,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls))
{
cp_error (ec_not_declared, name);
cp_error ("`%D' not declared", name);
return;
}
@ -4825,7 +4803,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
*newtype = BINDING_TYPE (decls);
if (oldtype && *newtype && oldtype != *newtype)
{
cp_error (ec_using_directive_introduced_ambiguous_type,
cp_error ("using directive `%D' introduced ambiguous type `%T'",
name, oldtype);
return;
}
@ -4892,13 +4870,13 @@ do_class_using_decl (decl)
if (TREE_CODE (decl) != SCOPE_REF
|| TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (decl, 0))) != 't')
{
cp_error (ec_usingdeclaration_for_nonmember_at_class_scope);
cp_error ("using-declaration for non-member at class scope");
return NULL_TREE;
}
name = TREE_OPERAND (decl, 1);
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
cp_error (ec_usingdeclaration_for_destructor);
cp_error ("using-declaration for destructor");
return NULL_TREE;
}
if (TREE_CODE (name) == TYPE_DECL)
@ -4925,12 +4903,12 @@ do_using_directive (namespace)
if (TREE_CODE (namespace) == IDENTIFIER_NODE)
{
/* Lookup in lexer did not find a namespace. */
cp_error (ec_namespace_undeclared, namespace);
cp_error ("namespace `%T' undeclared", namespace);
return;
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
cp_error (ec_is_not_a_namespace, namespace);
cp_error ("`%T' is not a namespace", namespace);
return;
}
namespace = ORIGINAL_NAMESPACE (namespace);
@ -4953,7 +4931,7 @@ check_default_args (x)
saw_def = 1;
else if (saw_def)
{
cp_error_at (ec_default_argument_missing_for_parameter_of,
cp_error_at ("default argument missing for parameter %P of `%+#D'",
i, x);
break;
}
@ -4998,9 +4976,9 @@ handle_class_head (aggr, scope, id)
return id;
if (scope)
cp_error (ec_does_not_have_a_nested_type_named, scope, id);
cp_error ("`%T' does not have a nested type named `%D'", scope, id);
else
cp_error (ec_no_filescope_type_named, id);
cp_error ("no file-scope type named `%D'", id);
id = xref_tag
(aggr, make_anon_name (), 1);

View File

@ -23,7 +23,6 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "toplev.h"
#include "cp-tree.h"
/* cp_printer is the type of a function which converts an argument into
a string for digestion by printf. The cp_printer function should deal
@ -38,36 +37,10 @@ extern cp_printer * cp_printers[256];
when we're computing the conversion costs for a method call. */
int cp_silent = 0;
/* The error messages themselves. */
typedef struct cp_err_msg {
/* The format of the error message. */
char* format;
/* The code which we should check when deciding whether or not to
issue this message. Used to indicate that some errors are "the
same" even though they have different formats. */
error_code equiv_code;
/* A count of how many more times this warning has been enabled than
disabled. (Ignored for errors.) */
int enabled;
} cp_err_msg;
static cp_err_msg err_msgs[] = {
#undef DEFERROR
#undef DEFERRORNUM
#define DEFERROR(code, format) DEFERRORNUM(code, format, code)
#define DEFERRORNUM(code, format, equiv_code) \
{ format, equiv_code, 1 },
#include "cp-error.def"
{ 0, 0, 0 }
};
typedef void errorfn (); /* deliberately vague */
extern char* cp_file_of PROTO((tree));
extern int cp_line_of PROTO((tree));
static int is_warning_enabled PROTO((error_code));
#define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap)
@ -76,13 +49,13 @@ static int is_warning_enabled PROTO((error_code));
#ifdef __STDC__
static void
cp_thing (errorfn *errfn, int atarg1, error_code ec, va_list ap)
cp_thing (errorfn *errfn, int atarg1, const char *format, va_list ap)
#else
static void
cp_thing (errfn, atarg1, ec, ap)
cp_thing (errfn, atarg1, format, ap)
errorfn *errfn;
int atarg1;
error_code ec;
const char *format;
va_list ap;
#endif
{
@ -93,29 +66,14 @@ cp_thing (errfn, atarg1, ec, ap)
long offset;
const char *f;
tree atarg = 0;
char* format;
my_friendly_assert ((int) ec >= 0 && (int) ec < ec_last_error_code,
0);
format = err_msgs[(int) ec].format;
my_friendly_assert (format != 0, 0);
len = strlen (format) + 1 /* '\0' */ + 16 /* code number */;
len = strlen (format) + 1;
if (len > buflen)
{
buflen = len;
buf = xrealloc (buf, buflen);
}
if (flag_diag_codes)
{
sprintf (buf, "[%d] ", (int) ec);
for (offset = 0; buf[offset]; ++offset)
;
}
else
offset = 0;
offset = 0;
for (f = format; *f; ++f)
{
@ -240,10 +198,10 @@ cp_thing (errfn, atarg1, ec, ap)
}
#ifdef __STDC__
#define DECLARE(name) void name (error_code ec, ...)
#define INIT va_start (ap, ec)
#define DECLARE(name) void name (const char *format, ...)
#define INIT va_start (ap, format)
#else
#define DECLARE(name) void name (ec, va_alist) error_code ec; va_dcl
#define DECLARE(name) void name (format, va_alist) char *format; va_dcl
#define INIT va_start (ap)
#endif
@ -252,7 +210,7 @@ DECLARE (cp_error)
va_list ap;
INIT;
if (! cp_silent)
cp_thing ((errorfn *) error, 0, ec, ap);
cp_thing ((errorfn *) error, 0, format, ap);
va_end (ap);
}
@ -260,8 +218,8 @@ DECLARE (cp_warning)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) warning, 0, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) warning, 0, format, ap);
va_end (ap);
}
@ -269,8 +227,8 @@ DECLARE (cp_pedwarn)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) pedwarn, 0, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn, 0, format, ap);
va_end (ap);
}
@ -280,7 +238,7 @@ DECLARE (cp_compiler_error)
va_list ap;
INIT;
if (! cp_silent)
cp_thing (compiler_error, 0, ec, ap);
cp_thing (compiler_error, 0, format, ap);
va_end (ap);
}
@ -288,7 +246,7 @@ DECLARE (cp_sprintf)
{
va_list ap;
INIT;
cp_thing ((errorfn *) sprintf, 0, ec, ap);
cp_thing ((errorfn *) sprintf, 0, format, ap);
va_end (ap);
}
@ -297,7 +255,7 @@ DECLARE (cp_error_at)
va_list ap;
INIT;
if (! cp_silent)
cp_thing ((errorfn *) error_with_file_and_line, 1, ec, ap);
cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
va_end (ap);
}
@ -305,8 +263,8 @@ DECLARE (cp_warning_at)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) warning_with_file_and_line, 1, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
va_end (ap);
}
@ -314,42 +272,7 @@ DECLARE (cp_pedwarn_at)
{
va_list ap;
INIT;
if (! cp_silent && is_warning_enabled (ec))
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, ec, ap);
if (! cp_silent)
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
va_end (ap);
}
/* If ON is non-zero, enable the warning with the indicated NUMBER.
If OFF is zero, disable it. Actually, this function manipulates a
counter, so that enabling/disabling of warnings can nest
appropriately. */
void
cp_enable_warning (number, on)
int number;
int on;
{
if (number < 0 || number > (int) ec_last_error_code)
error ("invalid warning number %d", number);
else if (on)
err_msgs[number].enabled++;
else
{
if (!err_msgs[number].enabled)
warning ("warning %d not enabled", number);
else
err_msgs[number].enabled--;
}
}
/* Returns non-zero if EC corresponds to an enabled error message. */
int
is_warning_enabled (ec)
error_code ec;
{
my_friendly_assert ((int) ec >= 0 && (int) ec < ec_last_error_code,
0);
return err_msgs[(int) ec].enabled;
}

View File

@ -633,7 +633,7 @@ process_start_catch_block_old (declspecs, declarator)
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
if (decl == NULL_TREE)
cp_error (ec_invalid_catch_parameter);
error ("invalid catch parameter");
}
if (decl)
@ -745,7 +745,7 @@ process_start_catch_block (declspecs, declarator)
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
if (decl == NULL_TREE)
cp_error (ec_invalid_catch_parameter);
error ("invalid catch parameter");
}
if (decl)
@ -1173,7 +1173,7 @@ expand_throw (exp)
exp = build_modify_expr (object, INIT_EXPR, exp);
if (exp == error_mark_node)
cp_error (ec_in_thrown_expression);
error (" in thrown expression");
expand_expr (exp, const0_rtx, VOIDmode, 0);
expand_eh_region_end (build_terminate_handler ());
@ -1277,7 +1277,7 @@ build_throw (e)
return build_min (THROW_EXPR, void_type_node, e);
if (e == null_node)
cp_warning (ec_throwing_which_has_integral_not_pointer_type);
cp_warning ("throwing NULL, which has integral, not pointer type");
e = build1 (THROW_EXPR, void_type_node, e);
TREE_SIDE_EFFECTS (e) = 1;

View File

@ -331,10 +331,10 @@ do_case (start, end)
if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
&& POINTER_TYPE_P (TREE_TYPE (start)))
cp_error (ec_pointers_are_not_permitted_as_case_values);
error ("pointers are not permitted as case values");
if (end && pedantic)
cp_pedwarn (ec_forbids_range_expressions_in_switch_statement);
pedwarn ("ANSI C++ forbids range expressions in switch statement");
if (processing_template_decl)
{
@ -366,43 +366,43 @@ do_case (start, end)
if (success == 1)
{
if (end)
cp_error (ec_case_label_not_within_a_switch_statement);
error ("case label not within a switch statement");
else if (start)
cp_error (ec_case_label_not_within_a_switch_statement, start);
cp_error ("case label `%E' not within a switch statement", start);
else
cp_error (ec_default_label_not_within_a_switch_statement);
error ("default label not within a switch statement");
}
else if (success == 2)
{
if (end)
{
cp_error (ec_duplicate_or_overlapping_case_value);
cp_error_at (ec_this_is_the_first_entry_overlapping_that_value,
error ("duplicate (or overlapping) case value");
cp_error_at ("this is the first entry overlapping that value",
duplicate);
}
else if (start)
{
cp_error (ec_duplicate_case_value, start);
cp_error_at (ec_previously_used_here, duplicate);
cp_error ("duplicate case value `%E'", start);
cp_error_at ("previously used here", duplicate);
}
else
{
cp_error (ec_multiple_default_labels_in_one_switch);
cp_error_at (ec_this_is_the_first_default_label, duplicate);
error ("multiple default labels in one switch");
cp_error_at ("this is the first default label", duplicate);
}
}
else if (success == 3)
cp_warning (ec_case_value_out_of_range);
warning ("case value out of range");
else if (success == 4)
cp_warning (ec_empty_range_specified);
warning ("empty range specified");
else if (success == 5)
{
if (end)
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array);
error ("case label within scope of cleanup or variable array");
else if (! start)
cp_error (ec_default_label_within_scope_of_cleanup_or_variable_array);
error ("`default' label within scope of cleanup or variable array");
else
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array, start);
cp_error ("case label `%E' within scope of cleanup or variable array", start);
}
}
if (start)

View File

@ -155,9 +155,9 @@ add_friend (type, decl)
{
if (decl == TREE_VALUE (friends))
{
cp_warning (ec_is_already_a_friend_of_class,
cp_warning ("`%D' is already a friend of class `%T'",
decl, type);
cp_warning_at (ec_previous_friend_declaration_of,
cp_warning_at ("previous friend declaration of `%D'",
TREE_VALUE (friends));
return;
}
@ -205,11 +205,11 @@ add_friends (type, name, friend_type)
if (friends)
{
if (friend_type)
cp_warning (ec_method_ss_is_already_a_friend_of_class,
warning ("method `%s::%s' is already a friend of class",
TYPE_NAME_STRING (friend_type),
IDENTIFIER_POINTER (name));
else
cp_warning (ec_function_s_is_already_a_friend_of_class_s,
warning ("function `%s' is already a friend of class `%s'",
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME (typedecl)));
}
@ -252,12 +252,12 @@ make_friend_class (type, friend_type)
if (IS_SIGNATURE (type))
{
cp_error (ec_friend_declaration_in_signature_definition);
error ("`friend' declaration in signature definition");
return;
}
if (IS_SIGNATURE (friend_type))
{
cp_error (ec_signature_type_s_declared_friend,
error ("signature type `%s' declared `friend'",
IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
return;
}
@ -269,7 +269,7 @@ make_friend_class (type, friend_type)
Friend declarations shall not declare partial
specializations. */
cp_error (ec_partial_specialization_declared_friend,
cp_error ("partial specialization `%T' declared `friend'",
friend_type);
return;
}
@ -281,7 +281,7 @@ make_friend_class (type, friend_type)
is_template_friend = 1;
else if (comptypes (type, friend_type, 1))
{
cp_pedwarn (ec_class_s_is_implicitly_friends_with_itself,
pedwarn ("class `%s' is implicitly friends with itself",
TYPE_NAME_STRING (type));
return;
}
@ -301,7 +301,7 @@ make_friend_class (type, friend_type)
comptypes (TREE_VALUE (classes), friend_type, 1)))
classes = TREE_CHAIN (classes);
if (classes)
cp_warning (ec_is_already_a_friend_of,
cp_warning ("`%T' is already a friend of `%T'",
TREE_VALUE (classes), type);
else
{
@ -384,7 +384,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
TYPE_SIZE (ctype) || template_class_depth (ctype) > 0)
add_friend (current_class_type, decl);
else
cp_error (ec_member_declared_as_friend_before_type_defined,
cp_error ("member `%D' declared as friend before type `%T' defined",
decl, ctype);
}
}
@ -399,7 +399,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
if (fields)
add_friends (current_class_type, declarator, ctype);
else
cp_error (ec_method_is_not_a_member_of_class,
cp_error ("method `%D' is not a member of class `%T'",
declarator, ctype);
decl = void_type_node;
}
@ -452,14 +452,14 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
&& current_template_parms && uses_template_parms (decl))
{
static int explained;
cp_warning (ec_friend_declaration, decl);
cp_warning (ec_declares_a_nontemplate_function);
cp_warning ("friend declaration `%#D'", decl);
warning (" declares a non-template function");
if (! explained)
{
cp_warning (ec_if_this_is_not_what_you_intended_make_sure);
cp_warning (ec_the_function_template_has_already_been_declared);
cp_warning (ec_and_add_after_the_function_name_here);
cp_warning (ec_o_disable_warning_use_nonontemplatefriend);
warning (" (if this is not what you intended, make sure");
warning (" the function template has already been declared,");
warning (" and add <> after the function name here)");
warning (" To disable warning use -Wno-non-template-friend");
explained = 1;
}
}
@ -477,7 +477,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
tree decl = lookup_name_nonclass (declarator);
if (decl == NULL_TREE)
{
cp_warning (ec_implicitly_declaring_as_struct, declarator);
cp_warning ("implicitly declaring `%T' as struct", declarator);
decl = xref_tag (record_type_node, declarator, 1);
decl = TYPE_MAIN_DECL (decl);
}
@ -486,7 +486,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
but not if those functions are really class names. */
if (TREE_CODE (decl) == TREE_LIST && TREE_TYPE (TREE_PURPOSE (decl)))
{
cp_warning (ec_friend_archaic_use_friend_class_instead,
cp_warning ("`friend %T' archaic, use `friend class %T' instead",
declarator, declarator);
decl = TREE_TYPE (TREE_PURPOSE (decl));
}

View File

@ -190,7 +190,7 @@ perform_member_init (member, name, init, explicit)
init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
else if (TREE_CODE (type) == REFERENCE_TYPE)
{
cp_error (ec_defaultinitialization_of_which_has_reference_type,
cp_error ("default-initialization of `%#D', which has reference type",
member);
init = error_mark_node;
}
@ -199,7 +199,7 @@ perform_member_init (member, name, init, explicit)
}
/* member traversal: note it leaves init NULL */
else if (TREE_CODE (TREE_TYPE (member)) == REFERENCE_TYPE)
cp_pedwarn (ec_uninitialized_reference_member, member);
cp_pedwarn ("uninitialized reference member `%D'", member);
}
else if (TREE_CODE (init) == TREE_LIST)
{
@ -207,7 +207,7 @@ perform_member_init (member, name, init, explicit)
work in that case. */
if (TREE_CHAIN (init))
{
cp_warning (ec_initializer_list_treated_as_compound_expression);
warning ("initializer list treated as compound expression");
init = build_compound_expr (init);
}
else
@ -298,9 +298,9 @@ sort_member_init (t)
{
if (pos < last_pos)
{
cp_warning_at (ec_member_initializers_for, last_field);
cp_warning_at (ec_and, field);
cp_warning (ec_will_be_reordered_to_match_declaration_order);
cp_warning_at ("member initializers for `%#D'", last_field);
cp_warning_at (" and `%#D'", field);
warning (" will be re-ordered to match declaration order");
}
last_pos = pos;
last_field = field;
@ -329,7 +329,7 @@ sort_member_init (t)
{
if (purpose_member (name, init_list))
{
cp_error (ec_multiple_initializations_given_for_member,
cp_error ("multiple initializations given for member `%D'",
IDENTIFIER_CLASS_VALUE (name));
continue;
}
@ -377,13 +377,13 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
switch (n_baseclasses)
{
case 0:
cp_error (ec_does_not_have_a_base_class_to_initialize,
cp_error ("`%T' does not have a base class to initialize",
current_class_type);
return;
case 1:
break;
default:
cp_error (ec_unnamed_initializer_ambiguous_for_which_uses_multiple_inheritance,
cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance",
current_class_type);
return;
}
@ -415,7 +415,7 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
break;
if (i < 0)
{
cp_error (ec_is_not_an_immediate_base_class_of,
cp_error ("`%T' is not an immediate base class of `%T'",
basetype, current_class_type);
continue;
}
@ -453,9 +453,9 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
{
if (pos < last_pos)
{
cp_warning_at (ec_base_initializers_for, last_base);
cp_warning_at (ec_and, BINFO_TYPE (binfo));
cp_warning (ec_will_be_reordered_to_match_inheritance_order);
cp_warning_at ("base initializers for `%#T'", last_base);
cp_warning_at (" and `%#T'", BINFO_TYPE (binfo));
warning (" will be re-ordered to match inheritance order");
}
last_pos = pos;
last_base = BINFO_TYPE (binfo);
@ -578,7 +578,7 @@ emit_base_init (t, immediately)
{
init = NULL_TREE;
if (extra_warnings && copy_args_p (current_function_decl))
cp_warning (ec_base_class_should_be_explicitly_initialized_in_the_copy_constructor,
cp_warning ("base class `%#T' should be explicitly initialized in the copy constructor",
BINFO_TYPE (base_binfo));
}
@ -658,7 +658,7 @@ emit_base_init (t, immediately)
if (warn_ecpp && init == NULL_TREE
&& !DECL_ARTIFICIAL (member)
&& TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE)
cp_warning (ec_should_be_initialized_in_the_member_initialization_list, member);
cp_warning ("`%D' should be initialized in the member initialization list", member);
}
perform_member_init (member, name, init, from_init_list);
@ -683,7 +683,7 @@ emit_base_init (t, immediately)
{
field = TREE_VALUE (field);
if (decl_type_context (field) != current_class_type)
cp_error (ec_field_not_in_immediate_context, field);
cp_error ("field `%D' not in immediate context", field);
}
#if 0
@ -731,7 +731,7 @@ check_base_init (t)
tree member;
for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member))
if (DECL_NAME (member) && TREE_USED (member))
cp_error (ec_field_used_before_initialized_after_assignment_to_this,
cp_error ("field `%D' used before initialized (after assignment to `this')",
member);
}
@ -855,13 +855,13 @@ member_init_ok_or_else (field, type, member_name)
return 0;
if (field == NULL_TREE || initializing_context (field) != type)
{
cp_error (ec_class_does_not_have_any_field_named_s, type,
cp_error ("class `%T' does not have any field named `%s'", type,
member_name);
return 0;
}
if (TREE_STATIC (field))
{
cp_error (ec_field_is_static_only_point_of_initialization_is_its_declaration,
cp_error ("field `%#D' is static; only point of initialization is its declaration",
field);
return 0;
}
@ -907,14 +907,14 @@ expand_member_init (exp, name, init)
switch (CLASSTYPE_N_BASECLASSES (type))
{
case 0:
cp_error (ec_base_class_initializer_specified_but_no_base_class_to_initialize);
error ("base class initializer specified, but no base class to initialize");
return;
case 1:
basetype = TYPE_BINFO_BASETYPE (type, 0);
break;
default:
cp_error (ec_initializer_for_unnamed_base_class_ambiguous);
cp_error (ec_type_uses_multiple_inheritance, type);
error ("initializer for unnamed base class ambiguous");
cp_error ("(type `%T' uses multiple inheritance)", type);
return;
}
@ -940,7 +940,7 @@ expand_member_init (exp, name, init)
name = TYPE_IDENTIFIER (basetype);
else
{
cp_error (ec_no_base_class_to_initialize);
error ("no base class to initialize");
return;
}
#endif
@ -954,24 +954,24 @@ expand_member_init (exp, name, init)
if (IDENTIFIER_CLASS_VALUE (name))
goto try_member;
if (TYPE_USES_VIRTUAL_BASECLASSES (type))
cp_error (ec_type_is_not_an_immediate_or_virtual_basetype_for,
cp_error ("type `%T' is not an immediate or virtual basetype for `%T'",
basetype, type);
else
cp_error (ec_type_is_not_an_immediate_basetype_for,
cp_error ("type `%T' is not an immediate basetype for `%T'",
basetype, type);
return;
}
if (purpose_member (basetype, current_base_init_list))
{
cp_error (ec_base_class_already_initialized, basetype);
cp_error ("base class `%T' already initialized", basetype);
return;
}
if (warn_reorder && current_member_init_list)
{
cp_warning (ec_base_initializer_for, basetype);
cp_warning (ec_will_be_reordered_to_precede_member_initializations);
cp_warning ("base initializer for `%T'", basetype);
warning (" will be re-ordered to precede member initializations");
}
base_init = build_tree_list (basetype, init);
@ -989,7 +989,7 @@ expand_member_init (exp, name, init)
if (purpose_member (name, current_member_init_list))
{
cp_error (ec_field_already_initialized, field);
cp_error ("field `%D' already initialized", field);
return;
}
@ -1080,7 +1080,7 @@ expand_aggr_init (exp, init, alias_this, flags)
COMPLEX zees(1.0, 0.0)[10];
}
*/
cp_error (ec_bad_array_initializer);
error ("bad array initializer");
return;
}
expand_vec_init (exp, exp, array_type_nelts (type), init,
@ -1268,7 +1268,7 @@ is_aggr_typedef (name, or_else)
else
{
if (or_else)
cp_error (ec_is_not_an_aggregate_typedef, name);
cp_error ("`%T' is not an aggregate typedef", name);
return 0;
}
@ -1277,7 +1277,7 @@ is_aggr_typedef (name, or_else)
&& TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
{
if (or_else)
cp_error (ec_is_not_an_aggregate_type, type);
cp_error ("`%T' is not an aggregate type", type);
return 0;
}
return 1;
@ -1299,7 +1299,7 @@ is_aggr_type (type, or_else)
&& TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
{
if (or_else)
cp_error (ec_is_not_an_aggregate_type, type);
cp_error ("`%T' is not an aggregate type", type);
return 0;
}
return 1;
@ -1322,7 +1322,7 @@ get_aggr_from_typedef (name, or_else)
else
{
if (or_else)
cp_error (ec_fails_to_be_an_aggregate_typedef, name);
cp_error ("`%T' fails to be an aggregate typedef", name);
return NULL_TREE;
}
@ -1331,7 +1331,7 @@ get_aggr_from_typedef (name, or_else)
&& TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
{
if (or_else)
cp_error (ec_type_is_of_nonaggregate_type, type);
cp_error ("type `%T' is of non-aggregate type", type);
return NULL_TREE;
}
return type;
@ -1415,7 +1415,7 @@ build_member_call (type, name, parmlist)
if (dtor)
{
cp_error (ec_cannot_call_destructor_without_object, type,
cp_error ("cannot call destructor `%T::~%T' without object", type,
method_name);
return error_mark_node;
}
@ -1470,7 +1470,7 @@ build_member_call (type, name, parmlist)
{
if (dont_use_this)
{
cp_error (ec_invalid_use_of_nonstatic_field, t);
cp_error ("invalid use of non-static field `%D'", t);
return error_mark_node;
}
decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t);
@ -1479,7 +1479,7 @@ build_member_call (type, name, parmlist)
decl = t;
else
{
cp_error (ec_invalid_use_of_member, t);
cp_error ("invalid use of member `%D'", t);
return error_mark_node;
}
if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl)))
@ -1489,7 +1489,7 @@ build_member_call (type, name, parmlist)
}
else
{
cp_error (ec_no_method, type, name);
cp_error ("no method `%T::%D'", type, name);
return error_mark_node;
}
}
@ -1555,7 +1555,7 @@ build_offset_ref (type, name)
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
if (! check_dtor_name (type, name))
cp_error (ec_qualified_type_does_not_match_destructor_name,
cp_error ("qualified type `%T' does not match destructor name `~%T'",
type, TREE_OPERAND (name, 0));
name = dtor_identifier;
}
@ -1574,7 +1574,7 @@ build_offset_ref (type, name)
t = NULL_TREE;
if (t == 0)
{
cp_error (ec_incomplete_type_does_not_have_member, type,
cp_error ("incomplete type `%T' does not have member `%D'", type,
name);
return error_mark_node;
}
@ -1652,14 +1652,14 @@ build_offset_ref (type, name)
access = compute_access (basebinfo, t);
if (access == access_protected_node)
{
cp_error_at (ec_member_function_is_protected, t);
cp_error (ec_in_this_context);
cp_error_at ("member function `%#D' is protected", t);
error ("in this context");
return error_mark_node;
}
if (access == access_private_node)
{
cp_error_at (ec_member_function_is_private, t);
cp_error (ec_in_this_context);
cp_error_at ("member function `%#D' is private", t);
error ("in this context");
return error_mark_node;
}
mark_used (t);
@ -1693,7 +1693,7 @@ build_offset_ref (type, name)
if (t == NULL_TREE)
{
cp_error (ec_is_not_a_member_of_type, name, type);
cp_error ("`%D' is not a member of type `%T'", name, type);
return error_mark_node;
}
@ -1712,7 +1712,7 @@ build_offset_ref (type, name)
if (TREE_CODE (t) == FIELD_DECL && DECL_BIT_FIELD (t))
{
cp_error (ec_illegal_pointer_to_bit_field, t);
cp_error ("illegal pointer to bit field `%D'", t);
return error_mark_node;
}
@ -1741,7 +1741,7 @@ resolve_offset_ref (exp)
if (TREE_CODE (exp) == TREE_LIST)
{
cp_pedwarn (ec_assuming_on_overloaded_member_function);
cp_pedwarn ("assuming & on overloaded member function");
return build_unary_op (ADDR_EXPR, exp, 0);
}
@ -1755,7 +1755,7 @@ resolve_offset_ref (exp)
my_friendly_assert (TREE_CODE (type) == OFFSET_TYPE, 214);
if (TYPE_OFFSET_BASETYPE (type) != current_class_type)
{
cp_error (ec_object_missing_in_use_of_pointertomember_construct);
error ("object missing in use of pointer-to-member construct");
return error_mark_node;
}
member = exp;
@ -1784,9 +1784,9 @@ resolve_offset_ref (exp)
{
if (TREE_ADDRESSABLE (member) == 0)
{
cp_error_at (ec_member_is_nonstatic_but_referenced_as_a_static_member,
cp_error_at ("member `%D' is non-static but referenced as a static member",
member);
cp_error (ec_at_this_point_in_file);
error ("at this point in file");
TREE_ADDRESSABLE (member) = 1;
}
return error_mark_node;
@ -1822,11 +1822,11 @@ resolve_offset_ref (exp)
/* Issue errors if there was an access violation. */
if (access != access_public_node)
{
cp_error_at (ec_member_is_s,
cp_error_at ("member `%D' is %s",
access == access_private_node
? "private" : "protected",
member);
cp_error (ec_in_this_context);
cp_error ("in this context");
}
/* Even in the case of illegal access, we form the
@ -1852,7 +1852,7 @@ resolve_offset_ref (exp)
{
if (addr == error_mark_node)
{
cp_error (ec_object_missing_in, exp);
cp_error ("object missing in `%E'", exp);
return error_mark_node;
}
@ -2012,7 +2012,7 @@ build_new (placement, decl, init, use_global_new)
if (this_nelts != error_mark_node)
{
if (this_nelts == NULL_TREE)
cp_error (ec_new_of_array_type_fails_to_specify_size);
error ("new of array type fails to specify size");
else if (processing_template_decl)
{
nelts = this_nelts;
@ -2024,7 +2024,7 @@ build_new (placement, decl, init, use_global_new)
absdcl = TREE_OPERAND (absdcl, 0);
if (this_nelts == integer_zero_node)
{
cp_warning (ec_zero_size_array_reserves_no_space);
warning ("zero size array reserves no space");
nelts = integer_zero_node;
}
else
@ -2099,13 +2099,13 @@ build_new (placement, decl, init, use_global_new)
returned by new.'' ARM 5.3.3 */
if (TREE_CODE (type) == REFERENCE_TYPE)
{
cp_error (ec_new_cannot_be_applied_to_a_reference_type);
error ("new cannot be applied to a reference type");
type = TREE_TYPE (type);
}
if (TREE_CODE (type) == FUNCTION_TYPE)
{
cp_error (ec_new_cannot_be_applied_to_a_function_type);
error ("new cannot be applied to a function type");
return error_mark_node;
}
@ -2232,7 +2232,7 @@ build_new_1 (exp)
if (TREE_CODE (true_type) == VOID_TYPE)
{
cp_error (ec_invalid_type_void_for_new);
error ("invalid type `void' for new");
return error_mark_node;
}
@ -2276,7 +2276,7 @@ build_new_1 (exp)
code = VEC_NEW_EXPR;
if (init && pedantic)
cp_pedwarn (ec_initialization_in_array_new);
cp_pedwarn ("initialization in array new");
}
/* Allocate the object. */
@ -2288,7 +2288,7 @@ build_new_1 (exp)
rval = NULL_TREE;
else
{
cp_error (ec_constructors_take_parameter_lists);
error ("constructors take parameter lists");
return error_mark_node;
}
}
@ -2405,10 +2405,10 @@ build_new_1 (exp)
TREE_READONLY (deref) = 0;
if (TREE_CHAIN (init) != NULL_TREE)
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
pedwarn ("initializer list being treated as compound expression");
else if (TREE_CODE (init) == CONSTRUCTOR)
{
cp_pedwarn (ec_initializer_list_appears_where_operand_should_be_used);
pedwarn ("initializer list appears where operand should be used");
init = TREE_OPERAND (init, 1);
}
init = build_compound_expr (init);
@ -2533,7 +2533,7 @@ build_new_1 (exp)
}
}
else if (TYPE_READONLY (true_type))
cp_error (ec_uninitialized_const_in_new_of, true_type);
cp_error ("uninitialized const in `new' of `%#T'", true_type);
done:
@ -2856,7 +2856,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
&& TYPE_NEEDS_CONSTRUCTING (type)
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
{
cp_error (ec_initializer_ends_prematurely);
error ("initializer ends prematurely");
return error_mark_node;
}
}
@ -3047,7 +3047,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
addr = save_expr (addr);
if (TYPE_DOMAIN (type) == NULL_TREE)
{
cp_error (ec_unknown_array_size_in_delete);
error ("unknown array size in delete");
return error_mark_node;
}
return build_vec_delete (addr, array_type_nelts (type),
@ -3295,7 +3295,7 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
else
{
if (base != error_mark_node)
cp_error (ec_type_to_vector_delete_is_neither_pointer_or_array_type);
error ("type to vector delete is neither pointer or array type");
return error_mark_node;
}

View File

@ -101,8 +101,6 @@ DEFINE_LANG_NAME ("C++")
{ "-fno-weak", "" },
{ "-fxref", "Emit cross referencing information" },
{ "-fno-xref", "" },
{ "-fdiag-codes", "Show code numbers when printing diagnostics" },
{ "-fno-diag-codes", "" },
{ "-Wreturn-type", "Warn about inconsistent return types" },
{ "-Wno-return-type", "" },
@ -128,6 +126,4 @@ DEFINE_LANG_NAME ("C++")
{ "-Wno-old-style-cast", "" },
{ "-Wnon-template-friend", "" },
{ "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" },
{ "-Wnumber-" },
{ "-Wno-number-" },

View File

@ -186,7 +186,7 @@ make_pointer_declarator (cv_qualifiers, target)
{
if (target && TREE_CODE (target) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (target))
cp_error (ec_type_name_expected_before_star);
error ("type name expected before `*'");
target = build_parse_node (INDIRECT_REF, target);
TREE_TYPE (target) = cv_qualifiers;
return target;
@ -208,16 +208,16 @@ make_reference_declarator (cv_qualifiers, target)
{
if (TREE_CODE (target) == ADDR_EXPR)
{
cp_error (ec_cannot_declare_references_to_references);
error ("cannot declare references to references");
return target;
}
if (TREE_CODE (target) == INDIRECT_REF)
{
cp_error (ec_cannot_declare_pointers_to_references);
error ("cannot declare pointers to references");
return target;
}
if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
cp_error (ec_type_name_expected_before_amp);
error ("type name expected before `&'");
}
target = build_parse_node (ADDR_EXPR, target);
TREE_TYPE (target) = cv_qualifiers;
@ -1082,7 +1082,7 @@ set_yydebug (value)
extern int yydebug;
yydebug = value;
#else
cp_warning (ec_yydebug_not_defined);
warning ("YYDEBUG not defined.");
#endif
}
@ -1293,7 +1293,7 @@ process_next_inline (t)
yychar = yylex ();
if (yychar != END_OF_SAVED_INPUT)
{
cp_error (ec_parse_error_at_end_of_saved_function_text);
error ("parse error at end of saved function text");
/* restore_pending_input will abort unless yychar is either
END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
@ -1350,9 +1350,9 @@ consume_string (this_obstack, matching_char)
int save_lineno = lineno;
lineno = starting_lineno;
if (matching_char == '"')
cp_error (ec_end_of_file_encountered_inside_string_constant);
error ("end of file encountered inside string constant");
else
cp_error (ec_end_of_file_encountered_inside_character_constant);
error ("end of file encountered inside character constant");
lineno = save_lineno;
return;
}
@ -1369,7 +1369,7 @@ consume_string (this_obstack, matching_char)
if (c == '\n')
{
if (pedantic)
cp_pedwarn (ec_forbids_newline_in_string_constant);
pedwarn ("ANSI C++ forbids newline in string constant");
lineno++;
}
obstack_1grow (this_obstack, c);
@ -1660,7 +1660,7 @@ reinit_parse_for_block (pyychar, obstackp)
{
if (look_for_lbrac)
{
cp_error (ec_function_body_for_constructor_missing);
error ("function body for constructor missing");
obstack_1grow (obstackp, '{');
obstack_1grow (obstackp, '}');
len += 2;
@ -1877,7 +1877,7 @@ finish_defarg ()
yychar = yylex ();
if (yychar != END_OF_SAVED_INPUT)
{
cp_error (ec_parse_error_at_end_of_saved_function_text);
error ("parse error at end of saved function text");
/* restore_pending_input will abort unless yychar is either
END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
@ -2105,10 +2105,10 @@ check_for_missing_semicolon (type)
|| end_of_file)
{
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
cp_error (ec_semicolon_missing_after_s_declaration,
error ("semicolon missing after %s declaration",
TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
else
cp_error (ec_semicolon_missing_after_declaration_of, type);
cp_error ("semicolon missing after declaration of `%T'", type);
shadow_tag (build_tree_list (0, type));
}
/* Could probably also hack cases where class { ... } f (); appears. */
@ -2171,7 +2171,7 @@ skip_white_space (c)
if (c == '\n')
lineno++;
else
cp_error (ec_stray_in_program);
error ("stray '\\' in program");
c = getch ();
break;
@ -2328,7 +2328,7 @@ check_newline ()
an explcit -Wunknown-pragmas has been given. */
if (warn_unknown_pragmas > 1
|| (warn_unknown_pragmas && ! in_system_header))
cp_warning (ec_ignoring_pragma_s, token_buffer);
warning ("ignoring pragma: %s", token_buffer);
}
goto skipline;
@ -2385,7 +2385,7 @@ check_newline ()
if (token != STRING
|| TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_ident);
error ("invalid #ident");
goto skipline;
}
@ -2417,7 +2417,7 @@ check_newline ()
goto skipline;
}
}
cp_error (ec_undefined_or_invalid_directive);
error ("undefined or invalid # directive");
goto skipline;
}
@ -2468,7 +2468,7 @@ linenum:
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_line);
error ("invalid #line");
goto skipline;
}
@ -2610,7 +2610,7 @@ linenum:
if (c_header_level && --c_header_level == 0)
{
if (entering_c_header)
cp_warning (ec_badly_nested_headers_from_preprocessor);
warning ("badly nested C headers from preprocessor");
--pending_lang_change;
}
in_system_header = entering_system_header;
@ -2622,7 +2622,7 @@ linenum:
debug_end_source_file (input_file_stack->line);
}
else
cp_error (ec_lines_for_entering_and_leaving_files_dont_match);
error ("#-lines for entering and leaving files don't match");
}
else
in_system_header = entering_system_header;
@ -2633,7 +2633,7 @@ linenum:
c = EOF;
}
else
cp_error (ec_invalid_line);
error ("invalid #-line");
/* skip the rest of this line. */
skipline:
@ -2698,7 +2698,7 @@ readescape (ignore_ptr)
nonnull = 1;
}
if (! nonnull)
cp_error (ec_x_used_with_no_following_hex_digits);
error ("\\x used with no following hex digits");
else if (count == 0)
/* Digits are all 0's. Ok. */
;
@ -2706,7 +2706,7 @@ readescape (ignore_ptr)
|| (count > 1
&& ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
<= firstdig)))
cp_pedwarn (ec_hex_escape_out_of_range);
pedwarn ("hex escape out of range");
return code;
case '0': case '1': case '2': case '3': case '4':
@ -2753,7 +2753,7 @@ readescape (ignore_ptr)
case 'e':
case 'E':
if (pedantic)
cp_pedwarn (ec_nonstandard_escape_sequence_c, c);
pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
return 033;
case '?':
@ -2766,13 +2766,13 @@ readescape (ignore_ptr)
/* `\%' is used to prevent SCCS from getting confused. */
case '%':
if (pedantic)
cp_pedwarn (ec_unknown_escape_sequence_c, c);
pedwarn ("unknown escape sequence `\\%c'", c);
return c;
}
if (c >= 040 && c < 0177)
cp_pedwarn (ec_unknown_escape_sequence_c, c);
pedwarn ("unknown escape sequence `\\%c'", c);
else
cp_pedwarn (ec_unknown_escape_sequence_followed_by_char_code_0xx, c);
pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
return c;
}
@ -2899,7 +2899,7 @@ do_identifier (token, parsing, args)
my_friendly_abort (61);
else
{
cp_error (ec_invalid_use_of_member_from_base_class, field,
cp_error ("invalid use of member `%D' from base class `%T'", field,
DECL_FIELD_CONTEXT (field));
id = error_mark_node;
return id;
@ -2943,7 +2943,7 @@ do_identifier (token, parsing, args)
else if (IDENTIFIER_OPNAME_P (token))
{
if (token != ansi_opname[ERROR_MARK])
cp_error (ec_not_defined, token);
cp_error ("`%D' not defined", token);
id = error_mark_node;
}
else if (in_call && ! flag_strict_prototype)
@ -2952,7 +2952,7 @@ do_identifier (token, parsing, args)
}
else if (current_function_decl == 0)
{
cp_error (ec_was_not_declared_in_this_scope, token);
cp_error ("`%D' was not declared in this scope", token);
id = error_mark_node;
}
else
@ -2962,12 +2962,12 @@ do_identifier (token, parsing, args)
{
static int undeclared_variable_notice;
cp_error (ec_undeclared_first_use_this_function, token);
cp_error ("`%D' undeclared (first use this function)", token);
if (! undeclared_variable_notice)
{
cp_error (ec_ach_undeclared_identifier_is_reported_only_once);
cp_error (ec_for_each_function_it_appears_in);
error ("(Each undeclared identifier is reported only once");
error ("for each function it appears in.)");
undeclared_variable_notice = 1;
}
}
@ -2990,11 +2990,11 @@ do_identifier (token, parsing, args)
{
if (!DECL_ERROR_REPORTED (id))
{
cp_warning (ec_name_lookup_of_s_changed,
warning ("name lookup of `%s' changed",
IDENTIFIER_POINTER (token));
cp_warning_at (ec_matches_this_under_current_rules,
cp_warning_at (" matches this `%D' under current ANSI rules",
shadowed);
cp_warning_at (ec_matches_this_under_old_rules, id);
cp_warning_at (" matches this `%D' under old rules", id);
DECL_ERROR_REPORTED (id) = 1;
}
id = shadowed;
@ -3007,13 +3007,13 @@ do_identifier (token, parsing, args)
if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id)))
{
error (msg, IDENTIFIER_POINTER (token));
cp_error_at (ec_cannot_use_obsolete_binding_at_because_it_has_a_destructor, id);
cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
id = error_mark_node;
}
else
{
pedwarn (msg, IDENTIFIER_POINTER (token));
cp_pedwarn_at (ec_using_obsolete_binding_at, id);
cp_pedwarn_at (" using obsolete binding at `%D'", id);
}
}
}
@ -3025,7 +3025,7 @@ do_identifier (token, parsing, args)
/* Check access. */
tree access = compute_access (TYPE_BINFO (current_class_type), id);
if (access == access_private_node)
cp_error (ec_enum_is_private, id);
cp_error ("enum `%D' is private", id);
/* protected is OK, since it's an enum of `this'. */
}
if (!processing_template_decl
@ -3104,7 +3104,7 @@ do_scoped_id (token, parsing)
else
{
if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
cp_error (ec_undeclared_first_use_here, token);
cp_error ("`::%D' undeclared (first use here)", token);
id = error_mark_node;
/* Prevent repeated error messages. */
SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
@ -3226,9 +3226,9 @@ real_yylex ()
case '$':
if (! dollars_in_ident)
cp_error (ec_in_identifier);
error ("`$' in identifier");
else if (pedantic)
cp_pedwarn (ec_in_identifier);
pedwarn ("`$' in identifier");
dollar_seen = 1;
goto letter;
@ -3284,9 +3284,9 @@ real_yylex ()
if (c == '$')
{
if (! dollars_in_ident)
cp_error (ec_in_identifier);
error ("`$' in identifier");
else if (pedantic)
cp_pedwarn (ec_in_identifier);
pedwarn ("`$' in identifier");
}
if (p >= token_buffer + maxtoken)
@ -3314,9 +3314,9 @@ real_yylex ()
if (c == '$')
{
if (! dollars_in_ident)
cp_error (ec_in_identifier);
error ("`$' in identifier");
else if (pedantic)
cp_pedwarn (ec_in_identifier);
pedwarn ("`$' in identifier");
}
if (p >= token_buffer + maxtoken)
@ -3366,7 +3366,7 @@ real_yylex ()
obstack. */
if (ptr->rid != RID_EXTERN)
cp_error (ec_invalid_modifier_s_for_language_string,
error ("invalid modifier `%s' for language string",
ptr->name);
real_yylex ();
value = EXTERN_LANG_STRING;
@ -3465,7 +3465,7 @@ real_yylex ()
|| TEMP_NAME_P (tmp)
|| ANON_AGGRNAME_P (tmp)
|| ANON_PARMNAME_P (tmp)))
cp_warning (ec_identifier_name_s_conflicts_with_internal_naming_strategy,
warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
token_buffer);
#endif
@ -3500,7 +3500,7 @@ real_yylex ()
value = ELLIPSIS;
goto done;
}
cp_error (ec_parse_error_at);
error ("parse error at `..'");
}
if (ISDIGIT (c1))
{
@ -3589,13 +3589,13 @@ real_yylex ()
if (c == '.')
{
if (base == 16)
cp_error (ec_floating_constant_may_not_be_in_radix_16);
error ("floating constant may not be in radix 16");
if (floatflag == TOO_MANY_POINTS)
/* We have already emitted an error. Don't need another. */
;
else if (floatflag == AFTER_POINT)
{
cp_error (ec_malformed_floating_constant);
error ("malformed floating constant");
floatflag = TOO_MANY_POINTS;
/* Avoid another error from atof by forcing all characters
from here on to be ignored. */
@ -3622,7 +3622,7 @@ real_yylex ()
value = ELLIPSIS;
goto done;
}
cp_error (ec_parse_error_at);
error ("parse error at `..'");
}
nextchar = c;
token_buffer[1] = '\0';
@ -3647,7 +3647,7 @@ real_yylex ()
floatflag = AFTER_POINT;
break; /* start of exponent */
}
cp_error (ec_nondigits_in_number_and_not_hexadecimal);
error ("nondigits in number and not hexadecimal");
c = 0;
}
else if (c >= 'a')
@ -3688,10 +3688,10 @@ real_yylex ()
}
if (numdigits == 0)
cp_error (ec_numeric_constant_with_no_digits);
error ("numeric constant with no digits");
if (largest_digit >= base)
cp_error (ec_numeric_constant_contains_digits_beyond_the_radix);
error ("numeric constant contains digits beyond the radix");
/* Remove terminating char from the token buffer and delimit the string */
*--p = 0;
@ -3718,7 +3718,7 @@ real_yylex ()
c = getch ();
}
if (! ISDIGIT (c))
cp_error (ec_floating_constant_exponent_has_no_digits);
error ("floating constant exponent has no digits");
while (ISDIGIT (c))
{
if (p >= token_buffer + maxtoken - 3)
@ -3734,7 +3734,7 @@ real_yylex ()
/* Convert string to a double, checking for overflow. */
if (setjmp (handler))
{
cp_error (ec_floating_constant_out_of_range);
error ("floating constant out of range");
value = dconst0;
}
else
@ -3757,21 +3757,21 @@ real_yylex ()
{
case 'f': case 'F':
if (fflag)
cp_error (ec_more_than_one_f_in_numeric_constant);
error ("more than one `f' in numeric constant");
fflag = 1;
break;
case 'l': case 'L':
if (lflag)
cp_error (ec_more_than_one_l_in_numeric_constant);
error ("more than one `l' in numeric constant");
lflag = 1;
break;
case 'i': case 'I':
if (imag)
cp_error (ec_more_than_one_i_or_j_in_numeric_constant);
error ("more than one `i' or `j' in numeric constant");
else if (pedantic)
cp_pedwarn (ec_forbids_imaginary_numeric_constants);
pedwarn ("ANSI C++ forbids imaginary numeric constants");
imag = 1;
break;
@ -3796,7 +3796,7 @@ real_yylex ()
if (fflag)
{
if (lflag)
cp_error (ec_both_f_and_l_in_floating_constant);
error ("both `f' and `l' in floating constant");
type = float_type_node;
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
@ -3804,20 +3804,20 @@ real_yylex ()
This is not pedwarn, become some people don't want
an error for this. */
if (REAL_VALUE_ISINF (value) && pedantic)
cp_warning (ec_floating_point_number_exceeds_range_of_float);
warning ("floating point number exceeds range of `float'");
}
else if (lflag)
{
type = long_double_type_node;
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
if (REAL_VALUE_ISINF (value) && pedantic)
cp_warning (ec_floating_point_number_exceeds_range_of_long_double);
warning ("floating point number exceeds range of `long double'");
}
else
{
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
if (REAL_VALUE_ISINF (value) && pedantic)
cp_warning (ec_floating_point_number_exceeds_range_of_double);
warning ("floating point number exceeds range of `double'");
}
set_float_handler (NULL_PTR);
@ -3830,7 +3830,7 @@ real_yylex ()
if (REAL_VALUES_LESS (dconst1, value)
|| REAL_VALUES_LESS (value, dconstm1))
{
cp_pedwarn (ec_floating_point_number_exceeds_range_of_s,
pedwarn ("floating point number exceeds range of `%s'",
IDENTIFIER_POINTER (TYPE_IDENTIFIER (type)));
exceeds_double = 1;
}
@ -3866,7 +3866,7 @@ real_yylex ()
if (c == 'u' || c == 'U')
{
if (spec_unsigned)
cp_error (ec_two_us_in_integer_constant);
error ("two `u's in integer constant");
spec_unsigned = 1;
}
else if (c == 'l' || c == 'L')
@ -3874,9 +3874,9 @@ real_yylex ()
if (spec_long)
{
if (spec_long_long)
cp_error (ec_three_ls_in_integer_constant);
error ("three `l's in integer constant");
else if (pedantic && ! in_system_header && warn_long_long)
cp_pedwarn (ec_forbids_long_long_integer_constants);
pedwarn ("ANSI C++ forbids long long integer constants");
spec_long_long = 1;
}
spec_long = 1;
@ -3884,9 +3884,9 @@ real_yylex ()
else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
{
if (spec_imag)
cp_error (ec_more_than_one_i_or_j_in_numeric_constant);
error ("more than one `i' or `j' in numeric constant");
else if (pedantic)
cp_pedwarn (ec_forbids_imaginary_numeric_constants);
pedwarn ("ANSI C++ forbids imaginary numeric constants");
spec_imag = 1;
}
else
@ -3917,7 +3917,7 @@ real_yylex ()
if (parts[i])
warn = 1;
if (warn)
cp_pedwarn (ec_integer_constant_out_of_range);
pedwarn ("integer constant out of range");
/* This is simplified by the fact that our constant
is always positive. */
@ -3958,10 +3958,10 @@ real_yylex ()
type = long_long_unsigned_type_node;
if (!int_fits_type_p (yylval.ttype, type) && !warn)
cp_pedwarn (ec_integer_constant_out_of_range);
pedwarn ("integer constant out of range");
if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
cp_warning (ec_decimal_integer_constant_is_so_large_that_it_is_unsigned);
warning ("decimal integer constant is so large that it is unsigned");
if (spec_imag)
{
@ -3972,7 +3972,7 @@ real_yylex ()
cp_convert (integer_type_node,
yylval.ttype));
else
cp_error (ec_complex_integer_constant_is_too_wide_for_complex_int);
error ("complex integer constant is too wide for `__complex int'");
}
else
TREE_TYPE (yylval.ttype) = type;
@ -4018,7 +4018,7 @@ real_yylex ()
goto tryagain;
if (width < HOST_BITS_PER_INT
&& (unsigned) c >= (1 << width))
cp_pedwarn (ec_escape_sequence_out_of_range_for_character);
pedwarn ("escape sequence out of range for character");
#ifdef MAP_CHARACTER
if (ISPRINT (c))
c = MAP_CHARACTER (c);
@ -4027,7 +4027,7 @@ real_yylex ()
else if (c == '\n')
{
if (pedantic)
cp_pedwarn (ec_forbids_newline_in_character_constant);
pedwarn ("ANSI C forbids newline in character constant");
lineno++;
}
else
@ -4076,7 +4076,7 @@ real_yylex ()
else
{
if (char_len == -1)
cp_warning (ec_gnoring_invalid_multibyte_character);
warning ("Ignoring invalid multibyte character");
if (wide_flag)
c = wc;
#ifdef MAP_CHARACTER
@ -4110,16 +4110,16 @@ real_yylex ()
}
if (c != '\'')
cp_error (ec_malformatted_character_constant);
error ("malformatted character constant");
else if (chars_seen == 0)
cp_error (ec_empty_character_constant);
error ("empty character constant");
else if (num_chars > max_chars)
{
num_chars = max_chars;
cp_error (ec_character_constant_too_long);
error ("character constant too long");
}
else if (chars_seen != 1 && warn_multichar)
cp_warning (ec_multicharacter_character_constant);
warning ("multi-character character constant");
/* If char type is signed, sign-extend the constant. */
if (! wide_flag)
@ -4179,12 +4179,12 @@ real_yylex ()
goto skipnewline;
if (width < HOST_BITS_PER_INT
&& (unsigned) c >= (1 << width))
cp_warning (ec_escape_sequence_out_of_range_for_character);
warning ("escape sequence out of range for character");
}
else if (c == '\n')
{
if (pedantic)
cp_pedwarn (ec_forbids_newline_in_string_constant);
pedwarn ("ANSI C++ forbids newline in string constant");
lineno++;
}
else
@ -4205,7 +4205,7 @@ real_yylex ()
c = getch ();
}
if (char_len == -1)
cp_warning (ec_gnoring_invalid_multibyte_character);
warning ("Ignoring invalid multibyte character");
else
{
/* mbtowc sometimes needs an extra char before accepting */
@ -4259,7 +4259,7 @@ real_yylex ()
skipnewline:
c = getch ();
if (c == EOF) {
cp_error (ec_nterminated_string);
error ("Unterminated string");
break;
}
}
@ -4408,7 +4408,7 @@ real_yylex ()
nextchar = c1;
}
if (pedantic)
cp_pedwarn (ec_use_of_operator_s_is_not_standard,
pedwarn ("use of `operator %s' is not standard C++",
token_buffer);
goto done;
}
@ -4772,13 +4772,13 @@ handle_cp_pragma (pname)
token = real_yylex ();
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_pragma_vtable);
error ("invalid #pragma vtable");
return -1;
}
if (write_virtuals != 2)
{
cp_warning (ec_use_e2_option_to_enable_pragma_vtable);
warning ("use `+e2' option to enable #pragma vtable");
return -1;
}
pending_vtables
@ -4787,7 +4787,7 @@ handle_cp_pragma (pname)
pending_vtables);
token = real_yylex ();
if (token != END_OF_LINE)
cp_warning (ec_trailing_characters_ignored);
warning ("trailing characters ignored");
return 1;
}
else if (! strcmp (pname, "unit"))
@ -4796,12 +4796,12 @@ handle_cp_pragma (pname)
token = real_yylex ();
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_pragma_unit);
error ("invalid #pragma unit");
return -1;
}
token = real_yylex ();
if (token != END_OF_LINE)
cp_warning (ec_trailing_characters_ignored);
warning ("trailing characters ignored");
return 1;
}
else if (! strcmp (pname, "interface"))
@ -4818,7 +4818,7 @@ handle_cp_pragma (pname)
if (token != STRING
|| TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_pragma_interface);
error ("invalid `#pragma interface'");
return -1;
}
main_filename = TREE_STRING_POINTER (yylval.ttype);
@ -4826,7 +4826,7 @@ handle_cp_pragma (pname)
}
if (token != END_OF_LINE)
cp_warning (ec_garbage_after_pragma_interface_ignored);
warning ("garbage after `#pragma interface' ignored");
#ifndef NO_LINKAGE_HEURISTICS
write_virtuals = 3;
@ -4871,7 +4871,7 @@ handle_cp_pragma (pname)
if (token != STRING
|| TREE_CODE (yylval.ttype) != STRING_CST)
{
cp_error (ec_invalid_pragma_implementation);
error ("invalid `#pragma implementation'");
return -1;
}
main_filename = TREE_STRING_POINTER (yylval.ttype);
@ -4879,7 +4879,7 @@ handle_cp_pragma (pname)
}
if (token != END_OF_LINE)
cp_warning (ec_garbage_after_pragma_implementation_ignored);
warning ("garbage after `#pragma implementation' ignored");
#ifndef NO_LINKAGE_HEURISTICS
if (write_virtuals == 3)
@ -4912,7 +4912,7 @@ handle_cp_pragma (pname)
}
}
else
cp_error (ec_pragma_implementation_can_only_appear_at_toplevel);
error ("`#pragma implementation' can only appear at top-level");
interface_only = 0;
#if 1
/* We make this non-zero so that we infer decl linkage

View File

@ -679,7 +679,7 @@ build_overload_value (type, value, in_template)
REAL_VALUE_TYPE val;
char *bufp = digit_buffer;
cp_pedwarn (ec_forbids_floatingpoint_template_arguments);
pedwarn ("ANSI C++ forbids floating-point template arguments");
my_friendly_assert (TREE_CODE (value) == REAL_CST, 244);
val = TREE_REAL_CST (value);
@ -1814,12 +1814,12 @@ hack_identifier (value, name)
#ifdef DEAD
if (DECL_CHAIN (fndecl) == NULL_TREE)
{
cp_warning (ec_methods_cannot_be_converted_to_function_pointers);
warning ("methods cannot be converted to function pointers");
return fndecl;
}
else
{
cp_error (ec_ambiguous_request_for_method_pointer_s,
error ("ambiguous request for method pointer `%s'",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
@ -1840,13 +1840,13 @@ hack_identifier (value, name)
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
cp_error (ec_invalid_use_of_member_in_static_member_function,
cp_error ("invalid use of member `%D' in static member function",
value);
else
/* We can get here when processing a bad default
argument, like:
struct S { int a; void f(int i = a); } */
cp_error (ec_invalid_use_of_member, value);
cp_error ("invalid use of member `%D'", value);
return error_mark_node;
}
@ -1887,12 +1887,12 @@ hack_identifier (value, name)
}
else if (TREE_CODE (value) == NAMESPACE_DECL)
{
cp_error (ec_use_of_namespace_as_expression, value);
cp_error ("use of namespace `%D' as expression", value);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (value))
{
cp_error (ec_use_of_class_template_as_expression, value);
cp_error ("use of class template `%T' as expression", value);
return error_mark_node;
}
else
@ -1904,10 +1904,10 @@ hack_identifier (value, name)
if (context != NULL_TREE && context != current_function_decl
&& ! TREE_STATIC (value))
{
cp_error (ec_use_of_s_from_containing_function,
cp_error ("use of %s from containing function",
(TREE_CODE (value) == VAR_DECL
? "`auto' variable" : "parameter"));
cp_error_at (ec_declared_here, value);
cp_error_at (" `%#D' declared here", value);
value = error_mark_node;
}
}
@ -1930,12 +1930,12 @@ hack_identifier (value, name)
if (access != access_public_node)
{
if (TREE_CODE (value) == VAR_DECL)
cp_error (ec_static_member_s_is_s,
error ("static member `%s' is %s",
IDENTIFIER_POINTER (name),
TREE_PRIVATE (value) ? "private"
: "from a private base class");
else
cp_error (ec_enum_s_is_from_private_base_class,
error ("enum `%s' is from private base class",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
@ -1946,7 +1946,7 @@ hack_identifier (value, name)
{
if (type == 0)
{
cp_error (ec_request_for_member_s_is_ambiguous_in_multiple_inheritance_lattice,
error ("request for member `%s' is ambiguous in multiple inheritance lattice",
IDENTIFIER_POINTER (name));
return error_mark_node;
}
@ -1992,7 +1992,7 @@ make_thunk (function, delta)
thunk = IDENTIFIER_GLOBAL_VALUE (thunk_id);
if (thunk && TREE_CODE (thunk) != THUNK_DECL)
{
cp_error (ec_implementationreserved_name_used, thunk_id);
cp_error ("implementation-reserved name `%D' used", thunk_id);
thunk = NULL_TREE;
SET_IDENTIFIER_GLOBAL_VALUE (thunk_id, thunk);
}
@ -2061,7 +2061,7 @@ emit_thunk (thunk_fndecl)
tree a, t;
if (varargs_function_p (function))
cp_error (ec_generic_thunk_code_fails_for_method_which_uses,
cp_error ("generic thunk code fails for method `%#D' which uses `...'",
function);
/* Set up clone argument trees for the thunk. */
@ -2173,7 +2173,7 @@ do_build_copy_constructor (fndecl)
p = convert_from_reference (p);
if (p == error_mark_node)
cp_error (ec_in_default_copy_constructor);
cp_error ("in default copy constructor");
else
current_base_init_list = tree_cons (basetype,
p, current_base_init_list);
@ -2191,7 +2191,7 @@ do_build_copy_constructor (fndecl)
CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
if (p == error_mark_node)
cp_error (ec_in_default_copy_constructor);
cp_error ("in default copy constructor");
else
{
p = convert_from_reference (p);
@ -2299,17 +2299,17 @@ do_build_assign_ref (fndecl)
if (TREE_READONLY (field))
{
if (DECL_NAME (field))
cp_error (ec_nonstatic_const_member_cant_use_default_assignment_operator, field);
cp_error ("non-static const member `%#D', can't use default assignment operator", field);
else
cp_error (ec_nonstatic_const_member_in_type_cant_use_default_assignment_operator, current_class_type);
cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
if (DECL_NAME (field))
cp_error (ec_nonstatic_reference_member_cant_use_default_assignment_operator, field);
cp_error ("non-static reference member `%#D', can't use default assignment operator", field);
else
cp_error (ec_nonstatic_reference_member_in_type_cant_use_default_assignment_operator, current_class_type);
cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type);
continue;
}

File diff suppressed because it is too large Load Diff

View File

@ -489,8 +489,7 @@ extern_lang_string:
{ push_lang_context ($1); }
| extern_lang_string EXTERN_LANG_STRING
{ if (current_lang_name != $2)
cp_error
(ec_use_of_linkage_spec_is_different_from_previous_spec, $2, current_lang_name);
cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
pop_lang_context (); push_lang_context ($2); }
;
@ -553,7 +552,7 @@ template_parm:
&& TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
&& TREE_CODE ($3) != TYPE_DECL)
{
cp_error (ec_invalid_default_template_argument);
error ("invalid default template argument");
$3 = error_mark_node;
}
$$ = build_tree_list ($3, $1);
@ -602,7 +601,7 @@ datadef:
| typed_declspecs initdecls ';'
{ note_list_got_semicolon ($1.t); }
| declmods ';'
{ cp_pedwarn (ec_empty_declaration); }
{ pedwarn ("empty declaration"); }
| explicit_instantiation ';'
| typed_declspecs ';'
{
@ -758,7 +757,7 @@ base_init:
':' .set_base_init member_init_list
{
if ($3 == 0)
cp_error (ec_no_base_initializers_given_following);
error ("no base initializers given following ':'");
setup_vtbl_ptr ();
/* Always keep the BLOCK node associated with the outermost
pair of curley braces of a function. These are needed
@ -781,9 +780,9 @@ base_init:
expand_start_bindings (0);
}
else if (current_class_type == NULL_TREE)
cp_error (ec_base_initializers_not_allowed_for_nonmember_functions);
error ("base initializers not allowed for non-member functions");
else if (! DECL_CONSTRUCTOR_P (current_function_decl))
cp_error (ec_only_constructors_take_base_initializers);
error ("only constructors take base initializers");
}
;
@ -800,13 +799,13 @@ member_init:
'(' nonnull_exprlist ')'
{
if (current_class_name)
cp_pedwarn (ec_anachronistic_old_style_base_class_initializer);
pedwarn ("anachronistic old style base class initializer");
expand_member_init (current_class_ref, NULL_TREE, $2);
}
| LEFT_RIGHT
{
if (current_class_name)
cp_pedwarn (ec_anachronistic_old_style_base_class_initializer);
pedwarn ("anachronistic old style base class initializer");
expand_member_init (current_class_ref, NULL_TREE, void_type_node);
}
| notype_identifier '(' nonnull_exprlist ')'
@ -917,7 +916,7 @@ template_close_bracket:
| RSHIFT
{
/* Handle `Class<Class<Type>>' without space in the `>>' */
cp_pedwarn (ec_should_be_in_template_class_name);
pedwarn ("`>>' should be `> >' in template class name");
yyungetc ('>', 1);
}
;
@ -964,7 +963,7 @@ expr:
paren_expr_or_null:
LEFT_RIGHT
{ cp_error (ec_forbids_an_empty_condition_for_s,
{ error ("ANSI C++ forbids an empty condition for `%s'",
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' expr ')'
@ -973,7 +972,7 @@ paren_expr_or_null:
paren_cond_or_null:
LEFT_RIGHT
{ cp_error (ec_forbids_an_empty_condition_for_s,
{ error ("ANSI C++ forbids an empty condition for `%s'",
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' condition ')'
@ -996,9 +995,9 @@ condition:
if (TREE_CODE (d) == TYPE_DECL) {
tree s = TREE_TYPE (d);
if (TREE_CODE (s) == RECORD_TYPE)
cp_error (ec_definition_of_class_in_condition, s);
cp_error ("definition of class `%T' in condition", s);
else if (TREE_CODE (s) == ENUMERAL_TYPE)
cp_error (ec_definition_of_enum_in_condition, s);
cp_error ("definition of enum `%T' in condition", s);
}
}
current_declspecs = $1.t;
@ -1012,7 +1011,7 @@ condition:
resume_momentary ($<itype>5);
$$ = $<ttype>6;
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
cp_error (ec_definition_of_array_in_condition, $$);
cp_error ("definition of array `%#D' in condition", $$);
}
| expr
;
@ -1070,7 +1069,7 @@ unary_expr:
/* Refer to the address of a label as a pointer. */
| ANDAND identifier
{ if (pedantic)
cp_pedwarn (ec_forbids);
pedwarn ("ANSI C++ forbids `&&'");
$$ = finish_label_address_expr ($2); }
| SIZEOF unary_expr %prec UNARY
{ $$ = expr_sizeof ($2); }
@ -1155,7 +1154,7 @@ new_placement:
'(' .begin_new_placement nonnull_exprlist ')'
{ $$ = finish_new_placement ($3, $2); }
| '{' .begin_new_placement nonnull_exprlist '}'
{ cp_pedwarn (ec_old_style_placement_syntax_use_instead);
{ cp_pedwarn ("old style placement syntax, use () instead");
$$ = finish_new_placement ($3, $2); }
;
@ -1166,7 +1165,7 @@ new_initializer:
{ $$ = NULL_TREE; }
| '(' typespec ')'
{
cp_error (ec_is_not_a_valid_expression, $2.t);
cp_error ("`%T' is not a valid expression", $2.t);
$$ = error_mark_node;
}
/* GNU extension so people can use initializer lists. Note that
@ -1175,7 +1174,7 @@ new_initializer:
| '=' init
{
if (pedantic)
cp_pedwarn (ec_forbids_initialization_of_new_expression_with);
pedwarn ("ANSI C++ forbids initialization of new expression with `='");
if (TREE_CODE ($2) != TREE_LIST
&& TREE_CODE ($2) != CONSTRUCTOR)
$$ = build_expr_list (NULL_TREE, $2);
@ -1205,7 +1204,7 @@ cast_expr:
tree init = build_nt (CONSTRUCTOR, NULL_TREE,
nreverse ($3));
if (pedantic)
cp_pedwarn (ec_forbids_constructorexpressions);
pedwarn ("ANSI C++ forbids constructor-expressions");
/* Indicate that this was a GNU C constructor expression. */
TREE_HAS_CONSTRUCTOR (init) = 1;
@ -1381,11 +1380,11 @@ primary:
{ tree scope = current_scope ();
if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
{
cp_error (ec_bracedgroup_within_expression_allowed_only_inside_a_function);
error ("braced-group within expression allowed only inside a function");
YYERROR;
}
if (pedantic)
cp_pedwarn (ec_forbids_bracedgroups_within_expressions);
pedwarn ("ANSI C++ forbids braced-groups within expressions");
$<ttype>$ = begin_stmt_expr ();
}
compstmt ')'
@ -1424,7 +1423,7 @@ primary:
#if 0
if ($3 == NULL_TREE)
{
cp_error (ec_cannot_cast_null_list_to_type_s,
error ("cannot cast null list to type `%s'",
IDENTIFIER_POINTER (TYPE_NAME (id)));
$$ = error_mark_node;
break;
@ -1445,7 +1444,7 @@ primary:
/* should not be able to get here (mrs) */
else if (id == ridpointers[(int) RID_FRIEND])
{
cp_error (ec_cannot_cast_expression_to_friend_type);
error ("cannot cast expression to `friend' type");
$$ = error_mark_node;
break;
}
@ -1539,13 +1538,13 @@ primary_no_id:
| '('
{ if (current_function_decl == 0)
{
cp_error (ec_bracedgroup_within_expression_allowed_only_inside_a_function);
error ("braced-group within expression allowed only inside a function");
YYERROR;
}
$<ttype>$ = expand_start_stmt_expr (); }
compstmt ')'
{ if (pedantic)
cp_pedwarn (ec_forbids_bracedgroups_within_expressions);
pedwarn ("ANSI C++ forbids braced-groups within expressions");
$$ = expand_end_stmt_expr ($<ttype>2); }
| primary_no_id '(' nonnull_exprlist ')'
{ $$ = build_x_function_call ($$, $3, current_class_ref); }
@ -1638,7 +1637,7 @@ decl:
note_list_got_semicolon ($1.t);
}
| declmods ';'
{ cp_warning (ec_empty_declaration); }
{ warning ("empty declaration"); }
| extension decl
{ pedantic = $<itype>1; }
;
@ -1715,14 +1714,14 @@ typed_declspecs1:
reserved_declspecs:
SCSPEC
{ if (extra_warnings)
cp_warning (ec_s_is_not_at_beginning_of_declaration,
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($$));
$$ = build_decl_list (NULL_TREE, $$); }
| reserved_declspecs typespecqual_reserved
{ $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
| reserved_declspecs SCSPEC
{ if (extra_warnings)
cp_warning (ec_s_is_not_at_beginning_of_declaration,
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($2));
$$ = decl_tree_cons (NULL_TREE, $2, $$); }
| reserved_declspecs attributes
@ -1746,7 +1745,7 @@ declmods:
TREE_STATIC ($$) = 1; }
| declmods SCSPEC
{ if (extra_warnings && TREE_STATIC ($$))
cp_warning (ec_s_is_not_at_beginning_of_declaration,
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($2));
$$ = decl_tree_cons (NULL_TREE, $2, $$);
TREE_STATIC ($$) = TREE_STATIC ($1); }
@ -1811,7 +1810,7 @@ typespec:
}
else
{
cp_error (ec_sigof_applied_to_nonaggregate_expression);
error ("`sigof' applied to non-aggregate expression");
$$.t = error_mark_node;
}
}
@ -1826,7 +1825,7 @@ typespec:
}
else
{
cp_error (ec_sigof_applied_to_nonaggregate_type);
error("`sigof' applied to non-aggregate type");
$$.t = error_mark_node;
}
}
@ -2102,7 +2101,7 @@ structsp:
{ $$.t = $2;
$$.new_type_flag = 0;
if (!processing_template_decl)
cp_pedwarn (ec_using_typename_outside_of_template); }
cp_pedwarn ("using `typename' outside of template"); }
/* C++ extensions, merged with C to avoid shift/reduce conflicts */
| class_head left_curly
opt.component_decl_list '}' maybe_attribute
@ -2126,7 +2125,7 @@ structsp:
$$.new_type_flag = 0;
if (TYPE_BINFO ($1) == NULL_TREE)
{
cp_error (ec_is_not_a_class_type, $1);
cp_error ("%T is not a class type", $1);
$$.t = error_mark_node;
}
else
@ -2135,7 +2134,7 @@ structsp:
/* struct B: public A; is not accepted by the WP grammar. */
if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
&& ! TYPE_BEING_DEFINED ($$.t))
cp_error (ec_base_clause_without_member_specification_for,
cp_error ("base clause without member specification for `%#T'",
$$.t);
}
}
@ -2150,19 +2149,19 @@ maybecomma_warn:
/* empty */
| ','
{ if (pedantic && !in_system_header)
cp_pedwarn (ec_comma_at_end_of_enumerator_list); }
pedwarn ("comma at end of enumerator list"); }
;
aggr:
AGGR
| aggr SCSPEC
{ cp_error (ec_storage_class_specifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
{ error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
| aggr TYPESPEC
{ cp_error (ec_type_specifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
{ error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
| aggr CV_QUALIFIER
{ cp_error (ec_type_qualifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
{ error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
| aggr AGGR
{ cp_error (ec_no_body_nor_separates_two_class_struct_or_union_declarations); }
{ error ("no body nor ';' separates two class, struct or union declarations"); }
| aggr attributes
{ $$ = build_decl_list ($2, $1); }
;
@ -2223,10 +2222,10 @@ named_class_head:
$$ = TREE_TYPE ($1);
if (TREE_INT_CST_LOW (current_aggr) == union_type
&& TREE_CODE ($$) != UNION_TYPE)
cp_pedwarn (ec_union_tag_used_in_declaring, $$);
cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
else if (TREE_CODE ($$) == UNION_TYPE
&& TREE_INT_CST_LOW (current_aggr) != union_type)
cp_pedwarn (ec_nonunion_tag_used_in_declaring, $$);
cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
if ($2)
{
maybe_process_partial_specialization ($$);
@ -2287,13 +2286,13 @@ base_class.1:
}
else
{
cp_error (ec_sigof_applied_to_nonaggregate_expression);
error ("`sigof' applied to non-aggregate expression");
$$ = error_mark_node;
}
}
else
{
cp_error (ec_sigof_in_struct_or_class_declaration);
error ("`sigof' in struct or class declaration");
$$ = error_mark_node;
}
}
@ -2308,13 +2307,13 @@ base_class.1:
}
else
{
cp_error (ec_sigof_applied_to_nonaggregate_expression);
error ("`sigof' applied to non-aggregate expression");
$$ = error_mark_node;
}
}
else
{
cp_error (ec_sigof_in_struct_or_class_declaration);
error ("`sigof' in struct or class declaration");
$$ = error_mark_node;
}
}
@ -2324,12 +2323,12 @@ base_class_access_list:
VISSPEC see_typename
| SCSPEC see_typename
{ if ($1 != ridpointers[(int)RID_VIRTUAL])
cp_error (ec_access, $1);
cp_error ("`%D' access", $1);
$$ = access_default_virtual_node; }
| base_class_access_list VISSPEC see_typename
{
if ($1 != access_default_virtual_node)
cp_error (ec_multiple_access_specifiers);
error ("multiple access specifiers");
else if ($2 == access_public_node)
$$ = access_public_virtual_node;
else if ($2 == access_protected_node)
@ -2339,7 +2338,7 @@ base_class_access_list:
}
| base_class_access_list SCSPEC see_typename
{ if ($2 != ridpointers[(int)RID_VIRTUAL])
cp_error (ec_access, $2);
cp_error ("`%D' access", $2);
else if ($$ == access_public_node)
$$ = access_public_virtual_node;
else if ($$ == access_protected_node)
@ -2347,7 +2346,7 @@ base_class_access_list:
else if ($$ == access_private_node)
$$ = access_private_virtual_node;
else
cp_error (ec_multiple_virtual_specifiers);
error ("multiple `virtual' specifiers");
}
;
@ -2380,7 +2379,7 @@ opt.component_decl_list:
if (current_aggr == signature_type_node)
{
cp_error (ec_access_specifier_not_allowed_in_signature);
error ("access specifier not allowed in signature");
visspec = access_public_node;
}
$$ = chainon ($$, build_tree_list (visspec, $4));
@ -2388,7 +2387,7 @@ opt.component_decl_list:
| opt.component_decl_list VISSPEC ':'
{
if (current_aggr == signature_type_node)
cp_error (ec_access_specifier_not_allowed_in_signature);
error ("access specifier not allowed in signature");
}
;
@ -2417,7 +2416,7 @@ component_decl:
component_decl_1 ';'
{ }
| component_decl_1 '}'
{ cp_error (ec_missing_before_right_brace);
{ error ("missing ';' before right brace");
yyungetc ('}', 0); }
/* C++: handle constructors, destructors and inline functions */
/* note that INLINE is like a TYPESPEC */
@ -2615,7 +2614,7 @@ new_type_id:
'[' expr ']'
{
if (pedantic)
cp_pedwarn (ec_forbids_array_dimensions_with_parenthesized_type_in_new);
pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
$$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($3.t), $6);
$$.t = build_decl_list (TREE_PURPOSE ($3.t), $$.t);
$$.new_type_flag = $3.new_type_flag;
@ -2871,7 +2870,7 @@ nested_name_specifier_1:
| IDENTIFIER SCOPE
{
failed_scope:
cp_error (ec_is_not_an_aggregate_typedef,
cp_error ("`%D' is not an aggregate typedef",
lastiddecl ? lastiddecl : $$);
$$ = error_mark_node;
}
@ -2891,7 +2890,7 @@ typename_sub0:
if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
$$ = make_typename_type ($1, $2);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error (ec_is_not_a_class_or_namespace, $2);
cp_error ("`%T' is not a class or namespace", $2);
else
{
$$ = $2;
@ -2911,14 +2910,14 @@ typename_sub1:
typename_sub2
{
if (TREE_CODE ($1) == IDENTIFIER_NODE)
cp_error (ec_is_not_a_class_or_namespace, $1);
cp_error ("`%T' is not a class or namespace", $1);
}
| typename_sub1 typename_sub2
{
if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
$$ = make_typename_type ($1, $2);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error (ec_is_not_a_class_or_namespace, $2);
cp_error ("`%T' is not a class or namespace", $2);
else
{
$$ = $2;
@ -2943,7 +2942,7 @@ typename_sub2:
got_scope = $$ = complete_type (IDENTIFIER_TYPE_VALUE ($1));
if ($$ == error_mark_node)
cp_error (ec_is_not_a_class_or_namespace, $1);
cp_error ("`%T' is not a class or namespace", $1);
}
| SELFNAME SCOPE
{
@ -3101,7 +3100,7 @@ maybe_label_decls:
/* empty */
| label_decls
{ if (pedantic)
cp_pedwarn (ec_forbids_label_declarations); }
pedwarn ("ANSI C++ forbids label declarations"); }
;
label_decls:
@ -3247,7 +3246,7 @@ simple_stmt:
| GOTO '*' expr ';'
{
if (pedantic)
cp_pedwarn (ec_forbids_computed_gotos);
pedwarn ("ANSI C++ forbids computed gotos");
finish_goto_stmt ($3);
}
| GOTO identifier ';'
@ -3255,7 +3254,7 @@ simple_stmt:
| label_colon stmt
{ finish_stmt (); }
| label_colon '}'
{ cp_error (ec_label_must_be_followed_by_statement);
{ error ("label must be followed by statement");
yyungetc ('}', 0);
finish_stmt (); }
| ';'
@ -3360,7 +3359,7 @@ for.init.statement:
| decl
| '{' compstmtend
{ if (pedantic)
cp_pedwarn (ec_forbids_compound_statements_inside_for_initializations);
pedwarn ("ANSI C++ forbids compound statements inside for initializations");
}
;
@ -3551,18 +3550,16 @@ see_typename:
bad_parm:
/* empty */ %prec EMPTY
{
cp_error (ec_type_specifier_omitted_for_parameter);
error ("type specifier omitted for parameter");
$$ = build_tree_list (integer_type_node, NULL_TREE);
}
| notype_declarator
{
cp_error (ec_type_specifier_omitted_for_parameter);
error ("type specifier omitted for parameter");
if (TREE_CODE ($$) == SCOPE_REF
&& (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
|| TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TEMPLATE_PARM))
cp_error
(ec_perhaps_you_want_typename_expr_to_make_it_a_type,
$$);
cp_error (" perhaps you want `typename %E' to make it a type", $$);
$$ = build_tree_list (integer_type_node, $$);
}
;

View File

@ -228,7 +228,7 @@ finish_member_template_decl (template_parameters, decl)
return decl;
}
else
cp_error (ec_invalid_member_template_declaration, decl);
cp_error ("invalid member template declaration `%D'", decl);
return error_mark_node;
@ -594,7 +594,7 @@ check_specialization_scope ()
shall be declared in the namespace of which the class template
is a member. */
if (scope && TREE_CODE (scope) != NAMESPACE_DECL)
cp_error (ec_explicit_specialization_in_nonnamespace_scope,
cp_error ("explicit specialization in non-namespace scope `%D'",
scope);
/* [temp.expl.spec]
@ -605,7 +605,7 @@ check_specialization_scope ()
explicitly specialize a class member template if its enclosing
class templates are not explicitly specialized as well. */
if (current_template_parms)
cp_error (ec_enclosing_class_templates_are_not_explicit_specialized);
cp_error ("enclosing class templates are not explicit specialized");
}
/* We've just seen template <>. */
@ -680,7 +680,7 @@ maybe_process_partial_specialization (type)
push_template_decl (TYPE_MAIN_DECL (type));
}
else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
cp_error (ec_specialization_of_type_after_instantiation, type);
cp_error ("specialization of `%T' after instantiation", type);
}
}
@ -797,7 +797,7 @@ register_specialization (spec, tmpl, args)
if (TREE_USED (fn)
|| DECL_EXPLICIT_INSTANTIATION (fn))
{
cp_error (ec_specialization_of_decl_after_instantiation,
cp_error ("specialization of %D after instantiation",
fn);
return spec;
}
@ -875,7 +875,7 @@ print_candidates (fns)
for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn))
{
cp_error_at (ec_decl, str, TREE_VALUE (fn));
cp_error_at ("%s %+#D", str, TREE_VALUE (fn));
str = " ";
}
}
@ -997,7 +997,7 @@ determine_specialization (template_id, decl, targs_out,
no_match:
if (complain)
{
cp_error_at (ec_templateid_for_does_not_match_any_template_declaration,
cp_error_at ("template-id `%D' for `%+D' does not match any template declaration",
template_id, decl);
return error_mark_node;
}
@ -1008,7 +1008,7 @@ determine_specialization (template_id, decl, targs_out,
ambiguous:
if (complain)
{
cp_error_at (ec_ambiguous_template_specialization_for,
cp_error_at ("ambiguous template specialization `%D' for `%+D'",
template_id, decl);
print_candidates (templates);
return error_mark_node;
@ -1095,7 +1095,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
lists. There can be at most one parameter list for
every qualifying class, plus one for the function
itself. */
cp_error (ec_too_many_template_parameter_lists_in_declaration_of, decl);
cp_error ("too many template parameter lists in declaration of `%D'", decl);
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
if (ctype)
@ -1127,17 +1127,17 @@ check_explicit_specialization (declarator, decl, template_count, flags)
void S<int>::T<char>::f();
But, we're missing another template <>. */
cp_error (ec_too_few_template_parameter_lists_in_declaration_of, decl);
cp_error("too few template parameter lists in declaration of `%D'", decl);
return decl;
}
}
else if (processing_explicit_instantiation)
{
if (template_header_count)
cp_error (ec_template_parameter_list_used_in_explicit_instantiation);
cp_error ("template parameter list used in explicit instantiation");
if (have_def)
cp_error (ec_definition_provided_for_explicit_instantiation);
cp_error ("definition provided for explicit instantiation");
explicit_instantiation = 1;
}
@ -1163,12 +1163,13 @@ check_explicit_specialization (declarator, decl, template_count, flags)
that's bogus. */
if (template_header_count)
{
cp_error (ec_template_parameters_specified_in_specialization);
cp_error ("template parameters specified in specialization");
return decl;
}
if (pedantic)
cp_pedwarn (ec_explicit_specialization_not_preceded_by_template);
cp_pedwarn
("explicit specialization not preceded by `template <>'");
specialization = 1;
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
}
@ -1185,7 +1186,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
/* This case handles bogus declarations like template <>
template <class T> void f<int>(); */
cp_error (ec_templateid_in_declaration_of_primary_template,
cp_error ("template-id `%D' in declaration of primary template",
declarator);
return decl;
}
@ -1198,7 +1199,8 @@ check_explicit_specialization (declarator, decl, template_count, flags)
for (; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
cp_pedwarn (ec_default_argument_specified_in_explicit_specialization);
cp_pedwarn
("default argument specified in explicit specialization");
break;
}
}
@ -1287,7 +1289,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
program is ill-formed.
Similar language is found in [temp.explicit]. */
cp_error (ec_specialization_of_implicitlydeclared_special_member_function);
cp_error ("specialization of implicitly-declared special member function");
return decl;
}
@ -1299,7 +1301,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
if (fns == NULL_TREE)
{
cp_error (ec_no_member_function_s_declared_in,
cp_error ("no member function `%s' declared in `%T'",
IDENTIFIER_POINTER (name),
ctype);
return decl;
@ -1423,9 +1425,7 @@ maybe_check_template_type (type)
;
else if (template_header_count > context_depth + 1)
/* There are two many template parameter lists. */
cp_error
(ec_too_many_template_parameter_lists_in_declaration_of_type,
type);
cp_error ("too many template parameter lists in declaration of `%T'", type);
}
}
@ -1610,16 +1610,16 @@ process_template_parm (list, next)
&& TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM
&& TREE_CODE (TREE_TYPE (parm)) != TYPENAME_TYPE)
{
cp_error (ec_is_not_a_valid_type_for_a_template_constant_parameter,
cp_error ("`%#T' is not a valid type for a template constant parameter",
TREE_TYPE (parm));
if (DECL_NAME (parm) == NULL_TREE)
cp_error (ec_a_template_type_parameter_must_begin_with_class_or_typename);
error (" a template type parameter must begin with `class' or `typename'");
TREE_TYPE (parm) = void_type_node;
}
else if (pedantic
&& (TREE_CODE (TREE_TYPE (parm)) == REAL_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE))
cp_pedwarn (ec_is_not_a_valid_type_for_a_template_constant_parameter,
cp_pedwarn ("`%T' is not a valid type for a template constant parameter",
TREE_TYPE (parm));
if (TREE_PERMANENT (parm) == 0)
{
@ -1872,7 +1872,7 @@ process_partial_specialization (decl)
{
if (!issued_default_arg_message)
{
cp_error (ec_default_argument_in_partial_specialization,
cp_error ("default argument in partial specialization `%T'",
type);
issued_default_arg_message = 1;
}
@ -1930,11 +1930,11 @@ process_partial_specialization (decl)
specialization. */
if (!did_error_intro)
{
cp_error (ec_template_parameters_not_used_in_partial_specialization);
cp_error ("template parameters not used in partial specialization:");
did_error_intro = 1;
}
cp_error (ec_template_parm,
cp_error (" `%D'",
TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
}
@ -1945,7 +1945,7 @@ process_partial_specialization (decl)
if (comp_template_args (inner_args,
innermost_args (CLASSTYPE_TI_ARGS (TREE_TYPE
(maintmpl)))))
cp_error (ec_partial_specialization_does_not_specialize_any_template_arguments, type);
cp_error ("partial specialization `%T' does not specialize any template arguments", type);
/* [temp.class.spec]
@ -1970,7 +1970,7 @@ process_partial_specialization (decl)
&& TREE_CODE (arg) != TEMPLATE_PARM_INDEX)
{
if (tpd.arg_uses_template_parms[i])
cp_error (ec_template_argument_involves_template_parameters, arg);
cp_error ("template argument `%E' involves template parameter(s)", arg);
else
{
/* Look at the corresponding template parameter,
@ -2010,7 +2010,7 @@ process_partial_specialization (decl)
if (tpd2.parms[j] != 0
&& tpd.arg_uses_template_parms [j])
{
cp_error (ec_type_of_template_argument_depends_on_template_paramters,
cp_error ("type `%T' of template argument `%E' depends on template paramter(s)",
type,
arg);
break;
@ -2090,12 +2090,12 @@ push_template_decl_real (decl, is_friend)
if (primary)
{
if (current_lang_name == lang_name_c)
cp_error (ec_template_with_linkage);
cp_error ("template with C linkage");
if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl)))
cp_error (ec_template_class_without_a_name);
cp_error ("template class without a name");
if (TREE_CODE (decl) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
cp_error (ec_template_declaration_of_type, TREE_TYPE (decl));
cp_error ("template declaration of `%#T'", TREE_TYPE (decl));
}
/* Partial specialization. */
@ -2136,7 +2136,7 @@ push_template_decl_real (decl, is_friend)
tree a;
if (CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
cp_error (ec_must_specialize_before_defining_member,
cp_error ("must specialize `%#T' before defining member `%#D'",
ctx, decl);
if (TREE_CODE (decl) == TYPE_DECL)
{
@ -2147,13 +2147,13 @@ push_template_decl_real (decl, is_friend)
tmpl = TYPE_TI_TEMPLATE (TREE_TYPE (decl));
else
{
cp_error (ec_does_not_declare_a_template_type, decl);
cp_error ("`%D' does not declare a template type", decl);
return decl;
}
}
else if (! DECL_TEMPLATE_INFO (decl))
{
cp_error (ec_template_definition_of_nontemplate, decl);
cp_error ("template definition of non-template `%#D'", decl);
return decl;
}
else
@ -2191,9 +2191,9 @@ push_template_decl_real (decl, is_friend)
t = DECL_INNERMOST_TEMPLATE_PARMS (tmpl);
if (TREE_VEC_LENGTH (t) != TREE_VEC_LENGTH (a))
{
cp_error (ec_got_d_template_parameters_for,
cp_error ("got %d template parameters for `%#D'",
TREE_VEC_LENGTH (a), decl);
cp_error (ec_but_d_required, TREE_VEC_LENGTH (t));
cp_error (" but %d required", TREE_VEC_LENGTH (t));
}
if (TMPL_ARGS_DEPTH (args) > 1)
/* Get the template parameters for the enclosing template
@ -2224,9 +2224,9 @@ push_template_decl_real (decl, is_friend)
if (t != NULL_TREE
&& TREE_VEC_LENGTH (t) != TREE_VEC_LENGTH (a))
{
cp_error (ec_got_d_template_parameters_for,
cp_error ("got %d template parameters for `%#D'",
TREE_VEC_LENGTH (a), decl);
cp_error (ec_but_has_d, ctx, TREE_VEC_LENGTH (t));
cp_error (" but `%#T' has %d", ctx, TREE_VEC_LENGTH (t));
}
}
@ -2254,7 +2254,7 @@ push_template_decl_real (decl, is_friend)
DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
}
else if (! DECL_LANG_SPECIFIC (decl))
cp_error (ec_template_declaration_of, decl);
cp_error ("template declaration of `%#D'", decl);
else
DECL_TEMPLATE_INFO (decl) = info;
@ -2294,8 +2294,8 @@ redeclare_class_template (type, parms)
if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
{
cp_error_at (ec_previous_declaration, tmpl);
cp_error (ec_used_d_template_parameters_instead_of_d,
cp_error_at ("previous declaration `%D'", tmpl);
cp_error ("used %d template parameter%s instead of %d",
TREE_VEC_LENGTH (tmpl_parms),
TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s",
TREE_VEC_LENGTH (parms));
@ -2311,8 +2311,8 @@ redeclare_class_template (type, parms)
if (TREE_CODE (tmpl_parm) != TREE_CODE (parm))
{
cp_error_at (ec_template_parameter, tmpl_parm);
cp_error (ec_redeclared_here_as, parm);
cp_error_at ("template parameter `%#D'", tmpl_parm);
cp_error ("redeclared here as `%#D'", parm);
return;
}
@ -2322,8 +2322,8 @@ redeclare_class_template (type, parms)
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
cp_error (ec_redefinition_of_default_argument_for, parm);
cp_error_at (ec_original_definition_appeared_here, tmpl_parm);
cp_error ("redefinition of default argument for `%#D'", parm);
cp_error_at (" original definition appeared here", tmpl_parm);
return;
}
@ -2392,7 +2392,7 @@ convert_nontype_argument (type, expr)
if (! TREE_CONSTANT (expr))
{
non_constant:
cp_error (ec_nonconstant_cannot_be_used_as_template_argument,
cp_error ("non-constant `%E' cannot be used as template argument",
expr);
return NULL_TREE;
}
@ -2409,8 +2409,8 @@ convert_nontype_argument (type, expr)
if (TREE_CODE (e) != ADDR_EXPR)
{
bad_argument:
cp_error (ec_is_not_a_valid_template_argument, expr);
cp_error (ec_it_must_be_ss_with_external_linkage,
cp_error ("`%E' is not a valid template argument", expr);
error ("it must be %s%s with external linkage",
TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE
? "a pointer to " : "",
TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == FUNCTION_TYPE
@ -2423,9 +2423,9 @@ convert_nontype_argument (type, expr)
if (TREE_CODE (referent) == STRING_CST)
{
cp_error (ec_string_literal_is_not_a_valid_template_argument,
cp_error ("string literal %E is not a valid template argument",
referent);
cp_error (ec_because_it_is_the_address_of_an_object_with_static_linkage);
error ("because it is the address of an object with static linkage");
return NULL_TREE;
}
@ -2436,7 +2436,7 @@ convert_nontype_argument (type, expr)
goto bad_argument;
else if (!TREE_PUBLIC (referent))
{
cp_error (ec_address_of_nonextern_cannot_be_used_as_template_argument, referent);
cp_error ("address of non-extern `%E' cannot be used as template argument", referent);
return error_mark_node;
}
}
@ -2447,7 +2447,7 @@ convert_nontype_argument (type, expr)
}
else
{
cp_error (ec_object_cannot_be_used_as_template_argument, expr);
cp_error ("object `%E' cannot be used as template argument", expr);
return NULL_TREE;
}
@ -2816,8 +2816,8 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
{
cp_pedwarn (ec_to_refer_to_a_type_member_of_a_template_parameter);
cp_pedwarn (ec_use_typename, arg);
cp_pedwarn ("to refer to a type member of a template parameter,");
cp_pedwarn (" use `typename %E'", arg);
arg = make_typename_type (TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1));
@ -2829,14 +2829,14 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (complain)
{
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
i + 1, in_decl);
if (is_type)
cp_error (ec_expected_a_constant_of_type_got,
cp_error (" expected a constant of type `%T', got `%T'",
TREE_TYPE (parm),
(is_tmpl_type ? DECL_NAME (arg) : arg));
else
cp_error (ec_expected_a_type_got_expr, arg);
cp_error (" expected a type, got `%E'", arg);
}
}
return error_mark_node;
@ -2845,12 +2845,12 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (in_decl && complain)
{
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
i + 1, in_decl);
if (is_tmpl_type)
cp_error (ec_expected_a_type_got_type, DECL_NAME (arg));
cp_error (" expected a type, got `%T'", DECL_NAME (arg));
else
cp_error (ec_expected_a_class_template_got, arg);
cp_error (" expected a class template, got `%T'", arg);
}
return error_mark_node;
}
@ -2877,9 +2877,9 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (in_decl && complain)
{
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
i + 1, in_decl);
cp_error (ec_expected_a_template_of_type_got, parm, arg);
cp_error (" expected a template of type `%D', got `%D'", parm, arg);
}
val = error_mark_node;
@ -2899,9 +2899,11 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
if (t)
{
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
cp_pedwarn (ec_templateargument_uses_anonymous_type, val);
cp_pedwarn
("template-argument `%T' uses anonymous type", val);
else
cp_error (ec_templateargument_uses_local_type,
cp_error
("template-argument `%T' uses local type `%T'",
val, t);
return error_mark_node;
}
@ -2933,7 +2935,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
if (val == NULL_TREE)
val = error_mark_node;
else if (val == error_mark_node && complain)
cp_error (ec_could_not_convert_template_argument_to,
cp_error ("could not convert template argument `%E' to `%T'",
arg, t);
}
@ -2980,11 +2982,11 @@ coerce_template_parms (parms, args, in_decl,
{
if (complain)
{
cp_error (ec_wrong_number_of_template_arguments_d_should_be_d,
cp_error ("wrong number of template arguments (%d, should be %d)",
nargs, nparms);
if (in_decl)
cp_error_at (ec_provided_for, in_decl);
cp_error_at ("provided for `%D'", in_decl);
}
return error_mark_node;
@ -3030,7 +3032,7 @@ coerce_template_parms (parms, args, in_decl,
}
else if (arg == error_mark_node)
{
cp_error (ec_template_argument_d_is_invalid, i + 1);
cp_error ("template argument %d is invalid", i + 1);
arg = error_mark_node;
}
else
@ -3235,7 +3237,7 @@ lookup_template_function (fns, arglist)
if (fns == NULL_TREE)
{
cp_error (ec_nontemplate_used_as_template);
cp_error ("non-template used as template");
return error_mark_node;
}
@ -3354,9 +3356,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
if (TREE_CODE (template) != TEMPLATE_DECL)
{
cp_error (ec_nontemplate_type_used_as_a_template, d1);
cp_error ("non-template type `%T' used as a template", d1);
if (in_decl)
cp_error_at (ec_for_template_declaration, in_decl);
cp_error_at ("for template declaration `%D'", in_decl);
return error_mark_node;
}
@ -3431,7 +3433,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
We should catch this error sooner (at the opening curly
for `S', but it is better to be safe than sorry here. */
{
cp_error (ec_invalid_use_of, template);
cp_error ("invalid use of `%D'", template);
return error_mark_node;
}
@ -3954,10 +3956,10 @@ push_tinst_level (d)
return 0;
last_template_error_tick = tinst_level_tick;
cp_error (ec_template_instantiation_depth_exceeds_maximum_of_d,
error ("template instantiation depth exceeds maximum of %d",
max_tinst_depth);
cp_error (ec_use_ftemplatedepth_to_increase_the_maximum);
cp_error (ec_instantiating, d);
error (" (use -ftemplate-depth-NN to increase the maximum)");
cp_error (" instantiating `%D'", d);
print_template_context (0);
@ -4274,13 +4276,13 @@ instantiate_class_template (type)
if (t == error_mark_node)
{
char *str = "candidates are:";
cp_error (ec_ambiguous_class_template_instantiation_for, type);
cp_error ("ambiguous class template instantiation for `%#T'", type);
for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t; t = TREE_CHAIN (t))
{
if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
args))
{
cp_error_at (ec_type, str, TREE_TYPE (t));
cp_error_at ("%s %+#T", str, TREE_TYPE (t));
str = " ";
}
}
@ -4431,10 +4433,11 @@ instantiate_class_template (type)
basetype = TREE_TYPE (elt);
if (! IS_AGGR_TYPE (basetype))
cp_error (ec_base_type_of_fails_to_be_a_struct_or_class_type,
cp_error
("base type `%T' of `%T' fails to be a struct or class type",
basetype, type);
else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE)
cp_error (ec_base_class_of_has_incomplete_type,
cp_error ("base class `%T' of `%T' has incomplete type",
basetype, type);
/* These are set up in xref_basetypes for normal classes, so
@ -5254,7 +5257,7 @@ tsubst_decl (t, args, type, in_decl)
DECL_INITIAL (r) = tsubst_expr (DECL_INITIAL (t), args, in_decl);
TREE_CHAIN (r) = NULL_TREE;
if (TREE_CODE (type) == VOID_TYPE)
cp_error_at (ec_instantiation_of_as_type_void, r);
cp_error_at ("instantiation of `%D' as type void", r);
}
break;
@ -5313,7 +5316,7 @@ tsubst_decl (t, args, type, in_decl)
TREE_CHAIN (r) = NULL_TREE;
if (TREE_CODE (type) == VOID_TYPE)
cp_error_at (ec_instantiation_of_as_type_void, r);
cp_error_at ("instantiation of `%D' as type void", r);
}
break;
@ -5644,7 +5647,7 @@ tsubst (t, args, in_decl)
if (last_line != lineno ||
last_file != input_filename)
{
cp_error (ec_cannot_form_type_s_to_reference_type_during_template_instantiation,
cp_error ("cannot form type %s to reference type %T during template instantiation",
(code == POINTER_TYPE) ? "pointer" : "reference",
type);
last_line = lineno;
@ -6425,8 +6428,8 @@ instantiate_template (tmpl, targ_ptr)
tree nt = target_type (t);
if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
{
cp_error (ec_type_composed_from_a_local_class_is_not_a_valid_templateargument, t);
cp_error (ec_trying_to_instantiate, gen_tmpl);
cp_error ("type `%T' composed from a local class is not a valid template-argument", t);
cp_error (" trying to instantiate `%D'", gen_tmpl);
fndecl = error_mark_node;
goto out;
}
@ -6829,7 +6832,7 @@ type_unification_real (tparms, targs, parms, args, subr,
if (TREE_VEC_ELT (targs, i) == NULL_TREE)
{
if (!allow_incomplete)
cp_error (ec_incomplete_type_unification);
error ("incomplete type unification");
return 2;
}
return 0;
@ -7661,7 +7664,7 @@ do_decl_instantiation (declspecs, declarator, storage)
if (! DECL_LANG_SPECIFIC (decl))
{
cp_error (ec_explicit_instantiation_of_nontemplate, decl);
cp_error ("explicit instantiation of non-template `%#D'", decl);
return;
}
else if (TREE_CODE (decl) == VAR_DECL)
@ -7677,13 +7680,13 @@ do_decl_instantiation (declspecs, declarator, storage)
result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, 0);
if (result && TREE_CODE (result) != VAR_DECL)
{
cp_error (ec_no_matching_template_for_found, result);
cp_error ("no matching template for `%D' found", result);
return;
}
}
else if (TREE_CODE (decl) != FUNCTION_DECL)
{
cp_error (ec_explicit_instantiation_of, decl);
cp_error ("explicit instantiation of `%#D'", decl);
return;
}
else
@ -7700,8 +7703,8 @@ do_decl_instantiation (declspecs, declarator, storage)
No program shall both explicitly instantiate and explicitly
specialize a template. */
cp_error (ec_explicit_instantiation_of_after, result);
cp_error_at (ec_explicit_specialization_here, result);
cp_error ("explicit instantiation of `%#D' after", result);
cp_error_at ("explicit specialization here", result);
return;
}
else if (DECL_EXPLICIT_INSTANTIATION (result))
@ -7715,7 +7718,7 @@ do_decl_instantiation (declspecs, declarator, storage)
first instantiation was `extern' and the second is not, and
EXTERN_P for the opposite case. */
if (DECL_INTERFACE_KNOWN (result) && !extern_p)
cp_error (ec_duplicate_explicit_instantiation_of, result);
cp_error ("duplicate explicit instantiation of `%#D'", result);
/* If we've already instantiated the template, just return now. */
if (DECL_INTERFACE_KNOWN (result))
@ -7723,12 +7726,12 @@ do_decl_instantiation (declspecs, declarator, storage)
}
else if (!DECL_IMPLICIT_INSTANTIATION (result))
{
cp_error (ec_no_matching_template_for_found, result);
cp_error ("no matching template for `%D' found", result);
return;
}
else if (!DECL_TEMPLATE_INFO (result))
{
cp_pedwarn (ec_explicit_instantiation_of_nontemplate, result);
cp_pedwarn ("explicit instantiation of non-template `%#D'", result);
return;
}
@ -7740,11 +7743,11 @@ do_decl_instantiation (declspecs, declarator, storage)
else if (storage == ridpointers[(int) RID_EXTERN])
{
if (pedantic)
cp_pedwarn (ec_forbids_the_use_of_extern_on_explicit_instantiations);
cp_pedwarn ("ANSI C++ forbids the use of `extern' on explicit instantiations");
extern_p = 1;
}
else
cp_error (ec_storage_class_applied_to_template_instantiation,
cp_error ("storage class `%D' applied to template instantiation",
storage);
SET_DECL_EXPLICIT_INSTANTIATION (result);
@ -7784,7 +7787,7 @@ do_type_instantiation (t, storage)
if (! IS_AGGR_TYPE (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
{
cp_error (ec_explicit_instantiation_of_nontemplate_type, t);
cp_error ("explicit instantiation of non-template type `%T'", t);
return;
}
@ -7797,7 +7800,7 @@ do_type_instantiation (t, storage)
if (TYPE_SIZE (t) == NULL_TREE)
{
cp_error (ec_explicit_instantiation_of_before_definition_of_template,
cp_error ("explicit instantiation of `%#T' before definition of template",
t);
return;
}
@ -7805,8 +7808,8 @@ do_type_instantiation (t, storage)
if (storage != NULL_TREE)
{
if (pedantic)
cp_pedwarn (ec_forbids_the_use_of_s_on_explicit_instantiations,
IDENTIFIER_POINTER (storage));
cp_pedwarn("ANSI C++ forbids the use of `%s' on explicit instantiations",
IDENTIFIER_POINTER (storage));
if (storage == ridpointers[(int) RID_INLINE])
nomem_p = 1;
@ -7816,7 +7819,7 @@ do_type_instantiation (t, storage)
static_p = 1;
else
{
cp_error (ec_storage_class_applied_to_template_instantiation,
cp_error ("storage class `%D' applied to template instantiation",
storage);
extern_p = 0;
}
@ -7828,8 +7831,8 @@ do_type_instantiation (t, storage)
No program shall both explicitly instantiate and explicitly
specialize a template. */
cp_error (ec_explicit_instantiation_of_type_after, t);
cp_error_at (ec_explicit_specialization_here, t);
cp_error ("explicit instantiation of `%#T' after", t);
cp_error_at ("explicit specialization here", t);
return;
}
else if (CLASSTYPE_EXPLICIT_INSTANTIATION (t))
@ -7843,7 +7846,7 @@ do_type_instantiation (t, storage)
instantiation was `extern', and if EXTERN_P then the second
is. Both cases are OK. */
if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p)
cp_error (ec_duplicate_explicit_instantiation_of_type, t);
cp_error ("duplicate explicit instantiation of `%#T'", t);
/* If we've already instantiated the template, just return now. */
if (!CLASSTYPE_INTERFACE_ONLY (t))
@ -7939,11 +7942,11 @@ regenerate_decl_from_template (decl, tmpl)
args = DECL_TI_ARGS (decl);
code_pattern = DECL_TEMPLATE_RESULT (tmpl);
/* Unregister the specialization so that when we call tsubst we will
not just return DECL. We don't have to unregister DECL from TMPL
(as opposed to GEN_TMPL) because if would only be registered
there if it were a partial instantiation of a specialization,
which it isn't: it's a full instantiation. */
/* Unregister the specialization so that when we tsubst we will not
just return DECL. We don't have to unregister DECL from TMPL
because if would only be registered there if it were a partial
instantiation of a specialization, which it isn't: it's a full
instantiation. */
gen_tmpl = most_general_template (tmpl);
unregistered = unregister_specialization (decl, gen_tmpl);
@ -8155,7 +8158,7 @@ instantiate_decl (d)
member function or static data member of a class template
shall be present in every translation unit in which it is
explicitly instantiated. */
cp_error (ec_explicit_instantiation_of_but_no_definition_available,
cp_error ("explicit instantiation of `%D' but no definition available",
d);
add_pending_template (d);
@ -8311,7 +8314,7 @@ add_maybe_template (d, fns)
return;
if (t == error_mark_node)
{
cp_error (ec_ambiguous_template_instantiation_for, d);
cp_error ("ambiguous template instantiation for `%D'", d);
return;
}

View File

@ -254,7 +254,7 @@ get_base_filename (filename)
if (p && ! compiling)
{
cp_warning (ec_frepo_must_be_used_with_c);
warning ("-frepo must be used with -c");
flag_use_repository = 0;
return NULL;
}
@ -344,7 +344,7 @@ init_repo (filename)
}
break;
default:
cp_error (ec_mysterious_repository_information_in_s, repo_name);
error ("mysterious repository information in %s", repo_name);
}
obstack_free (&temporary_obstack, buf);
}
@ -359,7 +359,7 @@ reopen_repo_file_for_write ()
if (repo_file == 0)
{
cp_error (ec_cant_create_repository_information_file_s, repo_name);
error ("can't create repository information file `%s'", repo_name);
flag_use_repository = 0;
}
}

View File

@ -101,7 +101,7 @@ build_headof (exp)
if (TREE_CODE (type) != POINTER_TYPE)
{
cp_error (ec_headof_applied_to_nonpointer_type);
error ("`headof' applied to non-pointer type");
return error_mark_node;
}
type = TREE_TYPE (type);
@ -190,7 +190,7 @@ get_tinfo_fn_dynamic (exp)
if (type_unknown_p (exp))
{
cp_error (ec_typeid_of_overloaded_function);
error ("typeid of overloaded function");
return error_mark_node;
}
@ -211,7 +211,7 @@ get_tinfo_fn_dynamic (exp)
if (! flag_rtti)
{
cp_warning (ec_taking_dynamic_typeid_of_object_without_frtti);
warning ("taking dynamic typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
@ -401,7 +401,7 @@ get_typeid (type)
if (! flag_rtti)
{
cp_warning (ec_requesting_typeid_of_object_without_frtti);
warning ("requesting typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
@ -554,7 +554,7 @@ build_dynamic_cast_1 (type, expr)
if (TREE_CODE (expr) == VAR_DECL
&& TREE_CODE (TREE_TYPE (expr)) == RECORD_TYPE)
{
cp_warning (ec_dynamic_cast_of_to_can_never_succeed,
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
expr, type);
return throw_bad_cast ();
}
@ -566,7 +566,7 @@ build_dynamic_cast_1 (type, expr)
if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{
cp_warning (ec_dynamic_cast_of_to_can_never_succeed,
cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
expr, type);
retval = build_int_2 (0, 0);
TREE_TYPE (retval) = type;
@ -650,7 +650,7 @@ build_dynamic_cast_1 (type, expr)
}
fail:
cp_error (ec_cannot_dynamic_cast_of_type_to_type,
cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'",
expr, exprtype, type);
return error_mark_node;
}

View File

@ -278,13 +278,13 @@ get_binfo (parent, binfo, protect)
if (dist == -3)
{
cp_error (ec_fields_of_are_inaccessible_in_due_to_private_inheritance,
cp_error ("fields of `%T' are inaccessible in `%T' due to private inheritance",
parent, type);
return error_mark_node;
}
else if (dist == -2 && protect)
{
cp_error (ec_type_is_ambiguous_base_class_for_type, parent,
cp_error ("type `%T' is ambiguous base class for type `%T'", parent,
type);
return error_mark_node;
}
@ -884,7 +884,7 @@ lookup_field (xbasetype, name, protect, want_type)
we know that binfo of a virtual base class will always == itself when
found along any line. (mrs) */
error_code ec = ec_last_error_code;
char *errstr = 0;
#if 0
/* We cannot search for constructor/destructor names like this. */
@ -952,10 +952,20 @@ lookup_field (xbasetype, name, protect, want_type)
{
if (TREE_PRIVATE (rval) | TREE_PROTECTED (rval))
this_v = compute_access (basetype_path, rval);
if (this_v == access_private_node)
ec = ec_private_in_class;
else if (this_v == access_protected_node)
ec = ec_protected_in_class;
if (TREE_CODE (rval) == CONST_DECL)
{
if (this_v == access_private_node)
errstr = "enum `%D' is a private value of class `%T'";
else if (this_v == access_protected_node)
errstr = "enum `%D' is a protected value of class `%T'";
}
else
{
if (this_v == access_private_node)
errstr = "member `%D' is a private member of class `%T'";
else if (this_v == access_protected_node)
errstr = "member `%D' is a protected member of class `%T'";
}
}
rval_binfo = basetype_path;
@ -1064,7 +1074,7 @@ lookup_field (xbasetype, name, protect, want_type)
else
{
/* This is ambiguous. */
ec = ec_ambiguous_member;
errstr = "request for member `%D' is ambiguous";
protect += 2;
break;
}
@ -1099,10 +1109,10 @@ lookup_field (xbasetype, name, protect, want_type)
}
if (rval == NULL_TREE)
ec = ec_last_error_code;
errstr = 0;
/* If this FIELD_DECL defines its own access level, deal with that. */
if (rval && ec == ec_last_error_code
if (rval && errstr == 0
&& (protect & 1)
&& DECL_LANG_SPECIFIC (rval)
&& DECL_ACCESS (rval))
@ -1118,7 +1128,7 @@ lookup_field (xbasetype, name, protect, want_type)
new_v = compute_access (TREE_VALUE (TREE_CHAIN (*tp)), rval);
if (this_v != access_default_node && new_v != this_v)
{
ec = ec_conflicting_access;
errstr = "conflicting access to member `%D'";
this_v = access_default_node;
}
own_access = new_v;
@ -1137,18 +1147,20 @@ lookup_field (xbasetype, name, protect, want_type)
}
search_stack = pop_search_level (search_stack);
if (ec == ec_last_error_code)
if (errstr == 0)
{
if (own_access == access_private_node)
ec = ec_member_private;
errstr = "member `%D' declared private";
else if (own_access == access_protected_node)
ec = ec_member_protected;
errstr = "member `%D' declared protected";
else if (this_v == access_private_node)
ec = TREE_PRIVATE (rval)
? ec_member_private : ec_member_in_private_base;
errstr = TREE_PRIVATE (rval)
? "member `%D' is private"
: "member `%D' is from private base class";
else if (this_v == access_protected_node)
ec = TREE_PROTECTED (rval)
? ec_member_protected : ec_member_in_protected_base;
errstr = TREE_PROTECTED (rval)
? "member `%D' is protected"
: "member `%D' is from protected base class";
}
out:
@ -1160,9 +1172,9 @@ lookup_field (xbasetype, name, protect, want_type)
protect = 0;
}
if (ec != ec_last_error_code && protect)
if (errstr && protect)
{
cp_error (ec, name, type);
cp_error (errstr, name, type);
rval = error_mark_node;
}
@ -1231,7 +1243,7 @@ lookup_nested_field (name, complain)
enums in nested classes) when we do need to call
this fn at parse time. So, in those cases, we pass
complain as a 0 and just return a NULL_TREE. */
cp_error (ec_assignment_to_nonstatic_member_of_enclosing_class,
cp_error ("assignment to non-static member `%D' of enclosing class `%T'",
id, DECL_CONTEXT (t));
/* Mark this for do_identifier(). It would otherwise
claim that the variable was undeclared. */
@ -1355,7 +1367,7 @@ lookup_fnfields (basetype_path, name, complain)
/* For now, don't try this. */
int protect = complain;
error_code ec = ec_last_error_code;
char *errstr = 0;
if (complain == -1)
{
@ -1512,7 +1524,7 @@ lookup_fnfields (basetype_path, name, complain)
else
{
/* This is ambiguous. */
ec = ec_ambiguous_member;
errstr = "request for method `%D' is ambiguous";
rvals = error_mark_node;
break;
}
@ -1530,9 +1542,9 @@ lookup_fnfields (basetype_path, name, complain)
}
search_stack = pop_search_level (search_stack);
if (ec != ec_last_error_code && protect)
if (errstr && protect)
{
cp_error (ec, name);
cp_error (errstr, name);
rvals = error_mark_node;
}
@ -1842,21 +1854,21 @@ get_matching_virtual (binfo, fndecl, dtorp)
if (pedantic && i == -1)
{
cp_pedwarn_at (ec_invalid_covariant_return_type_for_must_be_pointer_or_reference_to_class, fndecl);
cp_pedwarn_at (ec_overriding, tmp);
cp_pedwarn_at ("invalid covariant return type for `%#D' (must be pointer or reference to class)", fndecl);
cp_pedwarn_at (" overriding `%#D'", tmp);
}
}
else if (IS_AGGR_TYPE_2 (brettype, drettype)
&& comptypes (brettype, drettype, 0))
{
cp_error (ec_invalid_covariant_return_type_must_use_pointer_or_reference);
cp_error_at (ec_overriding, tmp);
cp_error_at (ec_with, fndecl);
error ("invalid covariant return type (must use pointer or reference)");
cp_error_at (" overriding `%#D'", tmp);
cp_error_at (" with `%#D'", fndecl);
}
else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)
{
cp_error_at (ec_conflicting_return_type_specified_for_virtual_function, fndecl);
cp_error_at (ec_overriding_definition_as, tmp);
cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);
cp_error_at (" overriding definition as `%#D'", tmp);
SET_IDENTIFIER_ERROR_LOCUS (name, basetype);
}
break;
@ -2434,7 +2446,7 @@ virtual_context (fndecl, t, vbase)
}
}
/* This shouldn't happen, I don't want errors! */
cp_warning (ec_recoverable_compiler_error_fixups_for_virtual_function);
warning ("recoverable compiler error, fixups for virtual function");
return vbase;
}
while (path)
@ -2697,7 +2709,7 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
tree in_charge_node = lookup_name (in_charge_identifier, 0);
if (! in_charge_node)
{
cp_warning (ec_recoverable_internal_compiler_error_nobodys_in_charge);
warning ("recoverable internal compiler error, nobody's in charge!");
in_charge_node = integer_zero_node;
}
in_charge_node = build_binary_op (EQ_EXPR, in_charge_node, integer_zero_node, 1);
@ -2825,9 +2837,9 @@ envelope_add_decl (type, decl, values)
|| ! TREE_PRIVATE (value)))
/* Should figure out access control more accurately. */
{
cp_warning_at (ec_member_is_shadowed, value);
cp_warning_at (ec_by_member_function, decl);
cp_warning (ec_in_this_context);
cp_warning_at ("member `%#D' is shadowed", value);
cp_warning_at ("by member function `%#D'", decl);
warning ("in this context");
}
context = DECL_REAL_CONTEXT (value);

View File

@ -453,7 +453,7 @@ finish_break_stmt ()
if (processing_template_decl)
add_tree (build_min_nt (BREAK_STMT));
else if ( ! expand_exit_something ())
cp_error (ec_break_statement_not_within_loop_or_switch);
cp_error ("break statement not within loop or switch");
}
/* Finish a continue-statement. */
@ -465,7 +465,7 @@ finish_continue_stmt ()
if (processing_template_decl)
add_tree (build_min_nt (CONTINUE_STMT));
else if (! expand_continue_loop (0))
cp_error (ec_continue_statement_not_within_a_loop);
cp_error ("continue statement not within a loop");
}
/* Begin a switch-statement. */
@ -735,7 +735,7 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
{
if (cv_qualifier != NULL_TREE
&& cv_qualifier != ridpointers[(int) RID_VOLATILE])
cp_warning (ec_qualifier_ignored_on_asm,
cp_warning ("%s qualifier ignored on asm",
IDENTIFIER_POINTER (cv_qualifier));
c_expand_asm_operands (string, output_operands,
@ -748,7 +748,7 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
else
{
if (cv_qualifier != NULL_TREE)
cp_warning (ec_qualifier_ignored_on_asm,
cp_warning ("%s qualifier ignored on asm",
IDENTIFIER_POINTER (cv_qualifier));
expand_asm (string);
}
@ -895,15 +895,15 @@ finish_this_expr ()
else if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
{
cp_error (ec_this_is_unavailable_for_static_member_functions);
error ("`this' is unavailable for static member functions");
result = error_mark_node;
}
else
{
if (current_function_decl)
cp_error (ec_invalid_use_of_this_in_nonmember_function);
error ("invalid use of `this' in non-member function");
else
cp_error (ec_invalid_use_of_this_at_top_level);
error ("invalid use of `this' at top level");
result = error_mark_node;
}
@ -941,7 +941,7 @@ finish_object_call_expr (fn, object, args)
fn = DECL_NAME (fn);
else
{
cp_error (ec_calling_type_like_a_method, fn);
cp_error ("calling type `%T' like a method", fn);
return error_mark_node;
}
}
@ -961,7 +961,7 @@ finish_qualified_object_call_expr (fn, object, args)
{
if (IS_SIGNATURE (TREE_OPERAND (fn, 0)))
{
cp_warning (ec_signature_name_in_scope_resolution_ignored);
warning ("signature name in scope resolution ignored");
return finish_object_call_expr (TREE_OPERAND (fn, 1), object, args);
}
else
@ -980,13 +980,13 @@ finish_pseudo_destructor_call_expr (object, scope, destructor)
tree destructor;
{
if (scope && scope != destructor)
cp_error (ec_destructor_specifier_must_have_matching_names,
cp_error ("destructor specifier `%T::~%T()' must have matching names",
scope, destructor);
if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
&& (TREE_CODE (TREE_TYPE (object)) !=
TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
cp_error (ec_is_not_of_type, object, destructor);
cp_error ("`%E' is not of type `%T'", object, destructor);
return cp_convert (void_type_node, object);
}
@ -1159,7 +1159,7 @@ finish_template_type_parm (aggr, identifier)
sorry ("signature as template type parameter");
else if (aggr != class_type_node)
{
cp_pedwarn (ec_template_type_parameters_must_use_the_keyword_class_or_typename);
pedwarn ("template type parameters must use the keyword `class' or `typename'");
aggr = class_type_node;
}
@ -1459,19 +1459,19 @@ finish_base_specifier (access_specifier, base_class,
if (base_class == NULL_TREE)
{
cp_error (ec_invalid_base_class);
error ("invalid base class");
type = error_mark_node;
}
else
type = TREE_TYPE (base_class);
if (current_aggr_is_signature && access_specifier)
cp_error (ec_access_and_source_specifiers_not_allowed_in_signature);
error ("access and source specifiers not allowed in signature");
if (! is_aggr_type (type, 1))
result = NULL_TREE;
else if (current_aggr_is_signature
&& (! type) && (! IS_SIGNATURE (type)))
{
cp_error (ec_class_name_not_allowed_as_base_signature);
error ("class name not allowed as base signature");
result = NULL_TREE;
}
else if (current_aggr_is_signature)
@ -1482,7 +1482,7 @@ finish_base_specifier (access_specifier, base_class,
}
else if (type && IS_SIGNATURE (type))
{
cp_error (ec_signature_name_not_allowed_as_base_class);
error ("signature name not allowed as base class");
result = NULL_TREE;
}
else

View File

@ -492,7 +492,7 @@ build_signature_table_constructor (sig_ty, rhs)
if (oty_type == NULL_TREE || oty_type == error_mark_node)
{
cp_error (ec_class_does_not_contain_type,
cp_error ("class `%T' does not contain type `%T'",
rhstype, oty_type);
undo_casts (sig_ty);
return error_mark_node;
@ -518,7 +518,7 @@ build_signature_table_constructor (sig_ty, rhs)
{
if (! IS_DEFAULT_IMPLEMENTATION (sig_method))
{
cp_error (ec_class_does_not_contain_method,
cp_error ("class `%T' does not contain method `%D'",
rhstype, sig_mname);
undo_casts (sig_ty);
return error_mark_node;
@ -549,7 +549,7 @@ build_signature_table_constructor (sig_ty, rhs)
|| (compute_access (basetypes, rhs_method)
!= access_public_node))
{
cp_error (ec_class_s_does_not_contain_a_method_conforming_to_s,
error ("class `%s' does not contain a method conforming to `%s'",
TYPE_NAME_STRING (rhstype),
fndecl_as_string (sig_method, 1));
undo_casts (sig_ty);
@ -735,7 +735,7 @@ build_sigtable (sig_type, rhs_type, init_from)
if (SIGNATURE_HAS_OPAQUE_TYPEDECLS (sig_type)
&& SIGTABLE_HAS_BEEN_GENERATED (sig_type))
{
cp_error (ec_signature_with_opaque_type_implemented_by_multiple_classes);
error ("signature with opaque type implemented by multiple classes");
return error_mark_node;
}
SIGTABLE_HAS_BEEN_GENERATED (sig_type) = 1;
@ -806,13 +806,13 @@ build_signature_pointer_constructor (lhs, rhs)
&& (IS_SIGNATURE_POINTER (rhstype)
|| IS_SIGNATURE_REFERENCE (rhstype)))))
{
cp_error (ec_invalid_assignment_to_signature_pointer_or_reference);
error ("invalid assignment to signature pointer or reference");
return error_mark_node;
}
if (TYPE_SIZE (sig_ty) == NULL_TREE)
{
cp_error (ec_undefined_signature_used_in_signature_s_declaration,
cp_error ("undefined signature `%T' used in signature %s declaration",
sig_ty,
IS_SIGNATURE_POINTER (lhstype) ? "pointer" : "reference");
return error_mark_node;
@ -1018,7 +1018,7 @@ build_signature_method_call (function, parms)
|| (IS_DEFAULT_IMPLEMENTATION (function)
&& (!deflt_call || deflt_call == error_mark_node)))
{
cp_compiler_error (ec_cannot_build_call_of_signature_member_function_s,
compiler_error ("cannot build call of signature member function `%s'",
fndecl_as_string (function, 1));
return error_mark_node;
}

View File

@ -221,7 +221,7 @@ lvalue_or_else (ref, string)
{
int win = lvalue_p (ref);
if (! win)
cp_error (ec_nonlvalue_in_s, string);
error ("non-lvalue in %s", string);
return win;
}
@ -755,7 +755,7 @@ layout_basetypes (rec, max)
my_friendly_assert (TREE_TYPE (field) == basetype, 23897);
if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
cp_warning (ec_direct_base_inaccessible_in_due_to_ambiguity,
cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
basetype, rec);
BINFO_OFFSET (base_binfo)
@ -776,7 +776,7 @@ layout_basetypes (rec, max)
{
tree basetype = BINFO_TYPE (vbase_types);
if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
cp_warning (ec_virtual_base_inaccessible_in_due_to_ambiguity,
cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
basetype, rec);
}
}
@ -1240,7 +1240,7 @@ binfo_value (elem, type)
tree type;
{
if (get_base_distance (elem, type, 0, (tree *)0) == -2)
cp_compiler_error (ec_base_class_s_ambiguous_in_binfo_value,
compiler_error ("base class `%s' ambiguous in binfo_value",
TYPE_NAME_STRING (elem));
if (elem == type)
return TYPE_BINFO (type);

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ error_not_base_type (basetype, type)
{
if (TREE_CODE (basetype) == FUNCTION_DECL)
basetype = DECL_CLASS_CONTEXT (basetype);
cp_error (ec_type_is_not_a_base_type_for_type, basetype, type);
cp_error ("type `%T' is not a base type for type `%T'", basetype, type);
return error_mark_node;
}
@ -83,7 +83,7 @@ readonly_error (arg, string, soft)
char *string;
int soft;
{
error_code ec;
char *fmt;
void (*fn)();
if (soft)
@ -94,32 +94,32 @@ readonly_error (arg, string, soft)
if (TREE_CODE (arg) == COMPONENT_REF)
{
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
ec = ec_member_in_readonly_structure;
fmt = "%s of member `%D' in read-only structure";
else
ec = ec_readonly_member;
(*fn) (ec, string, TREE_OPERAND (arg, 1));
fmt = "%s of read-only member `%D'";
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
}
else if (TREE_CODE (arg) == VAR_DECL)
{
if (DECL_LANG_SPECIFIC (arg)
&& DECL_IN_AGGR_P (arg)
&& !TREE_STATIC (arg))
ec = ec_constant_field;
fmt = "%s of constant field `%D'";
else
ec = ec_readonly_variable;
(*fn) (ec, string, arg);
fmt = "%s of read-only variable `%D'";
(*fn) (fmt, string, arg);
}
else if (TREE_CODE (arg) == PARM_DECL)
(*fn) (ec_readonly_parameter, string, arg);
(*fn) ("%s of read-only parameter `%D'", string, arg);
else if (TREE_CODE (arg) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
(*fn) (ec_readonly_reference, string, TREE_OPERAND (arg, 0));
(*fn) ("%s of read-only reference `%D'", string, TREE_OPERAND (arg, 0));
else if (TREE_CODE (arg) == RESULT_DECL)
(*fn) (ec_readonly_named_return_val, string, arg);
(*fn) ("%s of read-only named return value `%D'", string, arg);
else
(*fn) (ec_readonly_location, string);
(*fn) ("%s of read-only location", string);
}
/* Print an error message for invalid use of a type which declares
@ -161,22 +161,22 @@ abstract_virtuals_error (decl, type)
return;
if (TREE_CODE (decl) == VAR_DECL)
cp_error (ec_cannot_declare_variable_to_be_of_type,
cp_error ("cannot declare variable `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
cp_error (ec_cannot_declare_parameter_to_be_of_type,
cp_error ("cannot declare parameter `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
cp_error (ec_cannot_declare_field_to_be_of_type,
cp_error ("cannot declare field `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
cp_error (ec_invalid_return_type_for_method, decl);
cp_error ("invalid return type for method `%#D'", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
cp_error (ec_invalid_return_type_for_function, decl);
cp_error ("invalid return type for function `%#D'", decl);
}
else
cp_error (ec_cannot_allocate_an_object_of_type, type);
cp_error ("cannot allocate an object of type `%T'", type);
/* Only go through this once. */
if (TREE_PURPOSE (u) == NULL_TREE)
@ -184,28 +184,28 @@ abstract_virtuals_error (decl, type)
TREE_PURPOSE (u) = error_mark_node;
if (has_abstract_virtuals)
cp_error (ec_since_the_following_virtual_functions_are_abstract);
error (" since the following virtual functions are abstract:");
tu = u;
while (tu)
{
if (DECL_ABSTRACT_VIRTUAL_P (TREE_VALUE (tu))
&& ! DECL_NEEDS_FINAL_OVERRIDER_P (TREE_VALUE (tu)))
cp_error (ec_virtual, TREE_VALUE (tu));
cp_error ("\t%#D", TREE_VALUE (tu));
tu = TREE_CHAIN (tu);
}
if (needs_final_overriders)
{
if (has_abstract_virtuals)
cp_error (ec_and_the_following_virtual_functions_need_a_final_overrider);
error (" and the following virtual functions need a final overrider:");
else
cp_error (ec_since_the_following_virtual_functions_need_a_final_overrider);
error (" since the following virtual functions need a final overrider:");
}
tu = u;
while (tu)
{
if (DECL_NEEDS_FINAL_OVERRIDER_P (TREE_VALUE (tu)))
cp_error (ec_virtual, TREE_VALUE (tu));
cp_error ("\t%#D", TREE_VALUE (tu));
tu = TREE_CHAIN (tu);
}
}
@ -214,12 +214,12 @@ abstract_virtuals_error (decl, type)
if (has_abstract_virtuals)
{
if (needs_final_overriders)
cp_error (ec_since_type_has_abstract_virtual_functions_and_must_override_virtual_functions, type);
cp_error (" since type `%T' has abstract virtual functions and must override virtual functions", type);
else
cp_error (ec_since_type_has_abstract_virtual_functions, type);
cp_error (" since type `%T' has abstract virtual functions", type);
}
else
cp_error (ec_since_type_must_override_virtual_functions, type);
cp_error (" since type `%T' must override virtual functions", type);
}
}
@ -238,22 +238,22 @@ signature_error (decl, type)
return;
if (TREE_CODE (decl) == VAR_DECL)
cp_error (ec_cannot_declare_variable_to_be_of_signature_type,
cp_error ("cannot declare variable `%D' to be of signature type `%T'",
decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
cp_error (ec_cannot_declare_parameter_to_be_of_signature_type,
cp_error ("cannot declare parameter `%D' to be of signature type `%T'",
decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
cp_error (ec_cannot_declare_field_to_be_of_signature_type,
cp_error ("cannot declare field `%D' to be of signature type `%T'",
decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
cp_error (ec_invalid_return_type_for_method, decl);
cp_error ("invalid return type for method `%#D'", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
cp_error (ec_invalid_return_type_for_function, decl);
cp_error ("invalid return type for function `%#D'", decl);
}
else
cp_error (ec_cannot_allocate_an_object_of_signature_type, type);
cp_error ("cannot allocate an object of signature type `%T'", type);
}
/* Print an error message for invalid use of an incomplete type.
@ -265,13 +265,15 @@ incomplete_type_error (value, type)
tree value;
tree type;
{
char *errmsg = 0;
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
return;
if (value != 0 && (TREE_CODE (value) == VAR_DECL
|| TREE_CODE (value) == PARM_DECL))
cp_error (ec_has_incomplete_type, value);
cp_error ("`%D' has incomplete type", value);
else
{
retry:
@ -282,11 +284,11 @@ incomplete_type_error (value, type)
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
cp_error (ec_invalid_use_of_undefined_type, type);
return;
errmsg = "invalid use of undefined type `%#T'";
break;
case VOID_TYPE:
cp_error (ec_invalid_use_of_void_expression);
error ("invalid use of void expression");
return;
case ARRAY_TYPE:
@ -295,20 +297,22 @@ incomplete_type_error (value, type)
type = TREE_TYPE (type);
goto retry;
}
cp_error (ec_invalid_use_of_array_with_unspecified_bounds);
error ("invalid use of array with unspecified bounds");
return;
case OFFSET_TYPE:
cp_error (ec_invalid_use_of_member_type_did_you_forget_the);
error ("invalid use of member type (did you forget the `&' ?)");
return;
case TEMPLATE_TYPE_PARM:
cp_error (ec_invalid_use_of_template_type_parameter);
error ("invalid use of template type parameter");
return;
default:
my_friendly_abort (108);
}
cp_error (errmsg, type);
}
}
@ -382,16 +386,16 @@ my_friendly_abort (i)
ack ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
}
else
cp_error (ec_confused_by_earlier_errors_bailing_out);
error ("confused by earlier errors, bailing out");
exit (34);
}
++abortcount;
if (i == 0)
cp_error (ec_nternal_compiler_error);
error ("Internal compiler error.");
else
cp_error (ec_nternal_compiler_error_d, i);
error ("Internal compiler error %d.", i);
fatal ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
}
@ -592,13 +596,13 @@ store_init_value (decl, init)
if (TREE_CODE (init) == TREE_LIST
&& IS_SIGNATURE (type))
{
cp_error (ec_constructor_syntax_cannot_be_used_with_signature_type,
cp_error ("constructor syntax cannot be used with signature type `%T'",
type);
init = error_mark_node;
}
else if (TREE_CODE (init) == TREE_LIST)
{
cp_error (ec_constructor_syntax_used_but_no_constructor_declared_for_type, type);
cp_error ("constructor syntax used, but no constructor declared for type `%T'", type);
init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
}
#if 0
@ -608,25 +612,25 @@ store_init_value (decl, init)
/* Check that we're really an aggregate as ARM 8.4.1 defines it. */
if (CLASSTYPE_N_BASECLASSES (type))
cp_error_at (ec_initializer_list_construction_invalid_for_derived_class_object, decl);
cp_error_at ("initializer list construction invalid for derived class object `%D'", decl);
if (CLASSTYPE_VTBL_PTR (type))
cp_error_at (ec_initializer_list_construction_invalid_for_polymorphic_class_object, decl);
cp_error_at ("initializer list construction invalid for polymorphic class object `%D'", decl);
if (TYPE_NEEDS_CONSTRUCTING (type))
{
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
cp_error (ec_due_to_the_presence_of_a_constructor);
cp_error_at ("initializer list construction invalid for `%D'", decl);
error ("due to the presence of a constructor");
}
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
{
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
cp_error_at (ec_due_to_nonpublic_access_of_member, field);
cp_error_at ("initializer list construction invalid for `%D'", decl);
cp_error_at ("due to non-public access of member `%D'", field);
}
for (field = TYPE_METHODS (type); field; field = TREE_CHAIN (field))
if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
{
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
cp_error_at (ec_due_to_nonpublic_access_of_member, field);
cp_error_at ("initializer list construction invalid for `%D'", decl);
cp_error_at ("due to non-public access of member `%D'", field);
}
}
#endif
@ -638,7 +642,7 @@ store_init_value (decl, init)
{
if (TREE_CHAIN (init))
{
cp_warning (ec_comma_expression_used_to_initialize_return_value);
warning ("comma expression used to initialize return value");
init = build_compound_expr (init);
}
else
@ -654,7 +658,7 @@ store_init_value (decl, init)
else if (TREE_CODE (init) == TREE_LIST
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
{
cp_error (ec_cannot_initialize_arrays_using_this_syntax);
error ("cannot initialize arrays using this syntax");
return NULL_TREE;
}
else
@ -663,7 +667,7 @@ store_init_value (decl, init)
if (TREE_CHAIN (init) != NULL_TREE)
{
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
pedwarn ("initializer list being treated as compound expression");
init = build_compound_expr (init);
}
else
@ -716,7 +720,7 @@ store_init_value (decl, init)
|| IS_SIGNATURE_REFERENCE (type))))
{
if (! TREE_CONSTANT (value) || ! TREE_STATIC (value))
cp_pedwarn (ec_forbids_nonconstant_aggregate_initializer_expressions);
pedwarn ("ANSI C++ forbids non-constant aggregate initializer expressions");
}
}
#endif
@ -784,7 +788,7 @@ digest_init (type, init, tail)
if (TREE_CODE (init) == TREE_LIST)
{
cp_error (ec_initializing_array_with_parameter_list);
error ("initializing array with parameter list");
return error_mark_node;
}
@ -803,14 +807,14 @@ digest_init (type, init, tail)
!= char_type_node)
&& TYPE_PRECISION (typ1) == BITS_PER_UNIT)
{
cp_error (ec_chararray_initialized_from_wide_string);
error ("char-array initialized from wide string");
return error_mark_node;
}
if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
== char_type_node)
&& TYPE_PRECISION (typ1) != BITS_PER_UNIT)
{
cp_error (ec_intarray_initialized_from_nonwide_string);
error ("int-array initialized from non-wide string");
return error_mark_node;
}
@ -826,7 +830,7 @@ digest_init (type, init, tail)
counted in the length of the constant, but in C++ this would
be invalid. */
if (size < TREE_STRING_LENGTH (string))
cp_pedwarn (ec_initializerstring_for_array_of_chars_is_too_long);
pedwarn ("initializer-string for array of chars is too long");
}
return string;
}
@ -846,17 +850,17 @@ digest_init (type, init, tail)
{
if (element == 0)
{
cp_error (ec_initializer_for_scalar_variable_requires_one_element);
error ("initializer for scalar variable requires one element");
return error_mark_node;
}
init = element;
}
while (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
{
cp_pedwarn (ec_braces_around_scalar_initializer_for, type);
cp_pedwarn ("braces around scalar initializer for `%T'", type);
init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init))
cp_pedwarn (ec_ignoring_extra_initializers_for, type);
cp_pedwarn ("ignoring extra initializers for `%T'", type);
init = TREE_VALUE (init);
}
@ -868,7 +872,7 @@ digest_init (type, init, tail)
if (TYPE_SIZE (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{
cp_error (ec_variablesized_object_of_type_may_not_be_initialized,
cp_error ("variable-sized object of type `%T' may not be initialized",
type);
return error_mark_node;
}
@ -877,7 +881,7 @@ digest_init (type, init, tail)
{
if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
{
cp_error (ec_subobject_of_type_must_be_initialized_by_constructor_not_by,
cp_error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
type, init);
return error_mark_node;
}
@ -904,7 +908,7 @@ digest_init (type, init, tail)
}
}
cp_error (ec_invalid_initializer);
error ("invalid initializer");
return error_mark_node;
}
@ -942,7 +946,7 @@ process_init_constructor (type, init, elts)
if (elts)
{
if (warn_missing_braces)
cp_warning (ec_aggregate_has_a_partly_bracketed_initializer);
warning ("aggregate has a partly bracketed initializer");
tail = *elts;
}
else
@ -990,7 +994,7 @@ process_init_constructor (type, init, elts)
|| TREE_CODE (tail1) == TREE_LIST, 319);
if (tail == tail1 && len < 0)
{
cp_error (ec_nonempty_initializer_for_array_of_empty_elements);
error ("non-empty initializer for array of empty elements");
/* Just ignore what we were supposed to use. */
tail1 = NULL_TREE;
}
@ -1097,19 +1101,19 @@ process_init_constructor (type, init, elts)
members = expr_tree_cons (field, next1, members);
}
else if (TREE_READONLY (field))
cp_error (ec_uninitialized_const_member_s,
error ("uninitialized const member `%s'",
IDENTIFIER_POINTER (DECL_NAME (field)));
else if (TYPE_LANG_SPECIFIC (TREE_TYPE (field))
&& CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
cp_error (ec_member_s_with_uninitialized_const_fields,
error ("member `%s' with uninitialized const fields",
IDENTIFIER_POINTER (DECL_NAME (field)));
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
cp_error (ec_member_s_is_uninitialized_reference,
error ("member `%s' is uninitialized reference",
IDENTIFIER_POINTER (DECL_NAME (field)));
/* Warn when some struct elements are implicitly initialized
to zero. */
else if (extra_warnings)
cp_warning (ec_missing_initializer_for_member_s,
warning ("missing initializer for member `%s'",
IDENTIFIER_POINTER (DECL_NAME (field)));
}
}
@ -1134,7 +1138,7 @@ process_init_constructor (type, init, elts)
/* Handle the case of a call by build_c_cast. */
field = TREE_PURPOSE (tail), win = 1;
else if (TREE_CODE (TREE_PURPOSE (tail)) != IDENTIFIER_NODE)
cp_error (ec_index_value_instead_of_field_name_in_union_initializer);
error ("index value instead of field name in union initializer");
else
{
tree temp;
@ -1146,7 +1150,7 @@ process_init_constructor (type, init, elts)
if (temp)
field = temp, win = 1;
else
cp_error (ec_no_field_s_in_union_being_initialized,
error ("no field `%s' in union being initialized",
IDENTIFIER_POINTER (TREE_PURPOSE (tail)));
}
if (!win)
@ -1154,7 +1158,7 @@ process_init_constructor (type, init, elts)
}
else if (field == 0)
{
cp_error (ec_union_with_no_named_members_cannot_be_initialized,
cp_error ("union `%T' with no named members cannot be initialized",
type);
TREE_VALUE (tail) = error_mark_node;
}
@ -1190,7 +1194,7 @@ process_init_constructor (type, init, elts)
/* If arguments were specified as a constructor,
complain unless we used all the elements of the constructor. */
else if (tail)
cp_pedwarn (ec_excess_elements_in_aggregate_initializer);
pedwarn ("excess elements in aggregate initializer");
if (erroneous)
return error_mark_node;
@ -1317,7 +1321,7 @@ build_x_arrow (datum)
if (value_member (TREE_TYPE (rval), types_memoized))
{
cp_error (ec_circular_pointer_delegation_detected);
error ("circular pointer delegation detected");
return error_mark_node;
}
else
@ -1330,7 +1334,7 @@ build_x_arrow (datum)
if (last_rval == NULL_TREE)
{
cp_error (ec_base_operand_of_has_nonpointer_type, type);
cp_error ("base operand of `->' has non-pointer type `%T'", type);
return error_mark_node;
}
@ -1349,9 +1353,9 @@ build_x_arrow (datum)
return build_indirect_ref (last_rval, NULL_PTR);
if (types_memoized)
cp_error (ec_result_of_operator_yields_nonpointer_result);
error ("result of `operator->()' yields non-pointer result");
else
cp_error (ec_base_operand_of_is_not_a_pointer);
error ("base operand of `->' is not a pointer");
return error_mark_node;
}
@ -1396,7 +1400,7 @@ build_m_component_ref (datum, component)
if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
{
cp_error (ec_cannot_be_used_as_a_member_pointer_since_it_is_of_type, component, type);
cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
return error_mark_node;
}
@ -1406,15 +1410,15 @@ build_m_component_ref (datum, component)
if (! IS_AGGR_TYPE (objtype))
{
cp_error (ec_cannot_apply_member_pointer_to, component, datum);
cp_error (ec_which_is_of_nonaggregate_type, objtype);
cp_error ("cannot apply member pointer `%E' to `%E'", component, datum);
cp_error ("which is of non-aggregate type `%T'", objtype);
return error_mark_node;
}
binfo = get_binfo (TYPE_METHOD_BASETYPE (type), objtype, 1);
if (binfo == NULL_TREE)
{
cp_error (ec_member_type_incompatible_with_object_type,
cp_error ("member type `%T::' incompatible with object type `%T'",
TYPE_METHOD_BASETYPE (type), objtype);
return error_mark_node;
}
@ -1451,7 +1455,7 @@ build_functional_cast (exp, parms)
type = lookup_name (exp, 1);
if (!type || TREE_CODE (type) != TYPE_DECL)
{
cp_error (ec_fails_to_be_a_typedef_or_builtin_type, exp);
cp_error ("`%T' fails to be a typedef or built-in type", exp);
return error_mark_node;
}
type = TREE_TYPE (type);
@ -1467,7 +1471,7 @@ build_functional_cast (exp, parms)
if (IS_SIGNATURE (type))
{
cp_error (ec_signature_type_not_allowed_in_cast_or_constructor_expression);
error ("signature type not allowed in cast or constructor expression");
return error_mark_node;
}
@ -1479,7 +1483,7 @@ build_functional_cast (exp, parms)
else
{
if (TREE_CHAIN (parms) != NULL_TREE)
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
pedwarn ("initializer list being treated as compound expression");
parms = build_compound_expr (parms);
}
@ -1495,7 +1499,7 @@ build_functional_cast (exp, parms)
if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
{
cp_error (ec_type_is_not_yet_defined, type);
cp_error ("type `%T' is not yet defined", type);
return error_mark_node;
}
@ -1564,15 +1568,15 @@ report_case_error (code, type, new_value, old_value)
if (code == 1)
{
if (new_value)
cp_error (ec_case_label_not_within_a_switch_statement);
error ("case label not within a switch statement");
else
cp_error (ec_default_label_not_within_a_switch_statement);
error ("default label not within a switch statement");
}
else if (code == 2)
{
if (new_value == 0)
{
cp_error (ec_multiple_default_labels_in_one_switch);
error ("multiple default labels in one switch");
return;
}
if (TREE_CODE (new_value) == RANGE_EXPR)
@ -1626,29 +1630,29 @@ report_case_error (code, type, new_value, old_value)
else
{
if (TREE_CODE (type) == ENUMERAL_TYPE)
cp_error (ec_duplicate_label_s_in_switch_statement,
error ("duplicate label `%s' in switch statement",
enum_name_string (new_value, type));
else
cp_error (ec_duplicate_label_d_in_switch_statement,
error ("duplicate label (%d) in switch statement",
TREE_INT_CST_LOW (new_value));
}
}
else if (code == 3)
{
if (TREE_CODE (type) == ENUMERAL_TYPE)
cp_warning (ec_case_value_out_of_range_for_enum_s,
warning ("case value out of range for enum %s",
TYPE_NAME_STRING (type));
else
cp_warning (ec_case_value_out_of_range);
warning ("case value out of range");
}
else if (code == 4)
{
if (TREE_CODE (type) == ENUMERAL_TYPE)
cp_error (ec_range_values_s_and_s_reversed,
error ("range values `%s' and `%s' reversed",
enum_name_string (new_value, type),
enum_name_string (old_value, type));
else
cp_error (ec_range_values_reversed);
error ("range values reversed");
}
}
#endif
@ -1659,5 +1663,5 @@ check_for_new_type (string, inptree)
flagged_type_tree inptree;
{
if (pedantic && inptree.new_type_flag)
cp_pedwarn (ec_forbids_defining_types_within_s,string);
pedwarn ("ANSI C++ forbids defining types within %s",string);
}

View File

@ -832,7 +832,7 @@ open_xref_file(file)
if (xref_file == NULL)
{
cp_error (ec_ant_create_crossreference_file_s, xref_name);
error("Can't create cross-reference file `%s'", xref_name);
doing_xref = 0;
}
}