diff --git a/addons/misra.py b/addons/misra.py index 281d8dec9..600d56c06 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1512,7 +1512,9 @@ 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.file == endCall.file) and + ((typeStartToken.linenr > endCall.linenr) or + (typeStartToken.column > endCall.column))): self.reportError(typeStartToken, 8, 2) # Check arguments in pointer declarations diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 7881c488d..5b552e6ec 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -322,6 +322,10 @@ static int misra_8_2_l ( // 8.2 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; +} extern int a811[]; // 8.11 diff --git a/addons/test/misra/misra-test.h b/addons/test/misra/misra-test.h index ed932fcaf..74e49e58b 100644 --- a/addons/test/misra/misra-test.h +++ b/addons/test/misra/misra-test.h @@ -3,4 +3,5 @@ struct misra_h_s { int foo; }; bool test(char *); // 8.2 bool test(char *a); // OK +int misra_8_2_no_fp(int a); #endif // MISRA_TEST_H