This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82134] warn_unused_result triggers on empty structs even when they are used
- From: "zackw at panix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Sep 2017 15:45:31 +0000
- Subject: [Bug c/82134] warn_unused_result triggers on empty structs even when they are used
- Auto-submitted: auto-generated
- References: <bug-82134-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82134
--- Comment #2 from Zack Weinberg <zackw at panix dot com> ---
The claim in the Stack Overflow post was that this was useful in a scenario
involving machine-generated code that couldn't return void for some external
reason, but they didn't go into any kind of detail.
It has always been my opinion that warnings in general should be made
optimization-independent, including early dead code optimizations like this,
with _possible_ carefully-defined-and-documented exceptions for `if (0) { /*
don't warn about stuff in here */ }` and similar. But I realize that's a long
way from where GCC is or has ever been.