The (technical) problem that the void cast does not work is that the warning
is applied after gimplification, which strips the cast to void. So, this is
another case where warnings from the middle-end show their bad side - not that
it would be easy to move to the frontend(s).
This is at least a bug because the warning cannot be disabled:
if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
{
if (fdecl)
warning (0, "%Hignoring return value of %qD, " "declared with attribute warn_unused_result", EXPR_LOCUS (t), fdecl);
else
warning (0, "%Hignoring return value of function " "declared with attribute warn_unused_result", EXPR_LOCUS (t));
}
so, confirmed. Suggestions for a proper -Wno-XXX identifier? -Wno-unused-result?
The (technical) problem that the void cast does not work is that the warning
is applied after gimplification, which strips the cast to void. So, this is
another case where warnings from the middle-end show their bad side - not that
it would be easy to move to the frontend(s).
This is at least a bug because the warning cannot be disabled:
if (lookup_attribute ("warn_ unused_ result" , TYPE_ATTRIBUTES (ftype)))
"declared with attribute warn_unused_ result" ,
EXPR_LOCUS (t), fdecl);
"declared with attribute warn_unused_ result" ,
EXPR_LOCUS (t));
{
if (fdecl)
warning (0, "%Hignoring return value of %qD, "
else
warning (0, "%Hignoring return value of function "
}
so, confirmed. Suggestions for a proper -Wno-XXX identifier? -Wno-unused-result?