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

2016-04-05 Thread Aaron Ballman via cfe-commits
On Tue, Apr 5, 2016 at 3:13 PM, Richard Smith via cfe-commits wrote: > 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 ver

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

2016-04-05 Thread Richard Smith via cfe-commits
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

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

2016-04-05 Thread Sidney San Martín via cfe-commits
sidney added a comment. In http://reviews.llvm.org/D17043#390188, @alexfh wrote: > What's the status of this patch? Do you still want to continue working on it > or are you fine with the warn_unused_result/nodiscard-based solution? I'm still interested in working on this, but I was waiting for

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

2016-04-01 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision. alexfh added a comment. This revision now requires changes to proceed. What's the status of this patch? Do you still want to continue working on it or are you fine with the warn_unused_result/nodiscard-based solution? http://reviews.llvm.org/D17043

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

2016-02-11 Thread Joerg Sonnenberger via cfe-commits
On Wed, Feb 10, 2016 at 09:26:44PM -0500, Sidney San Martín via cfe-commits wrote: > > On Feb 10, 2016, at 8:05 PM, Joerg Sonnenberger > > wrote: > > > > I'm not a big fan of this. Those calls are by the very definition > > harmless, so they aggrevate the existing problem of stupid annotation.

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

2016-02-10 Thread Sidney San Martín via cfe-commits
> On Feb 10, 2016, at 8:05 PM, Joerg Sonnenberger > wrote: > > I'm not a big fan of this. Those calls are by the very definition > harmless, so they aggrevate the existing problem of stupid annotation. The issue is that the annotation's current diagnostic is pretty nonspecific and therefore no

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

2016-02-10 Thread Richard Smith via cfe-commits
On Wed, Feb 10, 2016 at 5:05 PM, Joerg Sonnenberger via cfe-commits wrote: > On Wed, Feb 10, 2016 at 04:21:02PM +, Alexander Kornienko via cfe-commits > wrote: >> alexfh added a comment. >> >> Thank you for working on this check! >> >> I'd like to note that there is a library-side way to miti

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

2016-02-10 Thread Joerg Sonnenberger via cfe-commits
On Wed, Feb 10, 2016 at 04:21:02PM +, Alexander Kornienko via cfe-commits wrote: > alexfh added a comment. > > Thank you for working on this check! > > I'd like to note that there is a library-side way to mitigate this > issue using the `[[clang::warn_unused_result]]` attribute on > `vector:

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

2016-02-10 Thread Sidney San Martín via cfe-commits
sidney added a comment. In http://reviews.llvm.org/D17043#348982, @alexfh wrote: > The attribute can have arguments (e.g. `[[deprecated("use some other API")]] > void f();`), so if there is a good reason, an argument (e.g. a custom > message) can be added to the `warn_unused_result` attribute.

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

2016-02-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D17043#348569, @sidney wrote: > In http://reviews.llvm.org/D17043#348525, @alexfh wrote: > > > I'd like to note that there is a library-side way to mitigate this issue > > using the `[[clang::warn_unused_result]]` attribute on `vector::empty()`

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

2016-02-10 Thread Sidney San Martín via cfe-commits
sidney added a comment. In http://reviews.llvm.org/D17043#348525, @alexfh wrote: > I'd like to note that there is a library-side way to mitigate this issue > using the `[[clang::warn_unused_result]]` attribute on `vector::empty()` and > similar methods: Using an attribute sounds much better t

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

2016-02-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. Thank you for working on this check! I'd like to note that there is a library-side way to mitigate this issue using the `[[clang::warn_unused_result]]` attribute on `vector::empty()` and similar methods: $ cat q.cc #if defined(__clang__) # if __cplusplus >= 201103

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

2016-02-10 Thread Sidney San Martín via cfe-commits
sidney created this revision. sidney added reviewers: mclow.lists, alexfh. sidney added a subscriber: cfe-commits. Currently has a whitelist of methods like std::vector::empty() which, in a standalone statement, likely won't do what the programmer wants. The whitelist is brittle (Did I misspell a

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

2016-02-10 Thread Sidney San Martín via cfe-commits
sidney added a comment. Quick note: this is my first contribution, born from the Clang/LLVM sprint last weekend. Marshall helped me get started. http://reviews.llvm.org/D17043 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llv