Skip to content
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

Ignore zero valued enum entries from badBitmaskCheck #5195

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

mptre
Copy link
Contributor

@mptre mptre commented Jun 26, 2023

Usage of zero valued enum entries can be used for documenting purposes and should be ignored just like zeroes expanded from macros.

Usage of zero valued enum entries can be used for documenting purposes and
should be ignored just like zeroes expanded from macros.
@danmar danmar merged commit 4ebb8ea into danmar:main Jun 26, 2023
64 checks passed
@mptre mptre deleted the badbitmask branch June 26, 2023 11:19
@chrchr-github
Copy link
Collaborator

I have no strong opinion on this, but the difference is that macros might be configuration-dependent. One can easily imagine a bug where an enumerator with value 0 is used with | instead of the correct one.
enum E { CONFUSING11, CONFUSING111 };

@danmar
Copy link
Owner

danmar commented Jun 27, 2023

One can easily imagine a bug where an enumerator with value 0 is used with | instead of the correct one.

yes it seems that there are many findings in 2.11 that are not found in latest HEAD:
http://cppcheck1.osuosl.org:8000/diff-badBitmaskCheck

I have checked 5-6 random warnings in erlang, far2l, exim.. and all those looked intentional (true negatives) to me. At least I did not see other suspicious enum constants with similar names that could have been intended instead.

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.

3 participants