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
2 changes: 1 addition & 1 deletion addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ def reportErrorIfMissingSuffix(variable, value):
reportErrorIfMissingSuffix(parameterDefinition.nameToken, usedParameter)

def misra_7_3(self, rawTokens):
compiled = re.compile(r'^[0-9.uU]+l')
compiled = re.compile(r'^[0-9.]+[Uu]*l+[Uu]*$')
for tok in rawTokens:
if compiled.match(tok.str):
self.reportError(tok, 7, 3)
Expand Down
14 changes: 13 additions & 1 deletion addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,25 @@ void misra_7_2(void) {
misra_7_2_call_va_test(1, 2, 3);
}

// The addon should not generate false positives for the identifiers.
struct misra_7_3_s
{
uint32_t ul_clka;
uint32_t test123l;
};

void misra_7_3(void) {
long misra_7_3_a = 0l; //7.3
long misra_7_3_b = 0lU; //7.3
long long misra_7_3_c = 0Ull; //7.3
long long misra_7_3_d = 0ll; //7.3
long double misra_7_3_e = 7.3l; //7.3
}
struct misra_7_3_s misra_7_3_f =
{
.ul_clka = 19U,
.test123l = 23U
};
}

typedef const char* MISRA_7_4_CHAR_CONST;
MISRA_7_4_CHAR_CONST misra_7_4_return_const_type_def (void) { return "return_typedef_const"; }
Expand Down