Fix false positive in misra.py rule 20.14 (#1240)

MISRA rule 20.14 is not limited to #if pragmas and also extends to
positives whenever #ifdef/#ifndef is used.
This commit is contained in:
Richard A. Smith 2018-05-20 02:31:59 -04:00 committed by Daniel Marjamäki
parent aa3722feea
commit a26d73f78f
1 changed files with 1 additions and 1 deletions

View File

@ -1297,7 +1297,7 @@ def misra_20_14(data):
# the size increases when there are inner #if directives.
ifStack = []
for directive in data.directives:
if directive.str.startswith('#if '):
if directive.str.startswith('#if ') or directive.str.startswith('#ifdef ') or directive.str.startswith('#ifndef '):
ifStack.append(directive)
elif directive.str == '#else' or directive.str.startswith('#elif '):
if len(ifStack)==0: