Commit Graph

15 Commits

Author SHA1 Message Date
Daniel Marjamäki 55433fce40 Library: added bufferSize parameters 2019-03-20 19:26:57 +01:00
Daniel Marjamäki 14528bcf25 Library: allowed values for the buffer-size attribute: malloc/calloc/strdup 2019-03-20 06:46:55 +01:00
Sebastian 19e9e42dd7
Library: Enhance minsize configuration and allow simple values. (#1736)
Some POSIX and Windows functions require buffers of at least some
specific size. This is now possible to configure via for example this
minsize configuration: `<minsize type="value" value="26"/>`.
The range for valid buffer size values is 1 to LLONG_MAX
(9223372036854775807)
2019-03-17 14:22:26 +01:00
Daniel Marjamäki 18668a52b9 Library: Added buffer-size attribute for <alloc> 2019-03-17 10:55:15 +01:00
Sebastian 9a5fcddb5d
Library configuration: Enable configuring the direction of arguments. (#1717)
This enhances the library configuration so the direction of function
arguments can be specified (in, out, inout).
isVariableChangedByFunctionCall() uses this information now to avoid
guessing.
2019-03-01 15:47:08 +01:00
Sebastian d7e219043a
Library configuration validation: Enhance relaxng file (arg elements) (#1698)
Make sure that the elements of function->arg contain no duplicates.
Except for 'minsize' which can be specified zero to many times.
2019-02-26 14:00:54 +01:00
Sebastian 6a3e1eeef7
Library configuration validation: Enhance relaxng file, fix *.cfg files. (#1685)
This fixes https://trac.cppcheck.net/ticket/8985 at least for the
function configuration.
Errors in configuration files found by the new relaxng file are fixed.
2019-02-22 15:31:52 +01: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
Sebastian 80c2074ea7
cppcheck-cfg.rng: Allow return value by reference (#1077) 2018-02-06 08:33:20 +01:00
Daniel Marjamäki 62b84e31ab ValidateCFG: Fix 'valid' pattern 2017-07-28 19:46:55 +02:00
Daniel Marjamäki 7875054f36 Fixed #8078 (cppcheck-cfg.rng outdated) 2017-07-23 12:09:41 +02:00
Daniel Marjamäki 5ee6e082e8 cppcheck-cfg.rng: more strict minsize type value 2015-01-31 10:48:11 +01:00
Daniel Marjamäki 9deffc088d cppcheck-cfg.rng: more strict about values 2015-01-31 08:08:39 +01:00
Daniel Marjamäki 0c89afcc48 cppcheck-cfg.rng: more strict about 'format' and 'valid' 2015-01-29 07:28:40 +01:00
Daniel Marjamäki 7d0f5ad7c1 cfg: added cppcheck-cfg.rng schema that cfg files can be validated against 2015-01-28 07:39:08 +01:00