Skip to content

Commit 2036ff2

Browse files
committed
M6-5-2 M17-0-5
1 parent 1dbba67 commit 2036ff2

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

cpp/autosar/src/rules/M17-0-5/SetjmpMacroAndTheLongjmpFunctionUsed.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
import cpp
1717
import codingstandards.cpp.autosar
1818

19-
predicate isLongJumpCall(FunctionCall fc) { fc.getTarget().hasGlobalOrStdName("longjmp") }
19+
predicate isLongJumpCall(Locatable fc) {
20+
fc.(FunctionCall).getTarget().hasGlobalOrStdName("longjmp") or
21+
fc.(MacroInvocation).getMacroName() = "longjmp"
22+
}
2023

2124
predicate isSetJumpCall(MacroInvocation mi) { mi.getMacroName() = "setjmp" }
2225

cpp/autosar/src/rules/M6-5-2/tempfile

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| test.cpp:7:9:7:19 | setjmp(__env) | Use of banned setjmp macro. |
2+
| test.cpp:12:3:12:9 | longjmp(__env,__val) | Use of banned longjmp function. |
3+
| test.cpp:14:3:14:9 | longjmp(__env,__val) | Use of banned longjmp function. |
4+
| test.cpp:16:9:16:19 | setjmp(__env) | Use of banned setjmp macro. |

cpp/common/src/codingstandards/cpp/Loops.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ predicate isInvalidForLoopIncrementation(ForStmt forLoop, Variable v, VariableAc
173173
exists(EqualityOperation eop | eop.getAnOperand() = va)
174174
or
175175
exists(Call call |
176-
call.getTarget() instanceof UserEqualityOperator and call.getQualifier() = va
176+
call.getTarget() instanceof UserEqualityOperator and
177+
[call.getQualifier(), call.getArgument(0)] = va
177178
)
178179
)
179180
}

0 commit comments

Comments
 (0)