Rule 2.5 unsued macro definition - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.2 Unused code (https://forum.misra.org.uk/forumdisplay.php?fid=157) +---- Thread: Rule 2.5 unsued macro definition (/showthread.php?tid=1363) |
Rule 2.5 unsued macro definition - sowiso - 08-09-2017 Hi, I have the following code: Code: cfg.h: The code is part of a library which is used in various projects which shall be MISRA2012 compliant. Based on each project a different version of cfg.h is used which configures the project specific needs. In projects where activate_feature is not defined I always got a claim from my code checking tool that the macro protected_feature is not used. Is this really a violation of Rule 2.5 or is the code checker wrong? If it is a violation how to handle code where parts a selected by conditional compiling? Re: Rule 2.5 unsued macro definition - misra-c - 21-09-2017 The rationale for rule 2.5 is that it is unclear to a reviewer whether an unused macro is intentionally redundant or whether it was left unused by mistake. The example is not compliant with rule 2.5. |