From a26d73f78f82334b12fce50fe5fa296fdf0b1114 Mon Sep 17 00:00:00 2001 From: "Richard A. Smith" Date: Sun, 20 May 2018 02:31:59 -0400 Subject: [PATCH] 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. --- addons/misra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/misra.py b/addons/misra.py index 17e294175..b68410929 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -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: