You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,13 @@ This repository contains CodeQL queries and libraries which support various Codi
6
6
7
7
_Carnegie Mellon and CERT are registered trademarks of Carnegie Mellon University._
8
8
9
-
This repository contains CodeQL queries and libraries which support various Coding Standards for the [C++14](https://www.iso.org/standard/64029.html), [C99](https://www.iso.org/standard/29237.html) and [C11](https://www.iso.org/standard/57853.html) programming languages.
9
+
This repository contains CodeQL queries and libraries which support various Coding Standards for the [C++14](https://www.iso.org/standard/64029.html), [C++17](https://www.iso.org/standard/68564.html), [C99](https://www.iso.org/standard/29237.html) and [C11](https://www.iso.org/standard/57853.html) programming languages.
10
10
11
11
The following coding standards are supported:
12
12
-[AUTOSAR - Guidelines for the use of C++14 language in critical and safety-related systems (Releases R22-11, R20-11, R19-11 and R19-03)](https://www.autosar.org/fileadmin/standards/R22-11/AP/AUTOSAR_RS_CPP14Guidelines.pdf).
13
13
-[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)
14
14
-[SEI CERT C Coding Standard: Rules for Developing Safe, Reliable, and Secure Systems (2016 Edition)](https://resources.sei.cmu.edu/downloads/secure-coding/assets/sei-cert-c-coding-standard-2016-v01.pdf)
15
+
-[MISRA C++ 2023: Guidelines for the use of C++ in critical systems](https://misra.org.uk/product/misra-cpp2023/).
15
16
-[MISRA C 2012, 3rd Edition, 1st revision](https://www.misra.org.uk/product/misra-c2012-third-edition-first-revision/) (incoporating Amendment 1 & Technical Corrigendum 1). In addition, we support the following additional amendments and technical corrigendums:
16
17
-[MISRA C 2012 Amendment 2](https://misra.org.uk/app/uploads/2021/06/MISRA-C-2012-AMD2.pdf)
17
18
-[MISRA C 2012 Technical Corrigendum 2](https://misra.org.uk/app/uploads/2022/04/MISRA-C-2012-TC2.pdf)
@@ -21,9 +22,13 @@ The following coding standards are supported:
21
22
22
23
## :construction: Standards under development :construction:
23
24
24
-
The following standards are under active development for [C++17](https://www.iso.org/standard/68564.html):
25
+
There are currently no new coding standards under active development.
25
26
26
-
-[MISRA C++ 2023](https://misra.org.uk/product/misra-cpp2023/) - under development - _scheduled for release 2026 Q1/Q2_
27
+
This project intends to begin development of the following standards in the near future:
28
+
29
+
-[MISRA C 2025](https://misra.org.uk/product/misra-c2025/)
30
+
31
+
If you are interested in this standard or when it will be available, consider contacting us via email or by filing an issue.
27
32
28
33
## How do I use the CodeQL Coding Standards Queries?
||[2023 Third Edition, Second Revision](https://misra.org.uk/product/misra-c2023/)| 221 | 210 | 207[^5]| Implemented |
73
-
| MISRA C++ |[2023](https://misra.org.uk/product/misra-cpp2023/)| 179 | 176[^6]|-| Under development|
74
+
| MISRA C++ |[2023](https://misra.org.uk/product/misra-cpp2023/)| 179 | 176[^6]|175[^7]| Implemented|
74
75
75
76
Not all rules in these standards are amenable to static analysis by CodeQL - some rules require external or domain specific knowledge to validate, or refer to properties which are not present in our representation of the codebase under analysis. In addition, some rules are natively enforced by the supported compilers. As CodeQL requires that the program under analysis compiles, we are unable to implement queries for these rules, and doing so would be redundant.
76
77
@@ -90,6 +91,7 @@ The datasheet _"CodeQL Coding Standards: supported rules"_, provided with each r
90
91
[^4]: The unimplemented supportable MISRA C 2012 Amendment 4 rule is `Rule 9.6`. `Rule 9.6` requires additional support in the CodeQL CLI to ensure the required information is available in the CodeQL database to identify violations of this rule.
91
92
[^5]: The unimplemented supportable MISRA C 2023 rules are `Rule 9.5`, `Rule 9.6`, `Rule 17.13`. `Rule 9.5`, `Rule 9.6` and `Rule 17.13` require additional support in the CodeQL CLI to ensure the required information is available in the CodeQL database to identify violations of these rules. Note: `Dir 4.14` is covered by the default CodeQL queries, which identify potential security vulnerabilities caused by not validating external input.
92
93
[^6]: The rules `5.13.7`, `19.0.1` and `19.1.2` are not planned to be implemented by CodeQL as they are compiler checked in all supported compilers.
94
+
[^7]: The rule `Dir 0.3.2` is not supported by our implementation. For customers who wish to validate function preconditions we recommend they consider using [this open source CodeQL project](https://github.com/advanced-security/codeql-contracts-smt-z3) that can find and validate preconditions with SMT constraint solving.
93
95
94
96
## Supported environment
95
97
@@ -114,30 +116,30 @@ In addition, the machine which performs the analysis must be able to complete a
114
116
115
117
#### C++
116
118
117
-
For C++ the codebase under analysis must comply with C++14 and use one of the following supported compiler configurations:
119
+
For C++ the codebase under analysis must comply with C++14 or C++17 and use one of the following supported compiler configurations:
118
120
119
-
| Compiler | Version | Standard library | Target architecture |Required flags |
Use of the queries outside these scenarios is possible, but not validated for functional safety. In particular:
126
128
127
129
- Use of the queries against codebases written with more recent versions of C++ (as supported by CodeQL) are not validated in the following circumstances:
128
130
- When new language features are used
129
-
- When language features are used which have a differing interpretation from C++14.
131
+
- When language features are used which have a differing interpretation from C++14 or C++17.
130
132
- Use of the queries against codebases which use other compilers or other compiler versions supported by CodeQL is not tested or validated for functional safety.
131
133
132
134
#### C
133
135
134
136
For C the codebase under analysis must comply with C99 or C11 and use one of the following supported compiler configurations:
135
137
136
-
| Compiler | Version | Standard library | Target architecture |Required Flags |
Use of the queries outside these scenarios is possible, but not validated for functional safety. In particular:
143
145
@@ -466,7 +468,7 @@ Note - considation should be taken to ensure the use of custom attributes for de
466
468
* Confirm that unknown attributes are ignored by the compiler.
467
469
* For MISRA C, add a project deviation against "Rule 1.2: Language extensions should not be used", if attribute support is a language extension in your language version.
468
470
469
-
**Use of attributes in C++ Coding Standards**: The C++ Standard supports attributes in C++14, however the handling of unknown attributes is implementation defined. From C++17 onwards, unknown attributes are mandated to be ignored. Unknown attributes will usually raise an "unknown attribute" warning. You should:
471
+
**Use of attributes in C++ Coding Standards**: The C++ Standard supports attributes in C++14 and C++17, however the handling of unknown attributes is implementation defined. From C++17 onwards, unknown attributes are mandated to be ignored. Unknown attributes will usually raise an "unknown attribute" warning. You should:
470
472
* If using C++14, confirm that your compiler ignores unknown attributes.
471
473
* If using AUTOSAR and a compiler which produces warnings on unknown attributes, the compiler warning should be disabled (as per `A1-1-2: A warning level of the compilation process shall be set in compliance with project policies`), to ensure compliance with `A1-4-3: All code should compiler free of compiler warnings`.
Copy file name to clipboardExpand all lines: rules.csv
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -832,7 +832,7 @@ cpp,MISRA-C++-2023,RULE-0-2-2,Yes,Required,Decidable,Single Translation Unit,A n
832
832
cpp,MISRA-C++-2023,RULE-0-2-3,Yes,Advisory,Decidable,Single Translation Unit,Types with limited visibility should be used at least once,A0-1-6,DeadCode9,Easy,
833
833
cpp,MISRA-C++-2023,RULE-0-2-4,Yes,Advisory,Decidable,System,Functions with limited visibility should be used at least once,A0-1-3,DeadCode10,Easy,
834
834
cpp,MISRA-C++-2023,DIR-0-3-1,Yes,Advisory,,,Floating-point arithmetic should be used appropriately,,FloatingPoint,Hard,
835
-
cpp,MISRA-C++-2023,DIR-0-3-2,Yes,Required,,,A function call shall not violate the function’s preconditions,,Preconditions,Hard,
835
+
cpp,MISRA-C++-2023,DIR-0-3-2,No,Required,,,A function call shall not violate the function’s preconditions,,,,Consider other projects such as github.com/advanced-security/codeql-contracts-smt-z3
836
836
cpp,MISRA-C++-2023,RULE-4-1-1,Yes,Required,Undecidable,System,A program shall conform to ISO/IEC 14882:2017 (C++17),,Toolchain2,Hard,
837
837
cpp,MISRA-C++-2023,RULE-4-1-2,Yes,Advisory,Decidable,Single Translation Unit,Deprecated features should not be used,,Toolchain3,Very Hard,
838
838
cpp,MISRA-C++-2023,RULE-4-1-3,Yes,Required,Undecidable,System,There shall be no occurrence of undefined or critical unspecified behaviour,,Undefined,Very Hard,
0 commit comments