Commit cb9a3ff8 by Gabriel Dos Reis Committed by Gabriel Dos Reis

call.c (build_object_call): Compress consecutive calls to cp_error.

2000-02-21  Gabriel Dos Reis  <gdr@codesourcery.com>

        * call.c (build_object_call): Compress consecutive calls to
        cp_error.
        (build_conditional_expr): Say 'ISO C++' not 'ANSI C++'.
        (build_op_delete_call): Adjust message formatting.

        * class.c (check_bases): Compress consecutive calls to
        cp_pedwarn.
        (finish_struct_anon): Say 'ISO C++'.

        * decl.c (start_decl): Same here.
        (grok_reference_init): Likewise.
        (grokfndecl): Correct message formatting.
        (grokfndecl): Improve diagnostic.
        (check_static_variable_definition): Likewise. Say 'ISO C++'
        (compute_array_index_type): Say 'ISO C++'
        (create_array_type_for_decl): Compress consecutive calls to
        cp_error.
        (grokdeclarator): Say 'ISO C++'
        (grok_op_properties): Likewise.

        * decl2.c (delete_sanity): Clairify diagnostic.
        (check_member_template): Same here.
        (grok_function_init): Use consistent terminology.

        * expr.c (do_case): Say 'ISO C++'

        * friend.c (do_friend): Compress consecutive calls to warning.

