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:
|
||||
if not directive.str.startswith('#include '):
|
||||
continue
|
||||
for pattern in ('\\', '//', '/*', "'"):
|
||||
for pattern in ('\\', '//', '/*', ',', "'"):
|
||||
if pattern in directive.str:
|
||||
self.reportError(directive, 20, 2)
|
||||
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
|
||||
|
||||
#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
|
||||
/*foo*/#include "file.h" // no warning
|
||||
|
|
Loading…
Reference in New Issue