https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

--- Comment #59 from Roman Krotov <romato.san1337 at gmail dot com> ---
(In reply to Ed Catmur from comment #58)
> (In reply to Roman Krotov from comment #57)
I already addressed all of it in my previous 2 comments...
I'll write more clearly then.

> > But I don't see any reasons not to implement the switch right now...
> Making [[gnu::warn_unused_result]] mean the same as [[nodiscard]] would be a
> reduction in expressivity.
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.
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.

In fact, gcc already has a "not recommended non-default" switch model:
  -Wno-coverage-mismatch
    <...>   -Wno-coverage-mismatch  can  be  used  to  disable  the warning
<...> disabling the warning is not recommended.

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.
It won't change the meaning of the wur attribute, bacause it will be a
non-default switch.

> > what about the projects
> > what don't agree with the distinction of these 2 attributes? Or just want to
> > be more compatible with clang?
> They can use [[nodiscard]].
> 
> > Or they just may not agree with the choice of a library, that decided to put
> > wur instead of nodiscard for a specific function.
> Then they can write their own wrappers using [[nodiscard]].
What about libraries and programs that will prefer to stay on C99/C11 (without
C2x extensions), especially if they use -pedantic?
Even if there will be something like __attribute__(nodiscard),
What about programs and libraries that will not prefer to update?
That's why we shouldn't rely on the future and should implement the solution
now.

Reply via email to