zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.51k stars 6.43k forks source link

MISRA C Do not have dead code #9885

Closed ceolin closed 3 years ago

ceolin commented 6 years ago

According with Wikipedia, "In computer programming, dead code is a section in the source code of a program which is executed but whose result is never used in any other computation.". The presence of dead code is specially bad in embedded systems - like Zephyr - because it wasting resources and, possibly, affecting timing constraints.

Dead code is also doomed by several "process" standards like IEC 61508 and ISO 26262.

Static analysis tools like coverity can be used to check it.

part of #9552

ceolin commented 5 years ago

rules 2.1 and 2.2

ioannisg commented 5 years ago

We do have coverity, right? So i suppose we are able to catch dead code, no?