Skip to content

Commit 95b15d2

Browse files
committed
doc
1 parent 1e338e5 commit 95b15d2

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

Diff for: man/manual.md

+37
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,10 @@ this attribute is only used when the error message is inconclusive
702702

703703
CWE ID for the problem; note that this attribute is only used when the CWE ID for the message is known
704704

705+
**remark**
706+
707+
Optional attribute. The related remark/justification from a remark comment.
708+
705709
## The `<location>` element
706710

707711
All locations related to an error are listed with `<location>` elements. The primary location is listed first.
@@ -848,6 +852,10 @@ The warning message
848852

849853
Warning id
850854

855+
**{remark}**
856+
857+
The remark text if a remark comment has been provided
858+
851859
**{code}**
852860

853861
The real code
@@ -900,6 +908,35 @@ Newline
900908

901909
Carriage return
902910

911+
# Justifications for warnings in the report
912+
913+
You can add remark comments in the source code that justify why there is a warning/violation.
914+
915+
Such a remark comment shall:
916+
* start with REMARK.
917+
* can either be added above the source code that generates the warning, or after the code on the same line.
918+
919+
Example code:
920+
921+
void foo(void) {
922+
// REMARK Initialize x with 0
923+
int x = 0;
924+
}
925+
926+
In Cppcheck text output the remarks are not shown by default, you can use `--template` option `{remark}` to show remarks:
927+
928+
$ ./cppcheck --enable=style --template="{file}:{line}: {message} [{id}]\\n{remark}" test1.c
929+
Checking test1.c ...
930+
test1.c:4: Variable 'x' is assigned a value that is never used. [unreadVariable]
931+
Initialize x with 0
932+
933+
In xml output the comment text is provided in a "remark" attribute:
934+
935+
$ ./cppcheck --enable=style --xml test1.c
936+
....
937+
remark="Initialize x with 0"
938+
....
939+
903940
# Addons
904941

905942
Addons are scripts that analyse Cppcheck dump files to check compatibility with secure coding standards and to locate issues.

Diff for: releasenotes.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Deprecations:
1818

1919
Other:
2020
- Add support for 'CLICOLOR_FORCE'/'NO_COLOR' environment variables to force/disable ANSI color output for diagnostics.
21-
- added command-line option `--cpp-header-probe` (and `--no-cpp-header-probe`) to probe headers and extension-less files for Emacs marker (see https://trac.cppcheck.net/ticket/10692 for more details)
22-
-
21+
- Added command-line option `--cpp-header-probe` (and `--no-cpp-header-probe`) to probe headers and extension-less files for Emacs marker (see https://trac.cppcheck.net/ticket/10692 for more details)
22+
- Add "remark comments" that can be used to generate reports with justifications for warnings

0 commit comments

Comments
 (0)