You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: man/manual.md
+15-22Lines changed: 15 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,32 +105,23 @@ need to use both approaches. Later chapters will describe this in more detail.
105
105
106
106
With `--file-filter=<str>` you can set a file filter and only those files matching the filter will be checked.
107
107
108
-
For example: if you want to check only those files and folders starting from a subfolder src/ that start with "test"
109
-
you have to type:
108
+
For example:
110
109
111
110
cppcheck src/ --file-filter=src/test*
112
111
113
-
Cppcheck first collects all files in src/ and will apply the filter after that. So the filter must start with the given
114
-
start folder.
112
+
You can use `**`, `*` and `?` in the file filter.
115
113
116
-
### Excluding a file or folder from checking
117
-
118
-
To exclude a file or folder, there are two options. The first option is to only provide the paths and files you want to
119
-
check:
120
-
121
-
cppcheck src/a src/b
114
+
The given file filter would mean for example that `src/test1.cpp` and `src/test/file1.cpp` are checked, but `src/file2.cpp` is not checked.
122
115
123
-
All files under src/a and src/b are then checked.
116
+
### Excluding a file or folder from checking
124
117
125
-
The second option is to use -i, which specifies the files/paths to ignore. With this command no files in src/c are
126
-
checked:
118
+
The option `-i` specifies files/paths to ignore. With this command no files in `src/c` are checked:
127
119
128
120
cppcheck -isrc/c src
129
121
130
-
This option is only valid when supplying an input directory. To ignore multiple directories supply the -i flag for each
131
-
directory individually. The following command ignores both the src/b and src/c directories:
122
+
The `-i` option is not used during preprocessing, it can't be used to exclude headers that are included from checking.
132
123
133
-
cppcheck -isrc/b -isrc/c
124
+
You can use `**`, `*` and `?` to specify excluded folders/files.
134
125
135
126
### Clang parser (experimental)
136
127
@@ -475,19 +466,19 @@ The format for an error suppression is one of:
475
466
[error id]:[filename2]
476
467
[error id]
477
468
478
-
The `error id` is the id that you want to suppress. The id of a warning is shown in brackets in the normal cppcheck text output. The suppression `error id` may contain \* to match any sequence of tokens.
469
+
The `error id` is the id that you want to suppress. The id of a warning is shown in brackets in the normal cppcheck text output. The suppression `error id` may contain `*` and/or `?`.
470
+
471
+
The filename pattern may contain `**`, `*` or `?`.
479
472
480
-
The filename may include the wildcard characters \* or ?, which matches any sequence of characters or any single character respectively.
481
-
It is recommended to use forward-slash `/` as path separator on all operating systems. The filename must match the filename in the reported warning exactly.
482
-
For instance, if the warning contains a relative path, then the suppression must match that relative path.
473
+
It is recommended to use forward-slash `/` as path separator on all operating systems.
483
474
484
-
## Command line suppression
475
+
###Command line suppression
485
476
486
477
The `--suppress=` command line option is used to specify suppressions on the command line. Example:
487
478
488
479
cppcheck --suppress=memleak:src/file1.cpp src/
489
480
490
-
## Suppressions in a file
481
+
###Suppressions in a file
491
482
492
483
You can create a suppressions file for example as follows:
493
484
@@ -524,6 +515,8 @@ The usage of the suppressions file is as follows:
524
515
525
516
cppcheck --suppress-xml=suppressions.xml src/
526
517
518
+
The `id` and `fileName` patterns may `**`, `*` or `?`.
519
+
527
520
## Inline suppressions
528
521
529
522
Suppressions can also be added directly in the code by adding comments that contain special keywords.
0 commit comments