diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/call.c | 36 | ||||
-rw-r--r-- | gcc/cp/class.c | 34 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 18 | ||||
-rw-r--r-- | gcc/cp/decl.c | 70 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 6 | ||||
-rw-r--r-- | gcc/cp/except.c | 6 | ||||
-rw-r--r-- | gcc/cp/friend.c | 10 | ||||
-rw-r--r-- | gcc/cp/init.c | 16 | ||||
-rw-r--r-- | gcc/cp/lex.c | 6 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 2 | ||||
-rw-r--r-- | gcc/cp/method.c | 2 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 22 | ||||
-rw-r--r-- | gcc/cp/parser.c | 12 | ||||
-rw-r--r-- | gcc/cp/repo.c | 2 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 68 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 8 |
19 files changed, 171 insertions, 164 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14a787ba7e6..6f2baf65f1a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2005-04-23 DJ Delorie <dj@redhat.com> + + * call.c, class.c, cvt.c, decl.c, decl2.c, except.c, friend.c, + init.c, lex.c, mangle.c, method.c, name-lookup.c, parser.c, + repo.c, rtti.c, tree.c, typeck.c, typeck2.c: Adjust warning() + callers. + 2005-04-22 Per Bothner <per@bothner.com> * decl.c (make_rtl_for_nonlocal_decl): Don't try get_fileinfo if diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 7dbb4d644f1..e40e61f0aae 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3402,14 +3402,14 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3) if (TREE_CODE (arg2_type) == ENUMERAL_TYPE && TREE_CODE (arg3_type) == ENUMERAL_TYPE) - warning ("enumeral mismatch in conditional expression: %qT vs %qT", + warning (0, "enumeral mismatch in conditional expression: %qT vs %qT", arg2_type, arg3_type); else if (extra_warnings && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE && !same_type_p (arg3_type, type_promotes_to (arg2_type))) || (TREE_CODE (arg3_type) == ENUMERAL_TYPE && !same_type_p (arg2_type, type_promotes_to (arg3_type))))) - warning ("enumeral and non-enumeral type in conditional expression"); + warning (0, "enumeral and non-enumeral type in conditional expression"); arg2 = perform_implicit_conversion (result_type, arg2); arg3 = perform_implicit_conversion (result_type, arg3); @@ -3776,7 +3776,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3, && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) != TYPE_MAIN_VARIANT (TREE_TYPE (arg2)))) { - warning ("comparison between %q#T and %q#T", + warning (0, "comparison between %q#T and %q#T", TREE_TYPE (arg1), TREE_TYPE (arg2)); } break; @@ -4097,7 +4097,7 @@ build_temp (tree expr, tree type, int flags, build_tree_list (NULL_TREE, expr), type, flags); if (warningcount > savew) - *diagnostic_fn = warning; + *diagnostic_fn = warning0; else if (errorcount > savee) *diagnostic_fn = error; else @@ -4160,10 +4160,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (ARITHMETIC_TYPE_P (t) && expr == null_node) { if (fn) - warning ("passing NULL to non-pointer argument %P of %qD", + warning (0, "passing NULL to non-pointer argument %P of %qD", argnum, fn); else - warning ("converting to non-pointer type %qT from NULL", t); + warning (0, "converting to non-pointer type %qT from NULL", t); } /* Warn about assigning a floating-point type to an integer type. */ @@ -4171,10 +4171,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, && TREE_CODE (t) == INTEGER_TYPE) { if (fn) - warning ("passing %qT for argument %P to %qD", + warning (0, "passing %qT for argument %P to %qD", TREE_TYPE (expr), argnum, fn); else - warning ("converting to %qT from %qT", t, TREE_TYPE (expr)); + warning (0, "converting to %qT from %qT", t, TREE_TYPE (expr)); } /* And warn about assigning a negative value to an unsigned variable. */ @@ -4183,10 +4183,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr)) { if (fn) - warning ("passing negative value %qE for argument %P to %qD", + warning (0, "passing negative value %qE for argument %P to %qD", expr, argnum, fn); else - warning ("converting negative value %qE to %qT", expr, t); + warning (0, "converting negative value %qE to %qT", expr, t); } overflow_warning (expr); @@ -4443,7 +4443,7 @@ convert_arg_to_ellipsis (tree arg) there is no need to emit a warning, since the expression won't be evaluated. We keep the builtin_trap just as a safety check. */ if (!skip_evaluation) - warning ("cannot pass objects of non-POD type %q#T through %<...%>; " + warning (0, "cannot pass objects of non-POD type %q#T through %<...%>; " "call will abort at runtime", TREE_TYPE (arg)); arg = call_builtin_trap (); arg = build2 (COMPOUND_EXPR, integer_type_node, arg, @@ -4469,7 +4469,7 @@ build_x_va_arg (tree expr, tree type) if (! pod_type_p (type)) { /* Undefined behavior [expr.call] 5.2.2/7. */ - warning ("cannot receive objects of non-POD type %q#T through %<...%>; " + warning (0, "cannot receive objects of non-POD type %q#T through %<...%>; " "call will abort at runtime", type); expr = convert (build_pointer_type (type), null_node); expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), @@ -5384,7 +5384,7 @@ build_new_method_call (tree instance, tree fns, tree args, || DECL_DESTRUCTOR_P (current_function_decl))) /* This is not an error, it is runtime undefined behavior. */ - warning ((DECL_CONSTRUCTOR_P (current_function_decl) ? + warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ? "abstract virtual %q#D called from constructor" : "abstract virtual %q#D called from destructor"), cand->fn); @@ -5997,9 +5997,9 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn) if (warn) { - warning ("passing %qT chooses %qT over %qT", + warning (0, "passing %qT chooses %qT over %qT", type, type1, type2); - warning (" in call to %qD", w->fn); + warning (0, " in call to %qD", w->fn); } else add_warning (w, l); @@ -6056,10 +6056,10 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn) tree source = source_type (w->convs[0]); if (! DECL_CONSTRUCTOR_P (w->fn)) source = TREE_TYPE (source); - warning ("choosing %qD over %qD", w->fn, l->fn); - warning (" for conversion from %qT to %qT", + warning (0, "choosing %qD over %qD", w->fn, l->fn); + warning (0, " for conversion from %qT to %qT", source, w->second_conv->type); - warning (" because conversion sequence for the argument is better"); + warning (0, " because conversion sequence for the argument is better"); } else add_warning (w, l); diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 2f2bd231a5c..6423fbcf894 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1234,7 +1234,7 @@ check_bases (tree t, here because the case of virtual functions but non-virtual dtor is handled in finish_struct_1. */ if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype)) - warning ("base class %q#T has a non-virtual destructor", basetype); + warning (0, "base class %q#T has a non-virtual destructor", basetype); /* If the base class doesn't have copy constructors or assignment operators that take const references, then the @@ -1548,7 +1548,7 @@ maybe_warn_about_overly_private_class (tree t) } if (!has_nonprivate_method) { - warning ("all member functions in class %qT are private", t); + warning (0, "all member functions in class %qT are private", t); return; } } @@ -1559,7 +1559,7 @@ maybe_warn_about_overly_private_class (tree t) fn = CLASSTYPE_DESTRUCTORS (t); if (fn && TREE_PRIVATE (fn)) { - warning ("%q#T only defines a private destructor and has no friends", + warning (0, "%q#T only defines a private destructor and has no friends", t); return; } @@ -1599,7 +1599,7 @@ maybe_warn_about_overly_private_class (tree t) if (nonprivate_ctor == 0) { - warning ("%q#T only defines private constructors and has no friends", + warning (0, "%q#T only defines private constructors and has no friends", t); return; } @@ -3035,16 +3035,16 @@ check_field_decls (tree t, tree *access_decls, && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) && !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) { - warning ("%q#T has pointer data members", t); + warning (0, "%q#T has pointer data members", t); if (! TYPE_HAS_INIT_REF (t)) { - warning (" but does not override %<%T(const %T&)%>", t, t); + warning (0, " but does not override %<%T(const %T&)%>", t, t); if (! TYPE_HAS_ASSIGN_REF (t)) - warning (" or %<operator=(const %T&)%>", t); + warning (0, " or %<operator=(const %T&)%>", t); } else if (! TYPE_HAS_ASSIGN_REF (t)) - warning (" but does not override %<operator=(const %T&)%>", t); + warning (0, " but does not override %<operator=(const %T&)%>", t); } @@ -3477,7 +3477,7 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets) propagate_binfo_offsets (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo))); else if (warn_abi) - warning ("offset of empty base %qT may not be ABI-compliant and may" + warning (0, "offset of empty base %qT may not be ABI-compliant and may" "change in a future version of GCC", BINFO_TYPE (binfo)); } @@ -3589,7 +3589,7 @@ build_base_field (record_layout_info rli, tree binfo, if (abi_version_at_least (2)) CLASSTYPE_NEARLY_EMPTY_P (t) = 0; else if (warn_abi) - warning ("class %qT will be considered nearly empty in a " + warning (0, "class %qT will be considered nearly empty in a " "future version of GCC", t); } } @@ -4334,7 +4334,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets) CLASSTYPE_ALIGN (basetype)), bitsize_unit_node), BINFO_OFFSET (vbase)))) - warning ("offset of virtual base %qT is not ABI-compliant and " + warning (0, "offset of virtual base %qT is not ABI-compliant and " "may change in a future version of GCC", basetype); @@ -4433,7 +4433,7 @@ warn_about_ambiguous_bases (tree t) basetype = BINFO_TYPE (base_binfo); if (!lookup_base (t, basetype, ba_unique | ba_quiet, NULL)) - warning ("direct base %qT inaccessible in %qT due to ambiguity", + warning (0, "direct base %qT inaccessible in %qT due to ambiguity", basetype, t); } @@ -4445,7 +4445,7 @@ warn_about_ambiguous_bases (tree t) basetype = BINFO_TYPE (binfo); if (!lookup_base (t, basetype, ba_unique | ba_quiet, NULL)) - warning ("virtual base %qT inaccessible in %qT due to ambiguity", + warning (0, "virtual base %qT inaccessible in %qT due to ambiguity", basetype, t); } } @@ -4622,7 +4622,7 @@ layout_class_type (tree t, tree *virtuals_p) else { if (warn_abi && TREE_CODE (t) == UNION_TYPE) - warning ("size assigned to %qT may not be " + warning (0, "size assigned to %qT may not be " "ABI-compliant and may change in a future " "version of GCC", t); @@ -4661,7 +4661,7 @@ layout_class_type (tree t, tree *virtuals_p) && DECL_MODE (field) != TYPE_MODE (type)) /* Versions of G++ before G++ 3.4 did not reset the DECL_MODE. */ - warning ("the offset of %qD may not be ABI-compliant and may " + warning (0, "the offset of %qD may not be ABI-compliant and may " "change in a future version of GCC", field); } else @@ -4754,7 +4754,7 @@ layout_class_type (tree t, tree *virtuals_p) TYPE_SIZE (base_t) = bitsize_zero_node; TYPE_SIZE_UNIT (base_t) = size_zero_node; if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli))) - warning ("layout of classes derived from empty class %qT " + warning (0, "layout of classes derived from empty class %qT " "may change in a future version of GCC", t); } @@ -5045,7 +5045,7 @@ finish_struct_1 (tree t) && (!TREE_PRIVATE (dtor) || CLASSTYPE_FRIEND_CLASSES (t) || DECL_FRIENDLIST (TYPE_MAIN_DECL (t))))) - warning ("%q#T has virtual functions but non-virtual destructor", + warning (0, "%q#T has virtual functions but non-virtual destructor", t); } diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 32dc96d10c6..5150fcf5548 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -194,7 +194,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force) if (bk == bk_via_virtual) { if (force) - warning ("pointer to member cast from %qT to %qT is via" + warning (0, "pointer to member cast from %qT to %qT is via" " virtual base", intype, type); else { @@ -512,7 +512,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, if (TREE_CODE (intype) == POINTER_TYPE && (comptypes (TREE_TYPE (intype), type, COMPARE_BASE | COMPARE_DERIVED))) - warning ("casting %qT to %qT does not dereference pointer", + warning (0, "casting %qT to %qT does not dereference pointer", intype, reftype); rval = build_unary_op (ADDR_EXPR, expr, 0); @@ -854,10 +854,10 @@ convert_to_void (tree expr, const char *implicit) int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (is_volatile && !is_complete) - warning ("object of incomplete type %qT will not be accessed in %s", + warning (0, "object of incomplete type %qT will not be accessed in %s", type, implicit ? implicit : "void context"); else if (is_reference && is_volatile) - warning ("object of type %qT will not be accessed in %s", + warning (0, "object of type %qT will not be accessed in %s", TREE_TYPE (TREE_OPERAND (expr, 0)), implicit ? implicit : "void context"); if (is_reference || !is_volatile || !is_complete) @@ -873,7 +873,7 @@ convert_to_void (tree expr, const char *implicit) int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (TYPE_VOLATILE (type) && !is_complete) - warning ("object %qE of incomplete type %qT will not be accessed in %s", + warning (0, "object %qE of incomplete type %qT will not be accessed in %s", expr, type, implicit ? implicit : "void context"); break; } @@ -895,7 +895,7 @@ convert_to_void (tree expr, const char *implicit) } else if (implicit && probe == expr && is_overloaded_fn (probe)) /* Only warn when there is no &. */ - warning ("%s is a reference, not call, to function %qE", + warning (0, "%s is a reference, not call, to function %qE", implicit, expr); } @@ -906,7 +906,7 @@ convert_to_void (tree expr, const char *implicit) /* The middle end does not warn about expressions that have been explicitly cast to void, so we must do so here. */ if (!TREE_SIDE_EFFECTS (expr)) - warning ("%s has no effect", implicit); + warning (0, "%s has no effect", implicit); else { tree e; @@ -938,7 +938,7 @@ convert_to_void (tree expr, const char *implicit) || code == PREINCREMENT_EXPR || code == POSTDECREMENT_EXPR || code == POSTINCREMENT_EXPR))) - warning ("value computed is not used"); + warning (0, "value computed is not used"); } } expr = build1 (CONVERT_EXPR, void_type_node, expr); @@ -1046,7 +1046,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain) if (expr == null_node && (desires & WANT_INT) && !(desires & WANT_NULL)) - warning ("converting NULL to non-pointer type"); + warning (0, "converting NULL to non-pointer type"); basetype = TREE_TYPE (expr); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5d52a2600f5..60b478ee3df 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -565,7 +565,7 @@ poplevel (int keep, int reverse, int functionbody) && ! TREE_USED (decl) && ! DECL_IN_SYSTEM_HEADER (decl) && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl)) - warning ("%Junused variable %qD", decl, decl); + warning (0, "%Junused variable %qD", decl, decl); /* Remove declarations for all the DECLs in this level. */ for (link = decls; link; link = TREE_CHAIN (link)) @@ -1055,17 +1055,17 @@ duplicate_decls (tree newdecl, tree olddecl) && DECL_UNINLINABLE (olddecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) { - warning ("%Jfunction %qD redeclared as inline", newdecl, newdecl); - warning ("%Jprevious declaration of %qD with attribute noinline", + warning (0, "%Jfunction %qD redeclared as inline", newdecl, newdecl); + warning (0, "%Jprevious declaration of %qD with attribute noinline", olddecl, olddecl); } else if (DECL_DECLARED_INLINE_P (olddecl) && DECL_UNINLINABLE (newdecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) { - warning ("%Jfunction %qD redeclared with attribute noinline", + warning (0, "%Jfunction %qD redeclared with attribute noinline", newdecl, newdecl); - warning ("%Jprevious declaration of %qD was inline", + warning (0, "%Jprevious declaration of %qD was inline", olddecl, olddecl); } } @@ -1086,7 +1086,7 @@ duplicate_decls (tree newdecl, tree olddecl) if (! TREE_PUBLIC (newdecl)) { if (warn_shadow) - warning ("shadowing %s function %q#D", + warning (0, "shadowing %s function %q#D", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); /* Discard the old built-in function. */ @@ -1095,7 +1095,7 @@ duplicate_decls (tree newdecl, tree olddecl) /* If the built-in is not ansi, then programs can override it even globally without an error. */ else if (! DECL_BUILT_IN (olddecl)) - warning ("library function %q#D redeclared as non-function %q#D", + warning (0, "library function %q#D redeclared as non-function %q#D", olddecl, newdecl); else { @@ -1152,12 +1152,12 @@ duplicate_decls (tree newdecl, tree olddecl) if (TREE_PUBLIC (newdecl)) { - warning ("new declaration %q#D", newdecl); - warning ("ambiguates built-in declaration %q#D", + warning (0, "new declaration %q#D", newdecl); + warning (0, "ambiguates built-in declaration %q#D", olddecl); } else if (warn_shadow) - warning ("shadowing %s function %q#D", + warning (0, "shadowing %s function %q#D", DECL_BUILT_IN (olddecl) ? "built-in" : "library", olddecl); } @@ -1363,7 +1363,7 @@ duplicate_decls (tree newdecl, tree olddecl) { /* Prototype decl follows defn w/o prototype. */ cp_warning_at ("prototype for %q#D", newdecl); - warning ("%Jfollows non-prototype definition here", olddecl); + warning (0, "%Jfollows non-prototype definition here", olddecl); } else if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)) @@ -1418,8 +1418,8 @@ duplicate_decls (tree newdecl, tree olddecl) && ! DECL_DECLARED_INLINE_P (olddecl) && TREE_ADDRESSABLE (olddecl) && warn_inline) { - warning ("%q#D was used before it was declared inline", newdecl); - warning ("%Jprevious non-inline declaration here", olddecl); + warning (0, "%q#D was used before it was declared inline", newdecl); + warning (0, "%Jprevious non-inline declaration here", olddecl); } } } @@ -1471,7 +1471,7 @@ duplicate_decls (tree newdecl, tree olddecl) /* Don't warn about friends, let add_friend take care of it. */ && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl))) { - warning ("redundant redeclaration of %qD in same scope", newdecl); + warning (0, "redundant redeclaration of %qD in same scope", newdecl); cp_warning_at ("previous declaration of %qD", olddecl); } } @@ -1806,9 +1806,9 @@ duplicate_decls (tree newdecl, tree olddecl) && DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) { - warning ("%J%qD: visibility attribute ignored because it", + warning (0, "%J%qD: visibility attribute ignored because it", newdecl, newdecl); - warning ("%Jconflicts with previous declaration here", olddecl); + warning (0, "%Jconflicts with previous declaration here", olddecl); } /* Choose the declaration which specified visibility. */ if (DECL_VISIBILITY_SPECIFIED (olddecl)) @@ -3645,7 +3645,7 @@ start_decl (const cp_declarator *declarator, { if (! toplevel_bindings_p () && DECL_EXTERNAL (decl)) - warning ("declaration of %q#D has %<extern%> and is initialized", + warning (0, "declaration of %q#D has %<extern%> and is initialized", decl); DECL_EXTERNAL (decl) = 0; if (toplevel_bindings_p ()) @@ -3667,7 +3667,7 @@ start_decl (const cp_declarator *declarator, && DECL_DECLARED_INLINE_P (decl) && DECL_UNINLINABLE (decl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) - warning ("%Jinline function %qD given attribute noinline", decl, decl); + warning (0, "%Jinline function %qD given attribute noinline", decl, decl); if (context && COMPLETE_TYPE_P (complete_type (context))) { @@ -4052,7 +4052,7 @@ maybe_commonize_var (tree decl) cp_warning_at ("sorry: semantics of inline function static " "data %q#D are wrong (you'll wind up " "with multiple copies)", decl); - warning ("%J you can work around this by removing " + warning (0, "%J you can work around this by removing " "the initializer", decl); } @@ -4366,7 +4366,7 @@ reshape_init (tree type, tree *initp) if (brace_enclosed_p) error ("too many initializers for %qT", type); else if (warn_missing_braces && !string_init_p) - warning ("missing braces around initializer"); + warning (0, "missing braces around initializer"); } return new_init; @@ -4506,7 +4506,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) && DECL_INITIAL (decl) && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST && PAREN_STRING_LITERAL_P (DECL_INITIAL (decl))) - warning ("array %qD initialized by parenthesized string literal %qE", + warning (0, "array %qD initialized by parenthesized string literal %qE", decl, DECL_INITIAL (decl)); init = NULL; } @@ -4783,7 +4783,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) && IS_AGGR_TYPE (type) && DECL_NAME (decl)) { if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type) - warning ("shadowing previous type declaration of %q#D", decl); + warning (0, "shadowing previous type declaration of %q#D", decl); set_identifier_type_value (DECL_NAME (decl), decl); } @@ -5885,7 +5885,7 @@ grokvardecl (tree type, no linkage can only be used to declare extern "C" entities. Since it's not always an error in the ISO C++ 90 Standard, we only issue a warning. */ - warning ("non-local variable %q#D uses anonymous type", + warning (0, "non-local variable %q#D uses anonymous type", decl); if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) cp_warning_at ("%q#D does not refer to the unqualified " @@ -5894,7 +5894,7 @@ grokvardecl (tree type, } } else - warning ("non-local variable %q#D uses local type %qT", decl, t); + warning (0, "non-local variable %q#D uses local type %qT", decl, t); } } else @@ -6728,7 +6728,7 @@ grokdeclarator (const cp_declarator *declarator, else if (pedantic || ! is_main) pedwarn ("ISO C++ forbids declaration of %qs with no type", name); else if (warn_return_type) - warning ("ISO C++ forbids declaration of %qs with no type", name); + warning (0, "ISO C++ forbids declaration of %qs with no type", name); type = integer_type_node; } @@ -7013,7 +7013,7 @@ grokdeclarator (const cp_declarator *declarator, /* It's common practice (and completely valid) to have a const be initialized and declared extern. */ if (!(type_quals & TYPE_QUAL_CONST)) - warning ("%qs initialized and declared %<extern%>", name); + warning (0, "%qs initialized and declared %<extern%>", name); } else error ("%qs has both %<extern%> and initializer", name); @@ -7953,7 +7953,7 @@ grokdeclarator (const cp_declarator *declarator, { /* Friends are treated specially. */ if (ctype == current_class_type) - warning ("member functions are implicitly friends of their class"); + warning (0, "member functions are implicitly friends of their class"); else if (decl && DECL_NAME (decl)) { if (template_class_depth (current_class_type) == 0) @@ -8777,7 +8777,7 @@ grok_op_properties (tree decl, int friendp, bool complain) what = "a base class"; if (what && warn_conversion) - warning ("conversion to %s%s will never use a type " + warning (0, "conversion to %s%s will never use a type " "conversion operator", ref ? "a reference to " : "", what); } @@ -8869,13 +8869,13 @@ grok_op_properties (tree decl, int friendp, bool complain) if (TREE_CODE (ret) != REFERENCE_TYPE || !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)), arg)) - warning ("prefix %qD should return %qT", decl, + warning (0, "prefix %qD should return %qT", decl, build_reference_type (arg)); } else { if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg)) - warning ("postfix %qD should return %qT", decl, arg); + warning (0, "postfix %qD should return %qT", decl, arg); } } } @@ -8904,7 +8904,7 @@ grok_op_properties (tree decl, int friendp, bool complain) && (operator_code == TRUTH_ANDIF_EXPR || operator_code == TRUTH_ORIF_EXPR || operator_code == COMPOUND_EXPR)) - warning ("user-defined %qD always evaluates both arguments", + warning (0, "user-defined %qD always evaluates both arguments", decl); } @@ -8918,7 +8918,7 @@ grok_op_properties (tree decl, int friendp, bool complain) || operator_code == MULT_EXPR || operator_code == TRUNC_MOD_EXPR) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE) - warning ("%qD should return by value", decl); + warning (0, "%qD should return by value", decl); /* [over.oper]/8 */ for (; argtypes && argtypes != void_list_node; @@ -9906,7 +9906,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) if (DECL_DECLARED_INLINE_P (decl1) && lookup_attribute ("noinline", attrs)) - warning ("%Jinline function %qD given attribute noinline", decl1, decl1); + warning (0, "%Jinline function %qD given attribute noinline", decl1, decl1); if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1)) /* This is a constructor, we must ensure that any default args @@ -9943,7 +9943,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) if (warn_ecpp && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) - warning ("%<operator=%> should return a reference to %<*this%>"); + warning (0, "%<operator=%> should return a reference to %<*this%>"); /* Make the init_value nonzero so pushdecl knows this is not tentative. error_mark_node is replaced below (in poplevel) with the BLOCK. */ @@ -10676,7 +10676,7 @@ finish_function (int flags) /* Structor return values (if any) are set by the compiler. */ && !DECL_CONSTRUCTOR_P (fndecl) && !DECL_DESTRUCTOR_P (fndecl)) - warning ("no return statement in function returning non-void"); + warning (0, "no return statement in function returning non-void"); /* Store the end of the function, so that we get good line number info for the epilogue. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 6cc68e249fe..530ba391f57 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -420,7 +420,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete) /* An array can't have been allocated by new, so complain. */ if (TREE_CODE (exp) == VAR_DECL && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) - warning ("deleting array %q#D", exp); + warning (0, "deleting array %q#D", exp); t = build_expr_type_conversion (WANT_POINTER, exp, true); @@ -446,7 +446,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete) /* Deleting ptr to void is undefined behavior [expr.delete/3]. */ if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) { - warning ("deleting %qT is undefined", type); + warning (0, "deleting %qT is undefined", type); doing_vec = 0; } @@ -1168,7 +1168,7 @@ finish_anon_union (tree anon_union_decl) main_decl = build_anon_union_vars (type, anon_union_decl); if (main_decl == NULL_TREE) { - warning ("anonymous union with no members"); + warning (0, "anonymous union with no members"); return; } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index ef4fb2193b5..60db762924e 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -599,7 +599,7 @@ build_throw (tree exp) } if (exp == null_node) - warning ("throwing NULL, which has integral, not pointer type"); + warning (0, "throwing NULL, which has integral, not pointer type"); if (exp != NULL_TREE) { @@ -918,9 +918,9 @@ check_handlers_1 (tree master, tree_stmt_iterator i) tree handler = tsi_stmt (i); if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler))) { - warning ("%Hexception of type %qT will be caught", + warning (0, "%Hexception of type %qT will be caught", EXPR_LOCUS (handler), TREE_TYPE (handler)); - warning ("%H by earlier handler for %qT", + warning (0, "%H by earlier handler for %qT", EXPR_LOCUS (master), type); break; } diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 8203dbb3b6f..213f8d72920 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -149,7 +149,7 @@ add_friend (tree type, tree decl, bool complain) if (decl == TREE_VALUE (friends)) { if (complain) - warning ("%qD is already a friend of class %qT", + warning (0, "%qD is already a friend of class %qT", decl, type); return; } @@ -361,7 +361,7 @@ make_friend_class (tree type, tree friend_type, bool complain) if (friend_type == probe) { if (complain) - warning ("%qD is already a friend of %qT", probe, type); + warning (0, "%qD is already a friend of %qT", probe, type); break; } } @@ -370,7 +370,7 @@ make_friend_class (tree type, tree friend_type, bool complain) if (same_type_p (probe, friend_type)) { if (complain) - warning ("%qT is already a friend of %qT", probe, type); + warning (0, "%qT is already a friend of %qT", probe, type); break; } } @@ -550,11 +550,11 @@ do_friend (tree ctype, tree declarator, tree decl, if (warn) { static int explained; - warning ("friend declaration %q#D declares a non-template " + warning (0, "friend declaration %q#D declares a non-template " "function", decl); if (! explained) { - warning ("(if this is not what you intended, make sure " + warning (0, "(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"); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 0abf1b25874..99891cb2922 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -323,7 +323,7 @@ perform_member_init (tree member, tree init) /* Effective C++ rule 12 requires that all data members be initialized. */ if (warn_ecpp && !explicit && TREE_CODE (type) != ARRAY_TYPE) - warning ("%J%qD should be initialized in the member initialization " + warning (0, "%J%qD should be initialized in the member initialization " "list", current_function_decl, member); if (init == void_type_node) @@ -370,7 +370,7 @@ perform_member_init (tree member, tree init) { init = build_default_init (type, /*nelts=*/NULL_TREE); if (TREE_CODE (type) == REFERENCE_TYPE) - warning ("%Jdefault-initialization of %q#D, " + warning (0, "%Jdefault-initialization of %q#D, " "which has reference type", current_function_decl, member); } @@ -525,13 +525,13 @@ sort_mem_initializers (tree t, tree mem_inits) cp_warning_at ("%qD will be initialized after", TREE_PURPOSE (next_subobject)); else - warning ("base %qT will be initialized after", + warning (0, "base %qT will be initialized after", TREE_PURPOSE (next_subobject)); if (TREE_CODE (subobject) == FIELD_DECL) cp_warning_at (" %q#D", subobject); else - warning (" base %qT", subobject); - warning ("%J when initialized here", current_function_decl); + warning (0, " base %qT", subobject); + warning (0, "%J when initialized here", current_function_decl); } /* Look again, from the beginning of the list. */ @@ -679,7 +679,7 @@ emit_mem_initializers (tree mem_inits) if (extra_warnings && !arguments && DECL_COPY_CONSTRUCTOR_P (current_function_decl) && TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (subobject))) - warning ("%Jbase class %q#T should be explicitly initialized in the " + warning (0, "%Jbase class %q#T should be explicitly initialized in the " "copy constructor", current_function_decl, BINFO_TYPE (subobject)); @@ -1645,7 +1645,7 @@ build_new (tree placement, tree type, tree nelts, tree init, pedwarn ("size in array new must have integral type"); nelts = save_expr (cp_convert (sizetype, nelts)); if (nelts == integer_zero_node) - warning ("zero size array reserves no space"); + warning (0, "zero size array reserves no space"); } /* ``A reference cannot be created by the new operator. A reference @@ -2735,7 +2735,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, complete_type (type); if (!COMPLETE_TYPE_P (type)) { - warning ("possible problem detected in invocation of " + warning (0, "possible problem detected in invocation of " "delete operator:"); cxx_incomplete_type_diagnostic (addr, type, 1); inform ("neither the destructor nor the class-specific " diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 6074fef9ea1..9e39241d6e2 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -433,7 +433,7 @@ parse_strconst_pragma (const char* name, int opt) { result = x; if (c_lex (&x) != CPP_EOF) - warning ("junk at end of #pragma %s", name); + warning (0, "junk at end of #pragma %s", name); return result; } @@ -527,7 +527,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED ) cookie (if any) of the filename, but this requires completing the --enable-mapped-location project first. See PR 17577. */ if (cpp_included (parse_in, filename)) - warning ("#pragma implementation for %qs appears after " + warning (0, "#pragma implementation for %qs appears after " "file is included", filename); #endif } @@ -552,7 +552,7 @@ handle_pragma_java_exceptions (cpp_reader* dfile ATTRIBUTE_UNUSED ) { tree x; if (c_lex (&x) != CPP_EOF) - warning ("junk at end of #pragma GCC java_exceptions"); + warning (0, "junk at end of #pragma GCC java_exceptions"); choose_personality_routine (lang_java); } diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 0f358cd98e5..fc6c4243a82 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2479,7 +2479,7 @@ static inline const char * finish_mangling (const bool warn) { if (warn_abi && warn && G.need_abi_warning) - warning ("the mangled name of %qD will change in a future " + warning (0, "the mangled name of %qD will change in a future " "version of GCC", G.entity); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 7e4e9566380..2bce7f8c4fb 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1096,7 +1096,7 @@ lazily_declare_fn (special_function_kind sfk, tree type) TYPE_METHODS list, which cause the destructor to be emitted in an incorrect location in the vtable. */ if (warn_abi && DECL_VIRTUAL_P (fn)) - warning ("vtable layout for class %qT may not be ABI-compliant" + warning (0, "vtable layout for class %qT may not be ABI-compliant" "and may change in a future version of GCC due to " "implicit virtual destructor", type); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ce1d5b3b119..634645d7fa4 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -894,7 +894,7 @@ pushdecl (tree x) /* OK */; else { - warning ("extern declaration of %q#D doesn't match", x); + warning (0, "extern declaration of %q#D doesn't match", x); cp_warning_at ("global declaration %q#D", oldglobal); } } @@ -938,8 +938,8 @@ pushdecl (tree x) if (warn_shadow && !err) { - warning ("declaration of %q#D shadows a parameter", x); - warning ("%Jshadowed declaration is here", oldlocal); + warning (0, "declaration of %q#D shadows a parameter", x); + warning (0, "%Jshadowed declaration is here", oldlocal); } } @@ -963,22 +963,22 @@ pushdecl (tree x) if (member && !TREE_STATIC (member)) { /* Location of previous decl is not useful in this case. */ - warning ("declaration of %qD shadows a member of 'this'", + warning (0, "declaration of %qD shadows a member of 'this'", x); } else if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == VAR_DECL) { - warning ("declaration of %qD shadows a previous local", x); - warning ("%Jshadowed declaration is here", oldlocal); + warning (0, "declaration of %qD shadows a previous local", x); + warning (0, "%Jshadowed declaration is here", oldlocal); } else if (oldglobal != NULL_TREE && TREE_CODE (oldglobal) == VAR_DECL) /* XXX shadow warnings in outer-more namespaces */ { - warning ("declaration of %qD shadows a global declaration", + warning (0, "declaration of %qD shadows a global declaration", x); - warning ("%Jshadowed declaration is here", oldglobal); + warning (0, "%Jshadowed declaration is here", oldglobal); } } } @@ -1092,7 +1092,7 @@ check_for_out_of_scope_variable (tree decl) { if (!DECL_ERROR_REPORTED (decl)) { - warning ("name lookup of %qD changed", DECL_NAME (decl)); + warning (0, "name lookup of %qD changed", DECL_NAME (decl)); cp_warning_at (" matches this %qD under ISO standard rules", shadowed); cp_warning_at (" matches this %qD under old rules", decl); @@ -1861,7 +1861,7 @@ push_overloaded_decl (tree decl, int flags) if (IS_AGGR_TYPE (t) && warn_shadow && (! DECL_IN_SYSTEM_HEADER (decl) || ! DECL_IN_SYSTEM_HEADER (old))) - warning ("%q#D hides constructor for %q#T", decl, t); + warning (0, "%q#D hides constructor for %q#T", decl, t); old = NULL_TREE; } else if (is_overloaded_fn (old)) @@ -3207,7 +3207,7 @@ parse_using_directive (tree namespace, tree attribs) DECL_NAMESPACE_ASSOCIATIONS (namespace)); } else - warning ("%qD attribute directive ignored", name); + warning (0, "%qD attribute directive ignored", name); } } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index cb09fa1995f..56ff04928d4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1798,7 +1798,7 @@ static inline void cp_parser_warn_min_max (void) { if (warn_deprecated && !in_system_header) - warning ("minimum/maximum operators are deprecated"); + warning (0, "minimum/maximum operators are deprecated"); } /* If not parsing tentatively, issue a diagnostic of the form @@ -5297,7 +5297,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p) && !in_system_header && !VOID_TYPE_P (type) && current_lang_name != lang_name_c) - warning ("use of old-style cast"); + warning (0, "use of old-style cast"); /* Only type conversions to integral or enumeration types can be used in constant-expressions. */ @@ -8128,7 +8128,7 @@ cp_parser_template_declaration (cp_parser* parser, bool member_p) /* Consume the `export' token. */ cp_lexer_consume_token (parser->lexer); /* Warn that we do not support `export'. */ - warning ("keyword %<export%> not implemented, and will be ignored"); + warning (0, "keyword %<export%> not implemented, and will be ignored"); } cp_parser_template_declaration_after_export (parser, member_p); @@ -9914,7 +9914,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, /* Warn about attributes. They are ignored. */ if (attributes) - warning ("type attributes are honored only at type definition"); + warning (0, "type attributes are honored only at type definition"); type = xref_tag (tag_type, identifier, ts, parser->num_template_parameter_lists); @@ -10759,7 +10759,7 @@ cp_parser_init_declarator (cp_parser* parser, attributes -- but ignores them. */ if (cp_parser_allow_gnu_extensions_p (parser) && is_parenthesized_init) if (cp_parser_attributes_opt (parser)) - warning ("attributes after parenthesized initializer ignored"); + warning (0, "attributes after parenthesized initializer ignored"); /* For an in-class declaration, use `grokfield' to create the declaration. */ @@ -12036,7 +12036,7 @@ cp_parser_parameter_declaration (cp_parser *parser, if (!parser->default_arg_ok_p) { if (!flag_pedantic_errors) - warning ("deprecated use of default argument for parameter of non-function"); + warning (0, "deprecated use of default argument for parameter of non-function"); else { error ("default arguments are only permitted for function parameters"); diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 6675980bd56..92a53b5ad4f 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -109,7 +109,7 @@ get_base_filename (const char *filename) if (p && ! compiling) { - warning ("-frepo must be used with -c"); + warning (0, "-frepo must be used with -c"); flag_use_repository = 0; return NULL; } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 9368bfee998..1cad0bda9f4 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -567,7 +567,7 @@ build_dynamic_cast_1 (tree type, tree expr) && TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE) { tree expr = throw_bad_cast (); - warning ("dynamic_cast of %q#D to %q#T can never succeed", + warning (0, "dynamic_cast of %q#D to %q#T can never succeed", old_expr, type); /* Bash it to the expected type. */ TREE_TYPE (expr) = type; @@ -581,7 +581,7 @@ build_dynamic_cast_1 (tree type, tree expr) if (TREE_CODE (op) == VAR_DECL && TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE) { - warning ("dynamic_cast of %q#D to %q#T can never succeed", + warning (0, "dynamic_cast of %q#D to %q#T can never succeed", op, type); retval = build_int_cst (type, 0); return retval; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 44315f46eef..9f0776a0df4 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1767,12 +1767,12 @@ handle_com_interface_attribute (tree* node, || !CLASS_TYPE_P (*node) || *node != TYPE_MAIN_VARIANT (*node)) { - warning ("%qE attribute can only be applied to class definitions", name); + warning (0, "%qE attribute can only be applied to class definitions", name); return NULL_TREE; } if (!warned++) - warning ("%qE is obsolete; g++ vtables are now COM-compatible by default", + warning (0, "%qE is obsolete; g++ vtables are now COM-compatible by default", name); return NULL_TREE; @@ -1835,7 +1835,7 @@ handle_init_priority_attribute (tree* node, if (pri <= MAX_RESERVED_INIT_PRIORITY) { warning - ("requested init_priority is reserved for internal use"); + (0, "requested init_priority is reserved for internal use"); } if (SUPPORTS_INIT_PRIORITY) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 28295767df6..2b4d9ec32ef 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1480,7 +1480,7 @@ string_conv_p (tree totype, tree exp, int warn) /* This warning is not very useful, as it complains about printf. */ if (warn && warn_write_strings) - warning ("deprecated conversion from string constant to %qT'", totype); + warning (0, "deprecated conversion from string constant to %qT'", totype); return 1; } @@ -1698,9 +1698,9 @@ build_class_member_access_expr (tree object, tree member, && !DECL_FIELD_IS_BASE (member) && !skip_evaluation) { - warning ("invalid access to non-static data member %qD of NULL object", + warning (0, "invalid access to non-static data member %qD of NULL object", member); - warning ("(perhaps the %<offsetof%> macro was used incorrectly)"); + warning (0, "(perhaps the %<offsetof%> macro was used incorrectly)"); } /* If MEMBER is from an anonymous aggregate, we have converted @@ -2174,7 +2174,7 @@ build_array_ref (tree array, tree idx) must have done so deliberately. */ if (warn_char_subscripts && TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node) - warning ("array subscript has type %<char%>"); + warning (0, "array subscript has type %<char%>"); if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx))) { @@ -2226,7 +2226,7 @@ build_array_ref (tree array, tree idx) while (TREE_CODE (foo) == COMPONENT_REF) foo = TREE_OPERAND (foo, 0); if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo)) - warning ("subscripting array declared %<register%>"); + warning (0, "subscripting array declared %<register%>"); } type = TREE_TYPE (TREE_TYPE (array)); @@ -2854,9 +2854,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) { if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1)) - warning ("division by zero in %<%E / 0%>", op0); + warning (0, "division by zero in %<%E / 0%>", op0); else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1)) - warning ("division by zero in %<%E / 0.%>", op0); + warning (0, "division by zero in %<%E / 0.%>", op0); if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); @@ -2890,9 +2890,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, case TRUNC_MOD_EXPR: case FLOOR_MOD_EXPR: if (code1 == INTEGER_TYPE && integer_zerop (op1)) - warning ("division by zero in %<%E %% 0%>", op0); + warning (0, "division by zero in %<%E %% 0%>", op0); else if (code1 == REAL_TYPE && real_zerop (op1)) - warning ("division by zero in %<%E %% 0.%>", op0); + warning (0, "division by zero in %<%E %% 0.%>", op0); if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) { @@ -2926,13 +2926,13 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, if (TREE_CODE (op1) == INTEGER_CST) { if (tree_int_cst_lt (op1, integer_zero_node)) - warning ("right shift count is negative"); + warning (0, "right shift count is negative"); else { if (! integer_zerop (op1)) short_shift = 1; if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) - warning ("right shift count >= width of type"); + warning (0, "right shift count >= width of type"); } } /* Convert the shift-count to an integer, regardless of @@ -2951,9 +2951,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, if (TREE_CODE (op1) == INTEGER_CST) { if (tree_int_cst_lt (op1, integer_zero_node)) - warning ("left shift count is negative"); + warning (0, "left shift count is negative"); else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) - warning ("left shift count >= width of type"); + warning (0, "left shift count >= width of type"); } /* Convert the shift-count to an integer, regardless of size of value being shifted. */ @@ -2972,10 +2972,10 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, if (TREE_CODE (op1) == INTEGER_CST) { if (tree_int_cst_lt (op1, integer_zero_node)) - warning ("%s rotate count is negative", + warning (0, "%s rotate count is negative", (code == LROTATE_EXPR) ? "left" : "right"); else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) - warning ("%s rotate count >= width of type", + warning (0, "%s rotate count >= width of type", (code == LROTATE_EXPR) ? "left" : "right"); } /* Convert the shift-count to an integer, regardless of @@ -2988,7 +2988,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, case EQ_EXPR: case NE_EXPR: if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE)) - warning ("comparing floating point with == or != is unsafe"); + warning (0, "comparing floating point with == or != is unsafe"); build_type = boolean_type_node; if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE @@ -3315,7 +3315,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0)) != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1))) { - warning ("comparison between types %q#T and %q#T", + warning (0, "comparison between types %q#T and %q#T", TREE_TYPE (orig_op0), TREE_TYPE (orig_op1)); } @@ -3351,7 +3351,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, (result_type))))) /* OK */; else - warning ("comparison between signed and unsigned integer expressions"); + warning (0, "comparison between signed and unsigned integer expressions"); /* Warn if two unsigned values are being compared in a size larger than their original size, and one (and only one) is the @@ -3395,7 +3395,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, { mask = (~ (HOST_WIDE_INT) 0) << bits; if ((mask & constant) != mask) - warning ("comparison of promoted ~unsigned with constant"); + warning (0, "comparison of promoted ~unsigned with constant"); } } else if (unsignedp0 && unsignedp1 @@ -3403,7 +3403,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, < TYPE_PRECISION (result_type)) && (TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (result_type))) - warning ("comparison of promoted ~unsigned with unsigned"); + warning (0, "comparison of promoted ~unsigned with unsigned"); } } } @@ -3430,7 +3430,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, performed. Note that pointer-difference and pointer-addition have already been handled above, and so we don't end up here in that case. */ - warning ("NULL used in arithmetic"); + warning (0, "NULL used in arithmetic"); if (! converted) { @@ -3593,7 +3593,7 @@ build_x_unary_op (enum tree_code code, tree xarg) } } else if (TREE_CODE (xarg) == TARGET_EXPR) - warning ("taking address of temporary"); + warning (0, "taking address of temporary"); exp = build_unary_op (ADDR_EXPR, xarg, 0); } @@ -4288,7 +4288,7 @@ cxx_mark_addressable (tree exp) } else if (extra_warnings) warning - ("address requested for %qD, which is declared %<register%>", x); + (0, "address requested for %qD, which is declared %<register%>", x); } TREE_ADDRESSABLE (x) = 1; return true; @@ -4492,7 +4492,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p, { /* C-style casts are allowed to cast away constness. With WARN_CAST_QUAL, we still want to issue a warning. */ - diag_fn = warn_cast_qual ? warning : NULL; + diag_fn = warn_cast_qual ? warning0 : NULL; desc = "cast"; } else @@ -4807,7 +4807,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, if (TYPE_PTR_P (intype) && (comptypes (TREE_TYPE (intype), TREE_TYPE (type), COMPARE_BASE | COMPARE_DERIVED))) - warning ("casting %qT to %qT does not dereference pointer", + warning (0, "casting %qT to %qT does not dereference pointer", intype, type); expr = build_unary_op (ADDR_EXPR, expr, 0); @@ -4879,7 +4879,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, && COMPLETE_TYPE_P (TREE_TYPE (type)) && COMPLETE_TYPE_P (TREE_TYPE (intype)) && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (intype))) - warning ("cast from %qT to %qT increases required alignment of " + warning (0, "cast from %qT to %qT increases required alignment of " "target type", intype, type); @@ -4893,7 +4893,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, where possible, and it is necessary in some cases. DR 195 addresses this issue, but as of 2004/10/26 is still in drafting. */ - warning ("ISO C++ forbids casting between pointer-to-function and pointer-to-object"); + warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object"); return fold_if_not_in_template (build_nop (type, expr)); } else if (TREE_CODE (type) == VECTOR_TYPE) @@ -5535,7 +5535,7 @@ get_delta_difference (tree from, tree to, virt_binfo = binfo_from_vbase (binfo); if (virt_binfo) /* This is a reinterpret cast, we choose to do nothing. */ - warning ("pointer to member cast via virtual base %qT", + warning (0, "pointer to member cast via virtual base %qT", BINFO_TYPE (virt_binfo)); else result = size_diffop (size_zero_node, BINFO_OFFSET (binfo)); @@ -5551,7 +5551,7 @@ get_delta_difference (tree from, tree to, { /* This is a reinterpret cast, we choose to do nothing. */ if (allow_inverse_p) - warning ("pointer to member cast via virtual base %qT", + warning (0, "pointer to member cast via virtual base %qT", BINFO_TYPE (virt_binfo)); else error ("pointer to member conversion via virtual base %qT", @@ -5973,14 +5973,14 @@ maybe_warn_about_returning_address_of_local (tree retval) if (TREE_CODE (whats_returned) == AGGR_INIT_EXPR || TREE_CODE (whats_returned) == TARGET_EXPR) { - warning ("returning reference to temporary"); + warning (0, "returning reference to temporary"); return; } if (TREE_CODE (whats_returned) == VAR_DECL && DECL_NAME (whats_returned) && TEMP_NAME_P (DECL_NAME (whats_returned))) { - warning ("reference to non-lvalue returned"); + warning (0, "reference to non-lvalue returned"); return; } } @@ -6019,7 +6019,7 @@ check_return_expr (tree retval) (This is a G++ extension, used to get better code for functions that call the `volatile' function.) */ if (TREE_THIS_VOLATILE (current_function_decl)) - warning ("function declared %<noreturn%> has a %<return%> statement"); + warning (0, "function declared %<noreturn%> has a %<return%> statement"); /* Check for various simple errors. */ if (DECL_DESTRUCTOR_P (current_function_decl)) @@ -6107,7 +6107,7 @@ check_return_expr (tree retval) && !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl)) && ! flag_check_new && null_ptr_cst_p (retval)) - warning ("%<operator new%> must not return NULL unless it is " + warning (0, "%<operator new%> must not return NULL unless it is " "declared %<throw()%> (or -fcheck-new is in effect)"); /* Effective C++ rule 15. See also start_function. */ @@ -6133,7 +6133,7 @@ check_return_expr (tree retval) } if (warn) - warning ("%<operator=%> should return a reference to %<*this%>"); + warning (0, "%<operator=%> should return a reference to %<*this%>"); } /* The fabled Named Return Value optimization, as per [class.copy]/15: diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 81e34d76dbe..37eb023324a 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -352,7 +352,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) if (diag_type == 1) { - p_msg = warning; + p_msg = warning0; p_msg_at = cp_warning_at; } else if (diag_type == 2) @@ -839,7 +839,7 @@ process_init_constructor (tree type, tree init, tree* elts) if (elts) { if (warn_missing_braces) - warning ("aggregate has a partly bracketed initializer"); + warning (0, "aggregate has a partly bracketed initializer"); tail = *elts; } else @@ -1005,7 +1005,7 @@ process_init_constructor (tree type, tree init, tree* elts) /* Warn when some struct elements are implicitly initialized. */ if (warn_missing_field_initializers && (!init || BRACE_ENCLOSED_INITIALIZER_P (init))) - warning ("missing initializer for member %qD", field); + warning (0, "missing initializer for member %qD", field); } else { @@ -1020,7 +1020,7 @@ process_init_constructor (tree type, tree init, tree* elts) to zero. */ if (warn_missing_field_initializers && (!init || BRACE_ENCLOSED_INITIALIZER_P (init))) - warning ("missing initializer for member %qD", field); + warning (0, "missing initializer for member %qD", field); if (! zero_init_p (TREE_TYPE (field))) next1 = build_zero_init (TREE_TYPE (field), |