-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[[nodiscard]] messages #2211
[[nodiscard]] messages #2211
Conversation
Partly addresses microsoft#271
Partly addresses microsoft#271
Why, it still fixes #1742 where possible |
You are correct. |
…packaged_task`.
Thanks for this major diagnostic improvement 😻 - and apologies for taking so very long to review this! I've pushed a bunch of changes, renaming/rephrasing stuff and updating a few more locations to use the message macros. Please let me know if anything looks undesirable. (I was probably most aggressive with rephrasing the |
I intentionally did not place full stop at the end of each message for consistency with other ranges. Consider this program: [[nodiscard("don't discard. the value is useful")]]
bool lock()
{
return false;
}
int main()
{
int i;
lock();
} The warnings (
Do you still want to have it? |
This comment was marked as resolved.
This comment was marked as resolved.
(capturing Discord discussion here for the record) The compiler definitely prefers short phrases without periods for most of its warning messages. However, longer messages (typically static analysis warnings) are sometimes full sentences with periods, like https://godbolt.org/z/v9ansc3fa :
And our Lines 935 to 939 in 8ca7bd3
Thus while there are arguments for both ways, we've concluded that keeping the periods would be best. |
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks again for enhancing the STL's favorite warning! 😻 |
Fixes #271
Fixes #1742