Skip to content

Commit f653123

Browse files
Update README to declare our support for MISRA C++ 2023
1 parent 9f112e7 commit f653123

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ This repository contains CodeQL queries and libraries which support various Codi
66

77
_Carnegie Mellon and CERT are registered trademarks of Carnegie Mellon University._
88

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.
1010

1111
The following coding standards are supported:
1212
- [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).
1313
- [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)
1414
- [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/).
1516
- [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:
1617
- [MISRA C 2012 Amendment 2](https://misra.org.uk/app/uploads/2021/06/MISRA-C-2012-AMD2.pdf)
1718
- [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:
2122

2223
## :construction: Standards under development :construction:
2324

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.
2526

26-
- [MISRA C++ 2023](https://misra.org.uk/product/misra-cpp2023/) - under development - _scheduled for release 2026 Q1/Q2_
27+
This product intends to begin development of the following standards in the near future:
28+
29+
- [MISRA C 2025](https://misra.org.uk/product/misra-cpp2025/)
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.
2732

2833
## How do I use the CodeQL Coding Standards Queries?
2934

docs/user_manual.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| 0.25.0 | 2025-01-15 | Mike Fairhurst | Add guidance for the usage of 'strict' queries. |
3535
| 0.26.0 | 2025-02-12 | Luke Cartey | Describe support for new deviation code identifier formats |
3636
| 0.27.0 | 2025-05-15 | Luke Cartey | Documented completed support for MISRA C 2023. |
37+
| 0.27.0 | 2025-05-15 | Mike Fairhurst | Documented completed support for MISRA C++ 2023. |
3738

3839
## Release information
3940

@@ -70,7 +71,7 @@ The _CodeQL Coding Standards_ product is a set of CodeQL queries for identifying
7071
| | [2012 Amendment 3](https://misra.org.uk/app/uploads/2021/06/MISRA-C-2012-AMD3.pdf) | 24 | 24 | 24 | Implemented |
7172
| | [2012 Amendment 4](https://misra.org.uk/app/uploads/2021/06/MISRA-C-2012-AMD4.pdf) | 22 | 22 | 21[^4] | Implemented |
7273
| | [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 | 175[^6] | - | Implemented |
7475

7576
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.
7677

@@ -89,7 +90,7 @@ The datasheet _"CodeQL Coding Standards: supported rules"_, provided with each r
8990
[^3]: The unimplemented supportable MISRA C 2012 rules are `Rule 9.5`, `Rule 17.13`. `Rule 9.5` 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.
9091
[^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.
9192
[^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-
[^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.
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. Our implementation does not support `Dir 0.3.2`, and 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.
9394

9495
## Supported environment
9596

@@ -116,11 +117,11 @@ In addition, the machine which performs the analysis must be able to complete a
116117

117118
For C++ the codebase under analysis must comply with C++14 and use one of the following supported compiler configurations:
118119

119-
| Compiler | Version | Standard library | Target architecture | Required flags |
120-
| -------- | ------- | ------------------- | --------------------- | -------------------------------- |
121-
| clang | 10.0.0 | libstdc++ (default) | x86_64-linux-gnu | -std=c++14 |
122-
| gcc | 8.4.0 | libstdc++ (default) | x86_64-linux-gnu | -std=c++14 |
123-
| qcc | 8.3.0 | libc++ (default) | gcc_ntoaarch64le_cxx | -std=c++14 -D_QNX_SOURCE -nopipe |
120+
| Compiler | Version | Standard library | Target architecture | Language standard flag | Other required flags |
121+
| -------- | ------- | ------------------- | --------------------- | ---------------------------- | ----------------------- |
122+
| clang | 10.0.0 | libstdc++ (default) | x86_64-linux-gnu | `-std=c++14` or `-std=c++17` | None |
123+
| gcc | 8.4.0 | libstdc++ (default) | x86_64-linux-gnu | `-std=c++14` or `-std=c++17` | None |
124+
| qcc | 8.3.0 | libc++ (default) | gcc_ntoaarch64le_cxx | `-std=c++14` or `-std=c++17` | `-D_QNX_SOURCE -nopipe` |
124125

125126
Use of the queries outside these scenarios is possible, but not validated for functional safety. In particular:
126127

@@ -133,11 +134,11 @@ Use of the queries outside these scenarios is possible, but not validated for fu
133134

134135
For C the codebase under analysis must comply with C99 or C11 and use one of the following supported compiler configurations:
135136

136-
| Compiler | Version | Standard library | Target architecture | Required Flags |
137-
| -------- | ------- | ------------------- | --------------------- | -------------------------- |
138-
| clang | 10.0.0 | glibc (default) | x86_64-linux-gnu | `-std=c11` or `-std=c99` |
139-
| gcc | 8.4.0 | glibc (default) | x86_64-linux-gnu | `-std=c11` or `-std=c99` |
140-
| qcc | 8.3.0 | glibc (default) | gcc_ntoaarch64le | `-std=c11 -nopipe` or `-std=c99 -nopipe` |
137+
| Compiler | Version | Standard library | Target architecture | Language standard flag | Other required flags |
138+
| -------- | ------- | ------------------- | --------------------- | ------------------------ | -------------------- |
139+
| clang | 10.0.0 | glibc (default) | x86_64-linux-gnu | `-std=c11` or `-std=c99` | None |
140+
| gcc | 8.4.0 | glibc (default) | x86_64-linux-gnu | `-std=c11` or `-std=c99` | None |
141+
| qcc | 8.3.0 | glibc (default) | gcc_ntoaarch64le | `-std=c11` or `-std=c99` | `-nopipe` |
141142

142143
Use of the queries outside these scenarios is possible, but not validated for functional safety. In particular:
143144

rules.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ cpp,MISRA-C++-2023,RULE-0-2-2,Yes,Required,Decidable,Single Translation Unit,A n
832832
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,
833833
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,
834834
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
836836
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,
837837
cpp,MISRA-C++-2023,RULE-4-1-2,Yes,Advisory,Decidable,Single Translation Unit,Deprecated features should not be used,,Toolchain3,Very Hard,
838838
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

Comments
 (0)