Commit Graph

92 Commits

Author SHA1 Message Date
orbitcowboy 02adb60f08 test std.cfg: Added a regression test for std::vsprintf(). The first argument is allowed to be a null pointer. 2019-11-11 09:29:16 +01:00
orbitcowboy f59a2b491d #9455: Added a test case. 2019-11-05 14:00:50 +01:00
versat 094caf31ac std.cfg: Remove redundant configurations for vector::(push|pop)_back()
Add tests in std.cpp to verify that a configuration for the functions
exists.
2019-10-18 12:40:10 +02:00
Sebastian 8eea046e5b
std.cfg: Add support for std::fill_n() (#2273)
Reference: https://en.cppreference.com/w/cpp/algorithm/fill_n
2019-10-18 12:24:57 +02:00
Sebastian 5615da4547
std.cfg: Add configuration and tests for std::bind() (#2207)
TODO:
Somehow Cppcheck fails to print an ignoredReturnValue message when the
return value is not used (see ticket 
https://trac.cppcheck.net/ticket/9369 )
2019-09-24 12:16:13 +02:00
Paul Fultz II ba037837c9 Track lifetime across multiple returns
This will now warn when doing something like this:

```cpp
template <class T, class K, class V>
const V& get_default(const T& t, const K& k, const V& v) {
    auto it = t.find(k);
    if (it == t.end()) return v;
    return it->second;
}
const int& bar(const std::unordered_map<int, int>& m, int k) {
    auto x = 0;
    return get_default(m, k, x);
}
```

The lifetime warning is considered inconclusive in this case.

I also updated valueflow to no tinject inconclusive values unless `--inconclusive` flag is passed. This creates some false negatives because library functions are not configured to not modify their input parameters, and there are some checks that do not check if the value is inconclusive or not.
2019-09-11 19:25:09 +02:00
orbitcowboy 1994cbbb9c std.cfg: Improved configuration for mbrlen() and extended test cases. 2019-08-27 08:18:19 +02:00
Sebastian 0934577dda
Library configuration: function argument direction fixes and enhancements (#1722)
* std.cfg: Add further argument directions (in, out, inout).

* testlibrary.cpp: Add test for function argument direction configuration.

* std.cfg: runastyle and add some more direction configurations.

* library.h: Add documentation for function argument direction enum.

* Do not use "direction" library information for pointer arguments.

Also fix further unmatched uninitvar messages in std configuration
tests.

* std.cfg: Add more argument direction configurations.

* test/cfg/std.c: Add test for argument direction configuration.

* astutils.cpp: Only ignore pointer arguments for out/inout arguments.

* library.h: Use suggested documentation for argument direction enum.
2019-03-04 22:57:40 +01:00
Daniel Marjamäki 5087f15035 Travis: Try to fix 'make checkcfg' 2019-03-02 19:38:11 +01:00
Sebastian 3427e61383
std.cfg: Add support for std::string::assign() (#1660)
Reference: https://en.cppreference.com/w/cpp/string/basic_string/assign
2019-02-11 13:40:36 +01:00
orbitcowboy 611eb81302 Fixed checkcfg: test/cfg/std.cpp:2904:error:uninitvar:Uninitialized variable: s 2018-12-23 18:09:55 +01:00
Daniel Marjamäki ec89c7b1b8 Travis: redundantCopy is not detected at the moment 2018-11-24 11:27:27 +01:00
orbitcowboy b4aa04db41 std.cfg: Added returnValue calculation for isless(), islessgreater() etc. 2018-11-20 16:58:33 +01:00
orbitcowboy 54c5d09ed3 test:std.cpp: Removed duplicate include <csetjmp>. 2018-10-06 00:23:14 +02:00
orbitcowboy ef82477d11 std.cfg: Do not take the return value of std::locale::global() into account. 2018-05-30 16:04:40 +02:00
orbitcowboy 5b6e6db376 test std.cfg: Added more test cases for strcat() functions. 2018-05-27 10:16:02 +02:00
Sebastian b53c4b2032 std.cfg: Add std::vector function configurations and tests (#1180) 2018-04-19 16:41:25 +02:00
Sebastian a36dad918a std.cfg: Add std::make_pair() (#1165) 2018-04-11 19:16:55 +02:00
orbitcowboy ef62207ada std.cfg: Added more tests for some std::vector functions. 2018-04-11 17:21:26 +02:00
Sebastian 3fc53eb122 std.cfg: Add std::[w]string::compare() with tests (#1162) 2018-04-10 21:07:39 +02:00
Daniel Marjamäki b10dd5d21e 2 TODOs are fixed 2018-03-19 11:02:58 +01:00
Daniel Marjamäki 58034dee86 Fixed #8076 (unmatched suppression when calling ./runtests.sh (test/cfg)) 2018-01-10 15:52:06 +01:00
U-SAMS\Alexander a8e12a6f29 Fix&cheat to make config test pass on cygwin 2017-05-03 11:41:37 +02:00
Matthias Krüger 65846efb6b test/cfg/std.cpp fix 'make checkcfg', std::vector needs to have <vector> #included 2017-03-06 16:59:17 +01:00
orbitcowboy e3d879e43d std.cfg: Improved support for some std::wstring functions. 2017-03-06 16:40:49 +01:00
Daniel Marjamäki 302bf925df Remove test/cfg/std.cpp test that fails 2017-03-06 12:39:08 +01:00
Daniel Marjamäki d535f17489 testing std::string and std::vector configuration a little 2017-03-05 22:23:45 +01:00
Daniel Marjamäki ecc59859e1 Don't simplify _Bool in TokenList 2017-03-04 11:13:28 +01:00
Daniel Marjamäki a8424bcb54 Test get/getline/read/readsome configuration in std.cfg 2017-03-04 08:56:37 +01:00
orbitcowboy 75124317e9 std.cfg: Added returnValue support for iswblank(). 2016-11-04 14:03:48 +01:00
Daniel Marjamäki 18f466a880 Test std::for_each 2016-11-02 10:01:56 +01:00
Daniel Marjamäki fd67bbf2d3 Test std::count and std::count_if 2016-11-02 09:57:35 +01:00
Daniel Marjamäki 12319d705e Try to fix 'make checkcfg' 2016-11-02 09:50:37 +01:00
Daniel Marjamäki b90a17f64f Test std::all_of, std::any_of, std::none_of 2016-11-02 09:29:15 +01:00
Daniel Marjamäki 6e762659c0 Test std::find_if and std::find_if_not 2016-11-02 09:13:54 +01:00
Daniel Marjamäki 0e9810b7f6 CheckStl: validation of iterators returned from functions 2016-11-01 14:08:42 +01:00
Daniel Marjamäki 476789c1a7 Remove unused variable in test 2016-11-01 12:44:31 +01:00
Daniel Marjamäki 7f71ad8360 Test std::find() 2016-11-01 12:25:23 +01:00
Daniel Marjamäki 7242e661ef checkcfg: add missing inline suppression for ignoredReturnValue of abs() 2016-10-18 22:35:54 +02:00
orbitcowboy 87409ea6b3 Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read. 2016-08-25 19:17:07 +02:00
Daniel Marjamäki e8182395f7 Fix 'make checkcfg' by adding inline suppressions when obsolete functions are used. 2015-11-22 17:52:47 +01:00
Martin Ettl 12b4bf75e0 std.cfg: Fixed false negatives regarding uninitialized variable usage and added test cases. 2015-09-30 13:10:31 +02:00
Martin Ettl 0b782853fe Imroved std.cfg and added more test cases. 2015-09-30 12:45:40 +02:00
Martin Ettl 4fcd324ccd Improved testing of std.cfg regarding <arg nr=any> configured functions and added more test cases. 2015-09-30 12:18:56 +02:00
Martin Ettl c64f9cf9b1 #7012: Fixed FP in std.cfg by explicitly definining the first parameter of snprintf. 2015-09-29 21:33:39 +02:00
Martin Ettl 7476f0d1c2 std.cfg: Added support for wmemcmp() and corresponding test cases. 2015-09-23 22:46:36 +02:00
Martin Ettl 34dcf1182c test/cfg: Deactivated a test case in std.cpp, which tests std::string::find (three parameter version). It cases the travis build to be failing. 2015-09-22 20:54:25 +02:00
Martin Ettl 10da5d6d2f std.cfg: Added configuration for std::string:find. 2015-09-21 23:01:51 +02:00
Martin Ettl 39622417b1 Improved std.cfg and added coressponding test cases to test/cfg. 2015-09-18 23:57:20 +02:00
Martin Ettl 841ad5462d test/cfg: Improved std.cfg and added corresponding test cases. 2015-09-18 23:02:51 +02:00