[SERVER-27244] Status class should have gnu::warn_unused_result attribute Created: 01/Dec/16 Updated: 06/Dec/17 Resolved: 19/Jun/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.9 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | ADAM Martin (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Platforms 2017-06-19 |
| Participants: |
| Description |
|
Far too many places are silently not checking the Statuses returned by functions. We should add this attribute and make all existing silent ignores either check the Status or use a void cast to explicitly ignore it. |
| Comments |
| Comment by Githook User [ 19/Jun/17 ] |
|
Author: {u'username': u'adamlsd', u'name': u'ADAM David Alan Martin', u'email': u'adam.martin@10gen.com'}Message: This change activates the compile-time checking for unused |
| Comment by Githook User [ 19/Jun/17 ] |
|
Author: {u'username': u'adamlsd', u'name': u'ADAM David Alan Martin', u'email': u'adam.martin@10gen.com'}Message: The enterprise module has a few ignored `Status` and |
| Comment by Githook User [ 19/Jun/17 ] |
|
Author: {u'username': u'adamlsd', u'name': u'ADAM David Alan Martin', u'email': u'adam.martin@10gen.com'}Message: A comment describing the new `MONGO_WARN_UNUSED_RESULT` flag went |
| Comment by Githook User [ 19/Jun/17 ] |
|
Author: {u'username': u'adamlsd', u'name': u'ADAM David Alan Martin', u'email': u'adam.martin@10gen.com'}Message: There are numerous places in the codebase where `mongo::Status` or This also introduces a `transitional_ignore` function, which allows |
| Comment by ADAM Martin (Inactive) [ 02/Jun/17 ] |
|
C+17 introduced `[[nodiscard]]` as a new attribute to provide this kind of functionality as well. We may wish to have some kind of `MONGO_NODISCARD` macro to allow us to use the more portable C+17 attribute when the time comes, and such a macro lets us use `gnu::warn_unused_result` where supported, in the meantime. |