Skip to content

Commit beff5c1

Browse files
authored
Merge branch 'main' into lcartey/essential-types
2 parents c6ce829 + 632033b commit beff5c1

File tree

281 files changed

+7909
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+7909
-697
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: ⚙️ Extra Rule Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "rc/**"
8+
- next
9+
pull_request:
10+
branches:
11+
- main
12+
- "rc/**"
13+
- next
14+
15+
16+
jobs:
17+
validate-rules-csv:
18+
name: Validate Rules CSV
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Check Rules
25+
shell: pwsh
26+
run: scripts/util/Get-DuplicateRules.ps1 -Language 'all' -CIMode
27+
28+
29+
validate-shared-rules-test-structure:
30+
name: Validate Rules Test Structure
31+
runs-on: ubuntu-22.04
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v2
35+
36+
- name: Ensure CPP Shared Rules Have Valid Structure
37+
shell: pwsh
38+
run: scripts/util/Test-SharedImplementationsHaveTestCases.ps1 -Language cpp -CIMode
39+
40+
- name: Ensure C Shared Rules Have Valid Structure
41+
shell: pwsh
42+
run: scripts/util/Test-SharedImplementationsHaveTestCases.ps1 -Language c -CIMode
43+
44+
45+
- uses: actions/upload-artifact@v3
46+
if: failure()
47+
with:
48+
name: missing-test-report.csv
49+
path: MissingTestReport*.csv
50+
51+
- uses: actions/upload-artifact@v3
52+
if: failure()
53+
with:
54+
name: test-report.csv
55+
path: TestReport*.csv
56+
if-no-files-found: error
57+
58+

.github/workflows/validate-rules-csv.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.vscode/tasks.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@
208208
"Declarations2",
209209
"Declarations3",
210210
"Declarations4",
211+
"Declarations5",
212+
"Declarations6",
213+
"Declarations7",
211214
"Exceptions1",
212215
"Exceptions2",
213216
"Expressions",
@@ -220,6 +223,8 @@
220223
"Includes",
221224
"Initialization",
222225
"IntegerConversion",
226+
"InvalidMemory1",
227+
"InvalidMemory2",
223228
"Invariants",
224229
"Iterators",
225230
"Lambdas",
@@ -228,6 +233,8 @@
228233
"Literals",
229234
"Loops",
230235
"Macros",
236+
"Memory1",
237+
"Memory2",
231238
"Misc",
232239
"MoveForward",
233240
"Naming",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _Carnegie Mellon and CERT are registered trademarks of Carnegie Mellon Universit
99
This repository contains CodeQL queries and libraries which support various Coding Standards for the [C++14](https://www.iso.org/standard/64029.html) programming language.
1010

1111
The following coding standards are supported:
12-
- [AUTOSAR - Guidelines for the use of C++14 language in critical and safety-related systems Release 20-11](https://www.autosar.org/fileadmin/user_upload/standards/adaptive/20-11/AUTOSAR_RS_CPP14Guidelines.pdf)
12+
- [AUTOSAR - Guidelines for the use of C++14 language in critical and safety-related systems Release 20-11](https://www.autosar.org/fileadmin/standards/adaptive/20-11/AUTOSAR_RS_CPP14Guidelines.pdf)
1313
- [MISRA C++:2008](https://www.misra.org.uk) (support limited to the rules specified in AUTOSAR 20-11).
1414
- [SEI CERT C++ Coding Standard: Rules for Developing Safe, Reliable, and Secure Systems (2016 Edition)](https://resources.sei.cmu.edu/library/asset-view.cfm?assetID=494932)
1515

c/cert/src/rules/DCL38-C/DeclaringAFlexibleArrayMember.ql

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,12 @@
1515

1616
import cpp
1717
import codingstandards.c.cert
18-
19-
/**
20-
* A member with the type array that is last in a struct
21-
* includes any sized array (either specified or not)
22-
*/
23-
class FlexibleArrayMember extends MemberVariable {
24-
Struct s;
25-
26-
FlexibleArrayMember() {
27-
this.getType() instanceof ArrayType and
28-
this.getDeclaringType() = s and
29-
not exists(int i, int j |
30-
s.getAMember(i) = this and
31-
exists(s.getAMember(j)) and
32-
j > i
33-
)
34-
}
35-
}
18+
import codingstandards.c.Variable
3619

3720
from VariableDeclarationEntry m, ArrayType a
3821
where
3922
not isExcluded(m, Declarations2Package::declaringAFlexibleArrayMemberQuery()) and
4023
m.getType() = a and
41-
m.getVariable() instanceof FlexibleArrayMember and
24+
m.getVariable() instanceof FlexibleArrayMemberCandidate and
4225
a.getArraySize() = 1
4326
select m, "Incorrect syntax used for declaring this flexible array member."

0 commit comments

Comments
 (0)