Commit Graph

388 Commits

Author SHA1 Message Date
Daniel Marjamäki c6dfec5d5f Verification; Describe our philosophy in the manual 2020-01-01 09:39:57 +01:00
Daniel Marjamäki c86a2d6e15 Verification; updated manual 2019-12-31 14:03:12 +01:00
Daniel Marjamäki 270140f1fa manual; add chapter about verification 2019-12-23 16:34:50 +01:00
Daniel Marjamäki 267bdc0f5f Manual: -i and --project 2019-12-14 13:05:05 +01:00
Armin Müller 130ebe4b85 Typos found by running "codespell" (#2380) 2019-11-19 20:02:24 +01:00
Daniel Marjamäki 65784a16c4 Manual: Clarify suppression filename, it must match exactly (#7780) 2019-11-17 17:18:41 +01:00
Daniel Marjamäki f5e3dc9a38 Improved fix for #8978 (False positive: Variable assigned value that is never used when assigning via iterator) 2019-11-17 12:08:21 +01:00
Paul Fultz II 4ebf54d090 Fix issue 9437: Dont assume init list constructor for strings (#2366)
* Fix issue 9437: Dont assume init list constuctor for strings

* Update the schema

* Add documentation
2019-11-17 03:22:04 +01:00
Sebastian b089ba4e3b
manuals: Fix missing/wrong table of contents in HTML files (#2360)
The YAML setting `toc: true` works for PDF creation but for HTML it
simply prints `true` as the table of contents.
It looks like a misconception and the only acceptable solution I have
found is to use `--toc` on the command line instead of the `toc: true`
setting in the YAML header.
It is a known issue, here are more details:
https://github.com/jgm/pandoc/issues/2872
With this fix I get table of contents not only for PDF but for HTML too.
The PDF looks like before for me, the table of contents and the outline
are still present as it was before.
2019-11-15 21:35:41 +01:00
Georgy Komarov 3bd126486f addons: Clean up and clarify addons usage. (#2359)
* addons: Add '--recursive' arg. Clean up and clarify errors messages.

This commit introduce '--recursive' option for cppcheck addons.
Iff this option is set addon will recursively traverse directories in
given input files to find files with '.dump' suffix that would be
checked. Otherwise it will treat input directory as error (current
behaviour).

Add additional error handling with more clear error messages, clean up
the code.

* Add regex specifier

* Roll back --recursive option

* Update addons section in manual
2019-11-15 20:14:30 +01:00
Paul Fultz II 7841430793 Fix issue 9428: FP uninitvar for pointer passed to sscanf (#2344)
* Add indirect to library cfg files

* Check indirect for non null arguments

* Reenable subfunction analysis

* Use indirect 1 when using not-null

* Parse correct string name

* Update documentation

* Make attribute optional
2019-11-13 12:46:54 +01:00
Masafumi Koba 38dec6a9ac Add missing ending tag in XML example (#2187) 2019-09-20 16:46:57 +02:00
Daniel Marjamäki 346a19393f removed manual.docbook 2019-09-12 20:48:20 +02:00
PKEuS e9f8dddabe Set version to 1.89.99/1.90 dev 2019-09-02 15:44:40 +02:00
Daniel Marjamäki 4ede39a9b7 1.89: Set version 2019-09-01 12:16:33 +02:00
Daniel Marjamäki 767667815d Manual: Remove chapter about safe checks again. I hide this for now. 2019-08-25 18:44:59 +02:00
Daniel Marjamäki 7367b212ae Manual: Add chapter about safe checks 2019-08-25 16:16:35 +02:00
Wolfgang Stöggl 1c32455ae1 Fix some typos (#1983) 2019-07-12 17:55:44 +02:00
Rikard Falkeborn 839fcddd8a Fix #6115 (Add support to realloc to cfg files) (#1953)
* Allow to configure realloc like functions

* memleakonrealloc: Bring back tests.

The old memleak checker was removed, and the tests for it was removed in
commit 9765a2dfab. This also removed the
tests for memleakOnRealloc. Bring back those tests, somewhat modified
since the checker no longer checks for memory leaks.

* Add realloc to mem leak check

* Add tests of realloc buffer size

* Configure realloc functions

* Add test of freopen

* Allow to configure which element is realloc argument

* Fix wrong close in test

cppcheck now warns for this

* Update manual

* Update docs

* Rename alloc/dalloc/realloc functions

Naming the member function realloc caused problems on appveyor. Rename
the alloc and dealloc functions as well for consistency.

* Change comparisson order

* Remove variable and use function call directly

* Create temporary variable to simplify

* Throw mismatchError on mismatching allocation/reallocation

* Refactor to separate function

* Fix potential nullptr dereference

As pointed out by cppcheck.
2019-07-05 12:44:52 +02:00
PKEuS d74f8c678f Set version to 1.88.99/1.89 dev 2019-07-02 20:59:52 +02:00
Daniel Marjamäki faaabc74a7 Set version 1.88 2019-06-29 08:38:13 +02:00
Daniel Marjamäki 325af2399b man: document the <smart-pointer> element 2019-06-28 17:15:53 +02:00
Daniel Marjamäki 481d94f059 reference-cfg-format: Document the direction attribute 2019-06-28 15:18:00 +02:00
Daniel Marjamäki 89a45c8f8a Manual: The Cppcheck GUI has some options that can be 'imported' on the command line 2019-06-16 12:37:18 +02:00
Daniel Marjamäki 167950c8e7 Manual: Move .cfg reference to its own document 2019-06-16 10:08:37 +02:00
Daniel Marjamäki 22ed912e47 manual: trim the manual somewhat. The "speeding up Cppcheck" chapter was removed. Addons should not be described in detail in the manual it is better that this is done in the addon. 2019-06-16 08:22:24 +02:00
Daniel Marjamäki 5301c44374 man: comment 2019-06-05 10:47:06 +02:00
Daniel Marjamäki 350b43c6ba Manual: Cleanup, update build script 2019-06-02 11:33:21 +02:00
Daniel Marjamäki c130208d9d Manual: fixes 2019-06-02 11:28:50 +02:00
Daniel Marjamäki 9e457b6136 Manual: Building html/pdf manuals 2019-06-01 19:52:09 +02:00
Paul Fultz II 091f4bcf8d Add check for unnecessary search before insertion
This will warn for cases where searching in an associative container happens before insertion, like this:

```cpp
void f1(std::set<unsigned>& s, unsigned x) {
    if (s.find(x) == s.end()) {
        s.insert(x);
    }
}

void f2(std::map<unsigned, unsigned>& m, unsigned x) {
    if (m.find(x) == m.end()) {
        m.emplace(x, 1);
    } else {
        m[x] = 1;
    }
}
```

In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.

I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
Daniel Marjamäki 1f68e038be Addons: Describe running addons from cppcheck in the manual 2019-04-08 21:31:38 +02:00
Sebastian b62a7fe059 manual.md: Spelling fixes (#1791)
Thanks!
2019-04-08 16:03:43 +02:00
Sebastian d8d4ca51d7
manual.md: Fix markdown lint warnings. (#1773) 2019-04-03 20:05:04 +02:00
versat 5fb23a4983 manual.md: Fix wrong code indentation. 2019-04-01 13:30:24 +02:00
versat 1c24a14f3f manual.md: Fixed missing back ticks and spaces.
When not between back ticks everything between angle brackets is
interpreted as HTML tags and not rendered.
Also fixed missing spaces after a sentence and in a code block.
2019-04-01 09:29:05 +02:00
Daniel Marjamäki 475036c4bc manual.md: describe library configuration 2019-03-17 10:28:53 +01:00
Daniel Marjamäki 5461fb64e3 manual.md: replace __MSCVER with _MSC_VER, that is more correct 2019-03-11 18:21:17 +01:00
Daniel Marjamäki 7fd34ac8a2 Manual: Add chapter about speeding up Cppcheck analysis 2019-03-11 13:11:17 +01:00
Daniel Marjamäki 996916358a manual.md: minor tweaks 2019-03-04 20:44:57 +01:00
Daniel Marjamäki f77754ba3b manual.md: Improved 'Get started' chapter. Add 'HTML Report' chapter 2019-03-04 20:33:13 +01:00
versat 973ccda733 manual.md: Copy and adapt chapter "Using your own custom .cfg file". 2019-03-04 16:11:42 +01:00
Daniel Marjamäki 97dc19b9b1 manual.md: imported info from manual.docbook 2019-03-03 17:31:02 +01:00
Daniel Marjamäki 5e85a3df6c manual.md: Add a 'Getting started' chapter 2019-03-02 14:33:14 +01:00
Daniel Marjamäki caaa4c0b98 manual.md: Add new manual file. 2019-03-02 10:08:09 +01:00
Andreas Rönnquist be6cec5ad8 Fix link to cppcheck wiki in man page (#1714) 2019-02-28 20:37:49 +01:00
PKEuS 11daabc1a8 Set version to 1.87.99/1.88 dev 2019-02-27 21:30:54 +01:00
fu7mu4 c78de5cdb5 change version number on manual-ja.docbook (#1658) 2019-02-10 16:57:48 +01:00
Daniel Marjamäki 502d5e9142 1.87: Set versions 2019-02-09 09:07:27 +01:00
Daniel Marjamäki 437800f46d CLI: Added --max-ctu-depth 2019-02-03 17:51:36 +01:00
Crayon d54017a0c4 Correct documentation and give an example (#1594) 2019-01-12 08:06:31 +01:00
Daniel Marjamäki dd62da02e4 manual: Try to clarify <podtype> documentation 2019-01-06 11:15:06 +01:00
fu7mu4 2abb3aa263 fix japanese translation typo and manual version (#1515) 2018-12-09 09:06:56 +01:00
PKEuS 886aa07ffb Set version to 1.86.99/1.87 dev 2018-12-08 11:53:37 +01:00
Daniel Marjamäki 5e527bdd08 Update version 2018-12-08 08:17:05 +01:00
fu7mu4 f3b127032a fix newline from backslash t to backslash n in manual-ja.docbook (#1443) 2018-10-21 07:05:15 +02:00
fu7mu4 ab985f624c update manual-ja.docbook (#1441) 2018-10-20 19:49:43 +02:00
fu7mu4 fdc6de2d52 fix typp on manual.docbook Newline is \n instead of \t (#1442) 2018-10-20 19:49:27 +02:00
rikardfalkeborn 613dc19b68 #4241: Check for address of single character passed as string (#1381)
* #4241: Check for address of single character passed as string

Add a check that address of a single character is not passed as argument
to argument marked as strings (using strz). The check does not warn if
the address of a character with known value '\0'.

Since ValueFlow currently does not handle global constants (see #7597),
do not warn if the variable is global to avoid FPs when the address of
a global variable assigned to '\0' is passed to a function expecting a
string.

Remove comment in docs saying strz is unused.

* Change asdf to Hello world

* Add test of address to first element in string

* Add error reporting function to getErrorMessages

* Fix strings in test
2018-10-14 18:49:34 +02:00
Daniel Marjamäki 895772711a 1.85: Set version 2018-10-13 18:55:19 +02:00
Daniel Marjamäki 140b0b5ae9 astyle formatting
[ci skip]
2018-10-13 18:42:09 +02:00
Jes Ramsing 5328caa6fa Added documentation for --suppress-xml (#1420)
* Added documentation for --suppress-xml

* Bad copy place job "--suppress-xml" not "--suppressions-list"

* Fixed indentation to use . instead of tab
2018-10-13 18:41:12 +02:00
rikardfalkeborn 491ee577c6 Support floats in valid config (#1297)
* Add tests for invalid ranges

* Refactor loadLibErrors

This reduces the amount of code slightly and will simplify adding
more tests.

* Handle empty valid field

Before this change, the sequence <valid></valid> in a config file would
result in a segmentation fault. Now an empty field results in the error
message:

cppcheck: Failed to load library configuration file 'mycfg.cfg'. Bad attribute value '""'

* Add support for valid for floating point arguments

Previously, it was not possible to add valid ranges to floating point
arguments since it only handled integers. This made ranges not work well
for floating point arguments since arguments were cast to integers
before the ranges were handled.

Fix this by using doubles instead of integers if the argument is a float.
Add some tests for this and make sure errors are printed with enough
precision (somewhat arbitrarily chosen).

Note that it is still only possible to add integer ranges (i.e. -1:1).

* Add support for floats in configuration valid range

Now that it is possible to handle decimal arguments, there is no reason
to not allow non-integer ranges. Take care to not allow broken
configurations.

* Move check to within if-clause

* Move asin{,f,l} and acos{,f,l} input checks to config file
2018-07-15 22:47:56 +02:00
PKEuS 009287f912 Set version to 1.84.99/1.85 dev 2018-06-25 21:03:43 +02:00
Daniel Marjamäki a21c05edfe 1.84: Set versions
[ci skip]
2018-06-10 22:21:57 +02:00
Matthias Krüger 4c8bb9ac6f fix a few typos 2018-05-14 13:11:59 +02:00
Daniel Marjamäki 74b1d1deb6 manual: updated documentation for --template and --template-location 2018-04-23 13:38:15 +02:00
Daniel Marjamäki 7176632bc6 manual: Document suppressions 2018-04-11 12:50:02 +02:00
PKEuS 32a2060f14 Set version to 1.83.99/1.84 dev
Updated copyright year in version.h
2018-04-02 15:21:37 +02:00
Daniel Marjamäki b4924e59da manual: updated MISRA chapter. The rule texts cant be extracted directly from the PDF anymore. 2018-04-01 22:57:04 +02:00
Daniel Marjamäki 7260be81a6 Update version 2018-03-31 21:25:29 +02:00
Daniel Marjamäki e1c7507204 manual: fixed documentation for <location> 2018-03-28 15:14:48 +02:00
fu7mu4 428d067f19 Cppcheck_ja.ts is updated (#1099)
* update to 1.82

* update cppcheck_ja.ts
2018-02-25 13:50:03 +01:00
Daniel Marjamäki 28a44e25bc Manual: Added a chapter about misra 2018-01-21 16:43:47 +01:00
Daniel Marjamäki 2f508c0bba 1.82: Updated versions 2018-01-14 16:25:17 +01:00
Sebastian b538db60df Fixed typo 2017-12-19 11:06:26 +01:00
Sebastian a6983dd279 Manual: Fix sizeof reference to strncpy config (#1016)
Because the configuration for strncpy contained sizeof by error, the example was no longer correct.
Replaced with a reference to memccpy which uses sizeof.
2017-12-12 10:54:42 +01:00
amai2012 2f2172e1a7 #8178 Remove all references to XML version 1 2017-11-22 10:49:59 +01:00
PKEuS a29b33b833 Set version to 1.81.99/1.82 dev 2017-10-07 23:22:31 +02:00
Daniel Marjamäki cebf34e718 1.81: Set versions 2017-10-07 12:55:36 +02:00
Daniel Marjamäki 7cd920f9d4 Manual: Added a getting started chapter for the GUI 2017-08-12 23:09:13 +02:00
PKEuS 9558877458 Set version to 1.80.99/1.81 dev 2017-07-30 08:48:47 +02:00
Daniel Marjamäki baedfa6718 1.80: Set versions 2017-07-29 12:55:53 +02:00
Matthias Krüger 531278e075 manuals: remove remaining occurrences of --append 2017-05-14 12:27:44 +02:00
PKEuS fda1f67da6 Set version to 1.79.99/1.80 dev 2017-05-14 10:07:38 +02:00
Daniel Marjamäki e5e5a5e4b8 1.79: Set version 2017-05-13 11:25:16 +02:00
PKEuS 47570f5791 Set version to 1.78.99/1.79 dev 2017-04-05 11:24:26 +02:00
Daniel Marjamäki 2eda59eb72 Update version 2017-04-01 11:03:45 +02:00
PKEuS 92414b923a Library: Support variadic functions which are not a formatstr-function 2017-03-14 17:41:34 +01:00
Matt Johnson 6bf77955bd Example of ignoring multiple directories
Add documentation for showing how to ignore multiple directories.
Also highlight the fact that the -i option does not currently work in conjunction with the --project option.
2017-01-06 13:16:06 +09:00
PKEuS 8ba9ce4924 Set version to 1.77.99/1.78 dev 2017-01-01 11:58:39 +01:00
Daniel Marjamäki bf5fa90952 updated version info 2016-12-31 18:35:08 +01:00
Matthias Krüger ecc91ba914 fix a couple of issues in shell scripts found by codacy. 2016-12-25 00:43:47 +01:00
PKEuS e417e15567 Set version to 1.76.99/1.77 dev 2016-10-09 10:33:03 +02:00
Daniel Marjamäki 0afe745c94 1.76: Update version 2016-10-08 18:40:36 +02:00
Daniel Marjamäki 2d4f0980cb manual: describe new --project handling 2016-08-13 11:52:45 +02:00
Daniel Marjamäki 7966306171 manual: moved '</section>' 2016-08-06 18:58:12 +02:00
Daniel Marjamäki 2f1c80560a 1.75: Set versions 2016-08-06 11:47:27 +02:00
Daniel Marjamäki 63540bc114 manual.docbook: add <strz/> and <const/> 2016-07-30 16:23:03 +02:00
Daniel Marjamäki 4e338e952d manual.docbook: added documentation about <not-bool> and <pure> 2016-07-29 23:09:01 +02:00