Comment 9 for bug 305176

Revision history for this message
In , Rguenth (rguenth) wrote :

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?