This topic explains how to prevent C++test from reporting specific static analysis violations (e.g., when you generally follow a rule, but decide to ignore that rule in an isolated number of exceptional situations). Suppression schemes can be entered in the GUI or defined directly in the source code.

Sections include:

About Suppressions

See Suppressions.

Defining Suppressions in the GUI

To suppress a static analysis task that is shown in the Quality Tasks view:

  1. Right-click the Quality Tasks view item that represents the task you want to suppress, then choose Suppress Task from the shortcut menu.
  2. Enter the reason for the suppression in the dialog box that opens
  3. If you want the suppression stored in the source code (as described in the following section), choose Suppress in Source Code. Otherwise, the suppression will be saved in Team Server (when available) or with the local installation

The task will then be "suppressed" and removed from the Quality Tasks view. A suppression entry will be added to the Suppressions view or directly to the source code (depending on selected mode). If the same static analysis violation is found in subsequent tests of this project, it will be reported in the Suppressions view, but not in the Quality Tasks view.


Team suppressions (as opposed to in-code suppressions) are message-based and not rule-based. Suppressions prevent the reporting of a specific static analysis task (e.g., fix the violation of rule X that occurs in line Y); they do not prevent the reporting of all violations of a rule.

Defining Suppressions in Source Code

When suppressions are defined in source code:

There are two ways to define suppressions in source code:

C++test allows you to define suppressions directly in the source code, using the following directives embedded in C or C++ style comments:

  1. parasoft-suppress <ruleid> [<ruleid> ...] ["<comment>"]: Creates a suppression for the current line only (line with suppression directive)
  2. parasoft off: Suppresses the reporting of all static analysis violations that occur between this line of code and the end of the file.
  3. parasoft on: Unsuppresses the reporting of all static analysis violations that occur between this line of code and the end of the file.
  4. parasoft suppress/unsuppress [line <linewildcard>][class <classnamewildcard>][file <filenamewildcard>] [item <ruleid>][type <severity>] [reason <comment>]:
    Creates a suppression with the desired parameters.

Example A:
/* parasoft suppress item SECURITY-02 */
This suppresses reporting of violation SECURITY-02 for the current file, starting from the line where the suppression is located.

 Example B:
/* parasoft unsuppress item * class MyClass line 10-* */
This unsuppresses all items for class MyClass in the current file starting from line 10.

Example C:
/* parasoft unsuppress item SECURITY-02 file *example.cpp */
This unsuppresses the item SECURITY-02 in any file that is in the current compilation unit and has a file path that matches the *example.cpp file name pattern.

 Example D:
/* parasoft suppress all */
This suppresses all messages in the current file starting from the line where this directive was entered.

Example E:
void foo(); /* parasoft-suppress SECURITY-02 */
void bar(); // parasoft-suppress SECURITY-03 "Not relevant to my code."
This suppresses item SECURITY-02 on the line with "foo" declaration and item SECURITY-03 on the line with "bar" declaration with the reason "Not relevant to my code."

 Example F:
/* parasoft off */
/* parasoft unsuppress line 30-45 */
This suppresses everything, then unsuppress lines 30 to 45.

Additional Notes

Viewing GUI-Based Suppressions

To view the suppressed messages that were reported in a subsequent test run:

  1. Open the Suppressions view. If this view is not available, choose Parasoft> Show View> Suppressions to open it.
  2. Select the resource whose suppressions you want to view.

The Suppression Messages view will display the following information:

To sort the Suppressions view contents by one of the column headings, click that column heading.


You can edit a suppression’s message or reason by right-clicking the suppression in the Suppressions view, choosing Edit Message or Edit Reason from the shortcut menu that opens, then modifying the message or reason in the dialog that opens.

Using the Suppression Filter to Restrict the Suppressions Shown

You can restrict which suppressions are shown in the Suppressions view by using the available suppressions filter.

To filter the suppressions shown in the Suppressions view:

  1. Click the Filter button in the Suppressions view toolbar. The Filters dialog will open.
  2. Check the Enabled check box to enable the filter.
  3. Use the dialog’s controls to specify your filtering criteria. Available options include:

Clearing GUI-Based Suppressions

To unsuppress a task:

If this same static analysis violation is found in subsequent tests of this project, the task will be reported in the Quality Tasks view.