Skip to content

Commit 753bc32

Browse files
authored
Enhance directive handling for #if and #elif
1 parent 3a99f41 commit 753bc32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

addons/misra.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3891,10 +3891,10 @@ def misra_20_14(self, data):
38913891
# the size increases when there are inner #if directives.
38923892
ifStack = []
38933893
for directive in data.directives:
3894-
if directive.str.startswith('#if ') or directive.str.startswith('#ifdef ') or directive.str.startswith(
3895-
'#ifndef '):
3894+
if directive.str.startswith('#if ') or directive.str.startswith('#if(') or directive.str.startswith('#ifdef ')
3895+
or directive.str.startswith('#ifndef '):
38963896
ifStack.append(directive)
3897-
elif directive.str == '#else' or directive.str.startswith('#elif '):
3897+
elif directive.str == '#else' or directive.str.startswith('#elif ') or directive.str.startswith('#elif('):
38983898
if len(ifStack) == 0:
38993899
self.reportError(directive, 20, 14)
39003900
ifStack.append(directive)

0 commit comments

Comments
 (0)