[llvm-bugs] [Bug 51228] warn_unused_result and cast to void

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 28 05:52:53 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51228

Aaron Ballman <aaron at aaronballman.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #5 from Aaron Ballman <aaron at aaronballman.com> ---
(In reply to David Blaikie from comment #4)
> Yeah, generally I'd consider this "working as intended".
> 
> Indeed this functionality is explicitly documented as such:
> https://releases.llvm.org/6.0.0/tools/clang/docs/AttributeReference.
> html#nodiscard-warn-unused-result-clang-warn-unused-result-gnu-warn-unused-
> result

+1, I consider this to be working as intended. The linked discussion of the GCC
bug report is interesting, but doesn't really make a compelling case for why a
cast to void to silence the warning is undesirable. Silencing this diagnostic
by casting to void is not unexpected behavior for users (as the GCC bug report
shows). Even if it was, changing that now would break user's code if they're
compiling with -Werror.

I'm resolving as WONTFIX because this is behaving by design, but that doesn't
mean discussion on the topic has to end (if someone wants to build a compelling
case that also considers the potential for breaking code relying on this
silencing mechanism, we can always reopen the issue).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210728/6541fb7a/attachment.html>


More information about the llvm-bugs mailing list