File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1822,21 +1822,23 @@ def misra_20_7(self, data):
18221822 pos = exp .find (arg , pos )
18231823 if pos < 0 :
18241824 break
1825+ # is 'arg' used at position pos
18251826 pos1 = pos - 1
18261827 pos2 = pos + len (arg )
18271828 pos = pos2
1828- if isalnum (exp [pos1 ]) or exp [pos1 ] == '_' :
1829+ if pos1 >= 0 and ( isalnum (exp [pos1 ]) or exp [pos1 ] == '_' ) :
18291830 continue
1830- if isalnum (exp [pos2 ]) or exp [pos2 ] == '_' :
1831+ if pos2 < len ( exp ) and ( isalnum (exp [pos2 ]) or exp [pos2 ] == '_' ) :
18311832 continue
1832- while exp [pos1 ] == ' ' :
1833+
1834+ while pos1 >= 0 and exp [pos1 ] == ' ' :
18331835 pos1 -= 1
1834- if exp [pos1 ] != '(' and exp [ pos1 ] != '[ ' :
1836+ if exp [pos1 ] not in '([# ' :
18351837 self .reportError (directive , 20 , 7 )
18361838 break
1837- while exp [pos2 ] == ' ' :
1839+ while pos2 < len ( exp ) and exp [pos2 ] == ' ' :
18381840 pos2 += 1
1839- if exp [ pos2 ] != ')' and exp [pos2 ] != '] ' :
1841+ if pos2 < len ( exp ) and exp [pos2 ] not in ')]# ' :
18401842 self .reportError (directive , 20 , 7 )
18411843 break
18421844
Original file line number Diff line number Diff line change @@ -754,8 +754,9 @@ union misra_19_2 { }; // 19.2
754754#define M_20_7_1 (A ) (A+1) // 20.7
755755#define M_20_7_2 (A ,B ) (1+AB+2) // no warning
756756#define M_20_7_3 (A ) ((A)+A) // 20.7
757+ #define M_20_7_4 (A ) x##A // 20.10 this test was written to see there are not FPs
757758
758- #define STRINGIFY (a ) (#a) // 20.7 20.10
759+ #define M_20_10 (a ) (#a) // 20.10
759760
760761#else1 // 20.13
761762
You can’t perform that action at this time.
0 commit comments