From-SVN: r32090
parent c801c87c
2000-02-21 Gabriel Dos Reis <gdr@codesourcery.com>
* call.c (build_object_call): Compress consecutive calls to
cp_error.
(build_conditional_expr): Say 'ISO C++' not 'ANSI C++'.
(build_op_delete_call): Adjust message formatting.
* class.c (check_bases): Compress consecutive calls to
cp_pedwarn.
(finish_struct_anon): Say 'ISO C++'.
* decl.c (start_decl): Same here.
(grok_reference_init): Likewise.
(grokfndecl): Correct message formatting.
(grokfndecl): Improve diagnostic.
(check_static_variable_definition): Likewise. Say 'ISO C++'
(compute_array_index_type): Say 'ISO C++'
(create_array_type_for_decl): Compress consecutive calls to
cp_error.
(grokdeclarator): Say 'ISO C++'
(grok_op_properties): Likewise.
* decl2.c (delete_sanity): Clairify diagnostic.
(check_member_template): Same here.
(grok_function_init): Use consistent terminology.
* expr.c (do_case): Say 'ISO C++'
* friend.c (do_friend): Compress consecutive calls to warning.
2000-02-20 Mark Mitchell <mark@codesourcery.com> 2000-02-20 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (merge_primary_and_secondary_vtables_p): New macro. * cp-tree.h (merge_primary_and_secondary_vtables_p): New macro.
......
...@@ -2556,8 +2556,7 @@ build_object_call (obj, args) ...@@ -2556,8 +2556,7 @@ build_object_call (obj, args)
{ {
/* It's no good looking for an overloaded operator() on a /* It's no good looking for an overloaded operator() on a
pointer-to-member-function. */ pointer-to-member-function. */
cp_error ("pointer-to-member function %E cannot be called", obj); cp_error ("pointer-to-member function %E cannot be called without an object; consider using .* or ->*", obj);
cp_error ("without an object; consider using .* or ->*");
return error_mark_node; return error_mark_node;
} }
...@@ -2773,7 +2772,7 @@ build_conditional_expr (arg1, arg2, arg3) ...@@ -2773,7 +2772,7 @@ build_conditional_expr (arg1, arg2, arg3)
if (!arg2) if (!arg2)
{ {
if (pedantic) if (pedantic)
pedwarn ("ANSI C++ forbids omitting the middle term of a ?: expression"); pedwarn ("ISO C++ forbids omitting the middle term of a ?: expression");
arg1 = arg2 = save_expr (arg1); arg1 = arg2 = save_expr (arg1);
} }
...@@ -3579,7 +3578,7 @@ build_op_delete_call (code, addr, size, flags, placement) ...@@ -3579,7 +3578,7 @@ build_op_delete_call (code, addr, size, flags, placement)
if (flags & LOOKUP_SPECULATIVELY) if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE; return NULL_TREE;
cp_error ("no suitable operator delete for `%T'", type); cp_error ("no suitable `operator delete' for `%T'", type);
return error_mark_node; return error_mark_node;
} }
......
...@@ -1923,11 +1923,8 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p, ...@@ -1923,11 +1923,8 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p,
{ {
*cant_have_default_ctor_p = 1; *cant_have_default_ctor_p = 1;
if (! TYPE_HAS_CONSTRUCTOR (t)) if (! TYPE_HAS_CONSTRUCTOR (t))
{ cp_pedwarn ("base `%T' with only non-default constructor in class without a constructor",
cp_pedwarn ("base `%T' with only non-default constructor", basetype);
basetype);
cp_pedwarn ("in class without a constructor");
}
} }
/* If the base class is not empty or nearly empty, then this /* If the base class is not empty or nearly empty, then this
...@@ -3471,7 +3468,7 @@ finish_struct_anon (t) ...@@ -3471,7 +3468,7 @@ finish_struct_anon (t)
continue; continue;
if (DECL_NAME (elt) == constructor_name (t)) if (DECL_NAME (elt) == constructor_name (t))
cp_pedwarn_at ("ANSI C++ forbids member `%D' with same name as enclosing class", cp_pedwarn_at ("ISO C++ forbids member `%D' with same name as enclosing class",
elt); elt);
if (TREE_CODE (elt) != FIELD_DECL) if (TREE_CODE (elt) != FIELD_DECL)
......
...@@ -6789,7 +6789,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -6789,7 +6789,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
{ {
if (DECL_CONTEXT (field) != context) if (DECL_CONTEXT (field) != context)
{ {
cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'", cp_pedwarn ("ISO C++ does not permit `%T::%D' to be defined as `%T::%D'",
DECL_CONTEXT (field), DECL_NAME (decl), DECL_CONTEXT (field), DECL_NAME (decl),
context, DECL_NAME (decl)); context, DECL_NAME (decl));
DECL_CONTEXT (decl) = DECL_CONTEXT (field); DECL_CONTEXT (decl) = DECL_CONTEXT (field);
...@@ -6959,7 +6959,7 @@ grok_reference_init (decl, type, init) ...@@ -6959,7 +6959,7 @@ grok_reference_init (decl, type, init)
if (TREE_CODE (init) == CONSTRUCTOR) if (TREE_CODE (init) == CONSTRUCTOR)
{ {
cp_error ("ANSI C++ forbids use of initializer list to initialize reference `%D'", decl); cp_error ("ISO C++ forbids use of initializer list to initialize reference `%D'", decl);
return; return;
} }
...@@ -8449,11 +8449,11 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8449,11 +8449,11 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
if (ctype == NULL_TREE && DECL_MAIN_P (decl)) if (ctype == NULL_TREE && DECL_MAIN_P (decl))
{ {
if (processing_template_decl) if (processing_template_decl)
error ("cannot declare `main' to be a template"); error ("cannot declare `::main' to be a template");
if (inlinep) if (inlinep)
error ("cannot declare `main' to be inline"); error ("cannot declare `::main' to be inline");
else if (! publicp) else if (! publicp)
error ("cannot declare `main' to be static"); error ("cannot declare `::main' to be static");
inlinep = 0; inlinep = 0;
publicp = 1; publicp = 1;
} }
...@@ -8532,7 +8532,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8532,7 +8532,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
if (PROCESSING_REAL_TEMPLATE_DECL_P ()) if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{ {
/* Something like `template <class T> friend void f<T>()'. */ /* Something like `template <class T> friend void f<T>()'. */
cp_error ("template-id `%D' in declaration of primary template", cp_error ("invalid use of template-id `%D' in declaration of primary template",
orig_declarator); orig_declarator);
return NULL_TREE; return NULL_TREE;
} }
...@@ -8870,7 +8870,7 @@ check_static_variable_definition (decl, type) ...@@ -8870,7 +8870,7 @@ check_static_variable_definition (decl, type)
required. */ required. */
if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE) if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE)
{ {
cp_error ("in-class initialization of static data member of non-integral type `%T'", cp_error ("invalid in-class initialization of static data member of non-integral type `%T'",
type); type);
/* If we just return the declaration, crashes will sometimes /* If we just return the declaration, crashes will sometimes
occur. We therefore return void_type_node, as if this was a occur. We therefore return void_type_node, as if this was a
...@@ -8879,10 +8879,10 @@ check_static_variable_definition (decl, type) ...@@ -8879,10 +8879,10 @@ check_static_variable_definition (decl, type)
return 1; return 1;
} }
else if (!CP_TYPE_CONST_P (type)) else if (!CP_TYPE_CONST_P (type))
cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'", cp_error ("ISO C++ forbids in-class initialization of non-const static member `%D'",
decl); decl);
else if (pedantic && !INTEGRAL_TYPE_P (type)) else if (pedantic && !INTEGRAL_TYPE_P (type))
cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type); cp_pedwarn ("ISO C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type);
return 0; return 0;
} }
...@@ -8966,9 +8966,9 @@ compute_array_index_type (name, size) ...@@ -8966,9 +8966,9 @@ compute_array_index_type (name, size)
else if (integer_zerop (size) && pedantic && !in_system_header) else if (integer_zerop (size) && pedantic && !in_system_header)
{ {
if (name) if (name)
cp_pedwarn ("ANSI C++ forbids zero-size array `%D'", name); cp_pedwarn ("ISO C++ forbids zero-size array `%D'", name);
else else
cp_pedwarn ("ANSI C++ forbids zero-size array"); cp_pedwarn ("ISO C++ forbids zero-size array");
} }
} }
...@@ -8987,10 +8987,10 @@ compute_array_index_type (name, size) ...@@ -8987,10 +8987,10 @@ compute_array_index_type (name, size)
if (pedantic) if (pedantic)
{ {
if (name) if (name)
cp_pedwarn ("ANSI C++ forbids variable-size array `%D'", cp_pedwarn ("ISO C++ forbids variable-size array `%D'",
name); name);
else else
cp_pedwarn ("ANSI C++ forbids variable-size array"); cp_pedwarn ("ISO C++ forbids variable-size array");
} }
/* Create a variable-sized array index type. */ /* Create a variable-sized array index type. */
...@@ -9073,9 +9073,8 @@ create_array_type_for_decl (name, type, size) ...@@ -9073,9 +9073,8 @@ create_array_type_for_decl (name, type, size)
can be omitted only for the first member of the sequence. */ can be omitted only for the first member of the sequence. */
if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
{ {
cp_error ("declaration of `%D' as multidimensional array", cp_error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first",
name); name);
cp_error ("must have bounds for all dimensions except the first");
return error_mark_node; return error_mark_node;
} }
...@@ -9604,7 +9603,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9604,7 +9603,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits)) if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits))
{ {
if (pedantic && ! in_system_header && warn_long_long) if (pedantic && ! in_system_header && warn_long_long)
pedwarn ("ANSI C++ does not support `long long'"); pedwarn ("ISO C++ does not support `long long'");
if (longlong) if (longlong)
error ("`long long long' is too long for GCC"); error ("`long long long' is too long for GCC");
else else
...@@ -9694,10 +9693,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9694,10 +9693,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (in_system_header || flag_ms_extensions) if (in_system_header || flag_ms_extensions)
/* Allow it, sigh. */; /* Allow it, sigh. */;
else if (pedantic || ! is_main) else if (pedantic || ! is_main)
cp_pedwarn ("ANSI C++ forbids declaration of `%s' with no type", cp_pedwarn ("ISO C++ forbids declaration of `%s' with no type",
name); name);
else if (warn_return_type) else if (warn_return_type)
cp_warning ("ANSI C++ forbids declaration of `%s' with no type", cp_warning ("ISO C++ forbids declaration of `%s' with no type",
name); name);
type = integer_type_node; type = integer_type_node;
...@@ -10655,7 +10654,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10655,7 +10654,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == FIELD) if (decl_context == FIELD)
{ {
if (declarator == constructor_name (current_class_type)) if (declarator == constructor_name (current_class_type))
cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class", cp_pedwarn ("ISO C++ forbids nested type `%D' with same name as enclosing class",
declarator); declarator);
decl = build_lang_decl (TYPE_DECL, declarator, type); decl = build_lang_decl (TYPE_DECL, declarator, type);
} }
...@@ -10726,7 +10725,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10726,7 +10725,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (ctype == NULL_TREE) if (ctype == NULL_TREE)
{ {
if (TREE_CODE (type) != METHOD_TYPE) if (TREE_CODE (type) != METHOD_TYPE)
cp_error_at ("invalid type qualifier for non-method type", decl); cp_error_at ("invalid type qualifier for non-member function type", decl);
else else
ctype = TYPE_METHOD_BASETYPE (type); ctype = TYPE_METHOD_BASETYPE (type);
} }
...@@ -11042,7 +11041,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11042,7 +11041,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{ {
if (friendp) if (friendp)
{ {
error ("`%s' is neither function nor method; cannot be declared friend", error ("`%s' is neither function nor member function; cannot be declared friend",
IDENTIFIER_POINTER (declarator)); IDENTIFIER_POINTER (declarator));
friendp = 0; friendp = 0;
} }
...@@ -11125,7 +11124,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11125,7 +11124,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
allow non-static data members here, because C does allow non-static data members here, because C does
and /usr/include/netinet/in.h uses that. */ and /usr/include/netinet/in.h uses that. */
&& (staticp || ! in_system_header)) && (staticp || ! in_system_header))
cp_pedwarn ("ANSI C++ forbids data member `%D' with same name as enclosing class", cp_pedwarn ("ISO C++ forbids data member `%D' with same name as enclosing class",
declarator); declarator);
if (staticp) if (staticp)
...@@ -12004,7 +12003,7 @@ grok_op_properties (decl, virtualp, friendp) ...@@ -12004,7 +12003,7 @@ grok_op_properties (decl, virtualp, friendp)
else if (name == ansi_opname[(int) COND_EXPR]) else if (name == ansi_opname[(int) COND_EXPR])
{ {
/* 13.4.0.3 */ /* 13.4.0.3 */
cp_error ("ANSI C++ prohibits overloading operator ?:"); cp_error ("ISO C++ prohibits overloading operator ?:");
} }
else if (ambi_op_p (name)) else if (ambi_op_p (name))
{ {
......
...@@ -1187,7 +1187,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete) ...@@ -1187,7 +1187,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
/* You can't delete functions. */ /* You can't delete functions. */
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{ {
error ("cannot delete a function"); error ("cannot delete a function. Only pointer-to-objects are valid arguments to `delete'");
return error_mark_node; return error_mark_node;
} }
...@@ -1245,7 +1245,7 @@ check_member_template (tmpl) ...@@ -1245,7 +1245,7 @@ check_member_template (tmpl)
/* 14.5.2.2 [temp.mem] /* 14.5.2.2 [temp.mem]
A local class shall not have member templates. */ A local class shall not have member templates. */
cp_error ("declaration of member template `%#D' in local class", cp_error ("invalid declaration of member template `%#D' in local class",
decl); decl);
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
...@@ -1862,7 +1862,7 @@ grok_function_init (decl, init) ...@@ -1862,7 +1862,7 @@ grok_function_init (decl, init)
#if 0 #if 0
/* We'll check for this in finish_struct_1. */ /* We'll check for this in finish_struct_1. */
else if (DECL_VINDEX (decl) == NULL_TREE) else if (DECL_VINDEX (decl) == NULL_TREE)
cp_error ("initializer specified for non-virtual method `%D'", decl); cp_error ("initializer specified for non-virtual member function `%D'", decl);
#endif #endif
else if (integer_zerop (init)) else if (integer_zerop (init))
{ {
......
...@@ -290,7 +290,7 @@ do_case (start, end) ...@@ -290,7 +290,7 @@ do_case (start, end)
error ("pointers are not permitted as case values"); error ("pointers are not permitted as case values");
if (end && pedantic) if (end && pedantic)
pedwarn ("ANSI C++ forbids range expressions in switch statement"); pedwarn ("ISO C++ forbids range expressions in switch statement");
if (start) if (start)
value1 = check_cp_case_value (start); value1 = check_cp_case_value (start);
......
...@@ -410,10 +410,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, ...@@ -410,10 +410,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
warning (" declares a non-template function"); warning (" declares a non-template function");
if (! explained) if (! explained)
{ {
warning (" (if this is not what you intended, make sure"); warning (" (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning.");
warning (" the function template has already been declared,");
warning (" and add <> after the function name here)");
warning (" -Wno-non-template-friend disables this warning.");
explained = 1; explained = 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment