File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,13 @@ import codingstandards.c.misra
1818from Function func , string message
1919where
2020 not isExcluded ( func , Statements5Package:: functionReturnConditionQuery ( ) ) and
21- count ( ReturnStmt return | return .getEnclosingFunction ( ) = func ) > 1 and
22- message = "Function has more than on return statement."
23- or
24- not func .getBlock ( ) .getLastStmt ( ) instanceof ReturnStmt and
25- message = "The last statement of the function is not a return statement."
21+ func .hasDefinition ( ) and
22+ not func .isCompilerGenerated ( ) and
23+ (
24+ count ( ReturnStmt return | return .getEnclosingFunction ( ) = func ) > 1 and
25+ message = "Function has more than on return statement."
26+ or
27+ not func .getBlock ( ) .getLastStmt ( ) instanceof ReturnStmt and
28+ message = "The last statement of the function is not a return statement."
29+ )
2630select func , message
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ void f4(int p1) { // NON_COMPLIANT
2424 }
2525 return ;
2626 p1 ++ ;
27- }
27+ }
28+
29+ void f5 (); // Ignored - no body
You can’t perform that action at this time.
0 commit comments