https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
--- Comment #60 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Roman Krotov from comment #59) > All, what I'm asking for, is to make something like -Wno-void-unused, which > would suppress the warnings only for the (void) casted calls. So you want to not warn for some (just *some*) explicitly unused cases, and do warn for other explicitly unused cases, and all implicitly unused cases? While the author of the code explicitly asked for a warning message to be emitted in all such cases: "The 'warn_unused_result' attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value." > This is desperately needed by the projects like systemd (see the first link > in my first comment) as a less severe variant than -Wno-unused-result, so > that they won't get punished with less diagnostics. They (like EVERYONE ELSE IN THE WORLD) should not use -Werror, if they do not like punishment. Warnings are warnings. The author of your code (the header files for the library code) wanted everyone to be warned about not using the return value from a certain function. He/she was almost certainly right about that. And it is easy to suppress the warning in the few cases where you really want to. > I don't see any reason not to implement -Wno-void-unused with the similar > description (stating that it's not recommended, if you want) to help the > projects like systemd. Define what it would do *exactly*, make a patch for it (including for the documentation, amending all existing documentation as well), and do that in such a way that it a) is correct, and b) makes any sense. Then send the patch to gcc-patches@. If you do not want to do all that work (including the very much non-trivial amount of follow-up work that will cause), then please go away? Don't tell us to do insane things that are an incredible amount of work just because you had a bad idea and now want it to become reality. > It won't change the meaning of the wur attribute, bacause it will be a > non-default switch. This makes no sense at all.