Suppress a violation / document a deviation in code¶
For safety/compliance work you often need to accept a specific violation and record why. CodeCheck lets you do that with an in-code comment — the suppression and its rationale live next to the code and travel with it (auditable deviations).
The keywords¶
Put an UndCC_ comment on or around the code. The rationale is anything you write after the keyword:
goto cleanup; // UndCC_Line(*) goto approved by G. Turner on 2014-11-07 (deviation #42)
| Keyword | Scope |
|---|---|
UndCC_Line(...) |
this line |
UndCC_NextLine(...) |
the next line |
UndCC_Begin(...) … UndCC_End(...) |
a range of lines |
UndCC_File(...) |
the whole file |
UndCC_Entity(Name, ...) |
everywhere in the named entity |
UndCC_EntityBegin(Name, ...) … UndCC_EntityEnd(Name, ...) |
the named entity, within a range |
The keyword prefix is case-insensitive (undcc_).
Target all checks or specific ones¶
The argument in parentheses is a CheckID list, or * for all checks:
x = y; // UndCC_Line(*) ignore ALL violations on this line
x = y; // UndCC_Line(MISRA23_10.1) ignore only MISRA 23 rule 10.1 here
You can pass a comma-separated list of CheckIDs. CheckIDs are shown in the Understand GUI next to each check.
Require an explicit CheckID (recommended for compliance)¶
Turn on Require Explicit CheckID on Ignores (project setting CodeCheckProjectSettings/RequireExplicitCheckID)
so a bare UndCC_Line(*) is rejected — every suppression must name the rule(s) it waives. When it's
missing, CodeCheck reports *** Required CheckID Missing.
Suppressed violations aren't deleted — they are marked as ignored and hidden by default, so an auditor can still review every deviation alongside the compliance report.