cp-error.def: New file.
* 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. From-SVN: r22304
This commit is contained in:
parent
e04a16fbee
commit
d41fbd2cb8
32 changed files with 4949 additions and 2317 deletions
|
@ -1,3 +1,48 @@
|
|||
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
|
||||
|
|
|
@ -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-tree.h $(srcdir)/cp/cp-tree.def $(srcdir)/cp/cp-error.def
|
||||
cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
|
||||
#
|
||||
# Build hooks:
|
||||
|
|
|
@ -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
|
||||
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def cp-error.def
|
||||
PARSE_H = $(srcdir)/parse.h
|
||||
PARSE_C = $(srcdir)/parse.c
|
||||
EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
|
||||
|
|
103
gcc/cp/call.c
103
gcc/cp/call.c
|
@ -132,7 +132,7 @@ build_field_call (basetype_path, instance_ptr, name, parms)
|
|||
|
||||
if (field == NULL_TREE)
|
||||
{
|
||||
cp_error ("`this' has no member named `%D'", name);
|
||||
cp_error (ec_this_has_no_member_named, 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)
|
||||
{
|
||||
error ("invalid call via pointer-to-member function");
|
||||
cp_error (ec_invalid_call_via_pointertomember_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 ("qualified type `%T' does not match destructor name `~%T'",
|
||||
cp_error (ec_qualified_type_does_not_match_destructor_name,
|
||||
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 ("type of `%E' does not match destructor type `%T' (type was `%T')",
|
||||
cp_error (ec_type_of_does_not_match_destructor_type_type_was,
|
||||
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 ("base object `%E' of scoped method call is of non-aggregate type `%T'",
|
||||
cp_error (ec_base_object_of_scoped_method_call_is_of_nonaggregate_type,
|
||||
exp, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -661,15 +661,14 @@ build_method_call (instance, name, parms, basetype_path, flags)
|
|||
if (TREE_CODE (name) == BIT_NOT_EXPR)
|
||||
{
|
||||
if (parms)
|
||||
error ("destructors take no parameters");
|
||||
cp_error (ec_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
|
||||
("destructor name `~%T' does not match type `%T' of expression",
|
||||
TREE_OPERAND (name, 0), basetype);
|
||||
cp_error (ec_destructor_name_does_not_match_type,
|
||||
TREE_OPERAND (name, 0), basetype);
|
||||
|
||||
if (! TYPE_HAS_DESTRUCTOR (complete_type (basetype)))
|
||||
return cp_convert (void_type_node, instance);
|
||||
|
@ -2019,20 +2018,20 @@ print_z_candidates (candidates)
|
|||
if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
|
||||
{
|
||||
if (candidates->fn == ansi_opname [COND_EXPR])
|
||||
cp_error ("%s %D(%T, %T, %T) <builtin>", str, candidates->fn,
|
||||
cp_error (ec_builtin_3, 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 ("%s %D(%T, %T) <builtin>", str, candidates->fn,
|
||||
cp_error (ec_builtin_2, str, candidates->fn,
|
||||
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
|
||||
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)));
|
||||
else
|
||||
cp_error ("%s %D(%T) <builtin>", str, candidates->fn,
|
||||
cp_error (ec_builtin_1, str, candidates->fn,
|
||||
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)));
|
||||
}
|
||||
else
|
||||
cp_error_at ("%s %+D%s", str, candidates->fn,
|
||||
cp_error_at (ec_candidate_1, str, candidates->fn,
|
||||
candidates->viable == -1 ? " <near match>" : "");
|
||||
str = " ";
|
||||
}
|
||||
|
@ -2169,7 +2168,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 ("no viable candidates");
|
||||
cp_error (ec_no_viable_candidates);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2183,7 +2182,7 @@ build_user_type_conversion_1 (totype, expr, flags)
|
|||
{
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
cp_error ("conversion from `%T' to `%T' is ambiguous",
|
||||
cp_error (ec_conversion_from_to_is_ambiguous,
|
||||
fromtype, totype);
|
||||
print_z_candidates (candidates);
|
||||
}
|
||||
|
@ -2249,7 +2248,7 @@ resolve_args (args)
|
|||
return error_mark_node;
|
||||
else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE)
|
||||
{
|
||||
error ("invalid use of void expression");
|
||||
cp_error (ec_invalid_use_of_void_expression);
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF)
|
||||
|
@ -2302,7 +2301,7 @@ build_new_function_call (fn, args)
|
|||
{
|
||||
if (candidates && ! candidates->next)
|
||||
return build_function_call (candidates->fn, args);
|
||||
cp_error ("no matching function for call to `%D (%A)'",
|
||||
cp_error (ec_no_matching_function_for_call_to,
|
||||
DECL_NAME (OVL_FUNCTION (fn)), args);
|
||||
if (candidates)
|
||||
print_z_candidates (candidates);
|
||||
|
@ -2313,7 +2312,7 @@ build_new_function_call (fn, args)
|
|||
|
||||
if (cand == 0)
|
||||
{
|
||||
cp_error ("call of overloaded `%D (%A)' is ambiguous",
|
||||
cp_error (ec_call_of_overloaded_is_ambiguous,
|
||||
DECL_NAME (OVL_FUNCTION (fn)), args);
|
||||
print_z_candidates (candidates);
|
||||
return error_mark_node;
|
||||
|
@ -2348,8 +2347,8 @@ build_object_call (obj, args)
|
|||
{
|
||||
/* It's no good looking for an overloaded operator() on a
|
||||
pointer-to-member-function. */
|
||||
cp_error ("pointer-to-member function %E cannot be called", obj);
|
||||
cp_error ("without an object; consider using .* or ->*");
|
||||
cp_error (ec_pointertomember_function_cannot_be_called, obj);
|
||||
cp_error (ec_without_an_object_consider_using_or);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -2419,7 +2418,7 @@ build_object_call (obj, args)
|
|||
|
||||
if (! any_viable (candidates))
|
||||
{
|
||||
cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
|
||||
cp_error (ec_no_match_for_call_to, TREE_TYPE (obj), args);
|
||||
print_z_candidates (candidates);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -2429,7 +2428,7 @@ build_object_call (obj, args)
|
|||
|
||||
if (cand == 0)
|
||||
{
|
||||
cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
|
||||
cp_error (ec_call_of_is_ambiguous, TREE_TYPE (obj), args);
|
||||
print_z_candidates (candidates);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -2455,23 +2454,23 @@ op_error (code, code2, arg1, arg2, arg3, problem)
|
|||
switch (code)
|
||||
{
|
||||
case COND_EXPR:
|
||||
cp_error ("%s for `%T ? %T : %T'", problem,
|
||||
cp_error (ec_for_1, problem,
|
||||
error_type (arg1), error_type (arg2), error_type (arg3));
|
||||
break;
|
||||
case POSTINCREMENT_EXPR:
|
||||
case POSTDECREMENT_EXPR:
|
||||
cp_error ("%s for `%T%s'", problem, error_type (arg1), opname);
|
||||
cp_error (ec_for_2, problem, error_type (arg1), opname);
|
||||
break;
|
||||
case ARRAY_REF:
|
||||
cp_error ("%s for `%T[%T]'", problem,
|
||||
cp_error (ec_for_3, problem,
|
||||
error_type (arg1), error_type (arg2));
|
||||
break;
|
||||
default:
|
||||
if (arg2)
|
||||
cp_error ("%s for `%T %s %T'", problem,
|
||||
cp_error (ec_for_4, problem,
|
||||
error_type (arg1), opname, error_type (arg2));
|
||||
else
|
||||
cp_error ("%s for `%s%T'", problem, opname, error_type (arg1));
|
||||
cp_error (ec_for_5, problem, opname, error_type (arg1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2496,7 +2495,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 ("`%D' must be declared before use", arg1);
|
||||
cp_error (ec_must_be_declared_before_use, arg1);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -2713,7 +2712,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 ("no `%D (int)' declared for postfix `%s', trying prefix operator instead",
|
||||
cp_pedwarn (ec_no_int_declared_for_postfix_s_trying_prefix_operator_instead,
|
||||
fnname, opname_tab [code]);
|
||||
if (code == POSTINCREMENT_EXPR)
|
||||
code = PREINCREMENT_EXPR;
|
||||
|
@ -2759,9 +2758,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
|
|||
&& candidates->next
|
||||
&& ! candidates->next->next)
|
||||
{
|
||||
cp_warning ("using synthesized `%#D' for copy assignment",
|
||||
cp_warning (ec_using_synthesized_for_copy_assignment,
|
||||
cand->fn);
|
||||
cp_warning_at (" where cfront would use `%#D'",
|
||||
cp_warning_at (ec_where_cfront_would_use,
|
||||
cand == candidates
|
||||
? candidates->next->fn
|
||||
: candidates->fn);
|
||||
|
@ -2796,7 +2795,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
|
|||
&& (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
|
||||
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
|
||||
{
|
||||
cp_warning ("comparison between `%#T' and `%#T'",
|
||||
cp_warning (ec_comparison_between_and,
|
||||
TREE_TYPE (arg1), TREE_TYPE (arg2));
|
||||
}
|
||||
break;
|
||||
|
@ -3023,7 +3022,7 @@ build_op_delete_call (code, addr, size, flags, placement)
|
|||
if (flags & LOOKUP_SPECULATIVELY)
|
||||
return NULL_TREE;
|
||||
|
||||
cp_error ("no suitable operator delete for `%T'", type);
|
||||
cp_error (ec_no_suitable_operator_delete_for, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3038,17 +3037,17 @@ enforce_access (basetype_path, decl)
|
|||
|
||||
if (access == access_private_node)
|
||||
{
|
||||
cp_error_at ("`%+#D' is %s", decl,
|
||||
cp_error_at (ec_access_is_1, decl,
|
||||
TREE_PRIVATE (decl) ? "private"
|
||||
: "from private base class");
|
||||
error ("within this context");
|
||||
cp_error (ec_within_this_context);
|
||||
}
|
||||
else if (access == access_protected_node)
|
||||
{
|
||||
cp_error_at ("`%+#D' %s", decl,
|
||||
cp_error_at (ec_access_is_2, decl,
|
||||
TREE_PROTECTED (decl) ? "is protected"
|
||||
: "has protected accessibility");
|
||||
error ("within this context");
|
||||
cp_error (ec_within_this_context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3151,11 +3150,11 @@ convert_like (convs, expr)
|
|||
if (comptypes (TREE_TYPE (expr), TREE_TYPE (convs), 1))
|
||||
incomplete_type_error (expr, TREE_TYPE (expr));
|
||||
else
|
||||
cp_error ("could not convert `%E' (with incomplete type `%T') to `%T'",
|
||||
cp_error (ec_could_not_convert_with_incomplete_type_to,
|
||||
expr, TREE_TYPE (expr), TREE_TYPE (convs));
|
||||
}
|
||||
else
|
||||
cp_error ("could not convert `%E' to `%T'",
|
||||
cp_error (ec_could_not_convert_to,
|
||||
expr, TREE_TYPE (convs));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -3196,7 +3195,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 ("cannot pass objects of type `%T' through `...'",
|
||||
cp_warning (ec_cannot_pass_objects_of_type_through,
|
||||
TREE_TYPE (arg));
|
||||
else
|
||||
/* Convert `short' and `char' to full-size `int'. */
|
||||
|
@ -3296,7 +3295,7 @@ build_over_call (cand, args, flags)
|
|||
char *p = (dv && dc ? "const and volatile"
|
||||
: dc ? "const" : dv ? "volatile" : "");
|
||||
|
||||
cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards %s",
|
||||
cp_pedwarn (ec_passing_as_this_argument_of_discards_s,
|
||||
TREE_TYPE (argtype), fn, p);
|
||||
}
|
||||
/* [class.mfct.nonstatic]: If a nonstatic member function of a class
|
||||
|
@ -3348,7 +3347,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 ("converting NULL to non-pointer type");
|
||||
cp_warning (ec_converting_null_to_nonpointer_type);
|
||||
|
||||
val = convert_like (conv, TREE_VALUE (arg));
|
||||
}
|
||||
|
@ -3598,7 +3597,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 ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
|
||||
cp_error (ec_request_for_member_in_which_is_of_nonaggregate_type,
|
||||
name, instance, basetype);
|
||||
|
||||
return error_mark_node;
|
||||
|
@ -3689,7 +3688,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 ("no matching function for call to `%T::%D (%A)%V'", basetype,
|
||||
cp_error (ec_no_matching_function_for_call_to_member, basetype,
|
||||
pretty_name, user_args, TREE_TYPE (TREE_TYPE (instance_ptr)));
|
||||
print_z_candidates (candidates);
|
||||
return error_mark_node;
|
||||
|
@ -3699,7 +3698,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
|
|||
|
||||
if (cand == 0)
|
||||
{
|
||||
cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
|
||||
cp_error (ec_call_of_overloaded_is_ambiguous_2, pretty_name,
|
||||
user_args);
|
||||
print_z_candidates (candidates);
|
||||
return error_mark_node;
|
||||
|
@ -3710,11 +3709,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 ("abstract virtual `%#D' called from constructor", cand->fn);
|
||||
cp_error (ec_abstract_virtual_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 ("cannot call member function `%D' without object", cand->fn);
|
||||
cp_error (ec_cannot_call_member_function_without_object, cand->fn);
|
||||
|
||||
if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL)
|
||||
&& ((instance == current_class_ref && (dtor_label || ctor_label))
|
||||
|
@ -4327,9 +4326,9 @@ joust (cand1, cand2, warn)
|
|||
|
||||
if (warn)
|
||||
{
|
||||
cp_warning ("passing `%T' chooses `%T' over `%T'",
|
||||
cp_warning (ec_passing_chooses_over,
|
||||
type, type1, type2);
|
||||
cp_warning (" in call to `%D'", w->fn);
|
||||
cp_warning (ec_in_call_to, w->fn);
|
||||
}
|
||||
else
|
||||
add_warning (w, l);
|
||||
|
@ -4368,10 +4367,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 ("choosing `%D' over `%D'", w->fn, l->fn);
|
||||
cp_warning (" for conversion from `%T' to `%T'",
|
||||
cp_warning (ec_choosing_over, w->fn, l->fn);
|
||||
cp_warning (ec_for_conversion_from_to,
|
||||
source, TREE_TYPE (w->second_conv));
|
||||
cp_warning (" because conversion sequence for the argument is better");
|
||||
cp_warning (ec_because_conversion_sequence_for_the_argument_is_better);
|
||||
}
|
||||
else
|
||||
add_warning (w, l);
|
||||
|
|
185
gcc/cp/class.c
185
gcc/cp/class.c
|
@ -285,7 +285,7 @@ build_vbase_path (code, type, expr, path, nonnull)
|
|||
}
|
||||
else
|
||||
{
|
||||
cp_error ("cannot cast up from virtual baseclass `%T'",
|
||||
cp_error (ec_cannot_cast_up_from_virtual_baseclass,
|
||||
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)
|
||||
warning ("internal inconsistency: binfo offset error for rtti");
|
||||
cp_warning (ec_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 ("replaced %D with %D", DECL_ASSEMBLER_NAME (base_fndecl),
|
||||
cp_warning (ec_replaced_with, 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 ("internal problem, current_class_type is zero when adding `%D', please report",
|
||||
cp_warning (ec_internal_problem_current_class_type_is_zero_when_adding_please_report,
|
||||
fndecl);
|
||||
if (current_class_type && t != current_class_type)
|
||||
cp_warning ("internal problem, current_class_type differs when adding `%D', please report",
|
||||
cp_warning (ec_internal_problem_current_class_type_differs_when_adding_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 ("duplicate enum value `%D'", x);
|
||||
cp_error_at (ec_duplicate_enum_value, x);
|
||||
else if (TREE_CODE (field) == CONST_DECL
|
||||
|| TREE_CODE (x) == CONST_DECL)
|
||||
cp_error_at ("duplicate field `%D' (as enum and non-enum)",
|
||||
cp_error_at (ec_duplicate_field_as_enum_and_nonenum,
|
||||
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 ("duplicate nested type `%D'", x);
|
||||
cp_error_at (ec_duplicate_nested_type, 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 ("duplicate field `%D' (as type and non-type)",
|
||||
cp_error_at (ec_duplicate_field_as_type_and_nontype,
|
||||
x);
|
||||
}
|
||||
else
|
||||
cp_error_at ("duplicate member `%D'", x);
|
||||
cp_error_at (ec_duplicate_member, 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 ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl));
|
||||
cp_error_at (ec_conflicting_access_specifications_for_method_ignored, TREE_TYPE (fdecl));
|
||||
else
|
||||
error ("conflicting access specifications for field `%s', ignored",
|
||||
cp_error (ec_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 ("using-declaration for constructor", using_decl);
|
||||
cp_error_at (ec_usingdeclaration_for_constructor, using_decl);
|
||||
|
||||
fdecl = lookup_member (binfo, name, 0, 0);
|
||||
|
||||
if (!fdecl)
|
||||
{
|
||||
cp_error_at ("no members matching `%D' in `%#T'", using_decl, ctype);
|
||||
cp_error_at (ec_no_members_matching_in, 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 ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
|
||||
cp_error_at (" because of local method `%#D' with same name",
|
||||
cp_error (ec_cannot_adjust_access_to_in, fdecl, t);
|
||||
cp_error_at (ec_because_of_local_method_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 ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
|
||||
cp_error_at (" because of local field `%#D' with same name", tmp);
|
||||
cp_error (ec_cannot_adjust_access_to_in, fdecl, t);
|
||||
cp_error_at (ec_because_of_local_field_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 ("base class `%#T' has a non-virtual destructor", basetype);
|
||||
cp_warning (ec_base_class_has_a_nonvirtual_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 ("base `%T' with only non-default constructor",
|
||||
cp_pedwarn (ec_base_with_only_nondefault_constructor,
|
||||
basetype);
|
||||
cp_pedwarn ("in class without a constructor");
|
||||
cp_pedwarn (ec_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 ("all member functions in class `%T' are private", t);
|
||||
cp_warning (ec_all_member_functions_in_class_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 ("`%#T' only defines a private destructor and has no friends",
|
||||
cp_warning (ec_only_defines_a_private_destructor_and_has_no_friends,
|
||||
t);
|
||||
}
|
||||
|
||||
|
@ -2091,8 +2091,8 @@ void
|
|||
duplicate_tag_error (t)
|
||||
tree t;
|
||||
{
|
||||
cp_error ("redefinition of `%#T'", t);
|
||||
cp_error_at ("previous definition here", t);
|
||||
cp_error (ec_redefinition_of, t);
|
||||
cp_error_at (ec_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 */
|
||||
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);
|
||||
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);
|
||||
return rval;
|
||||
}
|
||||
rval = nrval;
|
||||
|
@ -2396,7 +2396,7 @@ modify_one_vtable (binfo, t, fndecl, pfn)
|
|||
}
|
||||
|
||||
#ifdef NOTQUITE
|
||||
cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo)));
|
||||
cp_warning (ec_in, 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 ("method `%D' may not be declared static",
|
||||
cp_error_at (ec_method_may_not_be_declared_static,
|
||||
decl);
|
||||
cp_error_at ("(since `%D' declared virtual in base class.)",
|
||||
cp_error_at (ec_since_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 ("`%D' was hidden", TREE_VALUE (base_fndecls));
|
||||
cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls));
|
||||
cp_warning_at (ec_was_hidden, TREE_VALUE (base_fndecls));
|
||||
cp_warning_at (ec_by, 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 ("private member `%#D' in anonymous union",
|
||||
cp_pedwarn_at (ec_private_member_in_anonymous_union,
|
||||
*uelt);
|
||||
else if (TREE_PROTECTED (*uelt))
|
||||
cp_pedwarn_at ("protected member `%#D' in anonymous union",
|
||||
cp_pedwarn_at (ec_protected_member_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)))
|
||||
pedwarn ("anonymous class type not used to declare any objects");
|
||||
cp_pedwarn (ec_anonymous_class_type_not_used_to_declare_any_objects);
|
||||
|
||||
if (TYPE_SIZE (t))
|
||||
{
|
||||
if (IS_AGGR_TYPE (t))
|
||||
cp_error ("redefinition of `%#T'", t);
|
||||
cp_error (ec_redefinition_of, 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 ("initializer specified for non-virtual method `%D'", x);
|
||||
cp_error_at (ec_initializer_specified_for_nonvirtual_method, 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 ("field `%D' in local class cannot be static", x);
|
||||
cp_error_at (ec_field_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 ("field `%D' invalidly declared function type",
|
||||
cp_error_at (ec_field_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 ("field `%D' invalidly declared method type", x);
|
||||
cp_error_at (ec_field_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 ("field `%D' invalidly declared offset type", x);
|
||||
cp_error_at (ec_field_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 ("field `%D' declared static in union", x);
|
||||
cp_error_at (ec_field_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 ("non-static reference `%#D' in class without a constructor", x);
|
||||
cp_warning_at (ec_nonstatic_reference_name_in_class_without_a_constructor, x);
|
||||
else
|
||||
cp_warning_at ("non-static reference in class without a constructor", x);
|
||||
cp_warning_at (ec_nonstatic_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 ("non-static const member `%#D' in class without a constructor", x);
|
||||
cp_warning_at (ec_nonstatic_const_member_name_in_class_without_a_constructor, x);
|
||||
else
|
||||
cp_warning_at ("non-static const member in class without a constructor", x);
|
||||
cp_warning_at (ec_nonstatic_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 ("bit-field `%#D' with non-integral type", x);
|
||||
cp_error_at (ec_bitfield_with_nonintegral_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 ("bit-field `%D' width not an integer constant",
|
||||
cp_error_at (ec_bitfield_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 ("negative width in bit-field `%D'", x);
|
||||
cp_error_at (ec_negative_width_in_bitfield, x);
|
||||
}
|
||||
else if (width == 0 && DECL_NAME (x) != 0)
|
||||
{
|
||||
DECL_INITIAL (x) = NULL;
|
||||
cp_error_at ("zero width for bit-field `%D'", x);
|
||||
cp_error_at (ec_zero_width_for_bitfield, 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 (" in declaration of `%D'", x);
|
||||
cp_error_at (ec_in_declaration_of, 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 ("width of `%D' exceeds its type", x);
|
||||
cp_warning_at (ec_width_of_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 ("`%D' is too small to hold all values of `%#T'",
|
||||
cp_warning_at (ec_is_too_small_to_hold_all_values_of,
|
||||
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 ("member `%#D' with %s not allowed in union", x,
|
||||
cp_error_at (ec_member_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 ("member `%#D' with only non-default constructor", x);
|
||||
cp_pedwarn_at (ec_member_decl_with_only_nondefault_constructor, x);
|
||||
else
|
||||
cp_pedwarn_at ("member with only non-default constructor", x);
|
||||
cp_pedwarn_at ("in class without a constructor",
|
||||
cp_pedwarn_at (ec_member_with_only_nondefault_constructor, x);
|
||||
cp_pedwarn_at (ec_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 ("multiple fields in union `%T' initialized");
|
||||
cp_error_at (ec_multiple_fields_in_union_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 ("`%#T' has pointer data members", t);
|
||||
cp_warning (ec_has_pointer_data_members, t);
|
||||
|
||||
if (! TYPE_HAS_INIT_REF (t))
|
||||
{
|
||||
cp_warning (" but does not override `%T(const %T&)'", t, t);
|
||||
cp_warning (ec_but_does_not_override_const, t, t);
|
||||
if (! TYPE_HAS_ASSIGN_REF (t))
|
||||
cp_warning (" or `operator=(const %T&)'", t);
|
||||
cp_warning (ec_or_operatorconst, t);
|
||||
}
|
||||
else if (! TYPE_HAS_ASSIGN_REF (t))
|
||||
cp_warning (" but does not override `operator=(const %T&)'", t);
|
||||
cp_warning (ec_but_does_not_override_operatorconst, 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 ("`%#T' only defines private constructors and has no friends",
|
||||
cp_warning (ec_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 ("data member `%#D' conflicts with", x);
|
||||
cp_error_at ("function member `%#D'",
|
||||
cp_error_at (ec_data_member_conflicts_with, x);
|
||||
cp_error_at (ec_function_member,
|
||||
OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
|
||||
break;
|
||||
}
|
||||
|
@ -3845,7 +3845,7 @@ finish_struct_1 (t, warn_anon)
|
|||
}
|
||||
|
||||
#ifdef NOTQUITE
|
||||
cp_warning ("Doing hard virtuals for %T...", t);
|
||||
cp_warning (ec_oing_hard_virtuals_for, 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 ("`%#T' has virtual functions but non-virtual destructor",
|
||||
cp_warning (ec_has_virtual_functions_but_nonvirtual_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 ("declaration of identifier `%D' as `%+#D'",
|
||||
cp_pedwarn_at (ec_declaration_of_identifier_as,
|
||||
name, x);
|
||||
cp_pedwarn_at ("conflicts with other use in class as `%#D'",
|
||||
cp_pedwarn_at (ec_conflicts_with_other_use_in_class_as,
|
||||
icv);
|
||||
}
|
||||
}
|
||||
|
@ -4347,7 +4347,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
|
|||
if (current_class_type)
|
||||
popclass (0);
|
||||
else
|
||||
error ("trying to finish struct, but kicked out due to previous parse errors.");
|
||||
cp_error (ec_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
|
||||
error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
|
||||
cp_error (ec_language_string_not_recognized, IDENTIFIER_POINTER (name));
|
||||
}
|
||||
|
||||
/* Get out of the current language scope. */
|
||||
|
@ -4821,7 +4821,7 @@ validate_lhs (lhstype, complain)
|
|||
else
|
||||
{
|
||||
if (complain)
|
||||
error ("invalid type combination for overload");
|
||||
cp_error (ec_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)
|
||||
error ("not enough type information");
|
||||
cp_error (ec_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 ("argument of type `%T' does not match `%T'",
|
||||
cp_error (ec_argument_of_type_does_not_match,
|
||||
TREE_TYPE (rhs), lhstype);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -4960,14 +4960,14 @@ instantiate_type (lhstype, rhs, complain)
|
|||
if (field)
|
||||
{
|
||||
if (complain)
|
||||
error ("ambiguous overload for COMPONENT_REF requested");
|
||||
cp_error (ec_ambiguous_overload_for_requested);
|
||||
return error_mark_node;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (complain)
|
||||
error ("no appropriate overload exists for COMPONENT_REF");
|
||||
cp_error (ec_no_appropriate_overload_exists_for);
|
||||
return error_mark_node;
|
||||
}
|
||||
#endif
|
||||
|
@ -5004,9 +5004,8 @@ instantiate_type (lhstype, rhs, complain)
|
|||
&& TREE_CODE (lhstype) != METHOD_TYPE)
|
||||
{
|
||||
if (complain)
|
||||
cp_error("cannot resolve overloaded function `%D' "
|
||||
"based on non-function type",
|
||||
DECL_NAME (OVL_FUNCTION (rhs)));
|
||||
cp_error (ec_cannot_resolve_overloaded_function,
|
||||
DECL_NAME (OVL_FUNCTION (rhs)));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -5048,7 +5047,7 @@ instantiate_type (lhstype, rhs, complain)
|
|||
{
|
||||
if (save_elem)
|
||||
{
|
||||
cp_error ("ambiguous template instantiation converting to `%#T'", lhstype);
|
||||
cp_error (ec_ambiguous_template_instantiation_converting_to, lhstype);
|
||||
return error_mark_node;
|
||||
}
|
||||
save_elem = instantiate_template (elem, t);
|
||||
|
@ -5092,11 +5091,10 @@ instantiate_type (lhstype, rhs, complain)
|
|||
{
|
||||
if (complain)
|
||||
{
|
||||
cp_error
|
||||
("cannot resolve overload to target type `%#T'",
|
||||
cp_error (ec_cannot_resolve_overload_to_target_type,
|
||||
lhstype);
|
||||
cp_error_at (" ambiguity between `%#D'", save_elem);
|
||||
cp_error_at (" and `%#D', at least", elem);
|
||||
cp_error_at (ec_ambiguity_between, save_elem);
|
||||
cp_error_at (ec_and_at_least, elem);
|
||||
}
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -5108,9 +5106,8 @@ instantiate_type (lhstype, rhs, complain)
|
|||
/* We failed to find a match. */
|
||||
if (complain)
|
||||
{
|
||||
cp_error ("cannot resolve overload to target type `%#T'", lhstype);
|
||||
cp_error
|
||||
(" because no suitable overload of function `%D' exists",
|
||||
cp_error (ec_cannot_resolve_overload_to_target_type, lhstype);
|
||||
cp_error (ec_because_no_suitable_overload_of_function_exists,
|
||||
DECL_NAME (OVL_FUNCTION (rhs)));
|
||||
}
|
||||
return error_mark_node;
|
||||
|
@ -5179,7 +5176,7 @@ instantiate_type (lhstype, rhs, complain)
|
|||
if (elem)
|
||||
{
|
||||
if (complain)
|
||||
error ("ambiguous overload for overloaded method requested");
|
||||
cp_error (ec_ambiguous_overload_for_overloaded_method_requested);
|
||||
return error_mark_node;
|
||||
}
|
||||
mark_used (save_elem);
|
||||
|
@ -5204,7 +5201,7 @@ instantiate_type (lhstype, rhs, complain)
|
|||
#endif
|
||||
}
|
||||
if (complain)
|
||||
cp_error ("no compatible member functions named `%D'", name);
|
||||
cp_error (ec_no_compatible_member_functions_named, name);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -5262,7 +5259,7 @@ instantiate_type (lhstype, rhs, complain)
|
|||
case POSTINCREMENT_EXPR:
|
||||
case POSTDECREMENT_EXPR:
|
||||
if (complain)
|
||||
error ("invalid operation on uninstantiated type");
|
||||
cp_error (ec_invalid_operation_on_uninstantiated_type);
|
||||
return error_mark_node;
|
||||
|
||||
case TRUTH_AND_EXPR:
|
||||
|
@ -5278,14 +5275,14 @@ instantiate_type (lhstype, rhs, complain)
|
|||
case TRUTH_ORIF_EXPR:
|
||||
case TRUTH_NOT_EXPR:
|
||||
if (complain)
|
||||
error ("not enough type information");
|
||||
cp_error (ec_not_enough_type_information);
|
||||
return error_mark_node;
|
||||
|
||||
case COND_EXPR:
|
||||
if (type_unknown_p (TREE_OPERAND (rhs, 0)))
|
||||
{
|
||||
if (complain)
|
||||
error ("not enough type information");
|
||||
cp_error (ec_not_enough_type_information);
|
||||
return error_mark_node;
|
||||
}
|
||||
TREE_OPERAND (rhs, 1)
|
||||
|
@ -5315,7 +5312,7 @@ instantiate_type (lhstype, rhs, complain)
|
|||
else if (TREE_CODE (lhstype) != POINTER_TYPE)
|
||||
{
|
||||
if (complain)
|
||||
error ("type for resolving address of overloaded function must be pointer type");
|
||||
cp_error (ec_type_for_resolving_address_of_overloaded_function_must_be_pointer_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
{
|
||||
|
|
2469
gcc/cp/cp-error.def
Normal file
2469
gcc/cp/cp-error.def
Normal file
File diff suppressed because it is too large
Load diff
|
@ -493,6 +493,16 @@ 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. */
|
||||
|
@ -2240,6 +2250,9 @@ 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;
|
||||
|
@ -2627,6 +2640,7 @@ extern tree handle_class_head PROTO((tree, tree, tree));
|
|||
extern tree lookup_arg_dependent PROTO((tree, tree, tree));
|
||||
|
||||
/* in errfn.c */
|
||||
#ifndef NO_CP_ERROR_FNS
|
||||
extern void cp_error ();
|
||||
extern void cp_error_at ();
|
||||
extern void cp_warning ();
|
||||
|
@ -2635,6 +2649,8 @@ extern void cp_pedwarn ();
|
|||
extern void cp_pedwarn_at ();
|
||||
extern void cp_compiler_error ();
|
||||
extern void cp_sprintf ();
|
||||
#endif
|
||||
extern void cp_enable_warning PROTO((int, int));
|
||||
|
||||
/* in error.c */
|
||||
extern void init_error PROTO((void));
|
||||
|
|
46
gcc/cp/cvt.c
46
gcc/cp/cvt.c
|
@ -80,7 +80,7 @@ cp_convert_to_pointer (type, expr)
|
|||
intype = complete_type (intype);
|
||||
if (TYPE_SIZE (intype) == NULL_TREE)
|
||||
{
|
||||
cp_error ("can't convert from incomplete type `%T' to `%T'",
|
||||
cp_error (ec_cant_convert_from_incomplete_type_to,
|
||||
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 ("conversion of `%E' from `%T' to `%T' is ambiguous",
|
||||
cp_error (ec_conversion_of_from_to_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 ("converting from `%T' to `%T'", TREE_TYPE (expr),
|
||||
cp_pedwarn (ec_converting_from_to, 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 ("cannot convert `%E' from type `%T' to type `%T'",
|
||||
cp_error (ec_cannot_convert_from_type_to_type,
|
||||
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 ("cannot convert `%E' from type `%T' to type `%T'",
|
||||
cp_error (ec_cannot_convert_from_type_to_type,
|
||||
expr, intype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ convert_to_pointer_force (type, expr)
|
|||
if (distance == -2)
|
||||
{
|
||||
ambig:
|
||||
cp_error ("type `%T' is ambiguous baseclass of `%s'",
|
||||
cp_error (ec_type_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 ("initialization of non-const reference `%#T' from rvalue `%T'",
|
||||
cp_pedwarn (ec_initialization_of_nonconst_reference_from_rvalue,
|
||||
reftype, intype);
|
||||
else
|
||||
cp_pedwarn ("conversion to non-const `%T' from rvalue `%T'",
|
||||
cp_pedwarn (ec_conversion_to_nonconst_from_rvalue,
|
||||
reftype, intype);
|
||||
}
|
||||
else if (! (convtype & CONV_CONST))
|
||||
{
|
||||
if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
|
||||
cp_pedwarn ("conversion from `%T' to `%T' discards const",
|
||||
cp_pedwarn (ec_conversion_from_to_discards_const,
|
||||
ttr, reftype);
|
||||
else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
|
||||
cp_pedwarn ("conversion from `%T' to `%T' discards volatile",
|
||||
cp_pedwarn (ec_conversion_from_to_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 ("casting `%T' to `%T' does not dereference pointer",
|
||||
cp_warning (ec_casting_to_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 ("initializing non-const `%T' with `%T' will use a temporary",
|
||||
cp_pedwarn (ec_initializing_nonconst_with_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 ("cannot convert type `%T' to type `%T'", intype, reftype);
|
||||
cp_error (ec_cannot_convert_type_to_type, 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 ("cannot convert a pointer of type `%T' to a pointer of type `%T'",
|
||||
cp_error (ec_cannot_convert_a_pointer_of_type_to_a_pointer_of_type,
|
||||
intype, type);
|
||||
|
||||
if (distance == -2)
|
||||
cp_error ("because `%T' is an ambiguous base class", type);
|
||||
cp_error (ec_because_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 ("conversion from `%#T' to `%#T'", intype, type);
|
||||
cp_pedwarn (ec_conversion_from_to, 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 ("`%#T' used where a `%T' was expected", intype, type);
|
||||
cp_error (ec_used_where_a_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 ("the address of `%D', will always be `true'", expr);
|
||||
cp_warning (ec_the_address_of_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 ("`%#T' used where a floating point value was expected",
|
||||
cp_error (ec_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 ("conversion from `%T' to non-scalar type `%T' requested",
|
||||
cp_error (ec_conversion_from_to_nonscalar_type_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 ("converting NULL to non-pointer type");
|
||||
cp_warning (ec_converting_null_to_nonpointer_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 ("ambiguous default type conversion from `%T'",
|
||||
cp_error (ec_ambiguous_default_type_conversion_from,
|
||||
basetype);
|
||||
cp_error (" candidate conversions include `%D' and `%D'",
|
||||
cp_error (ec_candidate_conversions_include_and,
|
||||
winner, cand);
|
||||
}
|
||||
return error_mark_node;
|
||||
|
|
788
gcc/cp/decl.c
788
gcc/cp/decl.c
File diff suppressed because it is too large
Load diff
196
gcc/cp/decl2.c
196
gcc/cp/decl2.c
|
@ -181,6 +181,9 @@ 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;
|
||||
|
@ -487,7 +490,8 @@ 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}
|
||||
{"weak", &flag_weak, 1},
|
||||
{"diag-codes", &flag_diag_codes, 1}
|
||||
};
|
||||
|
||||
/* Decode the string P as a language-specific option.
|
||||
|
@ -530,7 +534,7 @@ lang_decode_option (argc, argv)
|
|||
|
||||
if (!strcmp (p, "handle-exceptions")
|
||||
|| !strcmp (p, "no-handle-exceptions"))
|
||||
warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
|
||||
cp_warning (ec_fhandleexceptions_has_been_renamed_to_fexceptions_and_is_now_on_by_default);
|
||||
|
||||
if (!strcmp (p, "memoize-lookups")
|
||||
|| !strcmp (p, "no-memoize-lookups")
|
||||
|
@ -549,7 +553,7 @@ lang_decode_option (argc, argv)
|
|||
|| !strcmp (p, "no-nonnull-objects")
|
||||
|| !strcmp (p, "no-ansi-overloading"))
|
||||
{
|
||||
warning ("-f%s is no longer supported", p);
|
||||
cp_warning (ec_fs_is_no_longer_supported, p);
|
||||
found = 1;
|
||||
}
|
||||
else if (! strcmp (p, "alt-external-templates"))
|
||||
|
@ -602,7 +606,7 @@ lang_decode_option (argc, argv)
|
|||
endp++;
|
||||
else
|
||||
{
|
||||
error ("Invalid option `%s'", p - 2);
|
||||
cp_error (ec_invalid_option_s, p - 2);
|
||||
goto template_depth_lose;
|
||||
}
|
||||
}
|
||||
|
@ -618,7 +622,7 @@ lang_decode_option (argc, argv)
|
|||
endp++;
|
||||
else
|
||||
{
|
||||
error ("Invalid option `%s'", p - 2);
|
||||
cp_error (ec_invalid_option_s, p - 2);
|
||||
goto mangling_version_lose;
|
||||
}
|
||||
}
|
||||
|
@ -711,6 +715,25 @@ 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"))
|
||||
|
@ -781,7 +804,7 @@ grok_method_quals (ctype, function, quals)
|
|||
if (TREE_VALUE (quals) == ridpointers[(int)RID_CONST])
|
||||
{
|
||||
if (TYPE_READONLY (ctype))
|
||||
error ("duplicate `%s' %s",
|
||||
cp_error (ec_duplicate_s_s,
|
||||
IDENTIFIER_POINTER (TREE_VALUE (quals)),
|
||||
(TREE_CODE (function) == FUNCTION_DECL
|
||||
? "for member function" : "in type declaration"));
|
||||
|
@ -791,7 +814,7 @@ grok_method_quals (ctype, function, quals)
|
|||
else if (TREE_VALUE (quals) == ridpointers[(int)RID_VOLATILE])
|
||||
{
|
||||
if (TYPE_VOLATILE (ctype))
|
||||
error ("duplicate `%s' %s",
|
||||
cp_error (ec_duplicate_s_s,
|
||||
IDENTIFIER_POINTER (TREE_VALUE (quals)),
|
||||
(TREE_CODE (function) == FUNCTION_DECL
|
||||
? "for member function" : "in type declaration"));
|
||||
|
@ -837,13 +860,13 @@ warn_if_unknown_interface (decl)
|
|||
lineno = til->line;
|
||||
input_filename = til->file;
|
||||
}
|
||||
cp_warning ("template `%#D' instantiated in file without #pragma interface",
|
||||
cp_warning (ec_template_instantiated_in_file_without_pragma_interface,
|
||||
decl);
|
||||
lineno = sl;
|
||||
input_filename = sf;
|
||||
}
|
||||
else
|
||||
cp_warning_at ("template `%#D' defined in file without #pragma interface",
|
||||
cp_warning_at (ec_template_defined_in_file_without_pragma_interface,
|
||||
decl);
|
||||
}
|
||||
|
||||
|
@ -866,7 +889,7 @@ grok_x_components (specs, components)
|
|||
|
||||
if (t == NULL_TREE)
|
||||
{
|
||||
error ("error in component specification");
|
||||
cp_error (ec_error_in_component_specification);
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
|
@ -933,7 +956,7 @@ grok_x_components (specs, components)
|
|||
q = &TREE_CHAIN (*q);
|
||||
}
|
||||
if (TYPE_METHODS (t))
|
||||
error ("an anonymous union cannot have function members");
|
||||
cp_error (ec_an_anonymous_union_cannot_have_function_members);
|
||||
|
||||
p = &pending_inlines;
|
||||
for (; *p; *p = (*p)->next)
|
||||
|
@ -955,7 +978,7 @@ grok_x_components (specs, components)
|
|||
|
||||
default:
|
||||
if (t != void_type_node)
|
||||
error ("empty component declaration");
|
||||
cp_error (ec_empty_component_declaration);
|
||||
return NULL_TREE;
|
||||
}
|
||||
}
|
||||
|
@ -1052,7 +1075,7 @@ grokclassfn (ctype, cname, function, flags, quals)
|
|||
|
||||
if (fn_name == NULL_TREE)
|
||||
{
|
||||
error ("name missing for member function");
|
||||
cp_error (ec_name_missing_for_member_function);
|
||||
fn_name = get_identifier ("<anonymous>");
|
||||
DECL_NAME (function) = fn_name;
|
||||
}
|
||||
|
@ -1122,7 +1145,7 @@ grok_alignof (expr)
|
|||
|
||||
if (TREE_CODE (expr) == COMPONENT_REF
|
||||
&& DECL_BIT_FIELD (TREE_OPERAND (expr, 1)))
|
||||
error ("`__alignof__' applied to a bit-field");
|
||||
cp_error (ec_alignof_applied_to_a_bitfield);
|
||||
|
||||
if (TREE_CODE (expr) == INDIRECT_REF)
|
||||
{
|
||||
|
@ -1174,7 +1197,7 @@ grok_array_decl (array_expr, index_exp)
|
|||
{
|
||||
/* Something has gone very wrong. Assume we are mistakenly reducing
|
||||
an expression instead of a declaration. */
|
||||
error ("parser may be lost: is there a '{' missing somewhere?");
|
||||
cp_error (ec_parser_may_be_lost_is_there_a_missing_somewhere);
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
|
@ -1205,7 +1228,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))
|
||||
error ("ambiguous conversion for array subscript");
|
||||
cp_error (ec_ambiguous_conversion_for_array_subscript);
|
||||
|
||||
if (p1 && i2)
|
||||
array_expr = p1, index_exp = i2;
|
||||
|
@ -1213,13 +1236,13 @@ grok_array_decl (array_expr, index_exp)
|
|||
array_expr = p2, index_exp = i1;
|
||||
else
|
||||
{
|
||||
cp_error ("invalid types `%T[%T]' for array subscript",
|
||||
cp_error (ec_invalid_types_for_array_subscript,
|
||||
type, TREE_TYPE (index_exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (array_expr == error_mark_node || index_exp == error_mark_node)
|
||||
error ("ambiguous conversion for array subscript");
|
||||
cp_error (ec_ambiguous_conversion_for_array_subscript);
|
||||
|
||||
return build_array_ref (array_expr, index_exp);
|
||||
}
|
||||
|
@ -1261,7 +1284,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
|
|||
|
||||
if (t == NULL_TREE || t == error_mark_node)
|
||||
{
|
||||
cp_error ("type `%#T' argument given to `delete', expected pointer",
|
||||
cp_error (ec_type_argument_given_to_delete_expected_pointer,
|
||||
TREE_TYPE (exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -1269,7 +1292,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);
|
||||
pedwarn ("anachronistic use of array size in vector delete");
|
||||
cp_pedwarn (ec_anachronistic_use_of_array_size_in_vector_delete);
|
||||
}
|
||||
|
||||
type = TREE_TYPE (t);
|
||||
|
@ -1279,7 +1302,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
|
|||
/* You can't delete functions. */
|
||||
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
||||
{
|
||||
error ("cannot delete a function");
|
||||
cp_error (ec_cannot_delete_a_function);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1287,7 +1310,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 ("deleting array `%#D'", TREE_OPERAND (t, 0));
|
||||
cp_warning (ec_deleting_array, TREE_OPERAND (t, 0));
|
||||
|
||||
/* Deleting a pointer with the value zero is valid and has no effect. */
|
||||
if (integer_zerop (t))
|
||||
|
@ -1334,7 +1357,7 @@ check_member_template (tmpl)
|
|||
/* 14.5.2.2 [temp.mem]
|
||||
|
||||
A local class shall not have member templates. */
|
||||
cp_error ("declaration of member template `%#D' in local class",
|
||||
cp_error (ec_declaration_of_member_template_in_local_class,
|
||||
decl);
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
|
||||
|
@ -1342,8 +1365,7 @@ check_member_template (tmpl)
|
|||
/* 14.5.2.3 [temp.mem]
|
||||
|
||||
A member function template shall not be virtual. */
|
||||
cp_error
|
||||
("invalid use of `virtual' in template declaration of `%#D'",
|
||||
cp_error (ec_invalid_use_of_virtual_in_template_declaration_of,
|
||||
decl);
|
||||
DECL_VIRTUAL_P (decl) = 0;
|
||||
}
|
||||
|
@ -1353,7 +1375,7 @@ check_member_template (tmpl)
|
|||
DECL_IGNORED_P (tmpl) = 1;
|
||||
}
|
||||
else
|
||||
cp_error ("template declaration of `%#D'", decl);
|
||||
cp_error (ec_template_declaration_of, decl);
|
||||
}
|
||||
|
||||
/* Return true iff TYPE is a valid Java parameter or return type. */
|
||||
|
@ -1403,7 +1425,7 @@ check_java_method (ctype, method)
|
|||
tree ret_type = TREE_TYPE (TREE_TYPE (method));
|
||||
if (! acceptable_java_type (ret_type))
|
||||
{
|
||||
cp_error ("Java method '%D' has non-Java return type `%T'",
|
||||
cp_error (ec_ava_method_has_nonava_return_type,
|
||||
method, ret_type);
|
||||
jerr++;
|
||||
}
|
||||
|
@ -1412,7 +1434,7 @@ check_java_method (ctype, method)
|
|||
tree type = TREE_VALUE (arg_types);
|
||||
if (! acceptable_java_type (type))
|
||||
{
|
||||
cp_error ("Java method '%D' has non-Java parameter type `%T'",
|
||||
cp_error (ec_ava_method_has_nonava_parameter_type,
|
||||
method, type);
|
||||
jerr++;
|
||||
}
|
||||
|
@ -1526,17 +1548,17 @@ check_classfn (ctype, function)
|
|||
if (methods != end)
|
||||
{
|
||||
tree fndecl = *methods;
|
||||
cp_error ("prototype for `%#D' does not match any in class `%T'",
|
||||
cp_error (ec_prototype_for_does_not_match_any_in_class,
|
||||
function, ctype);
|
||||
cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is",
|
||||
cp_error_at (ec_candidates, OVL_NEXT (fndecl) ? "s are" : " is",
|
||||
OVL_CURRENT (fndecl));
|
||||
while (fndecl = OVL_NEXT (fndecl), fndecl)
|
||||
cp_error_at (" %#D", OVL_CURRENT(fndecl));
|
||||
cp_error_at (ec_candidate_2, OVL_CURRENT(fndecl));
|
||||
}
|
||||
else
|
||||
{
|
||||
methods = 0;
|
||||
cp_error ("no `%#D' member function declared in class `%T'",
|
||||
cp_error (ec_no_member_function_declared_in_class,
|
||||
function, ctype);
|
||||
}
|
||||
|
||||
|
@ -1616,7 +1638,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 ("member `%D' conflicts with virtual function table field name",
|
||||
cp_error (ec_member_conflicts_with_virtual_function_table_field_name,
|
||||
value);
|
||||
|
||||
/* Stash away type declarations. */
|
||||
|
@ -1641,13 +1663,13 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
if (IS_SIGNATURE (current_class_type)
|
||||
&& TREE_CODE (value) != FUNCTION_DECL)
|
||||
{
|
||||
error ("field declaration not allowed in signature");
|
||||
cp_error (ec_field_declaration_not_allowed_in_signature);
|
||||
return void_type_node;
|
||||
}
|
||||
|
||||
if (DECL_IN_AGGR_P (value))
|
||||
{
|
||||
cp_error ("`%D' is already defined in the class %T", value,
|
||||
cp_error (ec_is_already_defined_in_the_class, value,
|
||||
DECL_CONTEXT (value));
|
||||
return void_type_node;
|
||||
}
|
||||
|
@ -1660,7 +1682,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
if (IS_SIGNATURE (current_class_type)
|
||||
&& TREE_CODE (value) == FUNCTION_DECL)
|
||||
{
|
||||
error ("function declarations cannot have initializers in signature");
|
||||
cp_error (ec_function_declarations_cannot_have_initializers_in_signature);
|
||||
init = NULL_TREE;
|
||||
}
|
||||
else if (TREE_CODE (value) == FUNCTION_DECL)
|
||||
|
@ -1706,7 +1728,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
&& (TREE_CODE_CLASS (TREE_CODE (init)) != 'd'
|
||||
|| DECL_EXTERNAL (init) == 0)))
|
||||
{
|
||||
error ("field initializer is not constant");
|
||||
cp_error (ec_field_initializer_is_not_constant);
|
||||
init = error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -1728,8 +1750,8 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
tree olddecl = IDENTIFIER_LOCAL_VALUE (declarator);
|
||||
if (decl_template_parm_p (olddecl))
|
||||
{
|
||||
cp_error ("redeclaration of template parameter `%T'", declarator);
|
||||
cp_error_at (" previously declared here `%#D'", olddecl);
|
||||
cp_error (ec_redeclaration_of_template_parameter, declarator);
|
||||
cp_error_at (ec_previously_declared_here, olddecl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1761,9 +1783,9 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|
|||
{
|
||||
static int explanation = 0;
|
||||
|
||||
error ("initializer invalid for static member with constructor");
|
||||
cp_error (ec_initializer_invalid_for_static_member_with_constructor);
|
||||
if (explanation++ == 0)
|
||||
error ("(you really want to initialize it separately)");
|
||||
cp_error (ec_you_really_want_to_initialize_it_separately);
|
||||
init = 0;
|
||||
}
|
||||
/* Force the compiler to know when an uninitialized static
|
||||
|
@ -1812,7 +1834,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 ("method `%#D' of local class must be defined in class body",
|
||||
cp_error (ec_method_of_local_class_must_be_defined_in_class_body,
|
||||
value);
|
||||
#endif
|
||||
|
||||
|
@ -1842,7 +1864,7 @@ grokbitfield (declarator, declspecs, width)
|
|||
|
||||
if (TREE_CODE (value) == TYPE_DECL)
|
||||
{
|
||||
cp_error ("cannot declare `%D' to be a bitfield type", value);
|
||||
cp_error (ec_cannot_declare_to_be_a_bitfield_type, value);
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
|
@ -1852,20 +1874,20 @@ grokbitfield (declarator, declspecs, width)
|
|||
check here. */
|
||||
if (TREE_CODE (value) == FUNCTION_DECL)
|
||||
{
|
||||
cp_error ("cannot declare bitfield `%D' with funcion type",
|
||||
cp_error (ec_cannot_declare_bitfield_with_funcion_type,
|
||||
DECL_NAME (value));
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
if (IS_SIGNATURE (current_class_type))
|
||||
{
|
||||
error ("field declaration not allowed in signature");
|
||||
cp_error (ec_field_declaration_not_allowed_in_signature);
|
||||
return void_type_node;
|
||||
}
|
||||
|
||||
if (DECL_IN_AGGR_P (value))
|
||||
{
|
||||
cp_error ("`%D' is already defined in the class %T", value,
|
||||
cp_error (ec_is_already_defined_in_the_class, value,
|
||||
DECL_CONTEXT (value));
|
||||
return void_type_node;
|
||||
}
|
||||
|
@ -1874,7 +1896,7 @@ grokbitfield (declarator, declspecs, width)
|
|||
|
||||
if (TREE_STATIC (value))
|
||||
{
|
||||
cp_error ("static member `%D' cannot be a bitfield", value);
|
||||
cp_error (ec_static_member_cannot_be_a_bitfield, value);
|
||||
return NULL_TREE;
|
||||
}
|
||||
cp_finish_decl (value, NULL_TREE, NULL_TREE, 0, 0);
|
||||
|
@ -1965,11 +1987,11 @@ grok_function_init (decl, init)
|
|||
tree type = TREE_TYPE (decl);
|
||||
|
||||
if (TREE_CODE (type) == FUNCTION_TYPE)
|
||||
cp_error ("initializer specified for non-member function `%D'", decl);
|
||||
cp_error (ec_initializer_specified_for_nonmember_function, decl);
|
||||
#if 0
|
||||
/* We'll check for this in finish_struct_1. */
|
||||
else if (DECL_VINDEX (decl) == NULL_TREE)
|
||||
cp_error ("initializer specified for non-virtual method `%D'", decl);
|
||||
cp_error (ec_initializer_specified_for_nonvirtual_method, decl);
|
||||
#endif
|
||||
else if (integer_zerop (init))
|
||||
{
|
||||
|
@ -1997,7 +2019,7 @@ grok_function_init (decl, init)
|
|||
}
|
||||
}
|
||||
else
|
||||
cp_error ("invalid initializer for virtual method `%D'", decl);
|
||||
cp_error (ec_invalid_initializer_for_virtual_method, decl);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2220,9 +2242,9 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
|
|||
continue;
|
||||
|
||||
if (TREE_PRIVATE (field))
|
||||
cp_pedwarn_at ("private member `%#D' in anonymous union", field);
|
||||
cp_pedwarn_at (ec_private_member_in_anonymous_union, field);
|
||||
else if (TREE_PROTECTED (field))
|
||||
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
|
||||
cp_pedwarn_at (ec_protected_member_in_anonymous_union, field);
|
||||
|
||||
if (DECL_NAME (field) == NULL_TREE
|
||||
&& TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
|
||||
|
@ -2292,7 +2314,7 @@ finish_anon_union (anon_union_decl)
|
|||
|
||||
if (public_p)
|
||||
{
|
||||
error ("global anonymous unions must be declared static");
|
||||
cp_error (ec_global_anonymous_unions_must_be_declared_static);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2308,7 +2330,7 @@ finish_anon_union (anon_union_decl)
|
|||
}
|
||||
else
|
||||
{
|
||||
warning ("anonymous union with no members");
|
||||
cp_warning (ec_anonymous_union_with_no_members);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2368,15 +2390,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, error ("`operator new' must return type `void *'");
|
||||
e1 = 1, cp_error (ec_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, error ("`operator new' takes type `size_t' parameter");
|
||||
e1 = 1, cp_error (ec_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, error ("`operator new' takes type `size_t' as first parameter");
|
||||
e2 = 1, cp_error (ec_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)
|
||||
|
@ -2401,11 +2423,11 @@ coerce_delete_type (type)
|
|||
}
|
||||
|
||||
if (TREE_TYPE (type) != void_type_node)
|
||||
e1 = 1, error ("`operator delete' must return type `void'");
|
||||
e1 = 1, cp_error (ec_operator_delete_must_return_type_void);
|
||||
|
||||
if (arg_types == NULL_TREE
|
||||
|| TREE_VALUE (arg_types) != ptr_type_node)
|
||||
e2 = 1, error ("`operator delete' takes type `void *' as first parameter");
|
||||
e2 = 1, cp_error (ec_operator_delete_takes_type_void_as_first_parameter);
|
||||
|
||||
#if 0
|
||||
if (arg_types
|
||||
|
@ -2417,14 +2439,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, error ("second argument to `operator delete' must be of type `size_t'");
|
||||
e3 = 1, cp_error (ec_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)))
|
||||
error ("too many arguments in declaration of `operator delete'");
|
||||
cp_error (ec_too_many_arguments_in_declaration_of_operator_delete);
|
||||
else
|
||||
error ("`...' invalid in specification of `operator delete'");
|
||||
cp_error (ec_invalid_in_specification_of_operator_delete);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2981,7 +3003,7 @@ setup_initp ()
|
|||
if (! flag_init_priority)
|
||||
{
|
||||
for (t = static_aggregates_initp; t; t = TREE_CHAIN (t))
|
||||
cp_warning ("init_priority for `%#D' ignored without -finit-priority",
|
||||
cp_warning (ec_init_priority_for_ignored_without_finitpriority,
|
||||
TREE_VALUE (t));
|
||||
return;
|
||||
}
|
||||
|
@ -3662,7 +3684,7 @@ reparse_absdcl_as_casts (decl, expr)
|
|||
|
||||
if (IS_SIGNATURE (type))
|
||||
{
|
||||
error ("cast specifies signature type");
|
||||
cp_error (ec_cast_specifies_signature_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3683,7 +3705,7 @@ reparse_absdcl_as_casts (decl, expr)
|
|||
}
|
||||
|
||||
if (warn_old_style_cast)
|
||||
warning ("use of old-style cast");
|
||||
cp_warning (ec_use_of_oldstyle_cast);
|
||||
|
||||
return expr;
|
||||
}
|
||||
|
@ -4024,7 +4046,7 @@ check_cp_case_value (value)
|
|||
if (TREE_CODE (value) != INTEGER_CST
|
||||
&& value != error_mark_node)
|
||||
{
|
||||
cp_error ("case label `%E' does not reduce to an integer constant",
|
||||
cp_error (ec_case_label_does_not_reduce_to_an_integer_constant,
|
||||
value);
|
||||
value = error_mark_node;
|
||||
}
|
||||
|
@ -4188,10 +4210,10 @@ ambiguous_decl (name, old, new, flags)
|
|||
/* Some declarations are functions, some are not. */
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
cp_error ("use of `%D' is ambiguous", name);
|
||||
cp_error_at (" first declared as `%#D' here",
|
||||
cp_error (ec_use_of_is_ambiguous, name);
|
||||
cp_error_at (ec_first_declared_as_here,
|
||||
BINDING_VALUE (old));
|
||||
cp_error_at (" also declared as `%#D' here", val);
|
||||
cp_error_at (ec_also_declared_as_here, val);
|
||||
}
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -4206,9 +4228,9 @@ ambiguous_decl (name, old, new, flags)
|
|||
{
|
||||
if (flags & LOOKUP_COMPLAIN)
|
||||
{
|
||||
cp_error ("`%D' denotes an ambiguous type",name);
|
||||
cp_error_at (" first type here", BINDING_TYPE (old));
|
||||
cp_error_at (" other type here", type);
|
||||
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);
|
||||
}
|
||||
}
|
||||
return old;
|
||||
|
@ -4295,7 +4317,7 @@ set_decl_namespace (decl, scope)
|
|||
scope = ORIGINAL_NAMESPACE (scope);
|
||||
|
||||
if (!is_namespace_ancestor (current_namespace, scope))
|
||||
cp_error ("declaration of `%D' not in a namespace surrounding `%D'",
|
||||
cp_error (ec_declaration_of_not_in_a_namespace_surrounding,
|
||||
decl, scope);
|
||||
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
|
||||
if (scope != current_namespace)
|
||||
|
@ -4320,7 +4342,7 @@ set_decl_namespace (decl, scope)
|
|||
else
|
||||
return;
|
||||
complain:
|
||||
cp_error ("`%D' should have been declared inside `%D'",
|
||||
cp_error (ec_should_have_been_declared_inside,
|
||||
decl, scope);
|
||||
}
|
||||
|
||||
|
@ -4423,9 +4445,9 @@ add_function (k, fn)
|
|||
{
|
||||
fn = f1; f1 = f2; f2 = fn;
|
||||
}
|
||||
cp_error_at ("`%D' is not a function,", f1);
|
||||
cp_error_at (" conflict with `%D'", f2);
|
||||
cp_error (" in call to `%D'", k->name);
|
||||
cp_error_at (ec_is_not_a_function, f1);
|
||||
cp_error_at (ec_conflict_with, f2);
|
||||
cp_error (ec_in_call_to, k->name);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
@ -4693,7 +4715,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 ("unknown namespace `%D'", namespace);
|
||||
cp_error (ec_unknown_namespace, namespace);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4755,7 +4777,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
|
|||
|
||||
if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls))
|
||||
{
|
||||
cp_error ("`%D' not declared", name);
|
||||
cp_error (ec_not_declared, name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4803,7 +4825,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
|
|||
*newtype = BINDING_TYPE (decls);
|
||||
if (oldtype && *newtype && oldtype != *newtype)
|
||||
{
|
||||
cp_error ("using directive `%D' introduced ambiguous type `%T'",
|
||||
cp_error (ec_using_directive_introduced_ambiguous_type,
|
||||
name, oldtype);
|
||||
return;
|
||||
}
|
||||
|
@ -4870,13 +4892,13 @@ do_class_using_decl (decl)
|
|||
if (TREE_CODE (decl) != SCOPE_REF
|
||||
|| TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (decl, 0))) != 't')
|
||||
{
|
||||
cp_error ("using-declaration for non-member at class scope");
|
||||
cp_error (ec_usingdeclaration_for_nonmember_at_class_scope);
|
||||
return NULL_TREE;
|
||||
}
|
||||
name = TREE_OPERAND (decl, 1);
|
||||
if (TREE_CODE (name) == BIT_NOT_EXPR)
|
||||
{
|
||||
cp_error ("using-declaration for destructor");
|
||||
cp_error (ec_usingdeclaration_for_destructor);
|
||||
return NULL_TREE;
|
||||
}
|
||||
if (TREE_CODE (name) == TYPE_DECL)
|
||||
|
@ -4903,12 +4925,12 @@ do_using_directive (namespace)
|
|||
if (TREE_CODE (namespace) == IDENTIFIER_NODE)
|
||||
{
|
||||
/* Lookup in lexer did not find a namespace. */
|
||||
cp_error ("namespace `%T' undeclared", namespace);
|
||||
cp_error (ec_namespace_undeclared, namespace);
|
||||
return;
|
||||
}
|
||||
if (TREE_CODE (namespace) != NAMESPACE_DECL)
|
||||
{
|
||||
cp_error ("`%T' is not a namespace", namespace);
|
||||
cp_error (ec_is_not_a_namespace, namespace);
|
||||
return;
|
||||
}
|
||||
namespace = ORIGINAL_NAMESPACE (namespace);
|
||||
|
@ -4931,7 +4953,7 @@ check_default_args (x)
|
|||
saw_def = 1;
|
||||
else if (saw_def)
|
||||
{
|
||||
cp_error_at ("default argument missing for parameter %P of `%+#D'",
|
||||
cp_error_at (ec_default_argument_missing_for_parameter_of,
|
||||
i, x);
|
||||
break;
|
||||
}
|
||||
|
@ -4976,9 +4998,9 @@ handle_class_head (aggr, scope, id)
|
|||
return id;
|
||||
|
||||
if (scope)
|
||||
cp_error ("`%T' does not have a nested type named `%D'", scope, id);
|
||||
cp_error (ec_does_not_have_a_nested_type_named, scope, id);
|
||||
else
|
||||
cp_error ("no file-scope type named `%D'", id);
|
||||
cp_error (ec_no_filescope_type_named, id);
|
||||
|
||||
id = xref_tag
|
||||
(aggr, make_anon_name (), 1);
|
||||
|
|
120
gcc/cp/errfn.c
120
gcc/cp/errfn.c
|
@ -23,6 +23,10 @@ Boston, MA 02111-1307, USA. */
|
|||
#include "system.h"
|
||||
#include "tree.h"
|
||||
#include "toplev.h"
|
||||
/* The declarations of cp_error and such here are incompatible with
|
||||
those in cp-tree.h. */
|
||||
#define NO_CP_ERROR_FNS
|
||||
#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
|
||||
|
@ -37,10 +41,36 @@ 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)
|
||||
|
||||
|
@ -49,13 +79,13 @@ extern int cp_line_of PROTO((tree));
|
|||
|
||||
#ifdef __STDC__
|
||||
static void
|
||||
cp_thing (errorfn *errfn, int atarg1, const char *format, va_list ap)
|
||||
cp_thing (errorfn *errfn, int atarg1, error_code ec, va_list ap)
|
||||
#else
|
||||
static void
|
||||
cp_thing (errfn, atarg1, format, ap)
|
||||
cp_thing (errfn, atarg1, ec, ap)
|
||||
errorfn *errfn;
|
||||
int atarg1;
|
||||
const char *format;
|
||||
error_code ec;
|
||||
va_list ap;
|
||||
#endif
|
||||
{
|
||||
|
@ -66,14 +96,29 @@ cp_thing (errfn, atarg1, format, ap)
|
|||
long offset;
|
||||
const char *f;
|
||||
tree atarg = 0;
|
||||
char* format;
|
||||
|
||||
len = strlen (format) + 1;
|
||||
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 */;
|
||||
if (len > buflen)
|
||||
{
|
||||
buflen = len;
|
||||
buf = xrealloc (buf, buflen);
|
||||
}
|
||||
offset = 0;
|
||||
if (flag_diag_codes)
|
||||
{
|
||||
sprintf (buf, "[%d] ", (int) ec);
|
||||
for (offset = 0; buf[offset]; ++offset)
|
||||
;
|
||||
}
|
||||
else
|
||||
offset = 0;
|
||||
|
||||
for (f = format; *f; ++f)
|
||||
{
|
||||
|
@ -198,10 +243,10 @@ cp_thing (errfn, atarg1, format, ap)
|
|||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#define DECLARE(name) void name (const char *format, ...)
|
||||
#define INIT va_start (ap, format)
|
||||
#define DECLARE(name) void name (error_code ec, ...)
|
||||
#define INIT va_start (ap, ec)
|
||||
#else
|
||||
#define DECLARE(name) void name (format, va_alist) char *format; va_dcl
|
||||
#define DECLARE(name) void name (ec, va_alist) error_code ec; va_dcl
|
||||
#define INIT va_start (ap)
|
||||
#endif
|
||||
|
||||
|
@ -210,7 +255,7 @@ DECLARE (cp_error)
|
|||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) error, 0, format, ap);
|
||||
cp_thing ((errorfn *) error, 0, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -218,8 +263,8 @@ DECLARE (cp_warning)
|
|||
{
|
||||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) warning, 0, format, ap);
|
||||
if (! cp_silent && is_warning_enabled (ec))
|
||||
cp_thing ((errorfn *) warning, 0, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -227,8 +272,8 @@ DECLARE (cp_pedwarn)
|
|||
{
|
||||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) pedwarn, 0, format, ap);
|
||||
if (! cp_silent && is_warning_enabled (ec))
|
||||
cp_thing ((errorfn *) pedwarn, 0, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -238,7 +283,7 @@ DECLARE (cp_compiler_error)
|
|||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing (compiler_error, 0, format, ap);
|
||||
cp_thing (compiler_error, 0, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -246,7 +291,7 @@ DECLARE (cp_sprintf)
|
|||
{
|
||||
va_list ap;
|
||||
INIT;
|
||||
cp_thing ((errorfn *) sprintf, 0, format, ap);
|
||||
cp_thing ((errorfn *) sprintf, 0, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -255,7 +300,7 @@ DECLARE (cp_error_at)
|
|||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
|
||||
cp_thing ((errorfn *) error_with_file_and_line, 1, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -263,8 +308,8 @@ DECLARE (cp_warning_at)
|
|||
{
|
||||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
|
||||
if (! cp_silent && is_warning_enabled (ec))
|
||||
cp_thing ((errorfn *) warning_with_file_and_line, 1, ec, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
|
@ -272,7 +317,42 @@ DECLARE (cp_pedwarn_at)
|
|||
{
|
||||
va_list ap;
|
||||
INIT;
|
||||
if (! cp_silent)
|
||||
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
|
||||
if (! cp_silent && is_warning_enabled (ec))
|
||||
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, ec, 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;
|
||||
}
|
||||
|
|
|
@ -633,7 +633,7 @@ process_start_catch_block_old (declspecs, declarator)
|
|||
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
|
||||
|
||||
if (decl == NULL_TREE)
|
||||
error ("invalid catch parameter");
|
||||
cp_error (ec_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)
|
||||
error ("invalid catch parameter");
|
||||
cp_error (ec_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)
|
||||
error (" in thrown expression");
|
||||
cp_error (ec_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 ("throwing NULL, which has integral, not pointer type");
|
||||
cp_warning (ec_throwing_which_has_integral_not_pointer_type);
|
||||
|
||||
e = build1 (THROW_EXPR, void_type_node, e);
|
||||
TREE_SIDE_EFFECTS (e) = 1;
|
||||
|
|
|
@ -331,10 +331,10 @@ do_case (start, end)
|
|||
|
||||
if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
|
||||
&& POINTER_TYPE_P (TREE_TYPE (start)))
|
||||
error ("pointers are not permitted as case values");
|
||||
cp_error (ec_pointers_are_not_permitted_as_case_values);
|
||||
|
||||
if (end && pedantic)
|
||||
pedwarn ("ANSI C++ forbids range expressions in switch statement");
|
||||
cp_pedwarn (ec_forbids_range_expressions_in_switch_statement);
|
||||
|
||||
if (processing_template_decl)
|
||||
{
|
||||
|
@ -366,43 +366,43 @@ do_case (start, end)
|
|||
if (success == 1)
|
||||
{
|
||||
if (end)
|
||||
error ("case label not within a switch statement");
|
||||
cp_error (ec_case_label_not_within_a_switch_statement);
|
||||
else if (start)
|
||||
cp_error ("case label `%E' not within a switch statement", start);
|
||||
cp_error (ec_case_label_not_within_a_switch_statement, start);
|
||||
else
|
||||
error ("default label not within a switch statement");
|
||||
cp_error (ec_default_label_not_within_a_switch_statement);
|
||||
}
|
||||
else if (success == 2)
|
||||
{
|
||||
if (end)
|
||||
{
|
||||
error ("duplicate (or overlapping) case value");
|
||||
cp_error_at ("this is the first entry overlapping that value",
|
||||
cp_error (ec_duplicate_or_overlapping_case_value);
|
||||
cp_error_at (ec_this_is_the_first_entry_overlapping_that_value,
|
||||
duplicate);
|
||||
}
|
||||
else if (start)
|
||||
{
|
||||
cp_error ("duplicate case value `%E'", start);
|
||||
cp_error_at ("previously used here", duplicate);
|
||||
cp_error (ec_duplicate_case_value, start);
|
||||
cp_error_at (ec_previously_used_here, duplicate);
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("multiple default labels in one switch");
|
||||
cp_error_at ("this is the first default label", duplicate);
|
||||
cp_error (ec_multiple_default_labels_in_one_switch);
|
||||
cp_error_at (ec_this_is_the_first_default_label, duplicate);
|
||||
}
|
||||
}
|
||||
else if (success == 3)
|
||||
warning ("case value out of range");
|
||||
cp_warning (ec_case_value_out_of_range);
|
||||
else if (success == 4)
|
||||
warning ("empty range specified");
|
||||
cp_warning (ec_empty_range_specified);
|
||||
else if (success == 5)
|
||||
{
|
||||
if (end)
|
||||
error ("case label within scope of cleanup or variable array");
|
||||
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array);
|
||||
else if (! start)
|
||||
error ("`default' label within scope of cleanup or variable array");
|
||||
cp_error (ec_default_label_within_scope_of_cleanup_or_variable_array);
|
||||
else
|
||||
cp_error ("case label `%E' within scope of cleanup or variable array", start);
|
||||
cp_error (ec_case_label_within_scope_of_cleanup_or_variable_array, start);
|
||||
}
|
||||
}
|
||||
if (start)
|
||||
|
|
|
@ -155,9 +155,9 @@ add_friend (type, decl)
|
|||
{
|
||||
if (decl == TREE_VALUE (friends))
|
||||
{
|
||||
cp_warning ("`%D' is already a friend of class `%T'",
|
||||
cp_warning (ec_is_already_a_friend_of_class,
|
||||
decl, type);
|
||||
cp_warning_at ("previous friend declaration of `%D'",
|
||||
cp_warning_at (ec_previous_friend_declaration_of,
|
||||
TREE_VALUE (friends));
|
||||
return;
|
||||
}
|
||||
|
@ -205,11 +205,11 @@ add_friends (type, name, friend_type)
|
|||
if (friends)
|
||||
{
|
||||
if (friend_type)
|
||||
warning ("method `%s::%s' is already a friend of class",
|
||||
cp_warning (ec_method_ss_is_already_a_friend_of_class,
|
||||
TYPE_NAME_STRING (friend_type),
|
||||
IDENTIFIER_POINTER (name));
|
||||
else
|
||||
warning ("function `%s' is already a friend of class `%s'",
|
||||
cp_warning (ec_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))
|
||||
{
|
||||
error ("`friend' declaration in signature definition");
|
||||
cp_error (ec_friend_declaration_in_signature_definition);
|
||||
return;
|
||||
}
|
||||
if (IS_SIGNATURE (friend_type))
|
||||
{
|
||||
error ("signature type `%s' declared `friend'",
|
||||
cp_error (ec_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 ("partial specialization `%T' declared `friend'",
|
||||
cp_error (ec_partial_specialization_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))
|
||||
{
|
||||
pedwarn ("class `%s' is implicitly friends with itself",
|
||||
cp_pedwarn (ec_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 ("`%T' is already a friend of `%T'",
|
||||
cp_warning (ec_is_already_a_friend_of,
|
||||
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 ("member `%D' declared as friend before type `%T' defined",
|
||||
cp_error (ec_member_declared_as_friend_before_type_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 ("method `%D' is not a member of class `%T'",
|
||||
cp_error (ec_method_is_not_a_member_of_class,
|
||||
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 ("friend declaration `%#D'", decl);
|
||||
warning (" declares a non-template function");
|
||||
cp_warning (ec_friend_declaration, decl);
|
||||
cp_warning (ec_declares_a_nontemplate_function);
|
||||
if (! explained)
|
||||
{
|
||||
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");
|
||||
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);
|
||||
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 ("implicitly declaring `%T' as struct", declarator);
|
||||
cp_warning (ec_implicitly_declaring_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 ("`friend %T' archaic, use `friend class %T' instead",
|
||||
cp_warning (ec_friend_archaic_use_friend_class_instead,
|
||||
declarator, declarator);
|
||||
decl = TREE_TYPE (TREE_PURPOSE (decl));
|
||||
}
|
||||
|
|
134
gcc/cp/init.c
134
gcc/cp/init.c
|
@ -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 ("default-initialization of `%#D', which has reference type",
|
||||
cp_error (ec_defaultinitialization_of_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 ("uninitialized reference member `%D'", member);
|
||||
cp_pedwarn (ec_uninitialized_reference_member, 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))
|
||||
{
|
||||
warning ("initializer list treated as compound expression");
|
||||
cp_warning (ec_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 ("member initializers for `%#D'", last_field);
|
||||
cp_warning_at (" and `%#D'", field);
|
||||
warning (" will be re-ordered to match declaration order");
|
||||
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);
|
||||
}
|
||||
last_pos = pos;
|
||||
last_field = field;
|
||||
|
@ -329,7 +329,7 @@ sort_member_init (t)
|
|||
{
|
||||
if (purpose_member (name, init_list))
|
||||
{
|
||||
cp_error ("multiple initializations given for member `%D'",
|
||||
cp_error (ec_multiple_initializations_given_for_member,
|
||||
IDENTIFIER_CLASS_VALUE (name));
|
||||
continue;
|
||||
}
|
||||
|
@ -377,13 +377,13 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
|
|||
switch (n_baseclasses)
|
||||
{
|
||||
case 0:
|
||||
cp_error ("`%T' does not have a base class to initialize",
|
||||
cp_error (ec_does_not_have_a_base_class_to_initialize,
|
||||
current_class_type);
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance",
|
||||
cp_error (ec_unnamed_initializer_ambiguous_for_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 ("`%T' is not an immediate base class of `%T'",
|
||||
cp_error (ec_is_not_an_immediate_base_class_of,
|
||||
basetype, current_class_type);
|
||||
continue;
|
||||
}
|
||||
|
@ -453,9 +453,9 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
|
|||
{
|
||||
if (pos < last_pos)
|
||||
{
|
||||
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");
|
||||
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);
|
||||
}
|
||||
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 ("base class `%#T' should be explicitly initialized in the copy constructor",
|
||||
cp_warning (ec_base_class_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 ("`%D' should be initialized in the member initialization list", member);
|
||||
cp_warning (ec_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 ("field `%D' not in immediate context", field);
|
||||
cp_error (ec_field_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 ("field `%D' used before initialized (after assignment to `this')",
|
||||
cp_error (ec_field_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 ("class `%T' does not have any field named `%s'", type,
|
||||
cp_error (ec_class_does_not_have_any_field_named_s, type,
|
||||
member_name);
|
||||
return 0;
|
||||
}
|
||||
if (TREE_STATIC (field))
|
||||
{
|
||||
cp_error ("field `%#D' is static; only point of initialization is its declaration",
|
||||
cp_error (ec_field_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:
|
||||
error ("base class initializer specified, but no base class to initialize");
|
||||
cp_error (ec_base_class_initializer_specified_but_no_base_class_to_initialize);
|
||||
return;
|
||||
case 1:
|
||||
basetype = TYPE_BINFO_BASETYPE (type, 0);
|
||||
break;
|
||||
default:
|
||||
error ("initializer for unnamed base class ambiguous");
|
||||
cp_error ("(type `%T' uses multiple inheritance)", type);
|
||||
cp_error (ec_initializer_for_unnamed_base_class_ambiguous);
|
||||
cp_error (ec_type_uses_multiple_inheritance, type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ expand_member_init (exp, name, init)
|
|||
name = TYPE_IDENTIFIER (basetype);
|
||||
else
|
||||
{
|
||||
error ("no base class to initialize");
|
||||
cp_error (ec_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 ("type `%T' is not an immediate or virtual basetype for `%T'",
|
||||
cp_error (ec_type_is_not_an_immediate_or_virtual_basetype_for,
|
||||
basetype, type);
|
||||
else
|
||||
cp_error ("type `%T' is not an immediate basetype for `%T'",
|
||||
cp_error (ec_type_is_not_an_immediate_basetype_for,
|
||||
basetype, type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (purpose_member (basetype, current_base_init_list))
|
||||
{
|
||||
cp_error ("base class `%T' already initialized", basetype);
|
||||
cp_error (ec_base_class_already_initialized, basetype);
|
||||
return;
|
||||
}
|
||||
|
||||
if (warn_reorder && current_member_init_list)
|
||||
{
|
||||
cp_warning ("base initializer for `%T'", basetype);
|
||||
warning (" will be re-ordered to precede member initializations");
|
||||
cp_warning (ec_base_initializer_for, basetype);
|
||||
cp_warning (ec_will_be_reordered_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 ("field `%D' already initialized", field);
|
||||
cp_error (ec_field_already_initialized, field);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1080,7 @@ expand_aggr_init (exp, init, alias_this, flags)
|
|||
COMPLEX zees(1.0, 0.0)[10];
|
||||
}
|
||||
*/
|
||||
error ("bad array initializer");
|
||||
cp_error (ec_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 ("`%T' is not an aggregate typedef", name);
|
||||
cp_error (ec_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 ("`%T' is not an aggregate type", type);
|
||||
cp_error (ec_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 ("`%T' is not an aggregate type", type);
|
||||
cp_error (ec_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 ("`%T' fails to be an aggregate typedef", name);
|
||||
cp_error (ec_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 ("type `%T' is of non-aggregate type", type);
|
||||
cp_error (ec_type_is_of_nonaggregate_type, type);
|
||||
return NULL_TREE;
|
||||
}
|
||||
return type;
|
||||
|
@ -1415,7 +1415,7 @@ build_member_call (type, name, parmlist)
|
|||
|
||||
if (dtor)
|
||||
{
|
||||
cp_error ("cannot call destructor `%T::~%T' without object", type,
|
||||
cp_error (ec_cannot_call_destructor_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 ("invalid use of non-static field `%D'", t);
|
||||
cp_error (ec_invalid_use_of_nonstatic_field, 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 ("invalid use of member `%D'", t);
|
||||
cp_error (ec_invalid_use_of_member, 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 ("no method `%T::%D'", type, name);
|
||||
cp_error (ec_no_method, 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 ("qualified type `%T' does not match destructor name `~%T'",
|
||||
cp_error (ec_qualified_type_does_not_match_destructor_name,
|
||||
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 ("incomplete type `%T' does not have member `%D'", type,
|
||||
cp_error (ec_incomplete_type_does_not_have_member, 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 ("member function `%#D' is protected", t);
|
||||
error ("in this context");
|
||||
cp_error_at (ec_member_function_is_protected, t);
|
||||
cp_error (ec_in_this_context);
|
||||
return error_mark_node;
|
||||
}
|
||||
if (access == access_private_node)
|
||||
{
|
||||
cp_error_at ("member function `%#D' is private", t);
|
||||
error ("in this context");
|
||||
cp_error_at (ec_member_function_is_private, t);
|
||||
cp_error (ec_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 ("`%D' is not a member of type `%T'", name, type);
|
||||
cp_error (ec_is_not_a_member_of_type, 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 ("illegal pointer to bit field `%D'", t);
|
||||
cp_error (ec_illegal_pointer_to_bit_field, t);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1741,7 +1741,7 @@ resolve_offset_ref (exp)
|
|||
|
||||
if (TREE_CODE (exp) == TREE_LIST)
|
||||
{
|
||||
cp_pedwarn ("assuming & on overloaded member function");
|
||||
cp_pedwarn (ec_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)
|
||||
{
|
||||
error ("object missing in use of pointer-to-member construct");
|
||||
cp_error (ec_object_missing_in_use_of_pointertomember_construct);
|
||||
return error_mark_node;
|
||||
}
|
||||
member = exp;
|
||||
|
@ -1784,9 +1784,9 @@ resolve_offset_ref (exp)
|
|||
{
|
||||
if (TREE_ADDRESSABLE (member) == 0)
|
||||
{
|
||||
cp_error_at ("member `%D' is non-static but referenced as a static member",
|
||||
cp_error_at (ec_member_is_nonstatic_but_referenced_as_a_static_member,
|
||||
member);
|
||||
error ("at this point in file");
|
||||
cp_error (ec_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 ("member `%D' is %s",
|
||||
cp_error_at (ec_member_is_s,
|
||||
access == access_private_node
|
||||
? "private" : "protected",
|
||||
member);
|
||||
cp_error ("in this context");
|
||||
cp_error (ec_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 ("object missing in `%E'", exp);
|
||||
cp_error (ec_object_missing_in, 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)
|
||||
error ("new of array type fails to specify size");
|
||||
cp_error (ec_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)
|
||||
{
|
||||
warning ("zero size array reserves no space");
|
||||
cp_warning (ec_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)
|
||||
{
|
||||
error ("new cannot be applied to a reference type");
|
||||
cp_error (ec_new_cannot_be_applied_to_a_reference_type);
|
||||
type = TREE_TYPE (type);
|
||||
}
|
||||
|
||||
if (TREE_CODE (type) == FUNCTION_TYPE)
|
||||
{
|
||||
error ("new cannot be applied to a function type");
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("invalid type `void' for new");
|
||||
cp_error (ec_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 ("initialization in array new");
|
||||
cp_pedwarn (ec_initialization_in_array_new);
|
||||
}
|
||||
|
||||
/* Allocate the object. */
|
||||
|
@ -2288,7 +2288,7 @@ build_new_1 (exp)
|
|||
rval = NULL_TREE;
|
||||
else
|
||||
{
|
||||
error ("constructors take parameter lists");
|
||||
cp_error (ec_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)
|
||||
pedwarn ("initializer list being treated as compound expression");
|
||||
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
|
||||
else if (TREE_CODE (init) == CONSTRUCTOR)
|
||||
{
|
||||
pedwarn ("initializer list appears where operand should be used");
|
||||
cp_pedwarn (ec_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 ("uninitialized const in `new' of `%#T'", true_type);
|
||||
cp_error (ec_uninitialized_const_in_new_of, 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))
|
||||
{
|
||||
error ("initializer ends prematurely");
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("unknown array size in delete");
|
||||
cp_error (ec_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)
|
||||
error ("type to vector delete is neither pointer or array type");
|
||||
cp_error (ec_type_to_vector_delete_is_neither_pointer_or_array_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ 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", "" },
|
||||
|
@ -126,4 +128,6 @@ 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-" },
|
||||
|
||||
|
|
194
gcc/cp/lex.c
194
gcc/cp/lex.c
|
@ -186,7 +186,7 @@ make_pointer_declarator (cv_qualifiers, target)
|
|||
{
|
||||
if (target && TREE_CODE (target) == IDENTIFIER_NODE
|
||||
&& ANON_AGGRNAME_P (target))
|
||||
error ("type name expected before `*'");
|
||||
cp_error (ec_type_name_expected_before_star);
|
||||
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)
|
||||
{
|
||||
error ("cannot declare references to references");
|
||||
cp_error (ec_cannot_declare_references_to_references);
|
||||
return target;
|
||||
}
|
||||
if (TREE_CODE (target) == INDIRECT_REF)
|
||||
{
|
||||
error ("cannot declare pointers to references");
|
||||
cp_error (ec_cannot_declare_pointers_to_references);
|
||||
return target;
|
||||
}
|
||||
if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
|
||||
error ("type name expected before `&'");
|
||||
cp_error (ec_type_name_expected_before_amp);
|
||||
}
|
||||
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
|
||||
warning ("YYDEBUG not defined.");
|
||||
cp_warning (ec_yydebug_not_defined);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1293,7 +1293,7 @@ process_next_inline (t)
|
|||
yychar = yylex ();
|
||||
if (yychar != END_OF_SAVED_INPUT)
|
||||
{
|
||||
error ("parse error at end of saved function text");
|
||||
cp_error (ec_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 == '"')
|
||||
error ("end of file encountered inside string constant");
|
||||
cp_error (ec_end_of_file_encountered_inside_string_constant);
|
||||
else
|
||||
error ("end of file encountered inside character constant");
|
||||
cp_error (ec_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)
|
||||
pedwarn ("ANSI C++ forbids newline in string constant");
|
||||
cp_pedwarn (ec_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)
|
||||
{
|
||||
error ("function body for constructor missing");
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("parse error at end of saved function text");
|
||||
cp_error (ec_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)))
|
||||
error ("semicolon missing after %s declaration",
|
||||
cp_error (ec_semicolon_missing_after_s_declaration,
|
||||
TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
|
||||
else
|
||||
cp_error ("semicolon missing after declaration of `%T'", type);
|
||||
cp_error (ec_semicolon_missing_after_declaration_of, 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
|
||||
error ("stray '\\' in program");
|
||||
cp_error (ec_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))
|
||||
warning ("ignoring pragma: %s", token_buffer);
|
||||
cp_warning (ec_ignoring_pragma_s, token_buffer);
|
||||
}
|
||||
|
||||
goto skipline;
|
||||
|
@ -2385,7 +2385,7 @@ check_newline ()
|
|||
if (token != STRING
|
||||
|| TREE_CODE (yylval.ttype) != STRING_CST)
|
||||
{
|
||||
error ("invalid #ident");
|
||||
cp_error (ec_invalid_ident);
|
||||
goto skipline;
|
||||
}
|
||||
|
||||
|
@ -2417,7 +2417,7 @@ check_newline ()
|
|||
goto skipline;
|
||||
}
|
||||
}
|
||||
error ("undefined or invalid # directive");
|
||||
cp_error (ec_undefined_or_invalid_directive);
|
||||
goto skipline;
|
||||
}
|
||||
|
||||
|
@ -2468,7 +2468,7 @@ linenum:
|
|||
|
||||
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
|
||||
{
|
||||
error ("invalid #line");
|
||||
cp_error (ec_invalid_line);
|
||||
goto skipline;
|
||||
}
|
||||
|
||||
|
@ -2610,7 +2610,7 @@ linenum:
|
|||
if (c_header_level && --c_header_level == 0)
|
||||
{
|
||||
if (entering_c_header)
|
||||
warning ("badly nested C headers from preprocessor");
|
||||
cp_warning (ec_badly_nested_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
|
||||
error ("#-lines for entering and leaving files don't match");
|
||||
cp_error (ec_lines_for_entering_and_leaving_files_dont_match);
|
||||
}
|
||||
else
|
||||
in_system_header = entering_system_header;
|
||||
|
@ -2633,7 +2633,7 @@ linenum:
|
|||
c = EOF;
|
||||
}
|
||||
else
|
||||
error ("invalid #-line");
|
||||
cp_error (ec_invalid_line);
|
||||
|
||||
/* skip the rest of this line. */
|
||||
skipline:
|
||||
|
@ -2698,7 +2698,7 @@ readescape (ignore_ptr)
|
|||
nonnull = 1;
|
||||
}
|
||||
if (! nonnull)
|
||||
error ("\\x used with no following hex digits");
|
||||
cp_error (ec_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)))
|
||||
pedwarn ("hex escape out of range");
|
||||
cp_pedwarn (ec_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)
|
||||
pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
|
||||
cp_pedwarn (ec_nonstandard_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)
|
||||
pedwarn ("unknown escape sequence `\\%c'", c);
|
||||
cp_pedwarn (ec_unknown_escape_sequence_c, c);
|
||||
return c;
|
||||
}
|
||||
if (c >= 040 && c < 0177)
|
||||
pedwarn ("unknown escape sequence `\\%c'", c);
|
||||
cp_pedwarn (ec_unknown_escape_sequence_c, c);
|
||||
else
|
||||
pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
|
||||
cp_pedwarn (ec_unknown_escape_sequence_followed_by_char_code_0xx, c);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -2899,7 +2899,7 @@ do_identifier (token, parsing, args)
|
|||
my_friendly_abort (61);
|
||||
else
|
||||
{
|
||||
cp_error ("invalid use of member `%D' from base class `%T'", field,
|
||||
cp_error (ec_invalid_use_of_member_from_base_class, 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 ("`%D' not defined", token);
|
||||
cp_error (ec_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 ("`%D' was not declared in this scope", token);
|
||||
cp_error (ec_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 ("`%D' undeclared (first use this function)", token);
|
||||
cp_error (ec_undeclared_first_use_this_function, token);
|
||||
|
||||
if (! undeclared_variable_notice)
|
||||
{
|
||||
error ("(Each undeclared identifier is reported only once");
|
||||
error ("for each function it appears in.)");
|
||||
cp_error (ec_ach_undeclared_identifier_is_reported_only_once);
|
||||
cp_error (ec_for_each_function_it_appears_in);
|
||||
undeclared_variable_notice = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2990,11 +2990,11 @@ do_identifier (token, parsing, args)
|
|||
{
|
||||
if (!DECL_ERROR_REPORTED (id))
|
||||
{
|
||||
warning ("name lookup of `%s' changed",
|
||||
cp_warning (ec_name_lookup_of_s_changed,
|
||||
IDENTIFIER_POINTER (token));
|
||||
cp_warning_at (" matches this `%D' under current ANSI rules",
|
||||
cp_warning_at (ec_matches_this_under_current_rules,
|
||||
shadowed);
|
||||
cp_warning_at (" matches this `%D' under old rules", id);
|
||||
cp_warning_at (ec_matches_this_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 (" cannot use obsolete binding at `%D' because it has a destructor", id);
|
||||
cp_error_at (ec_cannot_use_obsolete_binding_at_because_it_has_a_destructor, id);
|
||||
id = error_mark_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
pedwarn (msg, IDENTIFIER_POINTER (token));
|
||||
cp_pedwarn_at (" using obsolete binding at `%D'", id);
|
||||
cp_pedwarn_at (ec_using_obsolete_binding_at, 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 ("enum `%D' is private", id);
|
||||
cp_error (ec_enum_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 ("`::%D' undeclared (first use here)", token);
|
||||
cp_error (ec_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)
|
||||
error ("`$' in identifier");
|
||||
cp_error (ec_in_identifier);
|
||||
else if (pedantic)
|
||||
pedwarn ("`$' in identifier");
|
||||
cp_pedwarn (ec_in_identifier);
|
||||
dollar_seen = 1;
|
||||
goto letter;
|
||||
|
||||
|
@ -3284,9 +3284,9 @@ real_yylex ()
|
|||
if (c == '$')
|
||||
{
|
||||
if (! dollars_in_ident)
|
||||
error ("`$' in identifier");
|
||||
cp_error (ec_in_identifier);
|
||||
else if (pedantic)
|
||||
pedwarn ("`$' in identifier");
|
||||
cp_pedwarn (ec_in_identifier);
|
||||
}
|
||||
|
||||
if (p >= token_buffer + maxtoken)
|
||||
|
@ -3314,9 +3314,9 @@ real_yylex ()
|
|||
if (c == '$')
|
||||
{
|
||||
if (! dollars_in_ident)
|
||||
error ("`$' in identifier");
|
||||
cp_error (ec_in_identifier);
|
||||
else if (pedantic)
|
||||
pedwarn ("`$' in identifier");
|
||||
cp_pedwarn (ec_in_identifier);
|
||||
}
|
||||
|
||||
if (p >= token_buffer + maxtoken)
|
||||
|
@ -3366,7 +3366,7 @@ real_yylex ()
|
|||
obstack. */
|
||||
|
||||
if (ptr->rid != RID_EXTERN)
|
||||
error ("invalid modifier `%s' for language string",
|
||||
cp_error (ec_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)))
|
||||
warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
|
||||
cp_warning (ec_identifier_name_s_conflicts_with_internal_naming_strategy,
|
||||
token_buffer);
|
||||
#endif
|
||||
|
||||
|
@ -3500,7 +3500,7 @@ real_yylex ()
|
|||
value = ELLIPSIS;
|
||||
goto done;
|
||||
}
|
||||
error ("parse error at `..'");
|
||||
cp_error (ec_parse_error_at);
|
||||
}
|
||||
if (ISDIGIT (c1))
|
||||
{
|
||||
|
@ -3589,13 +3589,13 @@ real_yylex ()
|
|||
if (c == '.')
|
||||
{
|
||||
if (base == 16)
|
||||
error ("floating constant may not be in radix 16");
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("malformed floating constant");
|
||||
cp_error (ec_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;
|
||||
}
|
||||
error ("parse error at `..'");
|
||||
cp_error (ec_parse_error_at);
|
||||
}
|
||||
nextchar = c;
|
||||
token_buffer[1] = '\0';
|
||||
|
@ -3647,7 +3647,7 @@ real_yylex ()
|
|||
floatflag = AFTER_POINT;
|
||||
break; /* start of exponent */
|
||||
}
|
||||
error ("nondigits in number and not hexadecimal");
|
||||
cp_error (ec_nondigits_in_number_and_not_hexadecimal);
|
||||
c = 0;
|
||||
}
|
||||
else if (c >= 'a')
|
||||
|
@ -3688,10 +3688,10 @@ real_yylex ()
|
|||
}
|
||||
|
||||
if (numdigits == 0)
|
||||
error ("numeric constant with no digits");
|
||||
cp_error (ec_numeric_constant_with_no_digits);
|
||||
|
||||
if (largest_digit >= base)
|
||||
error ("numeric constant contains digits beyond the radix");
|
||||
cp_error (ec_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))
|
||||
error ("floating constant exponent has no digits");
|
||||
cp_error (ec_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))
|
||||
{
|
||||
error ("floating constant out of range");
|
||||
cp_error (ec_floating_constant_out_of_range);
|
||||
value = dconst0;
|
||||
}
|
||||
else
|
||||
|
@ -3757,21 +3757,21 @@ real_yylex ()
|
|||
{
|
||||
case 'f': case 'F':
|
||||
if (fflag)
|
||||
error ("more than one `f' in numeric constant");
|
||||
cp_error (ec_more_than_one_f_in_numeric_constant);
|
||||
fflag = 1;
|
||||
break;
|
||||
|
||||
case 'l': case 'L':
|
||||
if (lflag)
|
||||
error ("more than one `l' in numeric constant");
|
||||
cp_error (ec_more_than_one_l_in_numeric_constant);
|
||||
lflag = 1;
|
||||
break;
|
||||
|
||||
case 'i': case 'I':
|
||||
if (imag)
|
||||
error ("more than one `i' or `j' in numeric constant");
|
||||
cp_error (ec_more_than_one_i_or_j_in_numeric_constant);
|
||||
else if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids imaginary numeric constants");
|
||||
cp_pedwarn (ec_forbids_imaginary_numeric_constants);
|
||||
imag = 1;
|
||||
break;
|
||||
|
||||
|
@ -3796,7 +3796,7 @@ real_yylex ()
|
|||
if (fflag)
|
||||
{
|
||||
if (lflag)
|
||||
error ("both `f' and `l' in floating constant");
|
||||
cp_error (ec_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)
|
||||
warning ("floating point number exceeds range of `float'");
|
||||
cp_warning (ec_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)
|
||||
warning ("floating point number exceeds range of `long double'");
|
||||
cp_warning (ec_floating_point_number_exceeds_range_of_long_double);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
|
||||
if (REAL_VALUE_ISINF (value) && pedantic)
|
||||
warning ("floating point number exceeds range of `double'");
|
||||
cp_warning (ec_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))
|
||||
{
|
||||
pedwarn ("floating point number exceeds range of `%s'",
|
||||
cp_pedwarn (ec_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)
|
||||
error ("two `u's in integer constant");
|
||||
cp_error (ec_two_us_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)
|
||||
error ("three `l's in integer constant");
|
||||
cp_error (ec_three_ls_in_integer_constant);
|
||||
else if (pedantic && ! in_system_header && warn_long_long)
|
||||
pedwarn ("ANSI C++ forbids long long integer constants");
|
||||
cp_pedwarn (ec_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)
|
||||
error ("more than one `i' or `j' in numeric constant");
|
||||
cp_error (ec_more_than_one_i_or_j_in_numeric_constant);
|
||||
else if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids imaginary numeric constants");
|
||||
cp_pedwarn (ec_forbids_imaginary_numeric_constants);
|
||||
spec_imag = 1;
|
||||
}
|
||||
else
|
||||
|
@ -3917,7 +3917,7 @@ real_yylex ()
|
|||
if (parts[i])
|
||||
warn = 1;
|
||||
if (warn)
|
||||
pedwarn ("integer constant out of range");
|
||||
cp_pedwarn (ec_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)
|
||||
pedwarn ("integer constant out of range");
|
||||
cp_pedwarn (ec_integer_constant_out_of_range);
|
||||
|
||||
if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
|
||||
warning ("decimal integer constant is so large that it is unsigned");
|
||||
cp_warning (ec_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
|
||||
error ("complex integer constant is too wide for `__complex int'");
|
||||
cp_error (ec_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))
|
||||
pedwarn ("escape sequence out of range for character");
|
||||
cp_pedwarn (ec_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)
|
||||
pedwarn ("ANSI C forbids newline in character constant");
|
||||
cp_pedwarn (ec_forbids_newline_in_character_constant);
|
||||
lineno++;
|
||||
}
|
||||
else
|
||||
|
@ -4076,7 +4076,7 @@ real_yylex ()
|
|||
else
|
||||
{
|
||||
if (char_len == -1)
|
||||
warning ("Ignoring invalid multibyte character");
|
||||
cp_warning (ec_gnoring_invalid_multibyte_character);
|
||||
if (wide_flag)
|
||||
c = wc;
|
||||
#ifdef MAP_CHARACTER
|
||||
|
@ -4110,16 +4110,16 @@ real_yylex ()
|
|||
}
|
||||
|
||||
if (c != '\'')
|
||||
error ("malformatted character constant");
|
||||
cp_error (ec_malformatted_character_constant);
|
||||
else if (chars_seen == 0)
|
||||
error ("empty character constant");
|
||||
cp_error (ec_empty_character_constant);
|
||||
else if (num_chars > max_chars)
|
||||
{
|
||||
num_chars = max_chars;
|
||||
error ("character constant too long");
|
||||
cp_error (ec_character_constant_too_long);
|
||||
}
|
||||
else if (chars_seen != 1 && warn_multichar)
|
||||
warning ("multi-character character constant");
|
||||
cp_warning (ec_multicharacter_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))
|
||||
warning ("escape sequence out of range for character");
|
||||
cp_warning (ec_escape_sequence_out_of_range_for_character);
|
||||
}
|
||||
else if (c == '\n')
|
||||
{
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids newline in string constant");
|
||||
cp_pedwarn (ec_forbids_newline_in_string_constant);
|
||||
lineno++;
|
||||
}
|
||||
else
|
||||
|
@ -4205,7 +4205,7 @@ real_yylex ()
|
|||
c = getch ();
|
||||
}
|
||||
if (char_len == -1)
|
||||
warning ("Ignoring invalid multibyte character");
|
||||
cp_warning (ec_gnoring_invalid_multibyte_character);
|
||||
else
|
||||
{
|
||||
/* mbtowc sometimes needs an extra char before accepting */
|
||||
|
@ -4259,7 +4259,7 @@ real_yylex ()
|
|||
skipnewline:
|
||||
c = getch ();
|
||||
if (c == EOF) {
|
||||
error ("Unterminated string");
|
||||
cp_error (ec_nterminated_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4408,7 +4408,7 @@ real_yylex ()
|
|||
nextchar = c1;
|
||||
}
|
||||
if (pedantic)
|
||||
pedwarn ("use of `operator %s' is not standard C++",
|
||||
cp_pedwarn (ec_use_of_operator_s_is_not_standard,
|
||||
token_buffer);
|
||||
goto done;
|
||||
}
|
||||
|
@ -4772,13 +4772,13 @@ handle_cp_pragma (pname)
|
|||
token = real_yylex ();
|
||||
if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
|
||||
{
|
||||
error ("invalid #pragma vtable");
|
||||
cp_error (ec_invalid_pragma_vtable);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (write_virtuals != 2)
|
||||
{
|
||||
warning ("use `+e2' option to enable #pragma vtable");
|
||||
cp_warning (ec_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)
|
||||
warning ("trailing characters ignored");
|
||||
cp_warning (ec_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)
|
||||
{
|
||||
error ("invalid #pragma unit");
|
||||
cp_error (ec_invalid_pragma_unit);
|
||||
return -1;
|
||||
}
|
||||
token = real_yylex ();
|
||||
if (token != END_OF_LINE)
|
||||
warning ("trailing characters ignored");
|
||||
cp_warning (ec_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)
|
||||
{
|
||||
error ("invalid `#pragma interface'");
|
||||
cp_error (ec_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)
|
||||
warning ("garbage after `#pragma interface' ignored");
|
||||
cp_warning (ec_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)
|
||||
{
|
||||
error ("invalid `#pragma implementation'");
|
||||
cp_error (ec_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)
|
||||
warning ("garbage after `#pragma implementation' ignored");
|
||||
cp_warning (ec_garbage_after_pragma_implementation_ignored);
|
||||
|
||||
#ifndef NO_LINKAGE_HEURISTICS
|
||||
if (write_virtuals == 3)
|
||||
|
@ -4912,7 +4912,7 @@ handle_cp_pragma (pname)
|
|||
}
|
||||
}
|
||||
else
|
||||
error ("`#pragma implementation' can only appear at top-level");
|
||||
cp_error (ec_pragma_implementation_can_only_appear_at_toplevel);
|
||||
interface_only = 0;
|
||||
#if 1
|
||||
/* We make this non-zero so that we infer decl linkage
|
||||
|
|
|
@ -679,7 +679,7 @@ build_overload_value (type, value, in_template)
|
|||
REAL_VALUE_TYPE val;
|
||||
char *bufp = digit_buffer;
|
||||
|
||||
pedwarn ("ANSI C++ forbids floating-point template arguments");
|
||||
cp_pedwarn (ec_forbids_floatingpoint_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)
|
||||
{
|
||||
warning ("methods cannot be converted to function pointers");
|
||||
cp_warning (ec_methods_cannot_be_converted_to_function_pointers);
|
||||
return fndecl;
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("ambiguous request for method pointer `%s'",
|
||||
cp_error (ec_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 ("invalid use of member `%D' in static member function",
|
||||
cp_error (ec_invalid_use_of_member_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 ("invalid use of member `%D'", value);
|
||||
cp_error (ec_invalid_use_of_member, value);
|
||||
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -1887,12 +1887,12 @@ hack_identifier (value, name)
|
|||
}
|
||||
else if (TREE_CODE (value) == NAMESPACE_DECL)
|
||||
{
|
||||
cp_error ("use of namespace `%D' as expression", value);
|
||||
cp_error (ec_use_of_namespace_as_expression, value);
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (DECL_CLASS_TEMPLATE_P (value))
|
||||
{
|
||||
cp_error ("use of class template `%T' as expression", value);
|
||||
cp_error (ec_use_of_class_template_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 ("use of %s from containing function",
|
||||
cp_error (ec_use_of_s_from_containing_function,
|
||||
(TREE_CODE (value) == VAR_DECL
|
||||
? "`auto' variable" : "parameter"));
|
||||
cp_error_at (" `%#D' declared here", value);
|
||||
cp_error_at (ec_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)
|
||||
error ("static member `%s' is %s",
|
||||
cp_error (ec_static_member_s_is_s,
|
||||
IDENTIFIER_POINTER (name),
|
||||
TREE_PRIVATE (value) ? "private"
|
||||
: "from a private base class");
|
||||
else
|
||||
error ("enum `%s' is from private base class",
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("request for member `%s' is ambiguous in multiple inheritance lattice",
|
||||
cp_error (ec_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 ("implementation-reserved name `%D' used", thunk_id);
|
||||
cp_error (ec_implementationreserved_name_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 ("generic thunk code fails for method `%#D' which uses `...'",
|
||||
cp_error (ec_generic_thunk_code_fails_for_method_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 ("in default copy constructor");
|
||||
cp_error (ec_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 ("in default copy constructor");
|
||||
cp_error (ec_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 ("non-static const member `%#D', can't use default assignment operator", field);
|
||||
cp_error (ec_nonstatic_const_member_cant_use_default_assignment_operator, field);
|
||||
else
|
||||
cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type);
|
||||
cp_error (ec_nonstatic_const_member_in_type_cant_use_default_assignment_operator, current_class_type);
|
||||
continue;
|
||||
}
|
||||
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
|
||||
{
|
||||
if (DECL_NAME (field))
|
||||
cp_error ("non-static reference member `%#D', can't use default assignment operator", field);
|
||||
cp_error (ec_nonstatic_reference_member_cant_use_default_assignment_operator, field);
|
||||
else
|
||||
cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type);
|
||||
cp_error (ec_nonstatic_reference_member_in_type_cant_use_default_assignment_operator, current_class_type);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
1645
gcc/cp/parse.c
1645
gcc/cp/parse.c
File diff suppressed because it is too large
Load diff
133
gcc/cp/parse.y
133
gcc/cp/parse.y
|
@ -489,7 +489,8 @@ extern_lang_string:
|
|||
{ push_lang_context ($1); }
|
||||
| extern_lang_string EXTERN_LANG_STRING
|
||||
{ if (current_lang_name != $2)
|
||||
cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
|
||||
cp_error
|
||||
(ec_use_of_linkage_spec_is_different_from_previous_spec, $2, current_lang_name);
|
||||
pop_lang_context (); push_lang_context ($2); }
|
||||
;
|
||||
|
||||
|
@ -552,7 +553,7 @@ template_parm:
|
|||
&& TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
|
||||
&& TREE_CODE ($3) != TYPE_DECL)
|
||||
{
|
||||
error ("invalid default template argument");
|
||||
cp_error (ec_invalid_default_template_argument);
|
||||
$3 = error_mark_node;
|
||||
}
|
||||
$$ = build_tree_list ($3, $1);
|
||||
|
@ -601,7 +602,7 @@ datadef:
|
|||
| typed_declspecs initdecls ';'
|
||||
{ note_list_got_semicolon ($1.t); }
|
||||
| declmods ';'
|
||||
{ pedwarn ("empty declaration"); }
|
||||
{ cp_pedwarn (ec_empty_declaration); }
|
||||
| explicit_instantiation ';'
|
||||
| typed_declspecs ';'
|
||||
{
|
||||
|
@ -757,7 +758,7 @@ base_init:
|
|||
':' .set_base_init member_init_list
|
||||
{
|
||||
if ($3 == 0)
|
||||
error ("no base initializers given following ':'");
|
||||
cp_error (ec_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
|
||||
|
@ -780,9 +781,9 @@ base_init:
|
|||
expand_start_bindings (0);
|
||||
}
|
||||
else if (current_class_type == NULL_TREE)
|
||||
error ("base initializers not allowed for non-member functions");
|
||||
cp_error (ec_base_initializers_not_allowed_for_nonmember_functions);
|
||||
else if (! DECL_CONSTRUCTOR_P (current_function_decl))
|
||||
error ("only constructors take base initializers");
|
||||
cp_error (ec_only_constructors_take_base_initializers);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -799,13 +800,13 @@ member_init:
|
|||
'(' nonnull_exprlist ')'
|
||||
{
|
||||
if (current_class_name)
|
||||
pedwarn ("anachronistic old style base class initializer");
|
||||
cp_pedwarn (ec_anachronistic_old_style_base_class_initializer);
|
||||
expand_member_init (current_class_ref, NULL_TREE, $2);
|
||||
}
|
||||
| LEFT_RIGHT
|
||||
{
|
||||
if (current_class_name)
|
||||
pedwarn ("anachronistic old style base class initializer");
|
||||
cp_pedwarn (ec_anachronistic_old_style_base_class_initializer);
|
||||
expand_member_init (current_class_ref, NULL_TREE, void_type_node);
|
||||
}
|
||||
| notype_identifier '(' nonnull_exprlist ')'
|
||||
|
@ -916,7 +917,7 @@ template_close_bracket:
|
|||
| RSHIFT
|
||||
{
|
||||
/* Handle `Class<Class<Type>>' without space in the `>>' */
|
||||
pedwarn ("`>>' should be `> >' in template class name");
|
||||
cp_pedwarn (ec_should_be_in_template_class_name);
|
||||
yyungetc ('>', 1);
|
||||
}
|
||||
;
|
||||
|
@ -963,7 +964,7 @@ expr:
|
|||
|
||||
paren_expr_or_null:
|
||||
LEFT_RIGHT
|
||||
{ error ("ANSI C++ forbids an empty condition for `%s'",
|
||||
{ cp_error (ec_forbids_an_empty_condition_for_s,
|
||||
cond_stmt_keyword);
|
||||
$$ = integer_zero_node; }
|
||||
| '(' expr ')'
|
||||
|
@ -972,7 +973,7 @@ paren_expr_or_null:
|
|||
|
||||
paren_cond_or_null:
|
||||
LEFT_RIGHT
|
||||
{ error ("ANSI C++ forbids an empty condition for `%s'",
|
||||
{ cp_error (ec_forbids_an_empty_condition_for_s,
|
||||
cond_stmt_keyword);
|
||||
$$ = integer_zero_node; }
|
||||
| '(' condition ')'
|
||||
|
@ -995,9 +996,9 @@ condition:
|
|||
if (TREE_CODE (d) == TYPE_DECL) {
|
||||
tree s = TREE_TYPE (d);
|
||||
if (TREE_CODE (s) == RECORD_TYPE)
|
||||
cp_error ("definition of class `%T' in condition", s);
|
||||
cp_error (ec_definition_of_class_in_condition, s);
|
||||
else if (TREE_CODE (s) == ENUMERAL_TYPE)
|
||||
cp_error ("definition of enum `%T' in condition", s);
|
||||
cp_error (ec_definition_of_enum_in_condition, s);
|
||||
}
|
||||
}
|
||||
current_declspecs = $1.t;
|
||||
|
@ -1011,7 +1012,7 @@ condition:
|
|||
resume_momentary ($<itype>5);
|
||||
$$ = $<ttype>6;
|
||||
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
|
||||
cp_error ("definition of array `%#D' in condition", $$);
|
||||
cp_error (ec_definition_of_array_in_condition, $$);
|
||||
}
|
||||
| expr
|
||||
;
|
||||
|
@ -1069,7 +1070,7 @@ unary_expr:
|
|||
/* Refer to the address of a label as a pointer. */
|
||||
| ANDAND identifier
|
||||
{ if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids `&&'");
|
||||
cp_pedwarn (ec_forbids);
|
||||
$$ = finish_label_address_expr ($2); }
|
||||
| SIZEOF unary_expr %prec UNARY
|
||||
{ $$ = expr_sizeof ($2); }
|
||||
|
@ -1154,7 +1155,7 @@ new_placement:
|
|||
'(' .begin_new_placement nonnull_exprlist ')'
|
||||
{ $$ = finish_new_placement ($3, $2); }
|
||||
| '{' .begin_new_placement nonnull_exprlist '}'
|
||||
{ cp_pedwarn ("old style placement syntax, use () instead");
|
||||
{ cp_pedwarn (ec_old_style_placement_syntax_use_instead);
|
||||
$$ = finish_new_placement ($3, $2); }
|
||||
;
|
||||
|
||||
|
@ -1165,7 +1166,7 @@ new_initializer:
|
|||
{ $$ = NULL_TREE; }
|
||||
| '(' typespec ')'
|
||||
{
|
||||
cp_error ("`%T' is not a valid expression", $2.t);
|
||||
cp_error (ec_is_not_a_valid_expression, $2.t);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
/* GNU extension so people can use initializer lists. Note that
|
||||
|
@ -1174,7 +1175,7 @@ new_initializer:
|
|||
| '=' init
|
||||
{
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids initialization of new expression with `='");
|
||||
cp_pedwarn (ec_forbids_initialization_of_new_expression_with);
|
||||
if (TREE_CODE ($2) != TREE_LIST
|
||||
&& TREE_CODE ($2) != CONSTRUCTOR)
|
||||
$$ = build_expr_list (NULL_TREE, $2);
|
||||
|
@ -1204,7 +1205,7 @@ cast_expr:
|
|||
tree init = build_nt (CONSTRUCTOR, NULL_TREE,
|
||||
nreverse ($3));
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids constructor-expressions");
|
||||
cp_pedwarn (ec_forbids_constructorexpressions);
|
||||
/* Indicate that this was a GNU C constructor expression. */
|
||||
TREE_HAS_CONSTRUCTOR (init) = 1;
|
||||
|
||||
|
@ -1380,11 +1381,11 @@ primary:
|
|||
{ tree scope = current_scope ();
|
||||
if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
|
||||
{
|
||||
error ("braced-group within expression allowed only inside a function");
|
||||
cp_error (ec_bracedgroup_within_expression_allowed_only_inside_a_function);
|
||||
YYERROR;
|
||||
}
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids braced-groups within expressions");
|
||||
cp_pedwarn (ec_forbids_bracedgroups_within_expressions);
|
||||
$<ttype>$ = begin_stmt_expr ();
|
||||
}
|
||||
compstmt ')'
|
||||
|
@ -1423,7 +1424,7 @@ primary:
|
|||
#if 0
|
||||
if ($3 == NULL_TREE)
|
||||
{
|
||||
error ("cannot cast null list to type `%s'",
|
||||
cp_error (ec_cannot_cast_null_list_to_type_s,
|
||||
IDENTIFIER_POINTER (TYPE_NAME (id)));
|
||||
$$ = error_mark_node;
|
||||
break;
|
||||
|
@ -1444,7 +1445,7 @@ primary:
|
|||
/* should not be able to get here (mrs) */
|
||||
else if (id == ridpointers[(int) RID_FRIEND])
|
||||
{
|
||||
error ("cannot cast expression to `friend' type");
|
||||
cp_error (ec_cannot_cast_expression_to_friend_type);
|
||||
$$ = error_mark_node;
|
||||
break;
|
||||
}
|
||||
|
@ -1538,13 +1539,13 @@ primary_no_id:
|
|||
| '('
|
||||
{ if (current_function_decl == 0)
|
||||
{
|
||||
error ("braced-group within expression allowed only inside a function");
|
||||
cp_error (ec_bracedgroup_within_expression_allowed_only_inside_a_function);
|
||||
YYERROR;
|
||||
}
|
||||
$<ttype>$ = expand_start_stmt_expr (); }
|
||||
compstmt ')'
|
||||
{ if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids braced-groups within expressions");
|
||||
cp_pedwarn (ec_forbids_bracedgroups_within_expressions);
|
||||
$$ = expand_end_stmt_expr ($<ttype>2); }
|
||||
| primary_no_id '(' nonnull_exprlist ')'
|
||||
{ $$ = build_x_function_call ($$, $3, current_class_ref); }
|
||||
|
@ -1637,7 +1638,7 @@ decl:
|
|||
note_list_got_semicolon ($1.t);
|
||||
}
|
||||
| declmods ';'
|
||||
{ warning ("empty declaration"); }
|
||||
{ cp_warning (ec_empty_declaration); }
|
||||
| extension decl
|
||||
{ pedantic = $<itype>1; }
|
||||
;
|
||||
|
@ -1714,14 +1715,14 @@ typed_declspecs1:
|
|||
reserved_declspecs:
|
||||
SCSPEC
|
||||
{ if (extra_warnings)
|
||||
warning ("`%s' is not at beginning of declaration",
|
||||
cp_warning (ec_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)
|
||||
warning ("`%s' is not at beginning of declaration",
|
||||
cp_warning (ec_s_is_not_at_beginning_of_declaration,
|
||||
IDENTIFIER_POINTER ($2));
|
||||
$$ = decl_tree_cons (NULL_TREE, $2, $$); }
|
||||
| reserved_declspecs attributes
|
||||
|
@ -1745,7 +1746,7 @@ declmods:
|
|||
TREE_STATIC ($$) = 1; }
|
||||
| declmods SCSPEC
|
||||
{ if (extra_warnings && TREE_STATIC ($$))
|
||||
warning ("`%s' is not at beginning of declaration",
|
||||
cp_warning (ec_s_is_not_at_beginning_of_declaration,
|
||||
IDENTIFIER_POINTER ($2));
|
||||
$$ = decl_tree_cons (NULL_TREE, $2, $$);
|
||||
TREE_STATIC ($$) = TREE_STATIC ($1); }
|
||||
|
@ -1810,7 +1811,7 @@ typespec:
|
|||
}
|
||||
else
|
||||
{
|
||||
error ("`sigof' applied to non-aggregate expression");
|
||||
cp_error (ec_sigof_applied_to_nonaggregate_expression);
|
||||
$$.t = error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -1825,7 +1826,7 @@ typespec:
|
|||
}
|
||||
else
|
||||
{
|
||||
error("`sigof' applied to non-aggregate type");
|
||||
cp_error (ec_sigof_applied_to_nonaggregate_type);
|
||||
$$.t = error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -2101,7 +2102,7 @@ structsp:
|
|||
{ $$.t = $2;
|
||||
$$.new_type_flag = 0;
|
||||
if (!processing_template_decl)
|
||||
cp_pedwarn ("using `typename' outside of template"); }
|
||||
cp_pedwarn (ec_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
|
||||
|
@ -2125,7 +2126,7 @@ structsp:
|
|||
$$.new_type_flag = 0;
|
||||
if (TYPE_BINFO ($1) == NULL_TREE)
|
||||
{
|
||||
cp_error ("%T is not a class type", $1);
|
||||
cp_error (ec_is_not_a_class_type, $1);
|
||||
$$.t = error_mark_node;
|
||||
}
|
||||
else
|
||||
|
@ -2134,7 +2135,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 ("base clause without member specification for `%#T'",
|
||||
cp_error (ec_base_clause_without_member_specification_for,
|
||||
$$.t);
|
||||
}
|
||||
}
|
||||
|
@ -2149,19 +2150,19 @@ maybecomma_warn:
|
|||
/* empty */
|
||||
| ','
|
||||
{ if (pedantic && !in_system_header)
|
||||
pedwarn ("comma at end of enumerator list"); }
|
||||
cp_pedwarn (ec_comma_at_end_of_enumerator_list); }
|
||||
;
|
||||
|
||||
aggr:
|
||||
AGGR
|
||||
| aggr SCSPEC
|
||||
{ error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
|
||||
{ cp_error (ec_storage_class_specifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
|
||||
| aggr TYPESPEC
|
||||
{ error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
|
||||
{ cp_error (ec_type_specifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
|
||||
| aggr CV_QUALIFIER
|
||||
{ error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
|
||||
{ cp_error (ec_type_qualifier_s_not_allowed_after_struct_or_class, IDENTIFIER_POINTER ($2)); }
|
||||
| aggr AGGR
|
||||
{ error ("no body nor ';' separates two class, struct or union declarations"); }
|
||||
{ cp_error (ec_no_body_nor_separates_two_class_struct_or_union_declarations); }
|
||||
| aggr attributes
|
||||
{ $$ = build_decl_list ($2, $1); }
|
||||
;
|
||||
|
@ -2222,10 +2223,10 @@ named_class_head:
|
|||
$$ = TREE_TYPE ($1);
|
||||
if (TREE_INT_CST_LOW (current_aggr) == union_type
|
||||
&& TREE_CODE ($$) != UNION_TYPE)
|
||||
cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
|
||||
cp_pedwarn (ec_union_tag_used_in_declaring, $$);
|
||||
else if (TREE_CODE ($$) == UNION_TYPE
|
||||
&& TREE_INT_CST_LOW (current_aggr) != union_type)
|
||||
cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
|
||||
cp_pedwarn (ec_nonunion_tag_used_in_declaring, $$);
|
||||
if ($2)
|
||||
{
|
||||
maybe_process_partial_specialization ($$);
|
||||
|
@ -2286,13 +2287,13 @@ base_class.1:
|
|||
}
|
||||
else
|
||||
{
|
||||
error ("`sigof' applied to non-aggregate expression");
|
||||
cp_error (ec_sigof_applied_to_nonaggregate_expression);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("`sigof' in struct or class declaration");
|
||||
cp_error (ec_sigof_in_struct_or_class_declaration);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -2307,13 +2308,13 @@ base_class.1:
|
|||
}
|
||||
else
|
||||
{
|
||||
error ("`sigof' applied to non-aggregate expression");
|
||||
cp_error (ec_sigof_applied_to_nonaggregate_expression);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("`sigof' in struct or class declaration");
|
||||
cp_error (ec_sigof_in_struct_or_class_declaration);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -2323,12 +2324,12 @@ base_class_access_list:
|
|||
VISSPEC see_typename
|
||||
| SCSPEC see_typename
|
||||
{ if ($1 != ridpointers[(int)RID_VIRTUAL])
|
||||
cp_error ("`%D' access", $1);
|
||||
cp_error (ec_access, $1);
|
||||
$$ = access_default_virtual_node; }
|
||||
| base_class_access_list VISSPEC see_typename
|
||||
{
|
||||
if ($1 != access_default_virtual_node)
|
||||
error ("multiple access specifiers");
|
||||
cp_error (ec_multiple_access_specifiers);
|
||||
else if ($2 == access_public_node)
|
||||
$$ = access_public_virtual_node;
|
||||
else if ($2 == access_protected_node)
|
||||
|
@ -2338,7 +2339,7 @@ base_class_access_list:
|
|||
}
|
||||
| base_class_access_list SCSPEC see_typename
|
||||
{ if ($2 != ridpointers[(int)RID_VIRTUAL])
|
||||
cp_error ("`%D' access", $2);
|
||||
cp_error (ec_access, $2);
|
||||
else if ($$ == access_public_node)
|
||||
$$ = access_public_virtual_node;
|
||||
else if ($$ == access_protected_node)
|
||||
|
@ -2346,7 +2347,7 @@ base_class_access_list:
|
|||
else if ($$ == access_private_node)
|
||||
$$ = access_private_virtual_node;
|
||||
else
|
||||
error ("multiple `virtual' specifiers");
|
||||
cp_error (ec_multiple_virtual_specifiers);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -2379,7 +2380,7 @@ opt.component_decl_list:
|
|||
|
||||
if (current_aggr == signature_type_node)
|
||||
{
|
||||
error ("access specifier not allowed in signature");
|
||||
cp_error (ec_access_specifier_not_allowed_in_signature);
|
||||
visspec = access_public_node;
|
||||
}
|
||||
$$ = chainon ($$, build_tree_list (visspec, $4));
|
||||
|
@ -2387,7 +2388,7 @@ opt.component_decl_list:
|
|||
| opt.component_decl_list VISSPEC ':'
|
||||
{
|
||||
if (current_aggr == signature_type_node)
|
||||
error ("access specifier not allowed in signature");
|
||||
cp_error (ec_access_specifier_not_allowed_in_signature);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -2416,7 +2417,7 @@ component_decl:
|
|||
component_decl_1 ';'
|
||||
{ }
|
||||
| component_decl_1 '}'
|
||||
{ error ("missing ';' before right brace");
|
||||
{ cp_error (ec_missing_before_right_brace);
|
||||
yyungetc ('}', 0); }
|
||||
/* C++: handle constructors, destructors and inline functions */
|
||||
/* note that INLINE is like a TYPESPEC */
|
||||
|
@ -2614,7 +2615,7 @@ new_type_id:
|
|||
'[' expr ']'
|
||||
{
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
|
||||
cp_pedwarn (ec_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;
|
||||
|
@ -2870,7 +2871,7 @@ nested_name_specifier_1:
|
|||
| IDENTIFIER SCOPE
|
||||
{
|
||||
failed_scope:
|
||||
cp_error ("`%D' is not an aggregate typedef",
|
||||
cp_error (ec_is_not_an_aggregate_typedef,
|
||||
lastiddecl ? lastiddecl : $$);
|
||||
$$ = error_mark_node;
|
||||
}
|
||||
|
@ -2890,7 +2891,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 ("`%T' is not a class or namespace", $2);
|
||||
cp_error (ec_is_not_a_class_or_namespace, $2);
|
||||
else
|
||||
{
|
||||
$$ = $2;
|
||||
|
@ -2910,14 +2911,14 @@ typename_sub1:
|
|||
typename_sub2
|
||||
{
|
||||
if (TREE_CODE ($1) == IDENTIFIER_NODE)
|
||||
cp_error ("`%T' is not a class or namespace", $1);
|
||||
cp_error (ec_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 ("`%T' is not a class or namespace", $2);
|
||||
cp_error (ec_is_not_a_class_or_namespace, $2);
|
||||
else
|
||||
{
|
||||
$$ = $2;
|
||||
|
@ -2942,7 +2943,7 @@ typename_sub2:
|
|||
got_scope = $$ = complete_type (IDENTIFIER_TYPE_VALUE ($1));
|
||||
|
||||
if ($$ == error_mark_node)
|
||||
cp_error ("`%T' is not a class or namespace", $1);
|
||||
cp_error (ec_is_not_a_class_or_namespace, $1);
|
||||
}
|
||||
| SELFNAME SCOPE
|
||||
{
|
||||
|
@ -3100,7 +3101,7 @@ maybe_label_decls:
|
|||
/* empty */
|
||||
| label_decls
|
||||
{ if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids label declarations"); }
|
||||
cp_pedwarn (ec_forbids_label_declarations); }
|
||||
;
|
||||
|
||||
label_decls:
|
||||
|
@ -3246,7 +3247,7 @@ simple_stmt:
|
|||
| GOTO '*' expr ';'
|
||||
{
|
||||
if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids computed gotos");
|
||||
cp_pedwarn (ec_forbids_computed_gotos);
|
||||
finish_goto_stmt ($3);
|
||||
}
|
||||
| GOTO identifier ';'
|
||||
|
@ -3254,7 +3255,7 @@ simple_stmt:
|
|||
| label_colon stmt
|
||||
{ finish_stmt (); }
|
||||
| label_colon '}'
|
||||
{ error ("label must be followed by statement");
|
||||
{ cp_error (ec_label_must_be_followed_by_statement);
|
||||
yyungetc ('}', 0);
|
||||
finish_stmt (); }
|
||||
| ';'
|
||||
|
@ -3359,7 +3360,7 @@ for.init.statement:
|
|||
| decl
|
||||
| '{' compstmtend
|
||||
{ if (pedantic)
|
||||
pedwarn ("ANSI C++ forbids compound statements inside for initializations");
|
||||
cp_pedwarn (ec_forbids_compound_statements_inside_for_initializations);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -3550,16 +3551,18 @@ see_typename:
|
|||
bad_parm:
|
||||
/* empty */ %prec EMPTY
|
||||
{
|
||||
error ("type specifier omitted for parameter");
|
||||
cp_error (ec_type_specifier_omitted_for_parameter);
|
||||
$$ = build_tree_list (integer_type_node, NULL_TREE);
|
||||
}
|
||||
| notype_declarator
|
||||
{
|
||||
error ("type specifier omitted for parameter");
|
||||
cp_error (ec_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 (" perhaps you want `typename %E' to make it a type", $$);
|
||||
cp_error
|
||||
(ec_perhaps_you_want_typename_expr_to_make_it_a_type,
|
||||
$$);
|
||||
$$ = build_tree_list (integer_type_node, $$);
|
||||
}
|
||||
;
|
||||
|
|
227
gcc/cp/pt.c
227
gcc/cp/pt.c
|
@ -228,7 +228,7 @@ finish_member_template_decl (template_parameters, decl)
|
|||
return decl;
|
||||
}
|
||||
else
|
||||
cp_error ("invalid member template declaration `%D'", decl);
|
||||
cp_error (ec_invalid_member_template_declaration, 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 ("explicit specialization in non-namespace scope `%D'",
|
||||
cp_error (ec_explicit_specialization_in_nonnamespace_scope,
|
||||
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 ("enclosing class templates are not explicit specialized");
|
||||
cp_error (ec_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 ("specialization of `%T' after instantiation", type);
|
||||
cp_error (ec_specialization_of_type_after_instantiation, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,7 @@ register_specialization (spec, tmpl, args)
|
|||
if (TREE_USED (fn)
|
||||
|| DECL_EXPLICIT_INSTANTIATION (fn))
|
||||
{
|
||||
cp_error ("specialization of %D after instantiation",
|
||||
cp_error (ec_specialization_of_decl_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 ("%s %+#D", str, TREE_VALUE (fn));
|
||||
cp_error_at (ec_decl, str, TREE_VALUE (fn));
|
||||
str = " ";
|
||||
}
|
||||
}
|
||||
|
@ -997,7 +997,7 @@ determine_specialization (template_id, decl, targs_out,
|
|||
no_match:
|
||||
if (complain)
|
||||
{
|
||||
cp_error_at ("template-id `%D' for `%+D' does not match any template declaration",
|
||||
cp_error_at (ec_templateid_for_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 ("ambiguous template specialization `%D' for `%+D'",
|
||||
cp_error_at (ec_ambiguous_template_specialization_for,
|
||||
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 ("too many template parameter lists in declaration of `%D'", decl);
|
||||
cp_error (ec_too_many_template_parameter_lists_in_declaration_of, 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("too few template parameter lists in declaration of `%D'", decl);
|
||||
cp_error (ec_too_few_template_parameter_lists_in_declaration_of, decl);
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
else if (processing_explicit_instantiation)
|
||||
{
|
||||
if (template_header_count)
|
||||
cp_error ("template parameter list used in explicit instantiation");
|
||||
cp_error (ec_template_parameter_list_used_in_explicit_instantiation);
|
||||
|
||||
if (have_def)
|
||||
cp_error ("definition provided for explicit instantiation");
|
||||
cp_error (ec_definition_provided_for_explicit_instantiation);
|
||||
|
||||
explicit_instantiation = 1;
|
||||
}
|
||||
|
@ -1163,13 +1163,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
that's bogus. */
|
||||
if (template_header_count)
|
||||
{
|
||||
cp_error ("template parameters specified in specialization");
|
||||
cp_error (ec_template_parameters_specified_in_specialization);
|
||||
return decl;
|
||||
}
|
||||
|
||||
if (pedantic)
|
||||
cp_pedwarn
|
||||
("explicit specialization not preceded by `template <>'");
|
||||
cp_pedwarn (ec_explicit_specialization_not_preceded_by_template);
|
||||
specialization = 1;
|
||||
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
|
||||
}
|
||||
|
@ -1186,7 +1185,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
/* This case handles bogus declarations like template <>
|
||||
template <class T> void f<int>(); */
|
||||
|
||||
cp_error ("template-id `%D' in declaration of primary template",
|
||||
cp_error (ec_templateid_in_declaration_of_primary_template,
|
||||
declarator);
|
||||
return decl;
|
||||
}
|
||||
|
@ -1199,8 +1198,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
for (; t; t = TREE_CHAIN (t))
|
||||
if (TREE_PURPOSE (t))
|
||||
{
|
||||
cp_pedwarn
|
||||
("default argument specified in explicit specialization");
|
||||
cp_pedwarn (ec_default_argument_specified_in_explicit_specialization);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1289,7 +1287,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
program is ill-formed.
|
||||
|
||||
Similar language is found in [temp.explicit]. */
|
||||
cp_error ("specialization of implicitly-declared special member function");
|
||||
cp_error (ec_specialization_of_implicitlydeclared_special_member_function);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
@ -1301,7 +1299,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
|
|||
|
||||
if (fns == NULL_TREE)
|
||||
{
|
||||
cp_error ("no member function `%s' declared in `%T'",
|
||||
cp_error (ec_no_member_function_s_declared_in,
|
||||
IDENTIFIER_POINTER (name),
|
||||
ctype);
|
||||
return decl;
|
||||
|
@ -1425,7 +1423,9 @@ maybe_check_template_type (type)
|
|||
;
|
||||
else if (template_header_count > context_depth + 1)
|
||||
/* There are two many template parameter lists. */
|
||||
cp_error ("too many template parameter lists in declaration of `%T'", type);
|
||||
cp_error
|
||||
(ec_too_many_template_parameter_lists_in_declaration_of_type,
|
||||
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 ("`%#T' is not a valid type for a template constant parameter",
|
||||
cp_error (ec_is_not_a_valid_type_for_a_template_constant_parameter,
|
||||
TREE_TYPE (parm));
|
||||
if (DECL_NAME (parm) == NULL_TREE)
|
||||
error (" a template type parameter must begin with `class' or `typename'");
|
||||
cp_error (ec_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 ("`%T' is not a valid type for a template constant parameter",
|
||||
cp_pedwarn (ec_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 ("default argument in partial specialization `%T'",
|
||||
cp_error (ec_default_argument_in_partial_specialization,
|
||||
type);
|
||||
issued_default_arg_message = 1;
|
||||
}
|
||||
|
@ -1930,11 +1930,11 @@ process_partial_specialization (decl)
|
|||
specialization. */
|
||||
if (!did_error_intro)
|
||||
{
|
||||
cp_error ("template parameters not used in partial specialization:");
|
||||
cp_error (ec_template_parameters_not_used_in_partial_specialization);
|
||||
did_error_intro = 1;
|
||||
}
|
||||
|
||||
cp_error (" `%D'",
|
||||
cp_error (ec_template_parm,
|
||||
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 ("partial specialization `%T' does not specialize any template arguments", type);
|
||||
cp_error (ec_partial_specialization_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 ("template argument `%E' involves template parameter(s)", arg);
|
||||
cp_error (ec_template_argument_involves_template_parameters, 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 ("type `%T' of template argument `%E' depends on template paramter(s)",
|
||||
cp_error (ec_type_of_template_argument_depends_on_template_paramters,
|
||||
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 ("template with C linkage");
|
||||
cp_error (ec_template_with_linkage);
|
||||
if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl)))
|
||||
cp_error ("template class without a name");
|
||||
cp_error (ec_template_class_without_a_name);
|
||||
if (TREE_CODE (decl) == TYPE_DECL
|
||||
&& TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
|
||||
cp_error ("template declaration of `%#T'", TREE_TYPE (decl));
|
||||
cp_error (ec_template_declaration_of_type, 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 ("must specialize `%#T' before defining member `%#D'",
|
||||
cp_error (ec_must_specialize_before_defining_member,
|
||||
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 ("`%D' does not declare a template type", decl);
|
||||
cp_error (ec_does_not_declare_a_template_type, decl);
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
else if (! DECL_TEMPLATE_INFO (decl))
|
||||
{
|
||||
cp_error ("template definition of non-template `%#D'", decl);
|
||||
cp_error (ec_template_definition_of_nontemplate, 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 ("got %d template parameters for `%#D'",
|
||||
cp_error (ec_got_d_template_parameters_for,
|
||||
TREE_VEC_LENGTH (a), decl);
|
||||
cp_error (" but %d required", TREE_VEC_LENGTH (t));
|
||||
cp_error (ec_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 ("got %d template parameters for `%#D'",
|
||||
cp_error (ec_got_d_template_parameters_for,
|
||||
TREE_VEC_LENGTH (a), decl);
|
||||
cp_error (" but `%#T' has %d", ctx, TREE_VEC_LENGTH (t));
|
||||
cp_error (ec_but_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 ("template declaration of `%#D'", decl);
|
||||
cp_error (ec_template_declaration_of, 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 ("previous declaration `%D'", tmpl);
|
||||
cp_error ("used %d template parameter%s instead of %d",
|
||||
cp_error_at (ec_previous_declaration, tmpl);
|
||||
cp_error (ec_used_d_template_parameters_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 ("template parameter `%#D'", tmpl_parm);
|
||||
cp_error ("redeclared here as `%#D'", parm);
|
||||
cp_error_at (ec_template_parameter, tmpl_parm);
|
||||
cp_error (ec_redeclared_here_as, 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 ("redefinition of default argument for `%#D'", parm);
|
||||
cp_error_at (" original definition appeared here", tmpl_parm);
|
||||
cp_error (ec_redefinition_of_default_argument_for, parm);
|
||||
cp_error_at (ec_original_definition_appeared_here, tmpl_parm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2392,7 +2392,7 @@ convert_nontype_argument (type, expr)
|
|||
if (! TREE_CONSTANT (expr))
|
||||
{
|
||||
non_constant:
|
||||
cp_error ("non-constant `%E' cannot be used as template argument",
|
||||
cp_error (ec_nonconstant_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 ("`%E' is not a valid template argument", expr);
|
||||
error ("it must be %s%s with external linkage",
|
||||
cp_error (ec_is_not_a_valid_template_argument, expr);
|
||||
cp_error (ec_it_must_be_ss_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 ("string literal %E is not a valid template argument",
|
||||
cp_error (ec_string_literal_is_not_a_valid_template_argument,
|
||||
referent);
|
||||
error ("because it is the address of an object with static linkage");
|
||||
cp_error (ec_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 ("address of non-extern `%E' cannot be used as template argument", referent);
|
||||
cp_error (ec_address_of_nonextern_cannot_be_used_as_template_argument, referent);
|
||||
return error_mark_node;
|
||||
}
|
||||
}
|
||||
|
@ -2447,7 +2447,7 @@ convert_nontype_argument (type, expr)
|
|||
}
|
||||
else
|
||||
{
|
||||
cp_error ("object `%E' cannot be used as template argument", expr);
|
||||
cp_error (ec_object_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 ("to refer to a type member of a template parameter,");
|
||||
cp_pedwarn (" use `typename %E'", arg);
|
||||
cp_pedwarn (ec_to_refer_to_a_type_member_of_a_template_parameter);
|
||||
cp_pedwarn (ec_use_typename, 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 ("type/value mismatch at argument %d in template parameter list for `%D'",
|
||||
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
|
||||
i + 1, in_decl);
|
||||
if (is_type)
|
||||
cp_error (" expected a constant of type `%T', got `%T'",
|
||||
cp_error (ec_expected_a_constant_of_type_got,
|
||||
TREE_TYPE (parm),
|
||||
(is_tmpl_type ? DECL_NAME (arg) : arg));
|
||||
else
|
||||
cp_error (" expected a type, got `%E'", arg);
|
||||
cp_error (ec_expected_a_type_got_expr, 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 ("type/value mismatch at argument %d in template parameter list for `%D'",
|
||||
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
|
||||
i + 1, in_decl);
|
||||
if (is_tmpl_type)
|
||||
cp_error (" expected a type, got `%T'", DECL_NAME (arg));
|
||||
cp_error (ec_expected_a_type_got_type, DECL_NAME (arg));
|
||||
else
|
||||
cp_error (" expected a class template, got `%T'", arg);
|
||||
cp_error (ec_expected_a_class_template_got, 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 ("type/value mismatch at argument %d in template parameter list for `%D'",
|
||||
cp_error (ec_typevalue_mismatch_at_argument_d_in_template_parameter_list_for,
|
||||
i + 1, in_decl);
|
||||
cp_error (" expected a template of type `%D', got `%D'", parm, arg);
|
||||
cp_error (ec_expected_a_template_of_type_got, parm, arg);
|
||||
}
|
||||
|
||||
val = error_mark_node;
|
||||
|
@ -2899,11 +2899,9 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
|
|||
if (t)
|
||||
{
|
||||
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
|
||||
cp_pedwarn
|
||||
("template-argument `%T' uses anonymous type", val);
|
||||
cp_pedwarn (ec_templateargument_uses_anonymous_type, val);
|
||||
else
|
||||
cp_error
|
||||
("template-argument `%T' uses local type `%T'",
|
||||
cp_error (ec_templateargument_uses_local_type,
|
||||
val, t);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -2935,7 +2933,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 ("could not convert template argument `%E' to `%T'",
|
||||
cp_error (ec_could_not_convert_template_argument_to,
|
||||
arg, t);
|
||||
}
|
||||
|
||||
|
@ -2982,11 +2980,11 @@ coerce_template_parms (parms, args, in_decl,
|
|||
{
|
||||
if (complain)
|
||||
{
|
||||
cp_error ("wrong number of template arguments (%d, should be %d)",
|
||||
cp_error (ec_wrong_number_of_template_arguments_d_should_be_d,
|
||||
nargs, nparms);
|
||||
|
||||
if (in_decl)
|
||||
cp_error_at ("provided for `%D'", in_decl);
|
||||
cp_error_at (ec_provided_for, in_decl);
|
||||
}
|
||||
|
||||
return error_mark_node;
|
||||
|
@ -3032,7 +3030,7 @@ coerce_template_parms (parms, args, in_decl,
|
|||
}
|
||||
else if (arg == error_mark_node)
|
||||
{
|
||||
cp_error ("template argument %d is invalid", i + 1);
|
||||
cp_error (ec_template_argument_d_is_invalid, i + 1);
|
||||
arg = error_mark_node;
|
||||
}
|
||||
else
|
||||
|
@ -3237,7 +3235,7 @@ lookup_template_function (fns, arglist)
|
|||
|
||||
if (fns == NULL_TREE)
|
||||
{
|
||||
cp_error ("non-template used as template");
|
||||
cp_error (ec_nontemplate_used_as_template);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3356,9 +3354,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
|
|||
|
||||
if (TREE_CODE (template) != TEMPLATE_DECL)
|
||||
{
|
||||
cp_error ("non-template type `%T' used as a template", d1);
|
||||
cp_error (ec_nontemplate_type_used_as_a_template, d1);
|
||||
if (in_decl)
|
||||
cp_error_at ("for template declaration `%D'", in_decl);
|
||||
cp_error_at (ec_for_template_declaration, in_decl);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3433,7 +3431,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 ("invalid use of `%D'", template);
|
||||
cp_error (ec_invalid_use_of, template);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3956,10 +3954,10 @@ push_tinst_level (d)
|
|||
return 0;
|
||||
|
||||
last_template_error_tick = tinst_level_tick;
|
||||
error ("template instantiation depth exceeds maximum of %d",
|
||||
cp_error (ec_template_instantiation_depth_exceeds_maximum_of_d,
|
||||
max_tinst_depth);
|
||||
error (" (use -ftemplate-depth-NN to increase the maximum)");
|
||||
cp_error (" instantiating `%D'", d);
|
||||
cp_error (ec_use_ftemplatedepth_to_increase_the_maximum);
|
||||
cp_error (ec_instantiating, d);
|
||||
|
||||
print_template_context (0);
|
||||
|
||||
|
@ -4276,13 +4274,13 @@ instantiate_class_template (type)
|
|||
if (t == error_mark_node)
|
||||
{
|
||||
char *str = "candidates are:";
|
||||
cp_error ("ambiguous class template instantiation for `%#T'", type);
|
||||
cp_error (ec_ambiguous_class_template_instantiation_for, 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 ("%s %+#T", str, TREE_TYPE (t));
|
||||
cp_error_at (ec_type, str, TREE_TYPE (t));
|
||||
str = " ";
|
||||
}
|
||||
}
|
||||
|
@ -4433,11 +4431,10 @@ instantiate_class_template (type)
|
|||
basetype = TREE_TYPE (elt);
|
||||
|
||||
if (! IS_AGGR_TYPE (basetype))
|
||||
cp_error
|
||||
("base type `%T' of `%T' fails to be a struct or class type",
|
||||
cp_error (ec_base_type_of_fails_to_be_a_struct_or_class_type,
|
||||
basetype, type);
|
||||
else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE)
|
||||
cp_error ("base class `%T' of `%T' has incomplete type",
|
||||
cp_error (ec_base_class_of_has_incomplete_type,
|
||||
basetype, type);
|
||||
|
||||
/* These are set up in xref_basetypes for normal classes, so
|
||||
|
@ -5257,7 +5254,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 ("instantiation of `%D' as type void", r);
|
||||
cp_error_at (ec_instantiation_of_as_type_void, r);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -5316,7 +5313,7 @@ tsubst_decl (t, args, type, in_decl)
|
|||
|
||||
TREE_CHAIN (r) = NULL_TREE;
|
||||
if (TREE_CODE (type) == VOID_TYPE)
|
||||
cp_error_at ("instantiation of `%D' as type void", r);
|
||||
cp_error_at (ec_instantiation_of_as_type_void, r);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -5647,7 +5644,7 @@ tsubst (t, args, in_decl)
|
|||
if (last_line != lineno ||
|
||||
last_file != input_filename)
|
||||
{
|
||||
cp_error ("cannot form type %s to reference type %T during template instantiation",
|
||||
cp_error (ec_cannot_form_type_s_to_reference_type_during_template_instantiation,
|
||||
(code == POINTER_TYPE) ? "pointer" : "reference",
|
||||
type);
|
||||
last_line = lineno;
|
||||
|
@ -6428,8 +6425,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 ("type `%T' composed from a local class is not a valid template-argument", t);
|
||||
cp_error (" trying to instantiate `%D'", gen_tmpl);
|
||||
cp_error (ec_type_composed_from_a_local_class_is_not_a_valid_templateargument, t);
|
||||
cp_error (ec_trying_to_instantiate, gen_tmpl);
|
||||
fndecl = error_mark_node;
|
||||
goto out;
|
||||
}
|
||||
|
@ -6832,7 +6829,7 @@ type_unification_real (tparms, targs, parms, args, subr,
|
|||
if (TREE_VEC_ELT (targs, i) == NULL_TREE)
|
||||
{
|
||||
if (!allow_incomplete)
|
||||
error ("incomplete type unification");
|
||||
cp_error (ec_incomplete_type_unification);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
|
@ -7664,7 +7661,7 @@ do_decl_instantiation (declspecs, declarator, storage)
|
|||
|
||||
if (! DECL_LANG_SPECIFIC (decl))
|
||||
{
|
||||
cp_error ("explicit instantiation of non-template `%#D'", decl);
|
||||
cp_error (ec_explicit_instantiation_of_nontemplate, decl);
|
||||
return;
|
||||
}
|
||||
else if (TREE_CODE (decl) == VAR_DECL)
|
||||
|
@ -7680,13 +7677,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 ("no matching template for `%D' found", result);
|
||||
cp_error (ec_no_matching_template_for_found, result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (TREE_CODE (decl) != FUNCTION_DECL)
|
||||
{
|
||||
cp_error ("explicit instantiation of `%#D'", decl);
|
||||
cp_error (ec_explicit_instantiation_of, decl);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -7703,8 +7700,8 @@ do_decl_instantiation (declspecs, declarator, storage)
|
|||
|
||||
No program shall both explicitly instantiate and explicitly
|
||||
specialize a template. */
|
||||
cp_error ("explicit instantiation of `%#D' after", result);
|
||||
cp_error_at ("explicit specialization here", result);
|
||||
cp_error (ec_explicit_instantiation_of_after, result);
|
||||
cp_error_at (ec_explicit_specialization_here, result);
|
||||
return;
|
||||
}
|
||||
else if (DECL_EXPLICIT_INSTANTIATION (result))
|
||||
|
@ -7718,7 +7715,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 ("duplicate explicit instantiation of `%#D'", result);
|
||||
cp_error (ec_duplicate_explicit_instantiation_of, result);
|
||||
|
||||
/* If we've already instantiated the template, just return now. */
|
||||
if (DECL_INTERFACE_KNOWN (result))
|
||||
|
@ -7726,12 +7723,12 @@ do_decl_instantiation (declspecs, declarator, storage)
|
|||
}
|
||||
else if (!DECL_IMPLICIT_INSTANTIATION (result))
|
||||
{
|
||||
cp_error ("no matching template for `%D' found", result);
|
||||
cp_error (ec_no_matching_template_for_found, result);
|
||||
return;
|
||||
}
|
||||
else if (!DECL_TEMPLATE_INFO (result))
|
||||
{
|
||||
cp_pedwarn ("explicit instantiation of non-template `%#D'", result);
|
||||
cp_pedwarn (ec_explicit_instantiation_of_nontemplate, result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7743,11 +7740,11 @@ do_decl_instantiation (declspecs, declarator, storage)
|
|||
else if (storage == ridpointers[(int) RID_EXTERN])
|
||||
{
|
||||
if (pedantic)
|
||||
cp_pedwarn ("ANSI C++ forbids the use of `extern' on explicit instantiations");
|
||||
cp_pedwarn (ec_forbids_the_use_of_extern_on_explicit_instantiations);
|
||||
extern_p = 1;
|
||||
}
|
||||
else
|
||||
cp_error ("storage class `%D' applied to template instantiation",
|
||||
cp_error (ec_storage_class_applied_to_template_instantiation,
|
||||
storage);
|
||||
|
||||
SET_DECL_EXPLICIT_INSTANTIATION (result);
|
||||
|
@ -7787,7 +7784,7 @@ do_type_instantiation (t, storage)
|
|||
|
||||
if (! IS_AGGR_TYPE (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
|
||||
{
|
||||
cp_error ("explicit instantiation of non-template type `%T'", t);
|
||||
cp_error (ec_explicit_instantiation_of_nontemplate_type, t);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7800,7 +7797,7 @@ do_type_instantiation (t, storage)
|
|||
|
||||
if (TYPE_SIZE (t) == NULL_TREE)
|
||||
{
|
||||
cp_error ("explicit instantiation of `%#T' before definition of template",
|
||||
cp_error (ec_explicit_instantiation_of_before_definition_of_template,
|
||||
t);
|
||||
return;
|
||||
}
|
||||
|
@ -7808,8 +7805,8 @@ do_type_instantiation (t, storage)
|
|||
if (storage != NULL_TREE)
|
||||
{
|
||||
if (pedantic)
|
||||
cp_pedwarn("ANSI C++ forbids the use of `%s' on explicit instantiations",
|
||||
IDENTIFIER_POINTER (storage));
|
||||
cp_pedwarn (ec_forbids_the_use_of_s_on_explicit_instantiations,
|
||||
IDENTIFIER_POINTER (storage));
|
||||
|
||||
if (storage == ridpointers[(int) RID_INLINE])
|
||||
nomem_p = 1;
|
||||
|
@ -7819,7 +7816,7 @@ do_type_instantiation (t, storage)
|
|||
static_p = 1;
|
||||
else
|
||||
{
|
||||
cp_error ("storage class `%D' applied to template instantiation",
|
||||
cp_error (ec_storage_class_applied_to_template_instantiation,
|
||||
storage);
|
||||
extern_p = 0;
|
||||
}
|
||||
|
@ -7831,8 +7828,8 @@ do_type_instantiation (t, storage)
|
|||
|
||||
No program shall both explicitly instantiate and explicitly
|
||||
specialize a template. */
|
||||
cp_error ("explicit instantiation of `%#T' after", t);
|
||||
cp_error_at ("explicit specialization here", t);
|
||||
cp_error (ec_explicit_instantiation_of_type_after, t);
|
||||
cp_error_at (ec_explicit_specialization_here, t);
|
||||
return;
|
||||
}
|
||||
else if (CLASSTYPE_EXPLICIT_INSTANTIATION (t))
|
||||
|
@ -7846,7 +7843,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 ("duplicate explicit instantiation of `%#T'", t);
|
||||
cp_error (ec_duplicate_explicit_instantiation_of_type, t);
|
||||
|
||||
/* If we've already instantiated the template, just return now. */
|
||||
if (!CLASSTYPE_INTERFACE_ONLY (t))
|
||||
|
@ -7942,11 +7939,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 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. */
|
||||
/* 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. */
|
||||
gen_tmpl = most_general_template (tmpl);
|
||||
unregistered = unregister_specialization (decl, gen_tmpl);
|
||||
|
||||
|
@ -8158,7 +8155,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 ("explicit instantiation of `%D' but no definition available",
|
||||
cp_error (ec_explicit_instantiation_of_but_no_definition_available,
|
||||
d);
|
||||
|
||||
add_pending_template (d);
|
||||
|
@ -8314,7 +8311,7 @@ add_maybe_template (d, fns)
|
|||
return;
|
||||
if (t == error_mark_node)
|
||||
{
|
||||
cp_error ("ambiguous template instantiation for `%D'", d);
|
||||
cp_error (ec_ambiguous_template_instantiation_for, d);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ get_base_filename (filename)
|
|||
|
||||
if (p && ! compiling)
|
||||
{
|
||||
warning ("-frepo must be used with -c");
|
||||
cp_warning (ec_frepo_must_be_used_with_c);
|
||||
flag_use_repository = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ init_repo (filename)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
error ("mysterious repository information in %s", repo_name);
|
||||
cp_error (ec_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)
|
||||
{
|
||||
error ("can't create repository information file `%s'", repo_name);
|
||||
cp_error (ec_cant_create_repository_information_file_s, repo_name);
|
||||
flag_use_repository = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ build_headof (exp)
|
|||
|
||||
if (TREE_CODE (type) != POINTER_TYPE)
|
||||
{
|
||||
error ("`headof' applied to non-pointer type");
|
||||
cp_error (ec_headof_applied_to_nonpointer_type);
|
||||
return error_mark_node;
|
||||
}
|
||||
type = TREE_TYPE (type);
|
||||
|
@ -190,7 +190,7 @@ get_tinfo_fn_dynamic (exp)
|
|||
|
||||
if (type_unknown_p (exp))
|
||||
{
|
||||
error ("typeid of overloaded function");
|
||||
cp_error (ec_typeid_of_overloaded_function);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ get_tinfo_fn_dynamic (exp)
|
|||
|
||||
if (! flag_rtti)
|
||||
{
|
||||
warning ("taking dynamic typeid of object without -frtti");
|
||||
cp_warning (ec_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)
|
||||
{
|
||||
warning ("requesting typeid of object without -frtti");
|
||||
cp_warning (ec_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 ("dynamic_cast of `%#D' to `%#T' can never succeed",
|
||||
cp_warning (ec_dynamic_cast_of_to_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 ("dynamic_cast of `%#D' to `%#T' can never succeed",
|
||||
cp_warning (ec_dynamic_cast_of_to_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 ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'",
|
||||
cp_error (ec_cannot_dynamic_cast_of_type_to_type,
|
||||
expr, exprtype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
|
|
@ -278,13 +278,13 @@ get_binfo (parent, binfo, protect)
|
|||
|
||||
if (dist == -3)
|
||||
{
|
||||
cp_error ("fields of `%T' are inaccessible in `%T' due to private inheritance",
|
||||
cp_error (ec_fields_of_are_inaccessible_in_due_to_private_inheritance,
|
||||
parent, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
else if (dist == -2 && protect)
|
||||
{
|
||||
cp_error ("type `%T' is ambiguous base class for type `%T'", parent,
|
||||
cp_error (ec_type_is_ambiguous_base_class_for_type, 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) */
|
||||
|
||||
char *errstr = 0;
|
||||
error_code ec = ec_last_error_code;
|
||||
|
||||
#if 0
|
||||
/* We cannot search for constructor/destructor names like this. */
|
||||
|
@ -952,20 +952,10 @@ lookup_field (xbasetype, name, protect, want_type)
|
|||
{
|
||||
if (TREE_PRIVATE (rval) | TREE_PROTECTED (rval))
|
||||
this_v = compute_access (basetype_path, rval);
|
||||
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'";
|
||||
}
|
||||
if (this_v == access_private_node)
|
||||
ec = ec_private_in_class;
|
||||
else if (this_v == access_protected_node)
|
||||
ec = ec_protected_in_class;
|
||||
}
|
||||
|
||||
rval_binfo = basetype_path;
|
||||
|
@ -1074,7 +1064,7 @@ lookup_field (xbasetype, name, protect, want_type)
|
|||
else
|
||||
{
|
||||
/* This is ambiguous. */
|
||||
errstr = "request for member `%D' is ambiguous";
|
||||
ec = ec_ambiguous_member;
|
||||
protect += 2;
|
||||
break;
|
||||
}
|
||||
|
@ -1109,10 +1099,10 @@ lookup_field (xbasetype, name, protect, want_type)
|
|||
}
|
||||
|
||||
if (rval == NULL_TREE)
|
||||
errstr = 0;
|
||||
ec = ec_last_error_code;
|
||||
|
||||
/* If this FIELD_DECL defines its own access level, deal with that. */
|
||||
if (rval && errstr == 0
|
||||
if (rval && ec == ec_last_error_code
|
||||
&& (protect & 1)
|
||||
&& DECL_LANG_SPECIFIC (rval)
|
||||
&& DECL_ACCESS (rval))
|
||||
|
@ -1128,7 +1118,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)
|
||||
{
|
||||
errstr = "conflicting access to member `%D'";
|
||||
ec = ec_conflicting_access;
|
||||
this_v = access_default_node;
|
||||
}
|
||||
own_access = new_v;
|
||||
|
@ -1147,20 +1137,18 @@ lookup_field (xbasetype, name, protect, want_type)
|
|||
}
|
||||
search_stack = pop_search_level (search_stack);
|
||||
|
||||
if (errstr == 0)
|
||||
if (ec == ec_last_error_code)
|
||||
{
|
||||
if (own_access == access_private_node)
|
||||
errstr = "member `%D' declared private";
|
||||
ec = ec_member_private;
|
||||
else if (own_access == access_protected_node)
|
||||
errstr = "member `%D' declared protected";
|
||||
ec = ec_member_protected;
|
||||
else if (this_v == access_private_node)
|
||||
errstr = TREE_PRIVATE (rval)
|
||||
? "member `%D' is private"
|
||||
: "member `%D' is from private base class";
|
||||
ec = TREE_PRIVATE (rval)
|
||||
? ec_member_private : ec_member_in_private_base;
|
||||
else if (this_v == access_protected_node)
|
||||
errstr = TREE_PROTECTED (rval)
|
||||
? "member `%D' is protected"
|
||||
: "member `%D' is from protected base class";
|
||||
ec = TREE_PROTECTED (rval)
|
||||
? ec_member_protected : ec_member_in_protected_base;
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -1172,9 +1160,9 @@ lookup_field (xbasetype, name, protect, want_type)
|
|||
protect = 0;
|
||||
}
|
||||
|
||||
if (errstr && protect)
|
||||
if (ec != ec_last_error_code && protect)
|
||||
{
|
||||
cp_error (errstr, name, type);
|
||||
cp_error (ec, name, type);
|
||||
rval = error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1243,7 +1231,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 ("assignment to non-static member `%D' of enclosing class `%T'",
|
||||
cp_error (ec_assignment_to_nonstatic_member_of_enclosing_class,
|
||||
id, DECL_CONTEXT (t));
|
||||
/* Mark this for do_identifier(). It would otherwise
|
||||
claim that the variable was undeclared. */
|
||||
|
@ -1367,7 +1355,7 @@ lookup_fnfields (basetype_path, name, complain)
|
|||
/* For now, don't try this. */
|
||||
int protect = complain;
|
||||
|
||||
char *errstr = 0;
|
||||
error_code ec = ec_last_error_code;
|
||||
|
||||
if (complain == -1)
|
||||
{
|
||||
|
@ -1524,7 +1512,7 @@ lookup_fnfields (basetype_path, name, complain)
|
|||
else
|
||||
{
|
||||
/* This is ambiguous. */
|
||||
errstr = "request for method `%D' is ambiguous";
|
||||
ec = ec_ambiguous_member;
|
||||
rvals = error_mark_node;
|
||||
break;
|
||||
}
|
||||
|
@ -1542,9 +1530,9 @@ lookup_fnfields (basetype_path, name, complain)
|
|||
}
|
||||
search_stack = pop_search_level (search_stack);
|
||||
|
||||
if (errstr && protect)
|
||||
if (ec != ec_last_error_code && protect)
|
||||
{
|
||||
cp_error (errstr, name);
|
||||
cp_error (ec, name);
|
||||
rvals = error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1854,21 +1842,21 @@ get_matching_virtual (binfo, fndecl, dtorp)
|
|||
|
||||
if (pedantic && i == -1)
|
||||
{
|
||||
cp_pedwarn_at ("invalid covariant return type for `%#D' (must be pointer or reference to class)", fndecl);
|
||||
cp_pedwarn_at (" overriding `%#D'", tmp);
|
||||
cp_pedwarn_at (ec_invalid_covariant_return_type_for_must_be_pointer_or_reference_to_class, fndecl);
|
||||
cp_pedwarn_at (ec_overriding, tmp);
|
||||
}
|
||||
}
|
||||
else if (IS_AGGR_TYPE_2 (brettype, drettype)
|
||||
&& comptypes (brettype, drettype, 0))
|
||||
{
|
||||
error ("invalid covariant return type (must use pointer or reference)");
|
||||
cp_error_at (" overriding `%#D'", tmp);
|
||||
cp_error_at (" with `%#D'", fndecl);
|
||||
cp_error (ec_invalid_covariant_return_type_must_use_pointer_or_reference);
|
||||
cp_error_at (ec_overriding, tmp);
|
||||
cp_error_at (ec_with, fndecl);
|
||||
}
|
||||
else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)
|
||||
{
|
||||
cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);
|
||||
cp_error_at (" overriding definition as `%#D'", tmp);
|
||||
cp_error_at (ec_conflicting_return_type_specified_for_virtual_function, fndecl);
|
||||
cp_error_at (ec_overriding_definition_as, tmp);
|
||||
SET_IDENTIFIER_ERROR_LOCUS (name, basetype);
|
||||
}
|
||||
break;
|
||||
|
@ -2446,7 +2434,7 @@ virtual_context (fndecl, t, vbase)
|
|||
}
|
||||
}
|
||||
/* This shouldn't happen, I don't want errors! */
|
||||
warning ("recoverable compiler error, fixups for virtual function");
|
||||
cp_warning (ec_recoverable_compiler_error_fixups_for_virtual_function);
|
||||
return vbase;
|
||||
}
|
||||
while (path)
|
||||
|
@ -2709,7 +2697,7 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
|
|||
tree in_charge_node = lookup_name (in_charge_identifier, 0);
|
||||
if (! in_charge_node)
|
||||
{
|
||||
warning ("recoverable internal compiler error, nobody's in charge!");
|
||||
cp_warning (ec_recoverable_internal_compiler_error_nobodys_in_charge);
|
||||
in_charge_node = integer_zero_node;
|
||||
}
|
||||
in_charge_node = build_binary_op (EQ_EXPR, in_charge_node, integer_zero_node, 1);
|
||||
|
@ -2837,9 +2825,9 @@ envelope_add_decl (type, decl, values)
|
|||
|| ! TREE_PRIVATE (value)))
|
||||
/* Should figure out access control more accurately. */
|
||||
{
|
||||
cp_warning_at ("member `%#D' is shadowed", value);
|
||||
cp_warning_at ("by member function `%#D'", decl);
|
||||
warning ("in this context");
|
||||
cp_warning_at (ec_member_is_shadowed, value);
|
||||
cp_warning_at (ec_by_member_function, decl);
|
||||
cp_warning (ec_in_this_context);
|
||||
}
|
||||
|
||||
context = DECL_REAL_CONTEXT (value);
|
||||
|
|
|
@ -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 ("break statement not within loop or switch");
|
||||
cp_error (ec_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 ("continue statement not within a loop");
|
||||
cp_error (ec_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 ("%s qualifier ignored on asm",
|
||||
cp_warning (ec_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 ("%s qualifier ignored on asm",
|
||||
cp_warning (ec_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))
|
||||
{
|
||||
error ("`this' is unavailable for static member functions");
|
||||
cp_error (ec_this_is_unavailable_for_static_member_functions);
|
||||
result = error_mark_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current_function_decl)
|
||||
error ("invalid use of `this' in non-member function");
|
||||
cp_error (ec_invalid_use_of_this_in_nonmember_function);
|
||||
else
|
||||
error ("invalid use of `this' at top level");
|
||||
cp_error (ec_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 ("calling type `%T' like a method", fn);
|
||||
cp_error (ec_calling_type_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)))
|
||||
{
|
||||
warning ("signature name in scope resolution ignored");
|
||||
cp_warning (ec_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 ("destructor specifier `%T::~%T()' must have matching names",
|
||||
cp_error (ec_destructor_specifier_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 ("`%E' is not of type `%T'", object, destructor);
|
||||
cp_error (ec_is_not_of_type, 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)
|
||||
{
|
||||
pedwarn ("template type parameters must use the keyword `class' or `typename'");
|
||||
cp_pedwarn (ec_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)
|
||||
{
|
||||
error ("invalid base class");
|
||||
cp_error (ec_invalid_base_class);
|
||||
type = error_mark_node;
|
||||
}
|
||||
else
|
||||
type = TREE_TYPE (base_class);
|
||||
if (current_aggr_is_signature && access_specifier)
|
||||
error ("access and source specifiers not allowed in signature");
|
||||
cp_error (ec_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)))
|
||||
{
|
||||
error ("class name not allowed as base signature");
|
||||
cp_error (ec_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))
|
||||
{
|
||||
error ("signature name not allowed as base class");
|
||||
cp_error (ec_signature_name_not_allowed_as_base_class);
|
||||
result = NULL_TREE;
|
||||
}
|
||||
else
|
||||
|
|
14
gcc/cp/sig.c
14
gcc/cp/sig.c
|
@ -492,7 +492,7 @@ build_signature_table_constructor (sig_ty, rhs)
|
|||
|
||||
if (oty_type == NULL_TREE || oty_type == error_mark_node)
|
||||
{
|
||||
cp_error ("class `%T' does not contain type `%T'",
|
||||
cp_error (ec_class_does_not_contain_type,
|
||||
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 ("class `%T' does not contain method `%D'",
|
||||
cp_error (ec_class_does_not_contain_method,
|
||||
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))
|
||||
{
|
||||
error ("class `%s' does not contain a method conforming to `%s'",
|
||||
cp_error (ec_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))
|
||||
{
|
||||
error ("signature with opaque type implemented by multiple classes");
|
||||
cp_error (ec_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)))))
|
||||
{
|
||||
error ("invalid assignment to signature pointer or reference");
|
||||
cp_error (ec_invalid_assignment_to_signature_pointer_or_reference);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (TYPE_SIZE (sig_ty) == NULL_TREE)
|
||||
{
|
||||
cp_error ("undefined signature `%T' used in signature %s declaration",
|
||||
cp_error (ec_undefined_signature_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)))
|
||||
{
|
||||
compiler_error ("cannot build call of signature member function `%s'",
|
||||
cp_compiler_error (ec_cannot_build_call_of_signature_member_function_s,
|
||||
fndecl_as_string (function, 1));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ lvalue_or_else (ref, string)
|
|||
{
|
||||
int win = lvalue_p (ref);
|
||||
if (! win)
|
||||
error ("non-lvalue in %s", string);
|
||||
cp_error (ec_nonlvalue_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 ("direct base `%T' inaccessible in `%T' due to ambiguity",
|
||||
cp_warning (ec_direct_base_inaccessible_in_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 ("virtual base `%T' inaccessible in `%T' due to ambiguity",
|
||||
cp_warning (ec_virtual_base_inaccessible_in_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)
|
||||
compiler_error ("base class `%s' ambiguous in binfo_value",
|
||||
cp_compiler_error (ec_base_class_s_ambiguous_in_binfo_value,
|
||||
TYPE_NAME_STRING (elem));
|
||||
if (elem == type)
|
||||
return TYPE_BINFO (type);
|
||||
|
|
448
gcc/cp/typeck.c
448
gcc/cp/typeck.c
File diff suppressed because it is too large
Load diff
200
gcc/cp/typeck2.c
200
gcc/cp/typeck2.c
|
@ -51,7 +51,7 @@ error_not_base_type (basetype, type)
|
|||
{
|
||||
if (TREE_CODE (basetype) == FUNCTION_DECL)
|
||||
basetype = DECL_CLASS_CONTEXT (basetype);
|
||||
cp_error ("type `%T' is not a base type for type `%T'", basetype, type);
|
||||
cp_error (ec_type_is_not_a_base_type_for_type, basetype, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ readonly_error (arg, string, soft)
|
|||
char *string;
|
||||
int soft;
|
||||
{
|
||||
char *fmt;
|
||||
error_code ec;
|
||||
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))))
|
||||
fmt = "%s of member `%D' in read-only structure";
|
||||
ec = ec_member_in_readonly_structure;
|
||||
else
|
||||
fmt = "%s of read-only member `%D'";
|
||||
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
|
||||
ec = ec_readonly_member;
|
||||
(*fn) (ec, 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))
|
||||
fmt = "%s of constant field `%D'";
|
||||
ec = ec_constant_field;
|
||||
else
|
||||
fmt = "%s of read-only variable `%D'";
|
||||
(*fn) (fmt, string, arg);
|
||||
ec = ec_readonly_variable;
|
||||
(*fn) (ec, string, arg);
|
||||
}
|
||||
else if (TREE_CODE (arg) == PARM_DECL)
|
||||
(*fn) ("%s of read-only parameter `%D'", string, arg);
|
||||
(*fn) (ec_readonly_parameter, 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) ("%s of read-only reference `%D'", string, TREE_OPERAND (arg, 0));
|
||||
(*fn) (ec_readonly_reference, string, TREE_OPERAND (arg, 0));
|
||||
else if (TREE_CODE (arg) == RESULT_DECL)
|
||||
(*fn) ("%s of read-only named return value `%D'", string, arg);
|
||||
(*fn) (ec_readonly_named_return_val, string, arg);
|
||||
else
|
||||
(*fn) ("%s of read-only location", string);
|
||||
(*fn) (ec_readonly_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 ("cannot declare variable `%D' to be of type `%T'",
|
||||
cp_error (ec_cannot_declare_variable_to_be_of_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == PARM_DECL)
|
||||
cp_error ("cannot declare parameter `%D' to be of type `%T'",
|
||||
cp_error (ec_cannot_declare_parameter_to_be_of_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == FIELD_DECL)
|
||||
cp_error ("cannot declare field `%D' to be of type `%T'",
|
||||
cp_error (ec_cannot_declare_field_to_be_of_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
|
||||
cp_error ("invalid return type for method `%#D'", decl);
|
||||
cp_error (ec_invalid_return_type_for_method, decl);
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
cp_error ("invalid return type for function `%#D'", decl);
|
||||
cp_error (ec_invalid_return_type_for_function, decl);
|
||||
}
|
||||
else
|
||||
cp_error ("cannot allocate an object of type `%T'", type);
|
||||
cp_error (ec_cannot_allocate_an_object_of_type, 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)
|
||||
error (" since the following virtual functions are abstract:");
|
||||
cp_error (ec_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 ("\t%#D", TREE_VALUE (tu));
|
||||
cp_error (ec_virtual, TREE_VALUE (tu));
|
||||
tu = TREE_CHAIN (tu);
|
||||
}
|
||||
|
||||
if (needs_final_overriders)
|
||||
{
|
||||
if (has_abstract_virtuals)
|
||||
error (" and the following virtual functions need a final overrider:");
|
||||
cp_error (ec_and_the_following_virtual_functions_need_a_final_overrider);
|
||||
else
|
||||
error (" since the following virtual functions need a final overrider:");
|
||||
cp_error (ec_since_the_following_virtual_functions_need_a_final_overrider);
|
||||
}
|
||||
tu = u;
|
||||
while (tu)
|
||||
{
|
||||
if (DECL_NEEDS_FINAL_OVERRIDER_P (TREE_VALUE (tu)))
|
||||
cp_error ("\t%#D", TREE_VALUE (tu));
|
||||
cp_error (ec_virtual, 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 (" since type `%T' has abstract virtual functions and must override virtual functions", type);
|
||||
cp_error (ec_since_type_has_abstract_virtual_functions_and_must_override_virtual_functions, type);
|
||||
else
|
||||
cp_error (" since type `%T' has abstract virtual functions", type);
|
||||
cp_error (ec_since_type_has_abstract_virtual_functions, type);
|
||||
}
|
||||
else
|
||||
cp_error (" since type `%T' must override virtual functions", type);
|
||||
cp_error (ec_since_type_must_override_virtual_functions, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,22 +238,22 @@ signature_error (decl, type)
|
|||
return;
|
||||
|
||||
if (TREE_CODE (decl) == VAR_DECL)
|
||||
cp_error ("cannot declare variable `%D' to be of signature type `%T'",
|
||||
cp_error (ec_cannot_declare_variable_to_be_of_signature_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == PARM_DECL)
|
||||
cp_error ("cannot declare parameter `%D' to be of signature type `%T'",
|
||||
cp_error (ec_cannot_declare_parameter_to_be_of_signature_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == FIELD_DECL)
|
||||
cp_error ("cannot declare field `%D' to be of signature type `%T'",
|
||||
cp_error (ec_cannot_declare_field_to_be_of_signature_type,
|
||||
decl, type);
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
|
||||
cp_error ("invalid return type for method `%#D'", decl);
|
||||
cp_error (ec_invalid_return_type_for_method, decl);
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL)
|
||||
cp_error ("invalid return type for function `%#D'", decl);
|
||||
cp_error (ec_invalid_return_type_for_function, decl);
|
||||
}
|
||||
else
|
||||
cp_error ("cannot allocate an object of signature type `%T'", type);
|
||||
cp_error (ec_cannot_allocate_an_object_of_signature_type, type);
|
||||
}
|
||||
|
||||
/* Print an error message for invalid use of an incomplete type.
|
||||
|
@ -265,15 +265,13 @@ 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 ("`%D' has incomplete type", value);
|
||||
cp_error (ec_has_incomplete_type, value);
|
||||
else
|
||||
{
|
||||
retry:
|
||||
|
@ -284,11 +282,11 @@ incomplete_type_error (value, type)
|
|||
case RECORD_TYPE:
|
||||
case UNION_TYPE:
|
||||
case ENUMERAL_TYPE:
|
||||
errmsg = "invalid use of undefined type `%#T'";
|
||||
break;
|
||||
cp_error (ec_invalid_use_of_undefined_type, type);
|
||||
return;
|
||||
|
||||
case VOID_TYPE:
|
||||
error ("invalid use of void expression");
|
||||
cp_error (ec_invalid_use_of_void_expression);
|
||||
return;
|
||||
|
||||
case ARRAY_TYPE:
|
||||
|
@ -297,22 +295,20 @@ incomplete_type_error (value, type)
|
|||
type = TREE_TYPE (type);
|
||||
goto retry;
|
||||
}
|
||||
error ("invalid use of array with unspecified bounds");
|
||||
cp_error (ec_invalid_use_of_array_with_unspecified_bounds);
|
||||
return;
|
||||
|
||||
case OFFSET_TYPE:
|
||||
error ("invalid use of member type (did you forget the `&' ?)");
|
||||
cp_error (ec_invalid_use_of_member_type_did_you_forget_the);
|
||||
return;
|
||||
|
||||
case TEMPLATE_TYPE_PARM:
|
||||
error ("invalid use of template type parameter");
|
||||
cp_error (ec_invalid_use_of_template_type_parameter);
|
||||
return;
|
||||
|
||||
default:
|
||||
my_friendly_abort (108);
|
||||
}
|
||||
|
||||
cp_error (errmsg, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,16 +382,16 @@ my_friendly_abort (i)
|
|||
ack ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
|
||||
}
|
||||
else
|
||||
error ("confused by earlier errors, bailing out");
|
||||
cp_error (ec_confused_by_earlier_errors_bailing_out);
|
||||
|
||||
exit (34);
|
||||
}
|
||||
++abortcount;
|
||||
|
||||
if (i == 0)
|
||||
error ("Internal compiler error.");
|
||||
cp_error (ec_nternal_compiler_error);
|
||||
else
|
||||
error ("Internal compiler error %d.", i);
|
||||
cp_error (ec_nternal_compiler_error_d, i);
|
||||
|
||||
fatal ("Please submit a full bug report to `egcs-bugs@cygnus.com'.");
|
||||
}
|
||||
|
@ -596,13 +592,13 @@ store_init_value (decl, init)
|
|||
if (TREE_CODE (init) == TREE_LIST
|
||||
&& IS_SIGNATURE (type))
|
||||
{
|
||||
cp_error ("constructor syntax cannot be used with signature type `%T'",
|
||||
cp_error (ec_constructor_syntax_cannot_be_used_with_signature_type,
|
||||
type);
|
||||
init = error_mark_node;
|
||||
}
|
||||
else if (TREE_CODE (init) == TREE_LIST)
|
||||
{
|
||||
cp_error ("constructor syntax used, but no constructor declared for type `%T'", type);
|
||||
cp_error (ec_constructor_syntax_used_but_no_constructor_declared_for_type, type);
|
||||
init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
|
||||
}
|
||||
#if 0
|
||||
|
@ -612,25 +608,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 ("initializer list construction invalid for derived class object `%D'", decl);
|
||||
cp_error_at (ec_initializer_list_construction_invalid_for_derived_class_object, decl);
|
||||
if (CLASSTYPE_VTBL_PTR (type))
|
||||
cp_error_at ("initializer list construction invalid for polymorphic class object `%D'", decl);
|
||||
cp_error_at (ec_initializer_list_construction_invalid_for_polymorphic_class_object, decl);
|
||||
if (TYPE_NEEDS_CONSTRUCTING (type))
|
||||
{
|
||||
cp_error_at ("initializer list construction invalid for `%D'", decl);
|
||||
error ("due to the presence of a constructor");
|
||||
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
|
||||
cp_error (ec_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 ("initializer list construction invalid for `%D'", decl);
|
||||
cp_error_at ("due to non-public access of member `%D'", field);
|
||||
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
|
||||
cp_error_at (ec_due_to_nonpublic_access_of_member, field);
|
||||
}
|
||||
for (field = TYPE_METHODS (type); field; field = TREE_CHAIN (field))
|
||||
if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
|
||||
{
|
||||
cp_error_at ("initializer list construction invalid for `%D'", decl);
|
||||
cp_error_at ("due to non-public access of member `%D'", field);
|
||||
cp_error_at (ec_initializer_list_construction_invalid_for, decl);
|
||||
cp_error_at (ec_due_to_nonpublic_access_of_member, field);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -642,7 +638,7 @@ store_init_value (decl, init)
|
|||
{
|
||||
if (TREE_CHAIN (init))
|
||||
{
|
||||
warning ("comma expression used to initialize return value");
|
||||
cp_warning (ec_comma_expression_used_to_initialize_return_value);
|
||||
init = build_compound_expr (init);
|
||||
}
|
||||
else
|
||||
|
@ -658,7 +654,7 @@ store_init_value (decl, init)
|
|||
else if (TREE_CODE (init) == TREE_LIST
|
||||
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
|
||||
{
|
||||
error ("cannot initialize arrays using this syntax");
|
||||
cp_error (ec_cannot_initialize_arrays_using_this_syntax);
|
||||
return NULL_TREE;
|
||||
}
|
||||
else
|
||||
|
@ -667,7 +663,7 @@ store_init_value (decl, init)
|
|||
|
||||
if (TREE_CHAIN (init) != NULL_TREE)
|
||||
{
|
||||
pedwarn ("initializer list being treated as compound expression");
|
||||
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
|
||||
init = build_compound_expr (init);
|
||||
}
|
||||
else
|
||||
|
@ -720,7 +716,7 @@ store_init_value (decl, init)
|
|||
|| IS_SIGNATURE_REFERENCE (type))))
|
||||
{
|
||||
if (! TREE_CONSTANT (value) || ! TREE_STATIC (value))
|
||||
pedwarn ("ANSI C++ forbids non-constant aggregate initializer expressions");
|
||||
cp_pedwarn (ec_forbids_nonconstant_aggregate_initializer_expressions);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -788,7 +784,7 @@ digest_init (type, init, tail)
|
|||
|
||||
if (TREE_CODE (init) == TREE_LIST)
|
||||
{
|
||||
error ("initializing array with parameter list");
|
||||
cp_error (ec_initializing_array_with_parameter_list);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -807,14 +803,14 @@ digest_init (type, init, tail)
|
|||
!= char_type_node)
|
||||
&& TYPE_PRECISION (typ1) == BITS_PER_UNIT)
|
||||
{
|
||||
error ("char-array initialized from wide string");
|
||||
cp_error (ec_chararray_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)
|
||||
{
|
||||
error ("int-array initialized from non-wide string");
|
||||
cp_error (ec_intarray_initialized_from_nonwide_string);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -830,7 +826,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))
|
||||
pedwarn ("initializer-string for array of chars is too long");
|
||||
cp_pedwarn (ec_initializerstring_for_array_of_chars_is_too_long);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
@ -850,17 +846,17 @@ digest_init (type, init, tail)
|
|||
{
|
||||
if (element == 0)
|
||||
{
|
||||
error ("initializer for scalar variable requires one element");
|
||||
cp_error (ec_initializer_for_scalar_variable_requires_one_element);
|
||||
return error_mark_node;
|
||||
}
|
||||
init = element;
|
||||
}
|
||||
while (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
|
||||
{
|
||||
cp_pedwarn ("braces around scalar initializer for `%T'", type);
|
||||
cp_pedwarn (ec_braces_around_scalar_initializer_for, type);
|
||||
init = CONSTRUCTOR_ELTS (init);
|
||||
if (TREE_CHAIN (init))
|
||||
cp_pedwarn ("ignoring extra initializers for `%T'", type);
|
||||
cp_pedwarn (ec_ignoring_extra_initializers_for, type);
|
||||
init = TREE_VALUE (init);
|
||||
}
|
||||
|
||||
|
@ -872,7 +868,7 @@ digest_init (type, init, tail)
|
|||
|
||||
if (TYPE_SIZE (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
|
||||
{
|
||||
cp_error ("variable-sized object of type `%T' may not be initialized",
|
||||
cp_error (ec_variablesized_object_of_type_may_not_be_initialized,
|
||||
type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -881,7 +877,7 @@ digest_init (type, init, tail)
|
|||
{
|
||||
if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
|
||||
{
|
||||
cp_error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
|
||||
cp_error (ec_subobject_of_type_must_be_initialized_by_constructor_not_by,
|
||||
type, init);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -908,7 +904,7 @@ digest_init (type, init, tail)
|
|||
}
|
||||
}
|
||||
|
||||
error ("invalid initializer");
|
||||
cp_error (ec_invalid_initializer);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -946,7 +942,7 @@ process_init_constructor (type, init, elts)
|
|||
if (elts)
|
||||
{
|
||||
if (warn_missing_braces)
|
||||
warning ("aggregate has a partly bracketed initializer");
|
||||
cp_warning (ec_aggregate_has_a_partly_bracketed_initializer);
|
||||
tail = *elts;
|
||||
}
|
||||
else
|
||||
|
@ -994,7 +990,7 @@ process_init_constructor (type, init, elts)
|
|||
|| TREE_CODE (tail1) == TREE_LIST, 319);
|
||||
if (tail == tail1 && len < 0)
|
||||
{
|
||||
error ("non-empty initializer for array of empty elements");
|
||||
cp_error (ec_nonempty_initializer_for_array_of_empty_elements);
|
||||
/* Just ignore what we were supposed to use. */
|
||||
tail1 = NULL_TREE;
|
||||
}
|
||||
|
@ -1101,19 +1097,19 @@ process_init_constructor (type, init, elts)
|
|||
members = expr_tree_cons (field, next1, members);
|
||||
}
|
||||
else if (TREE_READONLY (field))
|
||||
error ("uninitialized const member `%s'",
|
||||
cp_error (ec_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)))
|
||||
error ("member `%s' with uninitialized const fields",
|
||||
cp_error (ec_member_s_with_uninitialized_const_fields,
|
||||
IDENTIFIER_POINTER (DECL_NAME (field)));
|
||||
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
|
||||
error ("member `%s' is uninitialized reference",
|
||||
cp_error (ec_member_s_is_uninitialized_reference,
|
||||
IDENTIFIER_POINTER (DECL_NAME (field)));
|
||||
/* Warn when some struct elements are implicitly initialized
|
||||
to zero. */
|
||||
else if (extra_warnings)
|
||||
warning ("missing initializer for member `%s'",
|
||||
cp_warning (ec_missing_initializer_for_member_s,
|
||||
IDENTIFIER_POINTER (DECL_NAME (field)));
|
||||
}
|
||||
}
|
||||
|
@ -1138,7 +1134,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)
|
||||
error ("index value instead of field name in union initializer");
|
||||
cp_error (ec_index_value_instead_of_field_name_in_union_initializer);
|
||||
else
|
||||
{
|
||||
tree temp;
|
||||
|
@ -1150,7 +1146,7 @@ process_init_constructor (type, init, elts)
|
|||
if (temp)
|
||||
field = temp, win = 1;
|
||||
else
|
||||
error ("no field `%s' in union being initialized",
|
||||
cp_error (ec_no_field_s_in_union_being_initialized,
|
||||
IDENTIFIER_POINTER (TREE_PURPOSE (tail)));
|
||||
}
|
||||
if (!win)
|
||||
|
@ -1158,7 +1154,7 @@ process_init_constructor (type, init, elts)
|
|||
}
|
||||
else if (field == 0)
|
||||
{
|
||||
cp_error ("union `%T' with no named members cannot be initialized",
|
||||
cp_error (ec_union_with_no_named_members_cannot_be_initialized,
|
||||
type);
|
||||
TREE_VALUE (tail) = error_mark_node;
|
||||
}
|
||||
|
@ -1194,7 +1190,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)
|
||||
pedwarn ("excess elements in aggregate initializer");
|
||||
cp_pedwarn (ec_excess_elements_in_aggregate_initializer);
|
||||
|
||||
if (erroneous)
|
||||
return error_mark_node;
|
||||
|
@ -1321,7 +1317,7 @@ build_x_arrow (datum)
|
|||
|
||||
if (value_member (TREE_TYPE (rval), types_memoized))
|
||||
{
|
||||
error ("circular pointer delegation detected");
|
||||
cp_error (ec_circular_pointer_delegation_detected);
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
|
@ -1334,7 +1330,7 @@ build_x_arrow (datum)
|
|||
|
||||
if (last_rval == NULL_TREE)
|
||||
{
|
||||
cp_error ("base operand of `->' has non-pointer type `%T'", type);
|
||||
cp_error (ec_base_operand_of_has_nonpointer_type, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1353,9 +1349,9 @@ build_x_arrow (datum)
|
|||
return build_indirect_ref (last_rval, NULL_PTR);
|
||||
|
||||
if (types_memoized)
|
||||
error ("result of `operator->()' yields non-pointer result");
|
||||
cp_error (ec_result_of_operator_yields_nonpointer_result);
|
||||
else
|
||||
error ("base operand of `->' is not a pointer");
|
||||
cp_error (ec_base_operand_of_is_not_a_pointer);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1396,7 @@ build_m_component_ref (datum, component)
|
|||
|
||||
if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
|
||||
{
|
||||
cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
|
||||
cp_error (ec_cannot_be_used_as_a_member_pointer_since_it_is_of_type, component, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1410,15 +1406,15 @@ build_m_component_ref (datum, component)
|
|||
|
||||
if (! IS_AGGR_TYPE (objtype))
|
||||
{
|
||||
cp_error ("cannot apply member pointer `%E' to `%E'", component, datum);
|
||||
cp_error ("which is of non-aggregate type `%T'", objtype);
|
||||
cp_error (ec_cannot_apply_member_pointer_to, component, datum);
|
||||
cp_error (ec_which_is_of_nonaggregate_type, objtype);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
binfo = get_binfo (TYPE_METHOD_BASETYPE (type), objtype, 1);
|
||||
if (binfo == NULL_TREE)
|
||||
{
|
||||
cp_error ("member type `%T::' incompatible with object type `%T'",
|
||||
cp_error (ec_member_type_incompatible_with_object_type,
|
||||
TYPE_METHOD_BASETYPE (type), objtype);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -1455,7 +1451,7 @@ build_functional_cast (exp, parms)
|
|||
type = lookup_name (exp, 1);
|
||||
if (!type || TREE_CODE (type) != TYPE_DECL)
|
||||
{
|
||||
cp_error ("`%T' fails to be a typedef or built-in type", exp);
|
||||
cp_error (ec_fails_to_be_a_typedef_or_builtin_type, exp);
|
||||
return error_mark_node;
|
||||
}
|
||||
type = TREE_TYPE (type);
|
||||
|
@ -1471,7 +1467,7 @@ build_functional_cast (exp, parms)
|
|||
|
||||
if (IS_SIGNATURE (type))
|
||||
{
|
||||
error ("signature type not allowed in cast or constructor expression");
|
||||
cp_error (ec_signature_type_not_allowed_in_cast_or_constructor_expression);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1479,7 @@ build_functional_cast (exp, parms)
|
|||
else
|
||||
{
|
||||
if (TREE_CHAIN (parms) != NULL_TREE)
|
||||
pedwarn ("initializer list being treated as compound expression");
|
||||
cp_pedwarn (ec_initializer_list_being_treated_as_compound_expression);
|
||||
parms = build_compound_expr (parms);
|
||||
}
|
||||
|
||||
|
@ -1499,7 +1495,7 @@ build_functional_cast (exp, parms)
|
|||
|
||||
if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
|
||||
{
|
||||
cp_error ("type `%T' is not yet defined", type);
|
||||
cp_error (ec_type_is_not_yet_defined, type);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -1568,15 +1564,15 @@ report_case_error (code, type, new_value, old_value)
|
|||
if (code == 1)
|
||||
{
|
||||
if (new_value)
|
||||
error ("case label not within a switch statement");
|
||||
cp_error (ec_case_label_not_within_a_switch_statement);
|
||||
else
|
||||
error ("default label not within a switch statement");
|
||||
cp_error (ec_default_label_not_within_a_switch_statement);
|
||||
}
|
||||
else if (code == 2)
|
||||
{
|
||||
if (new_value == 0)
|
||||
{
|
||||
error ("multiple default labels in one switch");
|
||||
cp_error (ec_multiple_default_labels_in_one_switch);
|
||||
return;
|
||||
}
|
||||
if (TREE_CODE (new_value) == RANGE_EXPR)
|
||||
|
@ -1630,29 +1626,29 @@ report_case_error (code, type, new_value, old_value)
|
|||
else
|
||||
{
|
||||
if (TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
error ("duplicate label `%s' in switch statement",
|
||||
cp_error (ec_duplicate_label_s_in_switch_statement,
|
||||
enum_name_string (new_value, type));
|
||||
else
|
||||
error ("duplicate label (%d) in switch statement",
|
||||
cp_error (ec_duplicate_label_d_in_switch_statement,
|
||||
TREE_INT_CST_LOW (new_value));
|
||||
}
|
||||
}
|
||||
else if (code == 3)
|
||||
{
|
||||
if (TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
warning ("case value out of range for enum %s",
|
||||
cp_warning (ec_case_value_out_of_range_for_enum_s,
|
||||
TYPE_NAME_STRING (type));
|
||||
else
|
||||
warning ("case value out of range");
|
||||
cp_warning (ec_case_value_out_of_range);
|
||||
}
|
||||
else if (code == 4)
|
||||
{
|
||||
if (TREE_CODE (type) == ENUMERAL_TYPE)
|
||||
error ("range values `%s' and `%s' reversed",
|
||||
cp_error (ec_range_values_s_and_s_reversed,
|
||||
enum_name_string (new_value, type),
|
||||
enum_name_string (old_value, type));
|
||||
else
|
||||
error ("range values reversed");
|
||||
cp_error (ec_range_values_reversed);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1663,5 +1659,5 @@ check_for_new_type (string, inptree)
|
|||
flagged_type_tree inptree;
|
||||
{
|
||||
if (pedantic && inptree.new_type_flag)
|
||||
pedwarn ("ANSI C++ forbids defining types within %s",string);
|
||||
cp_pedwarn (ec_forbids_defining_types_within_s,string);
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ open_xref_file(file)
|
|||
|
||||
if (xref_file == NULL)
|
||||
{
|
||||
error("Can't create cross-reference file `%s'", xref_name);
|
||||
cp_error (ec_ant_create_crossreference_file_s, xref_name);
|
||||
doing_xref = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ in the following sections.
|
|||
-fname-mangling-version-@var{n} -fno-default-inline
|
||||
-fno-gnu-keywords -fnonnull-objects -fguiding-decls
|
||||
-foperator-names -fno-optional-diags -fstrict-prototype -fthis-is-variable
|
||||
-ftemplate-depth-@var{n} -nostdinc++ -traditional +e@var{n}
|
||||
-ftemplate-depth-@var{n} -fdiag-codes -nostdinc++ -traditional +e@var{n}
|
||||
@end smallexample
|
||||
|
||||
@item Warning Options
|
||||
|
@ -129,7 +129,7 @@ in the following sections.
|
|||
-Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes
|
||||
-Wswitch -Wsynth -Wtemplate-debugging -Wtraditional
|
||||
-Wtrigraphs -Wundef -Wuninitialized -Wunused -Wwrite-strings
|
||||
-Wunknown-pragmas
|
||||
-Wunknown-pragmas -Wnumber-@var{n}
|
||||
@end smallexample
|
||||
|
||||
@item Debugging Options
|
||||
|
@ -1165,6 +1165,19 @@ A limit on the template instantiation depth is needed to detect
|
|||
endless recursions during template class instantiation. ANSI/ISO C++
|
||||
conforming programs must not rely on a maximum depth greater than 17.
|
||||
|
||||
@item -fdiag-codes
|
||||
When printing a diagnostic, also print the corresponding diagnostic
|
||||
code. The code is printed in square brackets, before the message
|
||||
itself. For example, you might see something like:
|
||||
|
||||
@smallexample
|
||||
test.C:3: warning: [62] all member functions in class `C' are private
|
||||
@end smallexample
|
||||
|
||||
which indicates that this is warning number 62. Some diagnostics do not
|
||||
(yet) have corresponding code numbers. This option is useful in
|
||||
conjuction with @samp{-Wnumber-@var{n}}.
|
||||
|
||||
@item -nostdinc++
|
||||
Do not search for header files in the standard directories specific to
|
||||
C++, but do still search the other standard directories. (This option
|
||||
|
@ -1189,6 +1202,7 @@ Do not assume @samp{inline} for functions defined inside a class scope.
|
|||
@item -Wold-style-cast
|
||||
@itemx -Woverloaded-virtual
|
||||
@itemx -Wtemplate-debugging
|
||||
@itemx -Wnumber-@var{n}
|
||||
Warnings that apply only to C++ programs. @xref{Warning
|
||||
Options,,Options to Request or Suppress Warnings}.
|
||||
|
||||
|
@ -1697,6 +1711,11 @@ conformant compiler code but disables the helpful warning.
|
|||
Warn if a function can not be inlined, and either it was declared as inline,
|
||||
or else the @samp{-finline-functions} option was given.
|
||||
|
||||
@item -Wnumber-@var{n} (C++ only)
|
||||
Enable warning number @var{n}. (Or, more often, with
|
||||
@samp{-Wno-number-@var{n}}, disable that warning.) To obtain the
|
||||
appropriate numbers, use @samp{-fdiag-codes}.
|
||||
|
||||
@item -Wold-style-cast
|
||||
Warn if an old-style (C-style) cast is used within a program.
|
||||
|
||||
|
|
6
gcc/testsuite/g++.old-deja/g++.other/warn2.C
Normal file
6
gcc/testsuite/g++.old-deja/g++.other/warn2.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Build don't link:
|
||||
// Special g++ Options: -Wno-number-62
|
||||
|
||||
class C {
|
||||
C();
|
||||
};
|
Loading…
Add table
Reference in a new issue