misra: When checking C++ code only activate certain misra c++ compliant rules. It will be supported to run the addon on C++ code.
This commit is contained in:
parent
52453947c8
commit
ec13f5fe5c
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# MISRA C 2012 checkers
|
||||
# Partially reused for "MISRA C++ 2008" checking
|
||||
#
|
||||
# Example usage of this addon (scan a sourcefile main.cpp)
|
||||
# cppcheck --dump main.cpp
|
||||
|
@ -4208,7 +4209,8 @@ class MisraChecker:
|
|||
:param args: Check function arguments
|
||||
"""
|
||||
if not self.isRuleGloballySuppressed(rule_num):
|
||||
check_function(*args)
|
||||
if (not self.is_cpp) or rule_num in (202,203,1901):
|
||||
check_function(*args)
|
||||
|
||||
def parseDump(self, dumpfile):
|
||||
def fillVerifyExpected(verify_expected, tok):
|
||||
|
@ -4249,6 +4251,8 @@ class MisraChecker:
|
|||
else:
|
||||
self.printStatus('Checking ' + dumpfile + '...')
|
||||
|
||||
self.is_cpp = data.files and data.files[0].endswith('.cpp')
|
||||
|
||||
for cfgNumber, cfg in enumerate(data.iterconfigurations()):
|
||||
if not self.settings.quiet:
|
||||
self.printStatus('Checking %s, config %s...' % (dumpfile, cfg.name))
|
||||
|
|
|
@ -7,7 +7,7 @@ class C {
|
|||
|
||||
class misra_21_1_C {
|
||||
public:
|
||||
misra_21_1_C operator=(const misra_21_1_C &); // 8.2
|
||||
misra_21_1_C operator=(const misra_21_1_C &);
|
||||
};
|
||||
|
||||
class C2 {
|
||||
|
@ -20,6 +20,6 @@ C2::C2(void) : f(NULL) {}
|
|||
|
||||
static void test_misra_21_1_crash(void)
|
||||
{
|
||||
auto misra_21_1_C a, b; // 12.3
|
||||
auto misra_21_1_C a, b;
|
||||
a = b;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue