Merge pull request #2733 from jubnzv/fix-20-7-multicharacter
misra.py: Fix 20.7 false positive for multi-character arguments
This commit is contained in:
commit
20ded0b295
|
@ -2320,11 +2320,16 @@ class MisraChecker:
|
|||
else:
|
||||
state_in_string = True
|
||||
pos_search += 1
|
||||
elif exp[pos_search] in directive_args:
|
||||
skip_next = True # Skip check for the next argument
|
||||
break
|
||||
elif exp[pos_search] == arg:
|
||||
elif exp[pos_search].isalnum():
|
||||
word = ""
|
||||
while pos_search < len(exp) and exp[pos_search].isalnum():
|
||||
word += exp[pos_search]
|
||||
pos_search += 1
|
||||
if word == arg:
|
||||
pos_search += 1
|
||||
elif word in directive_args:
|
||||
skip_next = True
|
||||
break
|
||||
elif exp[pos_search] == ' ':
|
||||
pos_search += 1
|
||||
elif state_in_string:
|
||||
|
|
|
@ -1035,6 +1035,10 @@ union misra_19_2 { }; // 19.2
|
|||
#define M_20_7_11(A, B, C) (A " " B " " C)
|
||||
#define M_20_7_12(A, B, C) (A " " B + C) // 20.7
|
||||
#define M_20_7_13(A, B, C) (A + B " " C) // 20.7
|
||||
#define M_20_7_14(STRING1, STRING2) (STRING1 " " STRING2)
|
||||
#define M_20_7_15(STRING1, STRING2, STRING3) (STRING1 " " STRING2 " " STRING3)
|
||||
#define M_20_7_16(STRING1, STRING2, STRING3) (STRING1 " " STRING2 + STRING3) // 20.7
|
||||
#define M_20_7_17(STRING1, STRING2, STRING3) (STRING1 + STRING2 " " STRING3) // 20.7
|
||||
|
||||
// Compliant: M is a structure member name, not an expression
|
||||
struct { int a; } struct_20_7_s;
|
||||
|
|
Loading…
Reference in New Issue