misra: Fix false positives for rule 8.2 (#3311)

Reported in the forum: https://sourceforge.net/p/cppcheck/discussion/development/thread/801dc07e59/?page=1&limit=25#a1a8
This commit is contained in:
Georgiy Komarov 2021-06-27 23:57:50 +03:00 committed by GitHub
parent 6432922c76
commit 62dbe2eb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -1530,8 +1530,7 @@ class MisraChecker:
self.reportError(typeStartToken, 8, 2)
# Type declaration on next line (old style declaration list) is not allowed
if ((typeStartToken.linenr > endCall.linenr) or
(typeStartToken.column > endCall.column)):
if typeStartToken.linenr > endCall.linenr:
self.reportError(typeStartToken, 8, 2)
# Check arguments in function declaration

View File

@ -327,10 +327,17 @@ void misra_8_2_m(uint8_t * const x)
int16_t ( *misra_8_2_p_a ) (); // 8.2
int16_t ( *misra_8_2_p_b ) (void);
int16_t ( *misra_8_2_p_c ) (int);
int misra_8_2_no_fp (int a)
{
return a + 42;
}
int misra_8_2_n(int a)
{ return a + 42; }
int misra_8_2_o(
const uint32_t a1,
const uint8_t *const a2
)
{ return *a2 + a1; }
int misra_8_2_p(
const uint32_t a1,
const uint8_t *const a2
);
extern int a811[]; // 8.11