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

Fix #11878 FP misra-c2012-18.7 on function pointer parameter with array-type args #5343

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,10 @@ def misra_18_7(self, data):
if token.str == '{':
token = token.link

if cppcheckdata.simpleMatch(token, "[ ]"):
# skip function pointer parameter types
if token.astOperand1 is None:
pass
elif cppcheckdata.simpleMatch(token, "[ ]"):
self.reportError(token, 18, 7)
break
token = token.next
Expand Down
1 change: 1 addition & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,7 @@ struct {
} r18_7_struct; // 8.4
struct {
uint16_t len;
int (*array_param_func_ptr)(char const *argv[], int argc); // no-warning
uint8_t data_1[ 19 ];
uint8_t data_2[ ]; // 18.7
} r18_7_struct; // 8.4
Expand Down
Loading