Fixed #9505 (MISRA 20.7 check suggests code change that leads to invalid code)

This commit is contained in:
Daniel Marjamäki 2019-12-14 16:31:41 +01:00
parent 267bdc0f5f
commit 5e07528af5
2 changed files with 3 additions and 2 deletions

View File

@ -1857,12 +1857,12 @@ class MisraChecker:
while pos1 >= 0 and exp[pos1] == ' ': while pos1 >= 0 and exp[pos1] == ' ':
pos1 -= 1 pos1 -= 1
if exp[pos1] not in '([#': if exp[pos1] not in '([#,':
self.reportError(directive, 20, 7) self.reportError(directive, 20, 7)
break break
while pos2 < len(exp) and exp[pos2] == ' ': while pos2 < len(exp) and exp[pos2] == ' ':
pos2 += 1 pos2 += 1
if pos2 < len(exp) and exp[pos2] not in ')]#': if pos2 < len(exp) and exp[pos2] not in ')]#,':
self.reportError(directive, 20, 7) self.reportError(directive, 20, 7)
break break

View File

@ -755,6 +755,7 @@ union misra_19_2 { }; // 19.2
#define M_20_7_2(A,B) (1+AB+2) // no warning #define M_20_7_2(A,B) (1+AB+2) // no warning
#define M_20_7_3(A) ((A)+A) // 20.7 #define M_20_7_3(A) ((A)+A) // 20.7
#define M_20_7_4(A) x##A // 20.10 this test was written to see there are not FPs #define M_20_7_4(A) x##A // 20.10 this test was written to see there are not FPs
#define M_20_7_5(A,B) f(A, B) // no warning
#define M_20_10(a) (#a) // 20.10 #define M_20_10(a) (#a) // 20.10