-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathExpressionShouldNotRelyOnOrderOfEvaluation.ql
More file actions
35 lines (31 loc) · 1.33 KB
/
ExpressionShouldNotRelyOnOrderOfEvaluation.ql
File metadata and controls
35 lines (31 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @id cpp/autosar/expression-should-not-rely-on-order-of-evaluation
* @name A5-0-1: The value of an expression does not rely on the order of evaluation
* @description The value of an expression shall be the same under any order of evaluation that the
* standard permits.
* @kind problem
* @precision high
* @problem.severity error
* @tags external/autosar/id/a5-0-1
* correctness
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
*/
import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.rules.expressionwithunsequencedsideeffects.ExpressionWithUnsequencedSideEffects
import codingstandards.cpp.Ordering
import codingstandards.cpp.orderofevaluation.VariableAccessOrdering
import Ordering::Make<Cpp14VariableAccessInFullExpressionOrdering> as FullExprOrdering
module ExpressionShouldNotRelyOnOrderOfEvaluationConfig implements
ExpressionWithUnsequencedSideEffectsConfigSig
{
Query getQuery() {
result = OrderOfEvaluationPackage::expressionShouldNotRelyOnOrderOfEvaluationQuery()
}
predicate isUnsequenced(VariableAccess va1, VariableAccess va2) {
FullExprOrdering::isUnsequenced(va1, va2)
}
}
import ExpressionWithUnsequencedSideEffects<ExpressionShouldNotRelyOnOrderOfEvaluationConfig>