Suppress PREfast false positive (C28167) for RAII lock wrappers#629
Open
KintoCA wants to merge 1 commit intomicrosoft:masterfrom
Open
Suppress PREfast false positive (C28167) for RAII lock wrappers#629KintoCA wants to merge 1 commit intomicrosoft:masterfrom
KintoCA wants to merge 1 commit intomicrosoft:masterfrom
Conversation
760e6d6 to
a7d8620
Compare
a7d8620 to
25ddb8e
Compare
Author
|
CI is green and this PR is ready for review. This change suppresses PREfast warning C28167 in resource.h, which appears to be a false positive for the RAII lock pattern because the analyzer does not correctly model lock release through C++ destructors. There is no intended functional or behavioral change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PREfast warning C28167 ("The function changes the lock state and does not restore it") fires as a false positive on RAII-based locking patterns in resource.h. PREfast's interprocedural analysis cannot track that the lock is released inside a C++ destructor, causing it to incorrectly report that callers of WIL lock guards leave locks in an inconsistent state.
This change adds C28167 to the existing #pragma warning(disable ...) block that already suppresses the related C26135 and C26110 warnings for the same reason.
Testing:
Verified that the suppression eliminates the false-positive PREfast diagnostics without masking any real lock-state issues. No functional behavior changes.