Defining Suppression Rules in the GUI
Prerequisite:
Apply suppressions when you configure a project.
To create a suppression rule to help you focus during
future analysis runs on only those issues that require your attention:
- Although you are ultimately trying to suppress problems, theIntel Inspectorvehiclefor defining a suppression rule is one or more code locations.
- Narrow rules suppress a limited number of relevant problems; wider rules suppress a greater number of relevant problems.
- Every rule applied during analysis adds processing time.
- The goal: Suppress the greatest number of relevant problems with the fewest number of rules.
- To review rules to be applied during analysis, check theSuppressionstab of theProject Propertiesdialog box.
- To apply rules during analysis, select theApply Suppressionsradio button on theTargettab of theProject Propertiesdialog box.
- A code location may be part of multiple problems; therefore, multiple rules may suppress the same code location, or a rule created to suppress one problem may partially impact another problem.
- See suppression rule examples for more information.
1.
Choose Problems to Suppress During Future Analysis Runs
- In theCode Locationspane, right-click a code location for an occurrence of the problem you want to suppress during future analysis runs.
- In the context menu, chooseSuppress....
Outcome: The
Intel Inspector
displays the
Create Suppression
dialog box. The
Rule
grid in the center of the dialog box shows the
right-clicked code location and any related code locations in the specific
occurrence of the problem.
2.
Identify the new rule by name and storage location
- In theNametext box, type a short description to distinguish the new rule from other rules.
- If you want to store the new rule somewhere besides the default location, browse to and choose a filename and/or location.
Choose a non-default location only to make the rule
easily accessible to others.
3. Widen the
default rule reach to suppress the greatest number of relevant problems
By default, the
Intel Inspector
drafts a rule that suppresses problems based on:
- A specific problem type
- All the code locations in the problem occurrence
- A specific module, function, source, and line in the last-called stack frame in each code location.
To widen the rule reach, try one or more of the
following - do not suppress problems by:
- A specific problem type - In theProblem typedrop-down list, click the drop-down arrow and choose* (any).
- A specific code location - In theRulegrid, deselect the code location checkbox.
- A specific code location description - In theCode Location Descriptiondrop-down list, click the drop-down arrow and choose* (any).There are threeCode Location Descriptionpossibilities:Allocation site,Deallocation site, and* (any). Memory error example: If you right-click aMismatched allocation sitecode location for an occurrence of aMismatched allocation/deallocationproblem, theIntel Inspectordisplays one code location markedAllocation siteand one code location marked* (any); you can click the drop-down arrow to changeAllocation siteto* (any). Threading error example: If you right-click aReadcode location for an occurrence of a Read/WriteData raceproblem, theIntel Inspectordisplays two code locations marked* (any)and does not provide drop-down arrows.
- A specific stack frame module, function, source, and line number -
- Click a code locationEditbutton to open theSelect Stack Frame(s)dialog box.
- Notice you can select a different stack frame or multiple stack frames as the rule focus.
- In theModule,Function,Source, and/orLinedrop-down list for each selected stack frame, click the drop-down arrow and choose* (any)
- A single code location with all but one characteristic set to* (any)is ideal for widening a rule to suppress the greatest number of relevant problems.
- Suppression rules are more robust if you specify a stack with multiple frames instead of frames with line numbers. (Because line numbers can be altered by code insertions or deletions, suppressions may be rendered ineffective by even minor code maintenance. Stack-based suppressions require larger code changes to invalidate them, such as changes to function call sequences.)
4. Save the Rule
Click the
Create
button.
Outcome
Outcome:
- Intel Inspectorsaves the new suppression rule in a.supfile.
- In theCode LocationsandProblemspanes, theIntel Inspectormarks (strikes through) all result datapotentiallyimpacted by the rule. (It may take some time for all marks to appear.) The marks remain in the result even if you close and then reopen the result.Review the marked data to assess the effectiveness and potential reach of the rule. If necessary, delete the rule and start over, or edit the suppression file in a text editor.
- During the next analysis run, ifSuppressionsin theTargettab of theProject Propertiesdialog box is set to:
- Apply suppressions- TheIntel Inspectordoes not collect result data impacted by the suppression rules in files and directories specified in theSuppressionstab of theProject Propertiesdialog box.
- Do not apply suppressions- TheIntel Inspectorignores all suppression rules.