Commit Graph

371 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 45a3bf6f6f manual.docbook: no changes. just reformatting. 2016-07-29 23:06:43 +02:00
PKEuS dec839ea79 Manual: Described file0 attribute in XML output and the relationship between <not-null/> and <not-uninit/> 2016-07-27 15:50:04 +02:00
PKEuS e2a04c508c Manual: Refactorized chapter about libraries
- Reordered sections
- Describe more features
2016-07-27 15:28:35 +02:00
PKEuS 321d2aeafb Set version to 1.74.99/1.75 dev 2016-06-07 19:19:58 +02:00
Daniel Marjamäki e7f1318d4b 1.74: set version 2016-06-05 18:21:33 +02:00
PKEuS 7ff90e7fae Set version to 1.73.99/1.74 dev 2016-04-22 16:55:19 +02:00
Daniel Marjamäki b6d3aefba6 1.73: Set versions 2016-04-08 20:46:59 +02:00
fu7mu4 02fcbb0ea0 use more recent document to translate 2016-02-02 23:32:11 +09:00
fu7mu4 879f8f9664 fix japanese sentense and add literal tags 2016-02-02 00:07:41 +09:00
fu7mu4 2c81789178 add short description 2016-02-01 23:35:22 +09:00
Daniel Marjamäki 094f49b1c2 Merge pull request #770 from fu7mu4/man-ja
translate manual.docbook in Japanese
2016-01-31 14:47:12 +01:00
fu7mu4 485403f07e translate manual.docbook in Japanese v 0.01 2016-01-31 20:01:51 +09:00
PKEuS f47e05b6a7 Set version to 1.72.99/1.73 dev 2016-01-10 10:10:33 +01:00
Daniel Marjamäki 890ceea3bf 1.72: Set version 2016-01-09 14:41:54 +01:00
Daniel Marjamäki 26c8c0e09d manual: Added information about platform configuration 2016-01-09 10:23:17 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
PKEuS 80c89e7a38 Set Version to 1.71.99/1.72 dev 2015-11-15 09:57:57 +01:00