diff options
| author | Gabriel Dos Reis <gdr@cs.tamu.edu> | 2006-01-28 22:56:31 +0000 |
|---|---|---|
| committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2006-01-28 22:56:31 +0000 |
| commit | 74fa0285457b8a4eaad7425f59c93b12334bc392 (patch) | |
| tree | 5cec6efa51cbb5b7115e88b2f3121e5e2de70997 /gcc/cp/class.c | |
| parent | 2ef06beb77833e951ce436d9b0b954090e4248b6 (diff) | |
| download | gcc-74fa0285457b8a4eaad7425f59c93b12334bc392.zip gcc-74fa0285457b8a4eaad7425f59c93b12334bc392.tar.gz gcc-74fa0285457b8a4eaad7425f59c93b12334bc392.tar.bz2 | |
class.c (check_bases): Likewise.
* class.c (check_bases): Likewise.
(maybe_warn_about_overly_private_class): Likewise.
(check_field_decls): Likewise.
(layout_empty_base): Likewise.
(layout_virtual_bases): Likewise.
(layout_class_type): Likewise.
* call.c (joust): Pass option code to warning. Use inform for
explanation.
From-SVN: r110342
Diffstat (limited to 'gcc/cp/class.c')
| -rw-r--r-- | gcc/cp/class.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b9abaa8..275cbce 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1227,8 +1227,9 @@ check_bases (tree t, /* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P 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 (0, "base class %q#T has a non-virtual destructor", basetype); + if (!TYPE_POLYMORPHIC_P (basetype)) + warning (OPT_Weffc__, + "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 @@ -1542,7 +1543,8 @@ maybe_warn_about_overly_private_class (tree t) } if (!has_nonprivate_method) { - warning (0, "all member functions in class %qT are private", t); + warning (OPT_Wctor_dtor_privacy, + "all member functions in class %qT are private", t); return; } } @@ -1553,7 +1555,8 @@ maybe_warn_about_overly_private_class (tree t) fn = CLASSTYPE_DESTRUCTORS (t); if (fn && TREE_PRIVATE (fn)) { - warning (0, "%q#T only defines a private destructor and has no friends", + warning (OPT_Wctor_dtor_privacy, + "%q#T only defines a private destructor and has no friends", t); return; } @@ -1596,7 +1599,8 @@ maybe_warn_about_overly_private_class (tree t) if (nonprivate_ctor == 0) { - warning (0, "%q#T only defines private constructors and has no friends", + warning (OPT_Wctor_dtor_privacy, + "%q#T only defines private constructors and has no friends", t); return; } @@ -3032,12 +3036,14 @@ check_field_decls (tree t, tree *access_decls, if (! TYPE_HAS_INIT_REF (t)) { - warning (0, " but does not override %<%T(const %T&)%>", t, t); - if (! TYPE_HAS_ASSIGN_REF (t)) - warning (0, " or %<operator=(const %T&)%>", t); + warning (OPT_Weffc__, + " but does not override %<%T(const %T&)%>", t, t); + if (!TYPE_HAS_ASSIGN_REF (t)) + warning (OPT_Weffc__, " or %<operator=(const %T&)%>", t); } else if (! TYPE_HAS_ASSIGN_REF (t)) - warning (0, " but does not override %<operator=(const %T&)%>", t); + warning (OPT_Weffc__, + " but does not override %<operator=(const %T&)%>", t); } @@ -3492,8 +3498,9 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets) if (abi_version_at_least (2)) propagate_binfo_offsets (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo))); - else if (warn_abi) - warning (0, "offset of empty base %qT may not be ABI-compliant and may" + else + warning (OPT_Wabi, + "offset of empty base %qT may not be ABI-compliant and may" "change in a future version of GCC", BINFO_TYPE (binfo)); } @@ -3604,8 +3611,9 @@ 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 (0, "class %qT will be considered nearly empty in a " + else + warning (OPT_Wabi, + "class %qT will be considered nearly empty in a " "future version of GCC", t); } } @@ -4349,7 +4357,8 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets) CLASSTYPE_ALIGN (basetype)), bitsize_unit_node), BINFO_OFFSET (vbase)))) - warning (0, "offset of virtual base %qT is not ABI-compliant and " + warning (OPT_Wabi, + "offset of virtual base %qT is not ABI-compliant and " "may change in a future version of GCC", basetype); @@ -4636,8 +4645,8 @@ layout_class_type (tree t, tree *virtuals_p) padding = DECL_SIZE (field); else { - if (warn_abi && TREE_CODE (t) == UNION_TYPE) - warning (0, "size assigned to %qT may not be " + if (TREE_CODE (t) == UNION_TYPE) + warning (OPT_Wabi, "size assigned to %qT may not be " "ABI-compliant and may change in a future " "version of GCC", t); @@ -4676,7 +4685,8 @@ 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 (0, "the offset of %qD may not be ABI-compliant and may " + warning (OPT_Wabi, + "the offset of %qD may not be ABI-compliant and may " "change in a future version of GCC", field); } else @@ -4704,7 +4714,7 @@ layout_class_type (tree t, tree *virtuals_p) && !integer_zerop (size_binop (TRUNC_MOD_EXPR, DECL_FIELD_BIT_OFFSET (field), bitsize_unit_node))) - warning (0, "offset of %q+D is not ABI-compliant and may " + warning (OPT_Wabi, "offset of %q+D is not ABI-compliant and may " "change in a future version of GCC", field); /* G++ used to use DECL_FIELD_OFFSET as if it were the byte @@ -4713,7 +4723,7 @@ layout_class_type (tree t, tree *virtuals_p) && !tree_int_cst_equal (DECL_FIELD_OFFSET (field), byte_position (field)) && contains_empty_class_p (TREE_TYPE (field))) - warning (0, "%q+D contains empty classes which may cause base " + warning (OPT_Wabi, "%q+D contains empty classes which may cause base " "classes to be placed at different locations in a " "future version of GCC", field); @@ -4772,7 +4782,8 @@ 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 (0, "layout of classes derived from empty class %qT " + warning (OPT_Wabi, + "layout of classes derived from empty class %qT " "may change in a future version of GCC", t); } |
