Skip to content

Commit 6a79bae

Browse files
Update test expectations in stdlib flow edges/nodes
1 parent f1fc28e commit 6a79bae

File tree

2 files changed

+68
-25
lines changed

2 files changed

+68
-25
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @id cpp/misra/no-valid-ifdef-guard-in-header
3+
* @name RULE-19-2-1: Precautions shall be taken in order to prevent the contents of a header file being included more
4+
* @description Precautions shall be taken in order to prevent the contents of a header file being
5+
* included more than once.
6+
* @kind problem
7+
* @precision very-high
8+
* @problem.severity error
9+
* @tags external/misra/id/rule-19-2-1
10+
* scope/single-translation-unit
11+
* maintainability
12+
* correctness
13+
* external/misra/enforcement/decidable
14+
* external/misra/obligation/required
15+
*/
16+
17+
import cpp
18+
import codingstandards.cpp.misra
19+
import semmle.code.cpp.headers.MultipleInclusion
20+
21+
predicate isOutside(CorrectIncludeGuard includeGuard, Location location) {
22+
location.getFile() = includeGuard.getFile() and
23+
(
24+
location.isBefore(includeGuard.getIfndef().getLocation())
25+
or
26+
includeGuard.getEndif().getLocation().isBefore(location)
27+
)
28+
}
29+
30+
from HeaderFile included
31+
where
32+
not isExcluded(included, PreprocessorPackage::noValidIfdefGuardInHeaderQuery()) and
33+
not exists(CorrectIncludeGuard includeGuard |
34+
includeGuard.getFile() = included and
35+
// Stricter: define is before all other contents
36+
//not included
37+
// .getATopLevelDeclaration()
38+
// .getLocation()
39+
// .isBefore(includeGuard.getDefine().getLocation()) and
40+
// Stricter: do not allow includes outside of the inclusion guard
41+
not exists(Include include | isOutside(includeGuard, include.getLocation()))
42+
)
43+
select included, "File does not have a well formatted include guard."

cpp/misra/test/rules/RULE-8-1-1/NonTransientLambdaImplicitlyCapturesThis.expected

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ edges
77
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:17:93:41 | new | | |
88
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:17:93:41 | new | | |
99
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:17:93:41 | new | | |
10-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | | |
11-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | | |
12-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | | |
13-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | | |
14-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | | |
15-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | | |
16-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | | |
17-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | | |
18-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | | |
19-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
20-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
21-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
22-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
23-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | test.cpp:164:14:164:31 | call to forward | | |
10+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | | |
11+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | | |
12+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | | |
13+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | | |
14+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | | |
15+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | | |
16+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | | |
17+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | | |
18+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | | |
19+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
20+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
21+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
22+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:23:93:37 | call to forward | | |
23+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | test.cpp:164:14:164:31 | call to forward | | |
2424
| test.cpp:8:59:8:59 | f | test.cpp:10:12:10:12 | f | | |
2525
| test.cpp:8:59:8:59 | f | test.cpp:10:12:10:12 | f | | |
2626
| test.cpp:8:59:8:59 | f | test.cpp:10:12:10:12 | f | | |
@@ -47,7 +47,7 @@ edges
4747
| test.cpp:154:39:154:58 | [...](...){...} | test.cpp:145:31:145:63 | function_outside_translation_unit | | |
4848
| test.cpp:163:47:163:47 | f | test.cpp:164:33:164:33 | f | | |
4949
| test.cpp:164:14:164:31 | call to forward | test.cpp:164:5:164:35 | new | | |
50-
| test.cpp:164:33:164:33 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | | |
50+
| test.cpp:164:33:164:33 | f | file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | | |
5151
| test.cpp:176:15:176:34 | [...](...){...} | test.cpp:163:47:163:47 | f | | |
5252
nodes
5353
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:92:35:92:35 | f | semmle.label | f |
@@ -66,16 +66,16 @@ nodes
6666
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | semmle.label | f |
6767
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | semmle.label | f |
6868
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/functional.h:93:39:93:39 | f | semmle.label | f |
69-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | semmle.label | t |
70-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | semmle.label | t |
71-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | semmle.label | t |
72-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | semmle.label | t |
73-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:4:65:4:65 | t | semmle.label | t |
74-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | semmle.label | t |
75-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | semmle.label | t |
76-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | semmle.label | t |
77-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | semmle.label | t |
78-
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:5:29:5:29 | t | semmle.label | t |
69+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | semmle.label | t |
70+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | semmle.label | t |
71+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | semmle.label | t |
72+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | semmle.label | t |
73+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:6:65:6:65 | t | semmle.label | t |
74+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | semmle.label | t |
75+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | semmle.label | t |
76+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | semmle.label | t |
77+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | semmle.label | t |
78+
| file:///home/runner/work/codeql-coding-standards/codeql-coding-standards/cpp/common/test/includes/standard-library/utility.h:7:29:7:29 | t | semmle.label | t |
7979
| test.cpp:8:59:8:59 | f | semmle.label | f |
8080
| test.cpp:8:59:8:59 | f | semmle.label | f |
8181
| test.cpp:8:59:8:59 | f | semmle.label | f |

0 commit comments

Comments
 (0)