Fix false duplicate warnings with string prefix macros - #8834
Open
tzi4 wants to merge 1 commit into
Open
Conversation
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.
This fixes the false
duplicateExpressionwarning reported in Trac #5738.I reproduced it with expressions like this:
The
startswith(...)case from this ticket was fixed in July 2018. The direct comparisons above still trigger the warning on current main. This PR addresses those remaining comparisons.When
SRCDIRis undefined, Cppcheck compares the macro names and misses the different strings after them. The patch prevents that incomplete comparison from producing a duplicate warning.I added regression tests for the reported case and checked that real duplicates still produce warnings, including identical
throwexpressions. The three focused tests fail before the fix and pass after it. The full C++ suite passes with 5,323 tests and 355 existing TODOs. These checks ran on Linux/WSL at commitc976cac0ec531e1ff47b8cf78028f1182e84a35e.I found this issue through the bounty page. Is the program still running, and would this fix qualify for the listed $20? I'm based in Türkiye and can also receive crypto. Which payment methods do you support, and roughly how long does payment usually take?
I also have local fixes for Trac #6552 and Trac #4270. How should I request assignment for those?