Fixed #8567 (False positive: MISRA RULE 20.3)
This commit is contained in:
parent
8f9fa2e6a7
commit
8d88f75f03
|
@ -1476,7 +1476,12 @@ def misra_20_3(rawTokens):
|
||||||
if not simpleMatch(token, '# include'):
|
if not simpleMatch(token, '# include'):
|
||||||
continue
|
continue
|
||||||
headerToken = token.next.next
|
headerToken = token.next.next
|
||||||
if not headerToken or not (headerToken.str.startswith('<') or headerToken.str.startswith('"')):
|
num = 0
|
||||||
|
while headerToken and headerToken.linenr == linenr:
|
||||||
|
if not headerToken.str.startswith('/*') and not headerToken.str.startswith('//'):
|
||||||
|
num += 1
|
||||||
|
headerToken = headerToken.next
|
||||||
|
if num != 1:
|
||||||
reportError(token, 20, 3)
|
reportError(token, 20, 3)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// ~/cppcheck/cppcheck --dump misra-test.c && python ../misra.py -verify misra-test.c.dump
|
// ~/cppcheck/cppcheck --dump misra-test.c && python ../misra.py -verify misra-test.c.dump
|
||||||
|
|
||||||
#include "path\file.h" // 20.2
|
#include "path\file.h" // 20.2
|
||||||
#include /*abc*/ "file.h" // 20.3
|
#include /*abc*/ "file.h" // no warning
|
||||||
|
#include PATH "file.h" // 20.3
|
||||||
#include<file.h> // no warning
|
#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
|
||||||
|
|
Loading…
Reference in New Issue