OSDN Git Service

* class.c (check_bases): Likewise.
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 28 Jan 2006 22:56:31 +0000 (22:56 +0000)
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 28 Jan 2006 22:56:31 +0000 (22:56 +0000)
        (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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110342 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c

index 1071879..f2e245b 100644 (file)
@@ -1,3 +1,15 @@
+2006-01-28  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+       * 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. 
+
 2006-01-28  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/25999
index 7900176..2fc5c57 100644 (file)
@@ -6029,9 +6029,9 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
 
              if (warn)
                {
-                 warning (0, "passing %qT chooses %qT over %qT",
-                             type, type1, type2);
-                 warning (0, "  in call to %qD", w->fn);
+                 warning (OPT_Wsign_promo, "passing %qT chooses %qT over %qT",
+                           type, type1, type2);
+                 warning (OPT_Wsign_promo, "  in call to %qD", w->fn);
                }
              else
                add_warning (w, l);
@@ -6088,10 +6088,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 (0, "choosing %qD over %qD", w->fn, l->fn);
-         warning (0, "  for conversion from %qT to %qT",
+         warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn);
+         warning (OPT_Wconversion, "  for conversion from %qT to %qT",
                   source, w->second_conv->type);
-         warning (0, "  because conversion sequence for the argument is better");
+         inform ("  because conversion sequence for the argument is better");
        }
       else
        add_warning (w, l);
index b9abaa8..275cbce 100644 (file)
@@ -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);
        }