diff --git a/addons/misra.py b/addons/misra.py index be471efea..498756ccb 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -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: - pos_search += 1 + 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: diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 74b6ac1b3..8579318f8 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -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;