Commit Graph

279 Commits

Author SHA1 Message Date
orbitcowboy 55ff7c0823 test std.cfg: Updated tests for strncpy_s(). 2018-05-31 11:23:54 +02:00
orbitcowboy c7993c38b5 bsd.cfg: Added support for strlcat(). 2018-05-30 16:47:00 +02:00
orbitcowboy d412c3908f test std.cfg: Fixed introduced regression. 2018-05-30 16:30:00 +02:00
orbitcowboy 39feb150c0 std.cfg and windows.cfg: Added support for wcscat_s() and _tcscat_s(). 2018-05-30 16:25:09 +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 d06eb3eb8f std.cfg: Added support for strcat_s() (since C11). 2018-05-30 14:30:26 +02:00
orbitcowboy 53c53db312 windows.cfg: Added support for _mbscat_s(). 2018-05-28 21:52:44 +02:00
orbitcowboy 75e28e46c5 windows.cfg: Added support for _mbscat(). 2018-05-28 10:08:11 +02:00
orbitcowboy 5b6e6db376 test std.cfg: Added more test cases for strcat() functions. 2018-05-27 10:16:02 +02:00
orbitcowboy 3407f3e932 windows.cfg: Added test cases for CreateThread(). 2018-05-25 11:50:12 +02:00
orbitcowboy d7c8c46c10 test std.cfg: Improved testing for strcat() and wcscat(). 2018-05-25 08:36:47 +02:00
Sebastian 8b94bfaf0a
windows.cfg: Add macros SUCCEEDED() and FAILED(). (#1264)
Somehow the opposite inner condition is not detected when macros are used. I created this ticket: https://trac.cppcheck.net/ticket/8596
2018-05-24 14:52:32 +02:00
orbitcowboy 3311307227 windows.cfg: Added test cases for toupper/tolower functions. 2018-05-24 10:05:56 +02:00
Sebastian aa3722feea
windows.cfg: Add lstrlen() configuration and tests. (#1239)
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms647492(v=vs.85).aspx
2018-05-17 15:43:01 +02:00
Daniel Marjamäki 21ab5c7591 Removed the generated cfg tests, these are not used. 2018-05-16 07:09:08 +02:00
Sebastian 50aa3620da
posix.cfg: Add minsize to readlink[at] function configurations (#1216) 2018-05-09 18:20:45 +02:00
Sebastian b370861bed test/cfg/std.c: Cleaning up function names and redundant tests (#1198)
Make the names of uninitvar_* functions consistent and fix typos.
Remove completely redundant functions/tests. Combine according tests if
they are not completely redundant.
2018-05-01 07:33:43 +02:00
Sebastian 6208ee4af1 std.cfg: Add asctime_s function configuration with tests (#1191)
* std.cfg: Add asctime_s function configuration with tests

* std.cfg: Remove redundant/not needed not-bool attributes.
2018-04-27 23:51:16 +02:00
Sebastian 038064436d std.cfg: Fix minsize configuration for vsprintf (#1188)
minsize with argvalue for arg 2 which is a char pointer makes no sense.
Changing it to minsize with strlen for arg 2 results in false positives
(and i think false negatives too).
In std.c a test with a valid vsprintf usage is added that would result
in a FP when minsize with strlen for arg 2 would be used.
2018-04-25 02:52:19 +02:00
orbitcowboy e76f1e70e8 Added tests for invalidFunctionArg. 2018-04-23 12:54:49 +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
orbitcowboy 270635eb1f wxwidgets.cfg: Improved support for wxString to number conversion functions. 2018-04-07 20:27:02 +02:00
orbitcowboy 6e21d5ab84 wxwidgets.cfg: Added support for wxAtoi, wxAtol and wxAtof. 2018-04-04 21:29:55 +02:00
orbitcowboy e3977f7e51 Formatted test/cfg files and updated 'runastyle' script. The generated test files are exclued, since they are not style-compliant. 2018-03-31 13:49:47 +02:00
orbitcowboy d7072136dc wxwidgets.cfg: Added support for wxMenuBar::Append(). 2018-03-31 13:34:40 +02:00
orbitcowboy 43aac4696e wxwidgets.cfg: Added support for more functions. 2018-03-31 13:23:12 +02:00
Sebastian 3c5777fbc6
windows library: Add config for some Local* functions (#1139)
Add configuration and tests for LocalAlloc, LocalFree and some other
Local* functions.
LocalReAlloc is currently not configured as an alloc/dealloc function
(like realloc is not configured in std.cfg), i am not sure how to
correctly configure it.
2018-03-29 20:47:22 +02:00
Sebastian d3284d5d54 std.cfg: Add strncpy_s and strncat_s (#1136) 2018-03-26 18:38:26 +02:00
Sebastian e38ec41ded
windows.cfg: Add some commonly used macros (#1127) 2018-03-22 08:31:50 +01:00
Daniel Marjamäki dfd8ef5d52 generate_cfg_tests: fix argument count 2018-03-19 20:46:55 +01:00
Daniel Marjamäki 7202787435 posix: remove function 'remove' that is also configured in std.cfg 2018-03-19 20:04:58 +01:00
Daniel Marjamäki 3af7aef3f0 update generated cfg tests (aca16e3) 2018-03-19 16:25:44 +01:00
Daniel Marjamäki 6b00ca33bd posix.cfg: Removed rename function as this is configured in std.cfg 2018-03-19 15:29:47 +01:00
Daniel Marjamäki 4e1ad40c87 update generated cfg tests (113f1ef) 2018-03-19 13:51:51 +01:00
Daniel Marjamäki 6e66150feb posix.cfg: update configuration for rename 2018-03-19 11:51:19 +01:00
Daniel Marjamäki f94a02a61e update generated qt.cfg tests 2018-03-19 11:51:03 +01:00
Daniel Marjamäki b10dd5d21e 2 TODOs are fixed 2018-03-19 11:02:58 +01:00
Daniel Marjamäki 0d3ddd85b1 updated generated cfg tests 2018-03-19 09:46:16 +01:00
Daniel Marjamäki e932c44ae6 generate cfg tests: updated NULL pointer testing 2018-03-18 19:04:17 +01:00
Daniel Marjamäki 0741c389c0 generated cfg tests: updates, most unmatched suppressions are removed now 2018-03-18 14:06:26 +01:00
Daniel Marjamäki c800ac5118 generate_cfg_tests: updating testing for not-null 2018-03-18 13:53:46 +01:00
Daniel Marjamäki 914eea7ed1 generated cfg tests: updated test files 2018-03-18 13:22:33 +01:00
Daniel Marjamäki cf180dcc6b add script to generate cfg tests 2018-03-18 13:03:19 +01:00
Sebastian 65c85cbb53
Windows library: Add intrinsics __noop and __nop (#1119) 2018-03-15 12:31:20 +01:00
Sebastian ed3cd2929e
Windows library: Enhance functions, add tests (#1117)
Enhance *Equal/*Compare/*Copy/*Move/*Zero/*Fill memory functions to
catch buffer access out of bounds errors and ignored return values.
Replaced some function configuration by according defines as it is done
in windows to avoid redundant (and error prone) configurations.
2018-03-14 15:01:37 +01:00
Sebastian 7ba9ab7e4c Gtk library: Add configuration to avoid syntax error, add test file (#1109)
Add configuration for G_UNLIKELY and G_LIKELY to avoid syntax errors
when these macros are used as condition without enclosing brackets.
Add test file to verify Gtk library configuration. Syntax check for the
test file is only done when Gtk+2.0 or Gtk+3.0 is found and working.
Tested on Cygwin and on Ubuntu 16.04.
2018-03-10 11:22:10 +01:00
Alexander Mai 70664e5857 Ensure wxWidgets installation is at least 2.9.5 2018-02-26 20:46:56 +01:00
Sebastian 346704b2e2
windows library: Mainly add socket functions, some other stuff and tests. (#1095)
Add Windows Socket 2 type/function configuration. There are still many
(microsoft specific) socket functions that are not yet configured.
Add configuration for GetUserName(), GetWindowText() and _fileno().
On Windows __wchar_t is a synonym for wchar_t, so an according define is
added.
2018-02-23 12:51:37 +01:00
amai2012 1c38b3aae7 Fix warning in test on Cygwin 2018-02-22 12:27:46 +01:00
Sebastian 1d14919649
wxwidgets: Fix syntax checking errors and warning (#1093)
wxDebugContext is only defined if wxUSE_DEBUG_CONTEXT is 1, so otherwise
just skip it for syntax checking because it will fail.
Change wxT to wxT_2 and add wxT_2 to the config to remove a warning
during syntax check and be more compatible with newer/older wxwidgets
versions.
Be more precise when replacing function like macros, fix redundant macro
definition for "_".
2018-02-21 12:20:56 +01:00
orbitcowboy 2ce8a3fc95 wxwidgets.cfg: Improved support for some deprecated functions. 2018-02-20 23:34:01 +01:00
orbitcowboy 2defdb7d4c wxwidgets.cfg: Added more deprecated functions. 2018-02-14 09:53:40 +01:00
Sebastian bbe9fad81d
std library: Resolve two TODOs (#1074)
First resolved TODO in std.c is obsolete since the "res" variable is used later
and there is therefore no warning issued.
Second resolved TODO in std.c: A warning for uninit variables is issued by
cppcheck, so this check can be enabled. Since assert() has no noreturn configuration
(currently a useful configuration is not really possible, see ticket 8329) the
check-library message is suppressed.
2018-02-12 16:42:23 +01:00
orbitcowboy 8ef56972da wxwidgets.cfg: Added more deprecated-functions. 2018-02-11 16:58:39 +01:00
Sebastian 9eb6d38c06 std library: Add tests for wide character string functions, fix config (#1085)
Add equivalent tests for the wide character string functions like they
are already done for the normal string functions.
Fixed some issues with the configuration of the wide character string
functions that arised through the tests and were already fixed for the
normal string functions.
2018-02-09 21:17:01 +01:00
Sebastian 170d60712f wxwidgets library tests: Add syntax checking, fix test file. (#1084)
For the syntax check g++ needs to know the wxWidgets include paths which
are retrieved via wx-config. If includes are missing or not working the
syntax check is skipped.
wxwidgets.cpp: Fixed syntax, includes and added code so the syntax check
does not fail if some special features are not present.
2018-02-09 20:34:15 +01:00
orbitcowboy dccf96cb7b wxwidgets.cfg: Added more deprecated functions. 2018-02-07 13:33:15 +01:00
orbitcowboy dea662891a wxwidgets.cfg: Added some functions from the deprecated wxWidets-list (http://docs.wxwidgets.org/trunk/deprecated.html). 2018-02-07 11:40:42 +01:00
Sebastian 14e45f9dcb
wxwidgets library: Fix/Enhance cfg, add test file (#1082)
Add test file for wxwidgets configuration, fix found issues and enhance
the cfg a bit:
Fix declarations in comments for wxLog* functions.
Merge the two wxTextFile::Create overloaded function configurations into
one that works for both now.
Removed use-retval attribute from wxBoxSizer::AddSpacer and
wxButton::SetDefault configuration since the functions have side effects
and there is no need to use the return value.
Add some function configurations, the macro _(str) and POD wxLogLevel.
2018-02-06 15:33:45 +01:00
Sebastian 2e5d7a8391 Fix #8381: false positives for swprintf_ and stprintf_s (#1080)
This fixes false positives because of wrong configuration in
windows.cfg.
Add tests in testio.cpp and test/cfg/windows.cpp to avoid regression.
2018-02-03 05:10:52 +01:00
Sebastian c235930539
windows library: Add function configurations with tests (#1079)
Add function configurations with tests for:
GetLocalTime, GetSystemTime, GetLastError, SetLastError,
AllocateAndInitializeSid, FreeSid, HeapAlloc, HeapReAlloc, HeapFree,
HeapSize, HeapValidate and GetProcessHeap.
test/cfg/runtests.sh: Enable --inconclusive for the windows tests to
avoid some issues in the future.
2018-02-02 11:28:54 +01:00
Sebastian 1ad22ae231 windows library: Add strlwr/strupr configuration, fixing tests (#1076)
Add configuration for the deprecated strlwr/strupr functions with
according warning.
test/cfg/windows.cpp: Added tests for strlwr and strupr. Moved function
call that does not return (FreeLibraryAndExitThread) to the end of the
function to fix analysis that was silently aborted at that point
(reported as issue #8378).
2018-01-31 17:43:19 +01:00
Sebastian 7b02b45a76 posix library: Add strtok tests (#1069)
* posix library: Add strtok tests

In the posix library there is the same configuration for strtok but a
warning is added.

* posix.cfg: Remove redundant configuration for strtok, add comment.
2018-01-31 10:58:30 +01:00
Sebastian c62abee07a
windows library: Add _malloca/_freea and _alloca configuration with tests (#1071) 2018-01-30 16:40:38 +01:00
orbitcowboy f5e6ef9fd2
checkio: Fixed potential usage of invalid iterator. (#1066)
* checkio: Fixed potential usage of invalid iterator.

* formatted the code.

A ticket about FN (invalidIterator1) is created at https://trac.cppcheck.net/ticket/8373
2018-01-30 08:43:15 +01:00
Sebastian 4b5e4f989a std config: Remove misspelled function "strbprk" (#1065)
Remove misspelled function configuration "strbprk" (also from the
tests). The correct function "strpbrk" is already configured and tested.
2018-01-29 17:28:44 +01:00
Sebastian 30b9391461
windows library: Enhance Event function configuration, add tests (#1064) 2018-01-29 14:08:56 +01:00
Sebastian e8a262a1f2
posix.cfg: Enable/Add fdopen tests (#1063)
* posix.cfg: Enable/Add fdopen tests

* posix.cfg: Add missing empty line
2018-01-29 11:19:31 +01:00
Sebastian eabe5787ba Add windows configuration tests (#1053)
Implemented tests for the following windows configurations (more will
follow):
-Semaphore usage
-lstrcat function configuration
-_countof macro configuration
-Mutex usage
-Library usage (LoadLibrary, GetProcAddress, ...)
2018-01-24 20:05:16 +01:00
Daniel Marjamäki ce44a5805c astyle formatting
[ci skip]
2018-01-23 18:15:37 +01:00
Sebastian b78d714037 posix.cfg: access(): Removed redundant configuration, added tests (#1048)
I intentionally removed the second access() configuraion because it was
missing the use-retval attribute. But calling access() without using the
return value is absolutely senseless.
I added tests to posix.c to verify the correct configuration of
access().
2018-01-22 14:54:14 +01:00
Daniel Marjamäki 0a70b8794c astyle formatting
[ci skip]
2018-01-19 23:26:28 +01:00
Sebastian de7aa8f513 Fix #7504: posix: open() was twice in configuration file (#1032)
* Fix #7504: posix: open() was twice in configuration file

This fixes ticket #7504: Problems with the open function were not always
detected because the open function was twice in posix.cfg and only the
second configuration was used by cppcheck. Like suggested now only
one configuration is used and the third parameter has a default value
and is thereby optional.
use-retval has been removed to avoid duplicate warnings because the
alloc/dealloc configuration already warns about unused retval.
According tests to verify that open is configured
correctly now have been added to test/cfg/posix.c.

* posix.cfg: open(): Add TODO for use-retval configuration
2018-01-18 13:56:36 +01:00
Daniel Marjamäki 58034dee86 Fixed #8076 (unmatched suppression when calling ./runtests.sh (test/cfg)) 2018-01-10 15:52:06 +01:00
versat cc435c3e92 Add missing tests for strncpy
Add tests for verifying that the bufferoverrun tests are correct.
2017-12-11 10:25:59 +01:00
Daniel Marjamäki 92673afc8f fixed 'make checkcfg' 2017-10-06 15:16:25 +02:00
Daniel Marjamäki e4676b70dd Remove wrong testcase test/cfg/windows.cpp, there is missing configuration for that given code 2017-10-06 14:42:19 +02:00
U-SAMS\Alexander a8e12a6f29 Fix&cheat to make config test pass on cygwin 2017-05-03 11:41:37 +02:00
Alexander Mai 14be611a7e Correct configuration to allow NULL as 2nd argument to read/write. Whether it's a legal value depends on the 3rd argument 2017-04-29 17:57:16 +02:00
Daniel Marjamäki 4175902e36 astyle formatting
[ci skip]
2017-04-26 18:42:34 +02:00
orbitcowboy 0b6c726439 posix.cfg: Do not allow the second parameter of read and write to be a NULL pointer. 2017-04-26 14:25:14 +02:00
Daniel Marjamäki 1422487769 astyle formatting
[ci skip]
2017-04-20 17:43:28 +02:00
Daniel Marjamäki efcf71a5dc qt.cfg: attempt to fix cfg test 2017-04-18 19:26:54 +02:00
Daniel Marjamäki 296f250caa qt.cfg: configure some QString methods 2017-04-18 19:21:34 +02:00
Daniel Marjamäki 01c5c2fc5b qt.cfg: Add reademptycontainer test 2017-04-18 18:47:35 +02:00
Daniel Marjamäki c229754a70 qt.cfg: Add configuration for QString 2017-04-18 18:04:27 +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 beb72c2583 Revert changes from 9cb0941df2. 2017-02-02 15:53:52 +01:00
orbitcowboy 9cb0941df2 std.cfg: Take the return value from fread() into account. 2017-02-02 13:33:06 +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
orbitcowboy 55ae961ac2 std.cfg and windows.cfg: Improved support for <use-retval/> for functions like ftell(), [f]get[w]c(). 2016-11-26 21:31:15 +01:00
orbitcowboy 8a0f856e95 Fixed regression in test/cfg/std.c introduced by b0d09926fb. 2016-11-26 21:14:31 +01:00