Skip to content
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
7 changes: 7 additions & 0 deletions addons/misra_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,13 @@ def misra_9_x(self, data, rule, rawTokens = None):
if rule == 902 and not ed.isMisra92Compliant():
self.reportError(nameToken, 9, 2)
if rule == 903 and not ed.isMisra93Compliant():
# Do not check when variable is pointer type
type_token = variable.nameToken
while type_token and type_token.isName:
type_token = type_token.previous
if type_token and type_token.str == '*':
continue

self.reportError(nameToken, 9, 3)
if rule == 904 and not ed.isMisra94Compliant():
self.reportError(nameToken, 9, 4)
Expand Down
4 changes: 4 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ enum misra_8_12_e { misra_e1 = sizeof(int), misra_e2}; // no-crash

static void misra_8_14(char * restrict str) {(void)str;} // 8.14

// #11707 -- false positive
struct S_9_3 { struct S_9_3* p; int x; };
struct S_9_3* s_9_3_array[] = { x, NULL }; // 8.4

static void misra_9_empty_or_zero_initializers(void) {
int a[2] = {}; // 9.2
int b[2][2] = {}; // 9.2
Expand Down