xref: /CoreMQTT-Agent-v1.2.0/MISRA.md (revision ebbebbd49acd508adcde1fe38be2a71f2e7fb9dc)
1# MISRA Compliance
2
3The coreMQTT Agent library files conform to the [MISRA C:2012](https://www.misra.org.uk)
4guidelines, with some noted exceptions. Compliance is checked with Coverity static analysis.
5Deviations from the MISRA standard are listed below:
6
7### Ignored by [Coverity Configuration](tools/coverity/misra.config)
8| Deviation | Category | Justification |
9| :-: | :-: | :-: |
10| Directive 4.5 | Advisory | Allow names that MISRA considers ambiguous (such as LogInfo and LogError) |
11| Directive 4.8 | Advisory | Allow inclusion of unused types. Header files from coreMQTT may define types that are not used by the agent. |
12| Directive 4.9 | Advisory | Allow inclusion of function like macros. The `assert` macro is used throughout the library for parameter validation, and logging is done using function like macros. |
13| Rule 2.3 | Advisory | Allow unused types. Both the agent and coreMQTT headers define types that are not directly used by the library but are still intended to be used by the application. |
14| Rule 2.4 | Advisory | Allow unused tags. Some compilers warn if types are not tagged. |
15| Rule 2.5 | Advisory | Allow unused macros. Library headers may define macros intended for the application's use, but are not used by a specific file. |
16| Rule 3.1 | Required | Allow nested comments. C++ style `//` comments are used in example code within Doxygen documentation blocks. |
17| Rule 11.5 | Advisory | Allow casts from `void *`. Fields such as command parameters are passed as `void *` for generalization and must be cast to the correct data type before use. |
18
19### Flagged by Coverity
20| Deviation | Category | Justification |
21| :-: | :-: | :-: |
22| Rule 8.7 | Advisory | API functions are not used by the library outside of the files they are defined; however, they must be externally visible in order to be used by an application. |
23| Rule 8.13 | Advisory | Functions that are passed as pointers to coreMQTT or the agent must exactly match function signatures with the pointer type definition, so `const` modifiers cannot be added even if a specific function implementation does not modify a given parameter. |
24
25### Suppressed with Coverity Comments
26*None.*
27