diff --git a/man/manual-premium.md b/man/manual-premium.md index 4c30dc6d4b3..c8e38666530 100644 --- a/man/manual-premium.md +++ b/man/manual-premium.md @@ -572,6 +572,34 @@ The usage of the suppressions file is as follows: cppcheck --suppress-xml=suppressions.xml src/ +### The `` element + +Cppcheck calculates a unique ID for each error, called the hash. The hash depends on the code that +is related to the error, not on where that code is located. This means that the hash for an error +stays the same even when unrelated code elsewhere in the file is added, removed or moved, shifting +the line numbers around. The hash only changes if the related code itself is modified. + +This makes hash-based suppressions more robust than line-based suppressions: once you have +reviewed and suppressed a specific warning, the suppression keeps working even after the file is +edited, as long as the offending code is not changed. + +The hash for an error is included as the `hash` attribute in the [XML output](#the-error-element). +You can copy that value into a `` element in a suppressions XML file: + + + + + uninitvar + src/file1.c + 12345678 + + + +A suppression can use `` on its own, without ``, to suppress a specific error regardless +of its id. It is also possible to combine `` with ``, ``, `` and +``; when several of these are specified, all of them must match for the suppression to +apply. + ## Inline suppressions Suppressions can also be added directly in the code by adding comments that contain special keywords. diff --git a/man/manual.md b/man/manual.md index 47a3a43fd36..075f0e9d534 100644 --- a/man/manual.md +++ b/man/manual.md @@ -573,6 +573,34 @@ The usage of the suppressions file is as follows: cppcheck --suppress-xml=suppressions.xml src/ +### The `` element + +Cppcheck calculates a unique ID for each error, called the hash. The hash depends on the code that +is related to the error, not on where that code is located. This means that the hash for an error +stays the same even when unrelated code elsewhere in the file is added, removed or moved, shifting +the line numbers around. The hash only changes if the related code itself is modified. + +This makes hash-based suppressions more robust than line-based suppressions: once you have +reviewed and suppressed a specific warning, the suppression keeps working even after the file is +edited, as long as the offending code is not changed. + +The hash for an error is included as the `hash` attribute in the [XML output](#the-error-element). +You can copy that value into a `` element in a suppressions XML file: + + + + + uninitvar + src/file1.c + 12345678 + + + +A suppression can use `` on its own, without ``, to suppress a specific error regardless +of its id. It is also possible to combine `` with ``, ``, `` and +``; when several of these are specified, all of them must match for the suppression to +apply. + ## Inline suppressions Suppressions can also be added directly in the code by adding comments that contain special keywords.