[PATCH] D45163: [Sema] -Wunused-value: diagnose unused std::move() call results.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 3 13:21:18 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D45163#1056044, @rjmccall wrote:

> It seems reasonable to ask libc++ to use `__attribute__((warn_unused_result))` if `[[nodiscard]]` is unavailable.


https://reviews.llvm.org/D45179 should hopefully add an **opt-in** define to allow doing just that. But it will then have to be enabled in the LLVM buildsystem.

In https://reviews.llvm.org/D45163#1056074, @Quuxplusone wrote:

> In https://reviews.llvm.org/D45163#1055957, @lebedev.ri wrote:
>
> > In https://reviews.llvm.org/D45163#1055856, @rjmccall wrote:
> >
> > > Well, we should feel welcome to submit patches to the C++ library implementations, I think.  I can understand why Marshall is waiting to just do this until he gets a comprehensive committee paper, but he might consider taking a patch in the meantime.
> >
> >
> > That has been discussed, and it's not going to happen. Ask him if you want more info.
>
>
> You say a library patch is not going to happen, but isn't that library patch literally https://reviews.llvm.org/D45179, which has been accepted (although I just left a comment explaining why the current macro-soup is suboptimal)?


We may be talking about different things here.
I'm simply pointing out that libc++ will not be adding `nodiscard` attribute to functions unless it is mandated by the standard,
and that it *has* to be opt-in for earlier standards. I'm not saying that just to argue, i'm literally retranslating what @mclow.lists has said, it's his words.


Repository:
  rC Clang

https://reviews.llvm.org/D45163





More information about the cfe-commits mailing list