[PATCH] D17043: Check that the result of a library call w/o side effects is used

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 12:13:17 PDT 2016


rsmith added a comment.

The version of this attribute that was voted into the C++ standard (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0189r1.pdf) does not support a message, and I expect that is the version that libc++ will want to use.

I think we should at least improve Clang's diagnostic message here, maybe something like:

  warning: value returned by call to function 'blah' should always be used
  note: 'blah' declared with attribute 'nodiscard' here

It would also seem sensible to propose extending the standard attribute with an optional message.


http://reviews.llvm.org/D17043





More information about the cfe-commits mailing list