File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
cpp/common/src/codingstandards/cpp
c/misra/test/rules/RULE-8-13 Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -105,4 +105,8 @@ void test_struct_2(struct S *s) { // NON_COMPLIANT - could be const
105
105
}
106
106
107
107
void test_no_body (int * p ); // COMPLIANT - no body, so cannot evaluate whether it
108
- // should be const
108
+ // should be const
109
+
110
+ void increment (int * p ) { // COMPLIANT
111
+ * p ++ = 1 ;
112
+ }
Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ Expr getAnEffect(Expr base) {
190
190
or
191
191
exists ( PointerDereferenceExpr e | e .getOperand ( ) = base | result = getAnEffect ( e ) )
192
192
or
193
+ exists ( CrementOperation c | c .getOperand ( ) = base | result = getAnEffect ( c ) )
194
+ or
193
195
// local alias analysis, assume alias when data flows to derived type (pointer/reference)
194
196
// auto ptr = &base;
195
197
exists ( VariableAccess va , AddressOfExpr addressOf |
You can’t perform that action at this time.
0 commit comments