[C-safe-secure-studygroup] On MISRA C:2012 Rule 2.5
Roberto Bagnara
bagnara at cs.unipr.it
Mon Feb 20 10:42:56 UTC 2017
This advisory rule recommends against unused macro definitions
on the grounds that they impair readability and maintainability
(like any other sort of unused/unnecessary stuff that may clutter
the project sources.
The rule is usually not applied to system header files and library
header files, which tend to contain lots of unused macro definitions
that are perfectly justified.
Whether to include a similar rule in the standard we are working
on in this group depends on its objectives (which, to me, at least,
are less and less clear). So I prefer to give my answer to questions
that may be relevant.
Q1: Can violations of the rule directly threat safety and security?
A1: No: unused macros have no effects on the generated code.
Q2: Can violations of the rule indirectly threat safety and security?
A2: Yes: they have the potential of diminishing the effectiveness
of peer review.
Q3: Should an analyzer be able to detect unused macros?
A3: Yes, as part of its general ability to precisely track the
preprocessing translation phase.
--
Prof. Roberto Bagnara
Applied Formal Methods Laboratory - University of Parma, Italy
mailto:bagnara at cs.unipr.it
BUGSENG srl - http://bugseng.com
mailto:roberto.bagnara at bugseng.com
More information about the C-safe-secure-studygroup
mailing list