Skip to content

Commit e89d6a6

Browse files
authored
Manual: Minor tweaks to make text easier to read (danmar#7837)
1 parent 5e54366 commit e89d6a6

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

man/manual.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,18 @@ need to use both approaches. Later chapters will describe this in more detail.
105105

106106
With `--file-filter=<str>` you can configure file filter(s) and then only those files matching the filter will be checked.
107107

108-
For example, this command below means that `src/test1.cpp` and `src/test/file1.cpp` could be checked, but `src/file2.cpp` will not be checked:
109-
110-
cppcheck src/ --file-filter=src/test*
111-
112108
You can use `**`, `*` and `?` in the file filter pattern.
113109
`**`: matches zero or more characters, including path separators
114110
`*`: matches zero or more characters, excluding path separators
115111
`?`: matches any single character except path separators
116112

113+
For example, this command below means that `src/test1.cpp` could be checked, but `src/file2.cpp` and `src/test/file1.cpp` will not be checked:
114+
115+
cppcheck src/ --file-filter=src/test*
116+
117+
Cppcheck first collects all files in the specified directory, then applies the filter. Therefore, the filter pattern
118+
must include the directory path you specified.
119+
117120
A common use case for `--file-filter` is to check a project, but only check certain files:
118121

119122
cppcheck --project=compile_commands.json --file-filter=src/*.c
@@ -150,8 +153,8 @@ By default Cppcheck uses an internal C/C++ parser. However there is an experimen
150153

151154
Install `clang`. Then use Cppcheck option `--clang`.
152155

153-
Technically, Cppcheck will execute `clang` with its `-ast-dump` option. The Clang output is then imported and converted into
154-
the normal Cppcheck format. And then normal Cppcheck analysis is performed on that.
156+
Cppcheck executes clang with the -ast-dump option, imports the output, converts it to Cppcheck's internal format, and then
157+
performs standard analysis.
155158

156159
You can also pass a custom Clang executable to the option by using for example `--clang=clang-10`. You can also pass it
157160
with a path. On Windows it will append the `.exe` extension unless you use a path.
@@ -191,9 +194,8 @@ be improved.
191194

192195
Cppcheck instantiates the templates in your code.
193196

194-
If your templates are recursive this can lead to slow analysis that uses a lot
195-
of memory. Cppcheck will write information messages when there are potential
196-
problems.
197+
If your templates are recursive, this can lead to slow analysis and high memory usage. Cppcheck will write information
198+
messages when there are potential problems.
197199

198200
Example code:
199201

@@ -250,7 +252,7 @@ Using a Cppcheck build folder is not mandatory but it is recommended.
250252

251253
Cppcheck save analyzer information in that folder.
252254

253-
The advantages are;
255+
The advantages are:
254256

255257
- It speeds up the analysis as it makes incremental analysis possible. Only changed files are analyzed when you recheck.
256258
- Whole program analysis also when multiple threads are used.
@@ -286,7 +288,7 @@ To ignore certain folders in the project you can use `-i`. This will skip the an
286288

287289
## CMake
288290

289-
Generate a compile database:
291+
Generate a compile database (a JSON file containing compilation commands for each source file):
290292

291293
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
292294

@@ -369,9 +371,12 @@ Here is a file that has 3 bugs (when x,y,z are assigned).
369371
#error C must be defined
370372
#endif
371373

374+
The flag `-D` tells Cppcheck that a name is defined. Cppcheck will only analyze configurations that
375+
contain this define.
376+
377+
The flag `-U` tells Cppcheck that a name is not defined. Cppcheck will only analyze configurations
378+
that does not contain this define.
372379

373-
The flag `-D` tells Cppcheck that a name is defined. There will be no Cppcheck analysis without this define.
374-
The flag `-U` tells Cppcheck that a name is not defined. There will be no Cppcheck analysis with this define.
375380
The flag `--force` and `--max-configs` is used to control how many combinations are checked. When `-D` is used,
376381
Cppcheck will only check 1 configuration unless these are used.
377382

@@ -477,7 +482,8 @@ build dir. For instance, the unusedFunction warnings require whole program analy
477482

478483
If you want to filter out certain errors from being generated, then it is possible to suppress these.
479484

480-
If you encounter a false positive, then please report it to the Cppcheck team so that it can be fixed.
485+
If you encounter a false positive, please report it to the Cppcheck team so that the issue can be
486+
fixed.
481487

482488
## Plain text suppressions
483489

0 commit comments

Comments
 (0)