Skip to content

Commit 80b891f

Browse files
committed
WIP
1 parent 9f6b224 commit 80b891f

30 files changed

Lines changed: 363 additions & 23 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No expected results have yet been specified
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.gotostatementcondition.GotoStatementCondition

c/common/test/rules/gotostatementcondition/test.c

Whitespace-only changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @id c/misra/goto-label-location-condition
3+
* @name RULE-15-2: The goto statement shall jump to a label declared later in the same function
4+
* @description Unconstrained use of goto can lead to unstructured code
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/misra/id/rule-15-2
9+
* external/misra/obligation/required
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.misra
14+
import codingstandards.cpp.rules.gotostatementcondition.GotoStatementCondition
15+
16+
class GotoLabelLocationConditionQuery extends GotoStatementConditionSharedQuery {
17+
GotoLabelLocationConditionQuery() {
18+
this = Statements2Package::gotoLabelLocationConditionQuery()
19+
}
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @id c/misra/goto-label-block-condition
3+
* @name RULE-15-3: Any label referenced by a goto statement shall be declared in the same block, or in any block
4+
* @description Any label referenced by a goto statement shall be declared in the same block, or in
5+
* any block enclosing the goto statement
6+
* @kind problem
7+
* @precision very-high
8+
* @problem.severity error
9+
* @tags external/misra/id/rule-15-3
10+
* external/misra/obligation/required
11+
*/
12+
13+
import cpp
14+
import codingstandards.c.misra
15+
16+
from
17+
where
18+
not isExcluded(x, Statements2Package::gotoLabelBlockConditionQuery()) and
19+
select
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/misra/loop-iteration-condition
3+
* @name RULE-15-4: There should be no more than one break or goto statement used to terminate any iteration statement
4+
* @description
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/misra/id/rule-15-4
9+
* external/misra/obligation/advisory
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.misra
14+
15+
from
16+
where
17+
not isExcluded(x, Statements2Package::loopIterationConditionQuery()) and
18+
select
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/misra/switch-clause-number-condition
3+
* @name RULE-16-6: Every switch statement shall have at least two switch-clauses
4+
* @description
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/misra/id/rule-16-6
9+
* external/misra/obligation/required
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.misra
14+
15+
from
16+
where
17+
not isExcluded(x, Statements2Package::switchClauseNumberConditionQuery()) and
18+
select
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/misra/switch-expression-bool-condition
3+
* @name RULE-16-7: A switch-expression shall not have essentially Boolean type
4+
* @description
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/misra/id/rule-16-7
9+
* external/misra/obligation/required
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.misra
14+
15+
from
16+
where
17+
not isExcluded(x, Statements2Package::switchExpressionBoolConditionQuery()) and
18+
select
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No expected results have yet been specified
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules/RULE-15-2/GotoLabelLocationCondition.ql

0 commit comments

Comments
 (0)