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);
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);
/* 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
}
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;
}
}
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;
}
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;
}
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);
}
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));
}
{
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);
}
}
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);
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);
&& 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
&& !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
&& !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);
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);
}