Download H8S, H8/300 Series C/C++ Compiler Package Application Note

Transcript
Section 10 MISRA C
10.1.4
Rule Violations
Rule violations can consist of those that are known to be safe, and those that may have more effects. Rule violations such
as the former should be accepted, but some degree of safety is lost when rule violations are accepted too easily. This is
why MISRA C states a special procedure for accepting rule violations. Such violations require a valid reason, as well as
verification that the violation is safe. As such, locations and valid reasons for all accepted rules are documented. So that
violations are not accepted too easily, the signature of an individual with appropriate authority within the organization is
added to such documentation after consultation with an expert. This means that when a rule that is the same as one already
accepted is violated, it is deemed as an "accepted rule violation", and can be treated as accepted, without performing the
above procedures again. Of course, such violations need to be reviewed regularly.
10.1.5
MISRA C Compliance
To encourage MISRA C compliance, code needs to be developed in compliance with the rules, and rule violation
problems need to be resolved. To show whether code complies with the rules, documentation for the compliance matrix
and accepted rule violations is needed, along with signatures for each rule violation. To prevent future problems, you
should train programmers to make the most of the C language and tools used, implement policies regarding coding style,
choose adequate tools, and measure software metrics of various kinds. Such efforts should be officially standardized,
along with the appropriate documentation. MISRA C compliance requires more than just development of individual
products according to the guidelines, but rather of the organization itself.
10.2
SQMlint
10.2.1
What Is SQMlint?
SQMlint is a package that provides the Renesas C compiler with the additional function for checking whether it conforms
to the MISRA C rules. SQMlint statically checks the C source code, and reports the areas that violate the rules. SQMlint
runs as part of the C compiler in the Renesas product development environment. SQMlint can be started simply by adding
an option at compile-time, as shown in figure 10.5. It in no way affects the code generated by the compiler.
Table 10.2 lists the rules supported by SQMlint.
Renesas C
Compiler
C source
Preprocess
Preprocessed
C source
C compiler
SQMlint
Assembly source
Rule violation
message
Figure 10.5 SQMlint Positioning
Rev.3.00 2005.09.12 10-3
REJ05B0464-0300