misra.py: Fix rule 20.2 false negative (#2534)
This commit is contained in:
parent
cea17acd92
commit
2138091fa3
|
@ -2229,7 +2229,7 @@ class MisraChecker:
|
||||||
for directive in data.directives:
|
for directive in data.directives:
|
||||||
if not directive.str.startswith('#include '):
|
if not directive.str.startswith('#include '):
|
||||||
continue
|
continue
|
||||||
for pattern in ('\\', '//', '/*', "'"):
|
for pattern in ('\\', '//', '/*', ',', "'"):
|
||||||
if pattern in directive.str:
|
if pattern in directive.str:
|
||||||
self.reportError(directive, 20, 2)
|
self.reportError(directive, 20, 2)
|
||||||
break
|
break
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
// ~/cppcheck/cppcheck --dump --suppress=uninitvar --suppress=uninitStructMember misra/misra-test.c --std=c89 && python3 ../misra.py -verify misra/misra-test.c.dump
|
// ~/cppcheck/cppcheck --dump --suppress=uninitvar --suppress=uninitStructMember misra/misra-test.c --std=c89 && python3 ../misra.py -verify misra/misra-test.c.dump
|
||||||
|
|
||||||
#include "path\file.h" // 20.2
|
#include "path\file.h" // 20.2
|
||||||
|
#include "file//.h" // 20.2
|
||||||
|
#include "file/*.h" // 20.2
|
||||||
|
#include "file'.h" // 20.2
|
||||||
|
#include <file,.h> // 20.2
|
||||||
|
#include "file,.h" // 20.2
|
||||||
|
|
||||||
#include /*abc*/ "file.h" // no warning
|
#include /*abc*/ "file.h" // no warning
|
||||||
/*foo*/#include "file.h" // no warning
|
/*foo*/#include "file.h" // no warning
|
||||||
|
|
Loading…
Reference in New Issue