if (warn_override && !DECL_OVERRIDE_P (decl)
&& !DECL_DESTRUCTOR_P (decl))
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wsuggest_override,
- "%q+D can be marked override", decl);
+ "%qD can be marked override", decl);
}
if (DECL_VIRTUAL_P (decl))
FOR_EACH_VEC_ELT (base_fndecls, k, base_fndecl)
if (base_fndecl)
{
- /* Here we know it is a hider, and no overrider exists. */
- warning (OPT_Woverloaded_virtual, "%q+D was hidden", base_fndecl);
- warning (OPT_Woverloaded_virtual, " by %q+D", fns);
+ /* Here we know it is a hider, and no overrider exists. */
+ warning_at (location_of (base_fndecl),
+ OPT_Woverloaded_virtual,
+ "%qD was hidden", base_fndecl);
+ warning_at (location_of (fns),
+ OPT_Woverloaded_virtual, " by %qD", fns);
}
}
}
if (complain && !VAR_P (elt))
{
if (is_union)
- permerror (input_location,
- "%q+#D invalid; an anonymous union can "
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "%q#D invalid; an anonymous union can "
"only have non-static data members", elt);
else
- permerror (input_location,
- "%q+#D invalid; an anonymous struct can "
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "%q#D invalid; an anonymous struct can "
"only have non-static data members", elt);
}
continue;
if (TREE_PRIVATE (elt))
{
if (is_union)
- permerror (input_location,
- "private member %q+#D in anonymous union", elt);
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "private member %q#D in anonymous union", elt);
else
- permerror (input_location,
- "private member %q+#D in anonymous struct", elt);
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "private member %q#D in anonymous struct", elt);
}
else if (TREE_PROTECTED (elt))
{
if (is_union)
- permerror (input_location,
- "protected member %q+#D in anonymous union", elt);
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "protected member %q#D in anonymous union", elt);
else
- permerror (input_location,
- "protected member %q+#D in anonymous struct", elt);
+ permerror (DECL_SOURCE_LOCATION (elt),
+ "protected member %q#D in anonymous struct", elt);
}
}
|| ((TREE_CODE (type) == ENUMERAL_TYPE
|| TREE_CODE (type) == BOOLEAN_TYPE)
&& tree_int_cst_lt (TYPE_SIZE (type), w)))
- warning (0, "width of %q+D exceeds its type", field);
+ warning_at (DECL_SOURCE_LOCATION (field), 0,
+ "width of %qD exceeds its type", field);
else if (TREE_CODE (type) == ENUMERAL_TYPE
&& (0 > (compare_tree_int
(w, TYPE_PRECISION (ENUM_UNDERLYING_TYPE (type))))))
- warning (0, "%q+D is too small to hold all values of %q#T", field, type);
+ warning_at (DECL_SOURCE_LOCATION (field), 0,
+ "%qD is too small to hold all values of %q#T",
+ field, type);
}
if (w != error_mark_node)
{
if (!layout_pod_type_p (type) && !TYPE_PACKED (type))
{
- warning
- (0,
- "ignoring packed attribute because of unpacked non-POD field %q+#D",
+ warning_at
+ (DECL_SOURCE_LOCATION (x), 0,
+ "ignoring packed attribute because of unpacked non-POD field %q#D",
x);
cant_pack = 1;
}
user-declared constructor. */
if (constructor_name_p (DECL_NAME (x), t)
&& TYPE_HAS_USER_CONSTRUCTOR (t))
- permerror (input_location, "field %q+#D with same name as class", x);
+ permerror (DECL_SOURCE_LOCATION (x),
+ "field %q#D with same name as class", x);
}
/* Effective C++ rule 11: if a class has dynamic memory held by pointers,
ftype = TREE_TYPE (field);
if (!literal_type_p (ftype))
{
- inform (0, " non-static data member %q+D has "
- "non-literal type", field);
+ inform (DECL_SOURCE_LOCATION (field),
+ " non-static data member %qD has non-literal type",
+ field);
if (CLASS_TYPE_P (ftype))
explain_non_literal_class (ftype);
}
if (CP_TYPE_VOLATILE_P (ftype))
- inform (0, " non-static data member %q+D has "
- "volatile type", field);
+ inform (DECL_SOURCE_LOCATION (field),
+ " non-static data member %qD has volatile type", field);
}
}
}
type = TREE_TYPE (field);
if (TREE_CODE (type) == REFERENCE_TYPE)
- warning (OPT_Wuninitialized, "non-static reference %q+#D "
- "in class without a constructor", field);
+ warning_at (DECL_SOURCE_LOCATION (field),
+ OPT_Wuninitialized, "non-static reference %q#D "
+ "in class without a constructor", field);
else if (CP_TYPE_CONST_P (type)
&& (!CLASS_TYPE_P (type)
|| !TYPE_HAS_DEFAULT_CONSTRUCTOR (type)))
- warning (OPT_Wuninitialized, "non-static const member %q+#D "
- "in class without a constructor", field);
+ warning_at (DECL_SOURCE_LOCATION (field),
+ OPT_Wuninitialized, "non-static const member %q#D "
+ "in class without a constructor", field);
}
}
&& !integer_zerop (size_binop (TRUNC_MOD_EXPR,
DECL_FIELD_BIT_OFFSET (field),
bitsize_unit_node)))
- warning (OPT_Wabi, "offset of %q+D is not ABI-compliant and may "
- "change in a future version of GCC", field);
+ warning_at (DECL_SOURCE_LOCATION (field), OPT_Wabi,
+ "offset of %qD is not ABI-compliant and may "
+ "change in a future version of GCC", field);
/* The middle end uses the type of expressions to determine the
possible range of expression values. In order to optimize
in its context and when re-evaluated in the completed scope of
S. */
permerror (input_location, "declaration of %q#D", decl);
- permerror (input_location, "changes meaning of %qD from %q+#D",
- DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
+ permerror (location_of ((tree) n->value),
+ "changes meaning of %qD from %q#D",
+ DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
}
}
else
error ("%q#D conflicts with a previous declaration", decl);
- inform (input_location, "previous declaration %q+#D", bval);
+ inform (location_of (bval), "previous declaration %q#D", bval);
}
/* Wrapper for supplement_binding_1. */
pedwarn (input_location, 0,
"declaration of %q#D with C language linkage",
x);
- pedwarn (input_location, 0,
- "conflicts with previous declaration %q+#D",
+ pedwarn (DECL_SOURCE_LOCATION (previous), 0,
+ "conflicts with previous declaration %q#D",
previous);
pedwarn (input_location, 0,
"due to different exception specifications");
{
pedwarn (input_location, 0,
"declaration of %q#D with C language linkage", x);
- pedwarn (input_location, 0,
- "conflicts with previous declaration %q+#D",
+ pedwarn (DECL_SOURCE_LOCATION (previous), 0,
+ "conflicts with previous declaration %q#D",
previous);
}
}
{
if (permerror (input_location, "type mismatch with previous "
"external decl of %q#D", x))
- inform (input_location, "previous external decl of %q+#D",
- decl);
+ inform (DECL_SOURCE_LOCATION (decl),
+ "previous external decl of %q#D", decl);
}
}
else
{
warning (0, "extern declaration of %q#D doesn%'t match", x);
- warning (0, "global declaration %q+#D", oldglobal);
+ warning_at (DECL_SOURCE_LOCATION (oldglobal), 0,
+ "global declaration %q#D", oldglobal);
}
}
/* If we have a local external declaration,
|| oldscope->kind == sk_for))
{
error ("redeclaration of %q#D", x);
- inform (input_location, "%q+#D previously declared here",
- oldlocal);
+ inform (DECL_SOURCE_LOCATION (oldlocal),
+ "%q#D previously declared here", oldlocal);
nowarn = true;
}
/* C++11:
&& in_function_try_handler))
{
if (permerror (input_location, "redeclaration of %q#D", x))
- inform (input_location, "%q+#D previously declared here",
- oldlocal);
+ inform (DECL_SOURCE_LOCATION (oldlocal),
+ "%q#D previously declared here", oldlocal);
nowarn = true;
}
if (!DECL_ERROR_REPORTED (decl))
{
warning (0, "name lookup of %qD changed", DECL_NAME (decl));
- warning (0, " matches this %q+D under ISO standard rules",
- shadowed);
- warning (0, " matches this %q+D under old rules", decl);
+ warning_at (DECL_SOURCE_LOCATION (shadowed), 0,
+ " matches this %qD under ISO standard rules",
+ shadowed);
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ " matches this %qD under old rules", decl);
DECL_ERROR_REPORTED (decl) = 1;
}
return shadowed;
permerror (input_location, "name lookup of %qD changed for ISO %<for%> scoping",
DECL_NAME (decl));
if (flag_permissive)
- permerror (input_location, " using obsolete binding at %q+D", decl);
+ permerror (DECL_SOURCE_LOCATION (decl),
+ " using obsolete binding at %qD", decl);
else
{
static bool hint;