Skip to content

Commit 034a356

Browse files
committed
manual.md: Fix markdown lint warnings.
1 parent 1c24a14 commit 034a356

1 file changed

Lines changed: 20 additions & 33 deletions

File tree

man/manual.md

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
32
# Cppcheck 1.88 dev
43

54
## Introduction
@@ -8,9 +7,9 @@ Cppcheck is an analysis tool for C/C++ code. It provides unique code analysis to
87

98
Supported code and platforms:
109

11-
- You can check non-standard code that contains various compiler extensions, inline assembly code, etc.
12-
- Cppcheck should be compilable by any C++ compiler that handles the latest C++ standard.
13-
- Cppcheck should work on any platform that has sufficient CPU and memory.
10+
- You can check non-standard code that contains various compiler extensions, inline assembly code, etc.
11+
- Cppcheck should be compilable by any C++ compiler that handles the latest C++ standard.
12+
- Cppcheck should work on any platform that has sufficient CPU and memory.
1413

1514
Please understand that there are limits of Cppcheck. Cppcheck is rarely wrong about reported errors. But there are
1615
many bugs that it doesn't detect.
@@ -28,9 +27,10 @@ good results.
2827

2928
In the project settings dialog, the first option you see is "Import project". It is recommended that you use this
3029
feature if you can. Cppcheck can import:
31-
- Visual studio solution / project
32-
- Compile database (can be generated from cmake/qbs/etc build files)
33-
- Borland C++ Builder 6
30+
31+
- Visual studio solution / project
32+
- Compile database (can be generated from cmake/qbs/etc build files)
33+
- Borland C++ Builder 6
3434

3535
When you have filled out the project settings and click on OK; the Cppcheck analysis will start.
3636

@@ -56,7 +56,6 @@ The output from cppcheck will then be:
5656
Checking file1.c...
5757
[file1.c:4]: (error) Array 'a[10]' index 10 out of bounds
5858

59-
6059
#### Checking all files in a folder
6160

6261
Normally a program has many source files. And you want to check them all. Cppcheck can check all source files in a directory:
@@ -122,7 +121,6 @@ portability warnings. 64-bit portability. code might work different on different
122121

123122
Configuration problems. The recommendation is to only enable these during configuration.
124123

125-
126124
## Importing project
127125

128126
You can import some project files and build configurations into Cppcheck.
@@ -197,7 +195,6 @@ You can also create your own custom platform configuration in a xml file. Here i
197195
</sizeof>
198196
</platform>
199197

200-
201198
## Preprocessor Settings
202199

203200
If you use `--project` then Cppcheck will use the preprocessor settings from the imported project. Otherwise you'll probably want to configure the include paths, defines, etc.
@@ -212,7 +209,7 @@ Here is a file that has 2 preprocessor configurations (with A defined and withou
212209
x = z;
213210
#endif
214211

215-
By default Cppcheck will check all preprocessor configurations (except those that have #error in them). So the above code will by default be analyzed both with `A` defined and without `A` defined.
212+
By default Cppcheck will check all preprocessor configurations (except those that have #error in them). So the above code will by default be analyzed both with `A` defined and without `A` defined.
216213

217214
You can use `-D` to change this. When you use `-D`, cppcheck will by default only check the given configuration and nothing else. This is how compilers work. But you can use `--force` or `--max-configs` to override the number of configurations.
218215

@@ -234,7 +231,6 @@ Another useful flag might be `-U`. It tells Cppcheck that a macro is not defined
234231

235232
That will mean that X is not defined. Cppcheck will not check what happens when X is defined.
236233

237-
238234
### Include paths
239235

240236
To add an include path, use `-I`, followed by the path.
@@ -247,7 +243,7 @@ The purpose of this behaviour is that cppcheck is meant to work without necessar
247243

248244
If you want to filter out certain errors you can suppress these.
249245

250-
Please note that if you see a false positive then we (the Cppcheck team) want that you report it so we can fix it.
246+
Please note that if you see a false positive then we (the Cppcheck team) want that you report it so we can fix it.
251247

252248
### Plain text suppressions
253249

@@ -267,15 +263,14 @@ The `--suppress=` command line option is used to specify suppressions on the com
267263

268264
cppcheck --suppress=memleak:src/file1.cpp src/
269265

270-
271266
### Suppressions in a file
272267

273268
You can create a suppressions file. Example:
274269

275270
// suppress memleak and exceptNew errors in the file src/file1.cpp
276271
memleak:src/file1.cpp
277272
exceptNew:src/file1.cpp
278-
273+
279274
// suppress all uninitvar errors in all files
280275
uninitvar
281276

@@ -325,7 +320,7 @@ To suppress the error message, a comment can be added:
325320

326321
void f() {
327322
char arr[5];
328-
323+
329324
// cppcheck-suppress arrayIndexOutOfBounds
330325
arr[10] = 0;
331326
}
@@ -343,7 +338,6 @@ You can write comments for the suppress, however is recommended to use ; or // t
343338
// cppcheck-suppress arrayIndexOutOfBounds ; some comment
344339
// cppcheck-suppress arrayIndexOutOfBounds // some comment
345340

346-
347341
## XML output
348342

349343
Cppcheck can generate output in XML format. Use `--xml` to enable this format.
@@ -469,7 +463,7 @@ Many warnings have multiple locations. Example code:
469463
{
470464
*p = 3; // line 3
471465
}
472-
466+
473467
int main()
474468
{
475469
int *p = 0; // line 8
@@ -503,7 +497,6 @@ The first line in the warning is formatted by the --template format.
503497

504498
The other lines in the warning are formatted by the --template-location format.
505499

506-
507500
#### Format specifiers for --template
508501

509502
The available specifiers for --template are:
@@ -556,7 +549,6 @@ Newline
556549

557550
Carriage return
558551

559-
560552
#### Format specifiers for --template-location
561553

562554
The available specifiers for `--template-location` are:
@@ -614,9 +606,10 @@ Imagine this source code:
614606
}
615607

616608
By default Cppcheck will try to check all the configurations. There are 3 important configurations here:
617-
* Neither `__GNUC__` nor `_MSC_VER` is defined
618-
* `__GNUC__` is defined
619-
* `_MSC_VER` is defined
609+
610+
- Neither `__GNUC__` nor `_MSC_VER` is defined
611+
- `__GNUC__` is defined
612+
- `_MSC_VER` is defined
620613

621614
When you run Cppcheck, the output will be something like:
622615

@@ -632,7 +625,6 @@ Now if you want you can limit the analysis. You probably know what the target co
632625
Checking test.c ...
633626
Checking test.c: __GNUC__=1...
634627

635-
636628
### Unused templates
637629

638630
If you think Cppcheck is slow and you are using templates, then you should try how it works to remove unused templates.
@@ -685,7 +677,7 @@ You need:
685677

686678
Python 2.X or 3.X
687679

688-
The MISRA C 2012 PDF. You can buy this from http://www.misra.org.uk (costs 15-20 pounds)
680+
The MISRA C 2012 PDF. You can buy this from <http://www.misra.org.uk> (costs 15-20 pounds)
689681

690682
#### MISRA Text file
691683

@@ -710,7 +702,6 @@ To create the text file manually, copy paste Appendix A "Summary of guidelines"
710702

711703
Rules that you want to disable does not need to have a rule text. Rules that don't have rule text will be suppressed by the addon.
712704

713-
714705
## Library configuration
715706

716707
When external libraries are used, such as WinAPI, POSIX, gtk, Qt, etc, Cppcheck doesn't know how the external functions behave. Cppcheck then fails to detect various problems such as leaks, buffer overflows, possible null pointer dereferences, etc. But this can be fixed with configuration files.
@@ -988,8 +979,7 @@ Some example expressions you can use in the valid element:
988979
:0 => all values that are less or equal to 0 are valid
989980
0: => all values that are greater or equal to 0 are valid
990981
0,2:32 => the value 0 and all values between 2 and 32 are valid
991-
-1.5:5.6 => all values between -1.5 and 5.6 are valid
992-
982+
-1.5:5.6 => all values between -1.5 and 5.6 are valid
993983

994984
##### `<minsize>`
995985

@@ -1050,7 +1040,6 @@ With this you can say that an argument must be a zero-terminated string.
10501040
</function>
10511041
</def>
10521042

1053-
10541043
##### `<noreturn>`
10551044

10561045
Cppcheck doesn't assume that functions always return. Here is an example code:
@@ -1152,7 +1141,7 @@ Cppcheck normally assumes that the result might be different, and reports no war
11521141

11531142
If a proper const.cfg is provided, the unreachable code is detected:
11541143

1155-
$ cppcheck --enable=style --library=const const.c
1144+
$ cppcheck --enable=style --library=const const.c
11561145
Checking const.c...
11571146
[const.c:7]: (style) Expression is always false because 'else if' condition matches previous condition at line 5.
11581147

@@ -1253,10 +1242,9 @@ The following example provides a definition for std::vector, based on the defini
12531242
</container>
12541243
</def>
12551244

1256-
12571245
## HTML Report
12581246

1259-
You can convert the XML output from cppcheck into a HTML report. You'll need Python and the pygments module (http://pygments.org/) for this to work. In the Cppcheck source tree there is a folder htmlreport that contains a script that transforms a Cppcheck XML file into HTML output.
1247+
You can convert the XML output from cppcheck into a HTML report. You'll need Python and the pygments module (<http://pygments.org/)> for this to work. In the Cppcheck source tree there is a folder htmlreport that contains a script that transforms a Cppcheck XML file into HTML output.
12601248

12611249
This command generates the help screen:
12621250

@@ -1279,4 +1267,3 @@ An example usage:
12791267

12801268
./cppcheck gui/test.cpp --xml 2> err.xml
12811269
htmlreport/cppcheck-htmlreport --file=err.xml --report-dir=test1 --source-dir=.
1282-

0 commit comments

Comments
 (0)