File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ import codingstandards.cpp.alertreporting.HoldsForAllCopies
2222
2323class NonConstPointerVariableCandidate extends Variable {
2424 NonConstPointerVariableCandidate ( ) {
25+ // Ignore parameters in functions without bodies
26+ ( this instanceof Parameter implies exists ( this .( Parameter ) .getFunction ( ) .getBlock ( ) ) ) and
2527 // Ignore variables in functions that use ASM commands
2628 not exists ( AsmStmt a | a .getEnclosingFunction ( ) = this .( LocalScopeVariable ) .getFunction ( ) ) and
2729 // Avoid elements in macro expansions, as they cannot be equated across copies
Original file line number Diff line number Diff line change @@ -96,4 +96,7 @@ void test_struct(struct S *s) { // COMPLIANT
9696
9797void test_struct_2 (struct S * s ) { // NON_COMPLIANT - could be const
9898 s = 0 ;
99- }
99+ }
100+
101+ void test_no_body (int * p ); // COMPLIANT - no body, so cannot evaluate whether it
102+ // should be const
You can’t perform that action at this time.
0 commit comments