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

Add missing STD Library Identifiers #7325

Merged
merged 6 commits into from
Mar 8, 2025

Conversation

wienans
Copy link
Contributor

@wienans wienans commented Feb 23, 2025

Added a STDLIB_IDENTIFIERS for C11 as well as updated the C99 once based on,

C99: https://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf
C11: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

in the misra.py

@wienans wienans force-pushed the feature/std-lib-literals branch from 75edd8c to a5a449b Compare February 23, 2025 16:49
Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. some tests would be nice. Do you have some idea? I don't feel we need to test this in full but some kind of generic tests would be nice.. maybe ensure C11_STDLIB_IDENTIFIERS extends C99_STDLIB_IDENTIFIERS, make a few isStdLibId calls to make sure it works, ..

@wienans
Copy link
Contributor Author

wienans commented Feb 24, 2025

hmm.. some tests would be nice. Do you have some idea? I don't feel we need to test this in full but some kind of generic tests would be nice.. maybe ensure C11_STDLIB_IDENTIFIERS extends C99_STDLIB_IDENTIFIERS, make a few isStdLibId calls to make sure it works, ..

@danmar Test suggestions sound good, I can add that. is there already a test file where the misra.py is „unit tested“? I only found the .c file which tests the detections. If yes could you link the file where I should add it, if no could you make a suggestion how you would like to have the test added?

with test suggestions I don’t have additional ideas, the thing is it’s only a big list of keywords so there is not much to test, apart of the suggestions you already mentioned.

@wienans
Copy link
Contributor Author

wienans commented Mar 1, 2025

@danmar added a Test and also checked the isKeyword additionally to isStdLib and fixed a typo there, too.
Additionally i changed the switching std identifieres for C11 from a specific C11 check to else. Therefore all standards after C11 will get the C11 Std Lib Identifiers and Keywords.

If it is fine from your side it can be merged.

@wienans wienans requested a review from danmar March 1, 2025 17:01
@danmar danmar merged commit 1d3fe82 into danmar:main Mar 8, 2025
60 checks passed
@danmar
Copy link
Owner

danmar commented Mar 8, 2025

@wienans thanks! I wonder, is your name added in https://github.com/danmar/cppcheck/blob/main/AUTHORS yet?

@wienans wienans deleted the feature/std-lib-literals branch March 8, 2025 11:36
@wienans
Copy link
Contributor Author

wienans commented Mar 8, 2025

@danmar actually no i am not in it. You can add me as Sven Wienand

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