Fixed #8562 (false positive: MISRA rule 20.13)

This commit is contained in:
Daniel Marjamäki 2018-09-02 16:05:37 +02:00
parent cc402869a6
commit 8f9fa2e6a7
2 changed files with 4 additions and 4 deletions

View File

@ -1496,10 +1496,9 @@ def misra_20_5(data):
def misra_20_13(data): def misra_20_13(data):
for directive in data.directives: for directive in data.directives:
dir = directive.str dir = directive.str
if dir.find(' ') > 0: for sep in ' (<':
dir = dir[:dir.find(' ')] if dir.find(sep) > 0:
if dir.find('(') > 0: dir = dir[:dir.find(sep)]
dir = dir[:dir.find('(')]
if dir not in ['#define', '#elif', '#else', '#endif', '#error', '#if', '#ifdef', '#ifndef', '#include', if dir not in ['#define', '#elif', '#else', '#endif', '#error', '#if', '#ifdef', '#ifndef', '#include',
'#pragma', '#undef', '#warning']: '#pragma', '#undef', '#warning']:
reportError(directive, 20, 13) reportError(directive, 20, 13)

View File

@ -3,6 +3,7 @@
#include "path\file.h" // 20.2 #include "path\file.h" // 20.2
#include /*abc*/ "file.h" // 20.3 #include /*abc*/ "file.h" // 20.3
#include<file.h> // no warning
#include <setjmp.h> // 21.4 #include <setjmp.h> // 21.4
#include <signal.h> // 21.5 #include <signal.h> // 21.5
#include <stdio.h> //21.6 #include <stdio.h> //21.6