First pass at addressing cross-compiler compatibility in MISRA 2023.#884
Merged
MichaelRFairhurst merged 3 commits intomainfrom Apr 30, 2025
Conversation
Handles clang findings and gcc findings. Many issues were merely updates to the test cases, however, additional work has been done to properly handle tgmath.h and stdatomic.h macros across gcc and clang results.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses various cross-compiler issues related to MISRA 2023 compliance by adjusting test cases and fixing macro-related test behaviors. Key changes include updates to variably-modified array declarations, correction of memset argument orders, and standardization of main() signatures across tests.
Reviewed Changes
Copilot reviewed 30 out of 41 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| c/misra/test/rules/RULE-18-8/test.c | Adjusted VLA array parameter declaration to include dimension size. |
| c/misra/test/rules/RULE-18-10/test.c | Updated array declarations and removed an invalid array initialization assignment. |
| c/misra/test/rules/RULE-17-11/test.c | Corrected main() signature to standard format. |
| c/misra/test/rules/RULE-12-6/test.c | Corrected memset argument order to (destination, value, size) in multiple locations. |
| c/misra/test/rules/DIR-5-3/test.c | Updated main() signature for proper standard compliance. |
| c/misra/test/rules/DIR-5-1/test.c | Updated main() signature to comply with standard signature requirements. |
| c/common/test/rules/functionnoreturnattributecondition/test.c | Minor formatting update in the default case of a switch statement. |
Files not reviewed (11)
- c/common/src/codingstandards/c/TgMath.qll: Language not supported
- c/misra/src/rules/RULE-13-2/UnsequencedAtomicReads.ql: Language not supported
- c/misra/src/rules/RULE-21-22/TgMathArgumentWithInvalidEssentialType.ql: Language not supported
- c/misra/src/rules/RULE-21-23/TgMathArgumentsWithDifferingStandardType.ql: Language not supported
- c/misra/src/rules/RULE-21-25/InvalidMemoryOrderArgument.ql: Language not supported
- c/misra/src/rules/RULE-9-7/UninitializedAtomicObject.ql: Language not supported
- c/misra/test/rules/RULE-1-5/UseOfObsoleteMacroAtomicVarInit.expected.gcc: Language not supported
- c/misra/test/rules/RULE-11-10/test.c.clang: Language not supported
- c/misra/test/rules/RULE-12-6/test.c.clang: Language not supported
- c/misra/test/rules/RULE-13-2/UnsequencedAtomicReads.expected: Language not supported
- c/misra/test/rules/RULE-13-2/UnsequencedAtomicReads.expected.gcc: Language not supported
Comments suppressed due to low confidence (1)
c/misra/test/rules/RULE-18-10/test.c:75
- The assignment of a pointer to initialize an array is invalid. The change to remove the assignment helps prevent compilation errors.
int l6[10] = p23;
Collaborator
Author
|
Confirmed that new MISRA C rules are passing in CI/CD for gcc and clang at this ref. |
lcartey
approved these changes
Apr 30, 2025
Contributor
lcartey
left a comment
There was a problem hiding this comment.
Other than what's possibly a stray semi-colon, looks good to me!
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.
Handles clang findings and gcc findings.
Many issues were merely updates to the test cases, however, additional work has been done to properly handle tgmath.h and stdatomic.h macros across gcc and clang results.
Description
please enter the description of your change here
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
DIR-4-15,RULE-9-7,RULE-13-2,RULE-21-22,RULE-21-23,RULE-21-25Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.