13. Static Checking

<< Previous Table of Contents   |   Detailed Index Next >>
1. Static Checking Report for a Project

To static-check a project, click Project→Create Static Checker Report.

In the Static-checker dialog, select:

-   The Rule Type from the drop-down list

-   The rules to be checked under the Rule Type

-   The output report format.

-   Click <OK>.

The Static Checker progress meter will be displayed

As soon as the report generation is complete, the results will be displayed in the selected format.

      Static Checking a File

To static-check a file, click Tools→ Create Static Checker Report

      Which Static Checking     standards are supported

You can choose from:

-   MisraRule1998 - for MISRA-C:1998 .

-   MisraRule2004 - for MISRA-C:2004

2. Select the Rules to Check

Before you begin static-checking,

-   Select the rules to be checked

-   Unselect the rules you want to ignore

3. The Static Check dialog

Use this dialog and control the generation of static checking reports.

      Settings

Use the settings menu to Import or Export a pre-defined set of rules to be checked.

      Rule Type and Rules List

Chose the standard to check and then select the rules to check/ignore from the rules list

      General Settings

While reporting violations, if Crystal REVS find's a known violation that has been marked in the code for not to be reported, it will not be reported in the output if 'Report all violations ignoring the embedded pragmas' is unchecked.

      Output formats

The result of a static check violations test can be:

-   Viewed in the Output Window within Crystal C/C++. You can navigate, view and correct these violations

-   Viewed as HTML reports generated in a specified folder. These HTML reports can be given to the other members of a     development team to fix the various violations.

4. Viewing the Report

You can view a static report in the "Static Checker" tab of the output window.

5. Excluding known violations from being reported

For violations which are known to exist in a project, you may want to suppress reporting them every time.

To do so, mark such violations in the source code.

      Suppressing violations
    for the whole file

To suppress reporting rules 5.5 and 5.6 of MISRA 2004

-   In the beginning of the file insert /*#pragma disable( MISRA2004, 5.5, 5.6 )*/

      Suppressing violations
    for a given range

To suppress reporting rules 5.5 and 5.6 of MISRA 2004

-   In the beginning of the range insert /*#pragma disable( MISRA2004, 5.5, 5.6 )*/

-   In the end of the range for ignoring 5.5,insert /*#pragma enable( MISRA2004, 5.5 )*/

-   In the end of the range for ignoring 5.6,insert /*#pragma enable( MISRA2004, 5.5 )*/

      To add a reason while     suppressing a violation

To suppress reporting rules 45:2 of MISRA 1998

-   In the beginning of the range insert

  /*#pragma disable( MISRA1998, 45.2:" This rules has been suppressed." )*/

You can use any string of your choice after the colon ’:’

6. Static Check Reports and HTML Documentation

The static-check report can be part of the HTML documentation.

To include the static check report:

-   Click Project→Create HTML document

-   Enable Static Checker

7. Static Check Reports and Command Line mode

The static-check report can also be generated in the command line mode.

Please view the Help contents. ( Static Checking→...)

<< Previous Table of Contents   |   Detailed Index Next >>