Skip to content

Commit b32d9da

Browse files
SkptakSoren Ptak
andauthored
Misra Compliance updates (#38)
Modified MISRA.md/misra.config to reflect new style guidelines. Added the DNDEBUG flag when performing the coverity_analysis build to remove assert Co-authored-by: Soren Ptak <[email protected]>
1 parent f4edb1d commit b32d9da

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

MISRA.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
The backoffAlgorithm library files conform to the [MISRA C:2012](https://www.misra.org.uk)
44
guidelines, with some noted exceptions. Compliance is checked with Coverity static analysis.
5-
Deviations from the MISRA standard are listed below:
5+
The specific deviations, suppressed inline, are listed below.
66

7-
### Ignored by [Coverity Configuration](tools/coverity/misra.config)
8-
| Deviation | Category | Justification |
9-
| :-: | :-: | :-: |
10-
| Directive 4.9 | Advisory | Allow inclusion of function like macros. |
11-
| Rule 3.1 | Required | Allow nested comments. C++ style `//` comments are used in example code within Doxygen documentation blocks. |
12-
| Rule 2.4 | Advisory | Allow unused tags. Some compilers warn if types are not tagged. |
7+
Additionally, [MISRA configuration file](https://github.com/FreeRTOS/backoffAlgorithm/blob/main/tools/coverity/misra.config) contains the project wide deviations.
138

14-
### Flagged by Coverity
15-
| Deviation | Category | Justification |
16-
| :-: | :-: | :-: |
17-
| Rule 8.7 | Advisory | API functions are not used by the library; however, they must be externally visible in order to be used by an application. |
189

10+
### Suppressed with Coverity Comments
11+
To find the violation references in the source files run grep on the source code
12+
with ( Assuming rule 11.4 violation; with justification in point 2 ):
13+
```
14+
grep 'MISRA Ref 11.4.2' . -rI
15+
```
16+
*None.*

lexicon.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ getaddrinfo
2222
github
2323
html
2424
https
25+
ifdef
2526
ifndef
2627
inc
2728
ingroup
@@ -60,4 +61,3 @@ toolchain
6061
tr
6162
trng
6263
usleep
63-
utils

test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ target_include_directories( coverity_analysis
4545
PUBLIC
4646
${BACKOFF_ALGORITHM_INCLUDE_PUBLIC_DIRS} )
4747

48+
# Disable logging/assert() calls when building the Coverity analysis target
49+
target_compile_options(coverity_analysis PUBLIC -DNDEBUG )
50+
4851
# ==================================== Unit Test Configuration ====================================
4952

5053
if(${BUILD_CODE_EXAMPLE})

tools/coverity/misra.config

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
{
1818
deviation: "Rule 3.1",
1919
reason: "Allow nested comments. Documentation blocks contain comments for example code."
20-
}
20+
},
21+
{
22+
deviation: "Rule 8.7",
23+
reason: "API functions are not used by library. They must be externally visible in order to be used by the application."
24+
},
2125
]
2226
}

0 commit comments

Comments
 (0)