Everything

-misra2004 [Professional Edition only]


< Compile Options / Source Options >

[Format]

-misra2004 = {
   all
   | apply=<rule number>[,...]
   | ignore=<rule number>[,...]
   | required
   | required_add=<rule number>[,...]
   | required_remove=<rule number>[,...]
   | <filename> }

[Description]

-

This option enables checking against the MISRA-C:2004 rules and to select specific rules to be used.

-

When misra2004=all, the compiler checks the source code against all of the rules that are supported.

-

When misra2004=apply=<rule number>[,<rule number>,...], the compiler checks the source code against the rules with the selected numbers.

-

When misra2004=ignore=<rule number>[,<rule number>,...], the compiler checks the source code against the rules other than those with the selected numbers.

-

When misra2004=required, the compiler checks the source code against the rules of the "required" type.

-

When misra2004=required_add=<rule number>[,<rule number>,...], the compiler checks the source code against the rules of the "required" type and the rules with the selected numbers.

-

When misra2004=required_remove=<rule number>[,<rule number>,...], the compiler checks the source code against the rules other than those with the selected numbers among the rules of the "required" type.

-

When misra2004=<filename>, the compiler checks the source code against the rules with the numbers written in the specified file. One rule number is written per line in the file. Each rule number must be specified by using decimal values and a period (".").

-

When checking of a line of code against the MISRA-C:2004 rules leads to detection of a violation, a message in the following format will appear.

<Filename> (<line number>): M0523028 <Rule number>: <Message>

-

When -misra2004=<filename> is used more than once, only the last specification is valid.

[Remarks]

-

The -misra2004 option can be specified more than once. However, if multiple types exist, only the type written last and consecutive specifications of the same type are valid.

... -misra2004=ignore=2.2 -misra2004=apply=2.3

-misra2004=required_add=4.1 -misra2004=apply=4.2

-misra2004=apply=5.2 ...

In this example, ignore, apply, and required_add are specified, but only apply (used in the last two cases) is valid. The compiler will check the source code against rules 4.2 and 5.2.

-

When the number of an unsupported rule is specified for <rule number>, the compiler detects error F0523031 and stops the processing.

-

When the file specified in misra2004=<filename> cannot be opened, the compiler detects error F0523029. When rule numbers are not extractable from the specified file, the compiler detects error F0523030. Processing by the compiler stops in both cases.

-

This option is ignored when cpp, c99, or ecpp is selected for the lang option or when output=prep is specified at the same time.

-

This option supports the MISRA-C: 2004 rules listed below.

[Required]

2.2 2.3

4.1 4.2

5.2 5.3 5.4

6.1 6.2 6.4 6.5

7.1

8.1 8.2 8.3 8.5 8.6 8.7 8.11 8.12

9.1 9.2 9.3

10.1 10.2 10.3 10.4 10.5 10.6

11.1 11.2 11.5

12.3 12.4 12.5 12.7 12.8 12.9 12.10 12.12

13.1 13.3 13.4

14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 14.10

15.1 15.2 15.3 15.4 15.5

16.1 16.3 16.5 16.6 16.9

18.1 18.4

19.3 19.6 19.8 19.11 19.14 19.15

20.4 20.5 20.6 20.7 20.8 20.9 20.10 20.11 20.12

[Not required]

5.5 5.6

6.3

11.3 11.4

12.1 12.6 12.11 12.13

13.2

17.5

19.7 19.13

-

For source programs that use extended functions such as #pragma, checking against these rules will be suppressed under some conditions. For details, refer to the section on the check_language_extension option.

-

MISRA diagnostic messages displayed by the misra2004 option cannot be controlled by the change_message option.

-

The source code cannot be simultaneously checked against the MISRA-C: 2012 rules.