diff options
-rw-r--r-- | gcc/cp/ChangeLog | 30 | ||||
-rw-r--r-- | gcc/cp/call.c | 7 | ||||
-rw-r--r-- | gcc/cp/class.c | 9 | ||||
-rw-r--r-- | gcc/cp/decl.c | 45 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 6 | ||||
-rw-r--r-- | gcc/cp/expr.c | 2 | ||||
-rw-r--r-- | gcc/cp/friend.c | 5 |
7 files changed, 63 insertions, 41 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c326e41..045902c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,33 @@ +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> * cp-tree.h (merge_primary_and_secondary_vtables_p): New macro. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b78a0e4..e996b59 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2556,8 +2556,7 @@ 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 ("pointer-to-member function %E cannot be called without an object; consider using .* or ->*", obj); return error_mark_node; } @@ -2773,7 +2772,7 @@ build_conditional_expr (arg1, arg2, arg3) if (!arg2) { 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); } @@ -3579,7 +3578,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 ("no suitable `operator delete' for `%T'", type); return error_mark_node; } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7aed67b..ce3c2e8 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1923,11 +1923,8 @@ check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p, { *cant_have_default_ctor_p = 1; if (! TYPE_HAS_CONSTRUCTOR (t)) - { - cp_pedwarn ("base `%T' with only non-default constructor", - basetype); - cp_pedwarn ("in class without a constructor"); - } + cp_pedwarn ("base `%T' with only non-default constructor in class without a constructor", + basetype); } /* If the base class is not empty or nearly empty, then this @@ -3471,7 +3468,7 @@ finish_struct_anon (t) continue; 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); if (TREE_CODE (elt) != FIELD_DECL) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a948c30..4551509 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6789,7 +6789,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) { 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), context, DECL_NAME (decl)); DECL_CONTEXT (decl) = DECL_CONTEXT (field); @@ -6959,7 +6959,7 @@ grok_reference_init (decl, type, init) 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; } @@ -8449,11 +8449,11 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, if (ctype == NULL_TREE && DECL_MAIN_P (decl)) { if (processing_template_decl) - error ("cannot declare `main' to be a template"); + error ("cannot declare `::main' to be a template"); if (inlinep) - error ("cannot declare `main' to be inline"); + error ("cannot declare `::main' to be inline"); else if (! publicp) - error ("cannot declare `main' to be static"); + error ("cannot declare `::main' to be static"); inlinep = 0; publicp = 1; } @@ -8532,7 +8532,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, if (PROCESSING_REAL_TEMPLATE_DECL_P ()) { /* 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); return NULL_TREE; } @@ -8870,7 +8870,7 @@ check_static_variable_definition (decl, type) required. */ 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); /* If we just return the declaration, crashes will sometimes occur. We therefore return void_type_node, as if this was a @@ -8879,10 +8879,10 @@ check_static_variable_definition (decl, type) return 1; } 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); 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; } @@ -8966,9 +8966,9 @@ compute_array_index_type (name, size) else if (integer_zerop (size) && pedantic && !in_system_header) { if (name) - cp_pedwarn ("ANSI C++ forbids zero-size array `%D'", name); + cp_pedwarn ("ISO C++ forbids zero-size array `%D'", name); 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) if (pedantic) { if (name) - cp_pedwarn ("ANSI C++ forbids variable-size array `%D'", + cp_pedwarn ("ISO C++ forbids variable-size array `%D'", name); else - cp_pedwarn ("ANSI C++ forbids variable-size array"); + cp_pedwarn ("ISO C++ forbids variable-size array"); } /* Create a variable-sized array index type. */ @@ -9073,9 +9073,8 @@ create_array_type_for_decl (name, type, size) can be omitted only for the first member of the sequence. */ 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); - cp_error ("must have bounds for all dimensions except the first"); return error_mark_node; } @@ -9604,7 +9603,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits)) { 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) error ("`long long long' is too long for GCC"); else @@ -9694,10 +9693,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (in_system_header || flag_ms_extensions) /* Allow it, sigh. */; 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); 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); type = integer_type_node; @@ -10655,7 +10654,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (decl_context == FIELD) { 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); decl = build_lang_decl (TYPE_DECL, declarator, type); } @@ -10726,7 +10725,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (ctype == NULL_TREE) { 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 ctype = TYPE_METHOD_BASETYPE (type); } @@ -11042,7 +11041,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) { 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)); friendp = 0; } @@ -11125,7 +11124,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) allow non-static data members here, because C does and /usr/include/netinet/in.h uses that. */ && (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); if (staticp) @@ -12004,7 +12003,7 @@ grok_op_properties (decl, virtualp, friendp) else if (name == ansi_opname[(int) COND_EXPR]) { /* 13.4.0.3 */ - cp_error ("ANSI C++ prohibits overloading operator ?:"); + cp_error ("ISO C++ prohibits overloading operator ?:"); } else if (ambi_op_p (name)) { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 440cdcd..46f64fb 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1187,7 +1187,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"); + error ("cannot delete a function. Only pointer-to-objects are valid arguments to `delete'"); return error_mark_node; } @@ -1245,7 +1245,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 ("invalid declaration of member template `%#D' in local class", decl); if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) @@ -1862,7 +1862,7 @@ grok_function_init (decl, init) #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 ("initializer specified for non-virtual member function `%D'", decl); #endif else if (integer_zerop (init)) { diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 1fcecff..d11e232 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -290,7 +290,7 @@ do_case (start, end) error ("pointers are not permitted as case values"); if (end && pedantic) - pedwarn ("ANSI C++ forbids range expressions in switch statement"); + pedwarn ("ISO C++ forbids range expressions in switch statement"); if (start) value1 = check_cp_case_value (start); diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 1fc5794..01c5d94 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -410,10 +410,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, warning (" declares a non-template 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 (" -Wno-non-template-friend disables this warning."); + 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."); explained = 1; } } |