Suppress PREfast false positive (C28167) for RAII lock wrappers#629
Conversation
760e6d6 to
a7d8620
Compare
a7d8620 to
25ddb8e
Compare
|
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. |
|
@dunhor would you mind taking a look when you have a chance? This suppresses PREfast C28167 for RAII lock wrappers, alongside the existing Happy to adjust if you’d prefer a different scope or placement. |
|
@dunhor, Since I don’t have merge permissions on this repo, could someone please merge when convenient? |
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.