Skip to content

token.cpp: removed unreachable cases from multiComparePercent()#4814

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
firewave:tok-x
Feb 23, 2023
Merged

token.cpp: removed unreachable cases from multiComparePercent()#4814
danmar merged 1 commit intocppcheck-opensource:mainfrom
firewave:tok-x

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

The calling function multiCompare() already explicitly checks that those characters are not present so we don't need to handle them in the switch.

It also seems to lead to better inlining and improve the performance by a few percent.

@firewave
Copy link
Copy Markdown
Collaborator Author

I filed https://trac.cppcheck.net/ticket/11575 about detecting dead switch cases.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Feb 22, 2023

Running testrunner TestIO (which hits the non-matchcompilable code hard) with callgrind:

Clang 15 4,445,753,404 -> 4,404,427,785

@danmar danmar merged commit ce3ba5c into cppcheck-opensource:main Feb 23, 2023
@firewave firewave deleted the tok-x branch February 23, 2023 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants