manual.md: Fix markdown lint warnings. (#1773)

This commit is contained in:
Sebastian 2019-04-03 20:05:04 +02:00 committed by GitHub
parent 76bf5ecb06
commit d8d4ca51d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 33 deletions

View File

@ -1,5 +1,4 @@
# Cppcheck 1.88 dev
## Introduction
@ -28,6 +27,7 @@ good results.
In the project settings dialog, the first option you see is "Import project". It is recommended that you use this
feature if you can. Cppcheck can import:
- Visual studio solution / project
- Compile database (can be generated from cmake/qbs/etc build files)
- Borland C++ Builder 6
@ -56,7 +56,6 @@ The output from cppcheck will then be:
Checking file1.c...
[file1.c:4]: (error) Array 'a[10]' index 10 out of bounds
#### Checking all files in a folder
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
Configuration problems. The recommendation is to only enable these during configuration.
## Importing project
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
</sizeof>
</platform>
## Preprocessor Settings
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.
@ -234,7 +231,6 @@ Another useful flag might be `-U`. It tells Cppcheck that a macro is not defined
That will mean that X is not defined. Cppcheck will not check what happens when X is defined.
### Include paths
To add an include path, use `-I`, followed by the path.
@ -267,7 +263,6 @@ The `--suppress=` command line option is used to specify suppressions on the com
cppcheck --suppress=memleak:src/file1.cpp src/
### Suppressions in a file
You can create a suppressions file. Example:
@ -343,7 +338,6 @@ You can write comments for the suppress, however is recommended to use ; or // t
// cppcheck-suppress arrayIndexOutOfBounds ; some comment
// cppcheck-suppress arrayIndexOutOfBounds // some comment
## XML output
Cppcheck can generate output in XML format. Use `--xml` to enable this format.
@ -503,7 +497,6 @@ The first line in the warning is formatted by the --template format.
The other lines in the warning are formatted by the --template-location format.
#### Format specifiers for --template
The available specifiers for --template are:
@ -556,7 +549,6 @@ Newline
Carriage return
#### Format specifiers for --template-location
The available specifiers for `--template-location` are:
@ -614,9 +606,10 @@ Imagine this source code:
}
By default Cppcheck will try to check all the configurations. There are 3 important configurations here:
* Neither `__GNUC__` nor `_MSC_VER` is defined
* `__GNUC__` is defined
* `_MSC_VER` is defined
- Neither `__GNUC__` nor `_MSC_VER` is defined
- `__GNUC__` is defined
- `_MSC_VER` is defined
When you run Cppcheck, the output will be something like:
@ -632,7 +625,6 @@ Now if you want you can limit the analysis. You probably know what the target co
Checking test.c ...
Checking test.c: __GNUC__=1...
### Unused templates
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:
Python 2.X or 3.X
The MISRA C 2012 PDF. You can buy this from http://www.misra.org.uk (costs 15-20 pounds)
The MISRA C 2012 PDF. You can buy this from <http://www.misra.org.uk> (costs 15-20 pounds)
#### MISRA Text file
@ -710,7 +702,6 @@ To create the text file manually, copy paste Appendix A "Summary of guidelines"
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.
## Library configuration
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.
@ -990,7 +981,6 @@ Some example expressions you can use in the valid element:
0,2:32 => the value 0 and all values between 2 and 32 are valid
-1.5:5.6 => all values between -1.5 and 5.6 are valid
##### `<minsize>`
Some function arguments take a buffer. With minsize you can configure the min size of the buffer (in bytes, not elements). Imagine:
@ -1050,7 +1040,6 @@ With this you can say that an argument must be a zero-terminated string.
</function>
</def>
##### `<noreturn>`
Cppcheck doesn't assume that functions always return. Here is an example code:
@ -1253,10 +1242,9 @@ The following example provides a definition for std::vector, based on the defini
</container>
</def>
## HTML Report
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.
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.
This command generates the help screen:
@ -1279,4 +1267,3 @@ An example usage:
./cppcheck gui/test.cpp --xml 2> err.xml
htmlreport/cppcheck-htmlreport --file=err.xml --report-dir=test1 --source-dir=.