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
4 changes: 3 additions & 1 deletion addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,9 @@ def misra_7_2(self, data):
self.reportError(token, 7, 2)

def misra_7_3(self, rawTokens):
compiled = re.compile(r'^[0-9.]+[Uu]*l+[Uu]*$')
# Match decimal digits, hex digits, decimal point, and e/E p/P floating
# point constant exponent separators.
compiled = re.compile(r'^(0[xX])?[0-9a-fA-FpP.]+[Uu]*l+[Uu]*$')
for tok in rawTokens:
if compiled.match(tok.str):
self.reportError(tok, 7, 3)
Expand Down
14 changes: 14 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ struct misra_7_3_s
{
uint32_t ul_clka;
uint32_t test123l;
float t = 6.02E23l; // 7.3
float t1 = 6.02E23L;
float u = 0xa1B2.p12l; // 7.3
float u1 = 0xa1B2.p12L;
float v = 0xa1B2.P12l; // 7.3
float v1 = 0xa1B2.P12L;
float w = 6.02e23l; // 7.3
float w1 = 6.02e23L;
unsigned long x = 0xabcul; // 7.3
unsigned long x1 = 0xabcuL;
unsigned long y = 0xABCUl; // 7.3
unsigned long y1 = 0xABCUL;
unsigned long z = 0XdeadBeEfUl; // 7.3
unsigned long z1 = 0XdeadBeEfUL;
};

static void misra_7_3(void) {
Expand Down