misra: Fixed a crash in rule 8.2 (#3208)

Due to incorrect indentation, we return "None" instead of an empty list,
which causes the crash.

The problem was reported on the forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/e146b8d779/
This commit is contained in:
Georgiy Komarov 2021-04-13 11:09:42 +03:00 committed by GitHub
parent 5a7e361442
commit fce3db8b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -1477,7 +1477,7 @@ class MisraChecker:
break
following.append(rawToken)
return following
return following
# Check arguments in function declaration
for func in data.functions:

View File

@ -8,6 +8,8 @@
#include <file,.h> // 20.2
#include "file,.h" // 20.2
#include "misra-test.h"
#include /*abc*/ "file.h" // no warning
/*foo*/#include "file.h" // no warning
#include "./file.h" // no warning

View File

@ -1,4 +1,5 @@
#ifndef MISRA_TEST_H
#define MISRA_TEST_H
struct misra_h_s { int foo; };
bool test(char *a);
#endif // MISRA_TEST_H