Commit Graph

215 Commits

Author SHA1 Message Date
Sebastian d46cd46d0f windows.cfg: Add _countof macro configuration (#1047)
By telling cppcheck about the Microsoft Windows _countof() macro it is
now able to detect out of bounds array accesses like this:
wchar_t buf[10];
for(size_t i = 0; i <= (_countof(buf)); ++i) {
buf[i] = L'\0'; // (error) Array 'buf[10]' accessed at index 10, which
is out of bounds.
}
2018-01-23 15:45:06 +01:00
Sebastian d08709d10f windows.cfg: Add Semaphore function configuration (#1038) 2018-01-18 03:39:15 +01:00
Sebastian 5e74012e81 windows.cfg: Fix redundant function configurations (#1035)
Detected some errors when checking for redundant function
configurations:
The functions that receive an additional argument "locale" have the
suffix "_l".
Sadly the MSDN shows wrong declarations that are missing the "_l", i
guess this caused the wrong names (I have reported it to Microsoft, but
do not expect that this is fixed soon).

The function configuration for GetModuleHandle* existed twice, i have
merged them, and it looks sane for me now.
2018-01-16 15:43:36 +01:00
Sebastian d0bbd0535f windows.cfg: Add lstrcat configuration (#1028)
On the MSDN there is a prominent warning to not use this function, so i
decided to add a warn entry. See
https://msdn.microsoft.com/de-de/library/windows/desktop/ms647487(v=vs.85).aspx
for details.
2018-01-12 21:41:23 +01:00
Sebastian dc1c60f97f windows.cfg: Add CRITICAL_SECTION handling functions. (#1023)
* windows.cfg: Add CRITICAL_SECTION handling functions.

* windows.cfg: Add missing function InitializeCriticalSectionEx

* windows.cfg: Fix missing not-uninit entry for DeleteCriticalSection.
2018-01-11 14:31:38 +01:00
Sebastian dc0bcce3c2 windows.cfg: Add *Event functions configuration (#1025) 2018-01-10 15:38:02 +01:00
versat 70fcf5af87 Fix windows.cfg: GetProcAddress needs use-retval
While it was good to remove use-retval from the LoadLibrary* functions,
it is still needed for GetProcAddress. A call of GetProcAddress without
using the return value does not make sense.
2018-01-05 17:22:33 +01:00
versat a1cc44eb21 windows.cfg: Add Load/FreeLibrary() functions 2018-01-05 11:22:36 +01:00
orbitcowboy c799206c73 windows.cfg: Fixed FN for some strncpy functions. 2017-12-14 15:43:15 +01:00
Sebastian e9815bd523 windows.cfg: Add Sleep and SleepEx (#1007)
Add configuration for Sleep and SleepEx on Windows.
Not sure how to implement that the functions do not return when the first parameter is INFINITE.
2017-11-29 08:22:13 +01:00
Marcel Raad 8b6c14aa48
windows.cfg: fix GetPrivateProfileString nullPointer FP
The first three arguments can be NULL.
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724353.aspx
2017-11-23 11:05:49 +01:00
pmisik 9c8b0c2c90 Workaround for syntax error on Microsoft specific __pragma keyword (#982)
__pragma is Microsoft specific keyword equivalent to C99 _Pragma operator
https://msdn.microsoft.com/en-us/library/d9x1s805.aspx
https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas

It seems cppcheck does not support _Pragma at the moment.

This change will fix syntax error on code that looks like this:

 #define MY_DEPRECATED_ENUM(X) X __pragma(deprecated(X))
enum myEnum
{
    myEnum_1 = 1,
    MY_DEPRECATED_ENUM(myEnum_2) = 2,
    myEnum_3,
    myEnum_4,
};
int main()
{
    myEnum a = myEnum_3;
    printf("%d", a);
    return 0;
}

This change was fiscussed here: https://sourceforge.net/p/cppcheck/discussion/general/thread/1808a46b/
2017-10-25 14:40:00 +02:00
orbitcowboy 91202c47e6 windows.cfg: Added more returnValue-types. 2017-10-05 11:55:27 +02:00
orbitcowboy 7a56cfbb66 windows.cfg: Added support for more functions. 2017-09-19 21:17:15 +02:00
Daniel Marjamäki b9b47809f9 Fixed #8197 (iscast: '(b)&1' is not a cast) 2017-09-08 22:52:16 +02:00
orbitcowboy bf9980b7e0 windows.cfg: Added more returnValue-types. 2017-08-03 09:57:12 +02:00
Daniel Marjamäki 7875054f36 Fixed #8078 (cppcheck-cfg.rng outdated) 2017-07-23 12:09:41 +02:00
Daniel Marjamäki 101303a179 Fixed #6513 (Resource leak: hSocket - false positive / enhancement needed) 2017-07-02 08:39:48 +02:00
Daniel Marjamäki 5fb59a8063 windows.cfg: reordering of podtypes and defines 2017-07-02 08:38:07 +02:00
Alexander Mai 389b4cdf99 Remove atrribute to cure FP. Run astyle 2017-05-29 20:04:34 +02:00
Alexander Mai 1225b4b25a Fix false positive 2017-05-03 16:34:20 +02:00
Alexander Mai 40a5f78154 Change attributes for 2nd arg of GetTempPath 2017-05-01 20:43:03 +02:00
Alexander Mai 765a9c8660 Remove attribute from _wfopen_s,_tfopen_s to avoid false positives 2017-05-01 19:28:24 +02:00
Alexander Mai df19d2ba5b Remove attribute from GetTempPath,GetTempPathW,GetTempPathA 2017-04-30 20:38:28 +02:00
orbitcowboy c44b055fc1 windows.cfg: Added support for CreateDirectory and RemoveDirectory functions. 2017-04-19 09:42:32 +02:00
orbitcowboy dd0158ee63 std.cfg and windows.cfg: Improved support for localtime functions. 2017-04-19 09:27:24 +02:00
orbitcowboy 16f9e1646c windows.cfg: Improved support for string compar functions. 2017-03-31 08:40:41 +02:00
orbitcowboy f31e2e6696 windows.cfg: Improved support for string-copy functions. 2017-03-31 08:25:56 +02:00
orbitcowboy 93816a63a8 windows.cfg: Improved support for stat() and fstat() functions. 2017-03-29 13:30:12 +02:00
orbitcowboy 6111b38ebb std.cfg and windows.cfg: Improved support for freopen-functions. 2017-03-19 18:23:31 +01:00
orbitcowboy e569d96169 windows.cfg: Added support for _tcsftime(). 2017-03-08 08:53:05 +01:00
orbitcowboy 0bd46ec831 windows.cfg: Added support for _strftime_l() and _wcsftime_l(). 2017-03-08 08:49:13 +01:00
orbitcowboy fef52f2ea1 windows.cfg: Added support for _mbsrchr(). 2017-02-23 13:43:30 +01:00
orbitcowboy b4733a76bd windows.cfg: Added missing _tcsclen_l() function name. 2017-02-23 13:25:50 +01:00
orbitcowboy 6ea520a561 windows.cfg: Added support for strlen()-functions. 2017-02-23 13:23:53 +01:00
orbitcowboy 245da75a2f windows.cfg: Added support for more strdup and malloc functions. 2017-02-23 08:56:13 +01:00
orbitcowboy 6db99d105f windows.cfg: Added support for FindFirstFileEx. 2017-02-22 15:52:39 +01:00
orbitcowboy 26f0ee6703 windows.cfg and gnu.cfg: Improved support for strtok-functions. 2017-02-22 10:27:05 +01:00
PKEuS 7de055361c windows.cfg: Added several functions 2017-02-07 19:08:24 +01:00
PKEuS ae444d7e78 windows.cfg: Added PostMessage() 2017-02-02 13:23:37 +01:00
orbitcowboy 00fd38967f windows.cfg: SetEnvironmentVariable() the second parameter is allowed to be NULL. 2016-12-22 13:46:12 +01:00
orbitcowboy df5c815b1b windows.cfg: Added support for _strnicmp() functions. 2016-12-22 11:19:01 +01:00
orbitcowboy daacc0959e windows.cfg: Updated comments. There are no functional changes. 2016-12-16 17:22:37 +01:00
orbitcowboy 227049a6b1 windows.cfg: Added support for _swap(). 2016-12-16 16:58:42 +01:00
orbitcowboy af1398900c windows.cfg: Improved support for _open() and _close() functions. 2016-12-06 13:50:45 +01:00
orbitcowboy 6829a8da14 posix.cfg and windows.cfg: Added support for memccpy(). 2016-12-05 16:46:49 +01:00
orbitcowboy 942b5cdc20 windows.cfg: Improved configuration by using <valid>-tags. 2016-12-05 10:43:07 +01:00
orbitcowboy afb962575b windows.cfg: Added support for _mbsstr(),_tcsstr() and _mbsstr_l(). 2016-12-02 09:06:02 +01:00
orbitcowboy df0f5e3f39 windows.cfg: Removed not needed <use-retval/> configurations. 2016-11-29 10:07:35 +01:00
orbitcowboy b964513611 windows.cfg: Added support for more functions like SetupDiGetClassDevs(). 2016-11-29 09:18:08 +01:00
orbitcowboy 7b1ed9f415 windows.cfg and posix.cfg: Added more <use-retval/> configurations. 2016-11-28 16:58:33 +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 83d0b42c66 windows.cfg: Ensure the return value of _wfopen_s() and _tfopen_s() is taken into account as well. 2016-11-26 16:25:19 +01:00
orbitcowboy 5b1f112195 windows.cfg: Added support for GetTempPath(). 2016-11-22 08:32:11 +01:00
orbitcowboy e94407fbce windows.cfg: Added support for more functions. 2016-11-18 11:28:34 +01:00
orbitcowboy d95a4d83bc windows.cfg: Added support for FindClose() and FindFirstFile(). 2016-10-27 09:36:33 +02:00
orbitcowboy 6b168aba14 windows.cfg: Added support for swprintf_s(). 2016-10-25 17:03:30 +02:00
orbitcowboy 4130207edc posix.cfg and windows.cfg: Added support for more functions like _popen(). 2016-10-21 11:43:01 +02:00
orbitcowboy 340af57028 windows.cfg: Added missing argument. 2016-10-21 09:52:45 +02:00
orbitcowboy 73facf927b windows.cfg: Added support for CreateWaitableTimer(), SetWaitableTimer() and WaitForSingleObject(). 2016-10-21 09:38:14 +02:00
orbitcowboy 56317fe884 windows.cfg: No real changes. Cleanup a comment. 2016-10-21 08:53:44 +02:00
orbitcowboy 1ab8628f1c Fixed #7766 by ignoring WINAPI in windows.cfg. 2016-10-20 13:23:15 +02:00
orbitcowboy 56e75e5776 std.cfg: Added support <returnValue> support for imaxabs(). windows.cfg: Added support for _abs64(). 2016-10-17 14:31:44 +02:00
orbitcowboy 90a8dd7cf3 windows.cfg: Added support for _mkdir and _wmkdir. 2016-08-29 13:45:38 +02:00
orbitcowboy 61d642cb06 windows.cfg: Added support for _rmdir, _wrmdir. 2016-08-29 11:59:59 +02:00
Daniel Marjamäki 789aef7fde Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking) 2016-08-19 17:36:27 +02:00
orbitcowboy 8253a18646 windows.cfg and std.cfg: Improved support for vs[n]printf functions. 2016-08-11 11:45:59 +02:00
orbitcowboy 16271ffe45 windows.cfg: Added support for SetStdHandle and GetStdHandle. 2016-08-09 11:16:09 +02:00
PKEuS 5c92c231b8 windows.cfg: SendMessage must not be <leak-ignore/> 2016-07-26 11:57:46 +02:00
PKEuS 3916cd628e windows.cfg: Fixed configuration of _tfopen_s/_wfopen_s ( 2016-06-02 09:41:01 +02:00
PKEuS 2d34acae71 Fixed configuration for fopen_s and similar functions (#7520) 2016-05-26 21:11:32 +02:00
PKEuS 9ea49d48d1 Added a bunch of functions to windows.cfg, fixed <dealloc> arg number for some functions 2016-05-22 18:57:09 +02:00
PKEuS 64d2fd2f57 Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503)
2016-05-22 17:19:14 +02:00
orbitcowboy d676022556 cfg: Added support for the Windows functions: DeleteFile() and _access(). 2016-05-20 15:19:41 +02:00
orbitcowboy 5095196530 cfg: Ignore return values of fopen_s functions. 2016-05-19 11:56:52 +02:00
orbitcowboy b1b0c920e3 Removed sprintf_s from windows.cfg. 2016-05-19 08:22:40 +02:00
orbitcowboy 46adf180d7 cfg: Added support for fopen_s and sprintf_s functions. Fixed a wrong tests. 2016-05-18 09:31:26 +02:00
orbitcowboy 41576ee8ec cfg: Added support for the Windows SetConsoleTextAttribute function. 2016-05-17 11:31:54 +02:00
orbitcowboy 2d1ab79d98 cfg: Added support for Windows functions PathIsDirectory,PathIsDirectoryA and PathIsDirectoryW. 2016-05-17 09:54:11 +02:00
orbitcowboy 53a37d6134 cfg: Added support for Windows function WideCharToMultiByte. 2016-05-17 09:35:30 +02:00
Pierre Schweitzer ade7138358 windows.cfg: Add CoTaskMemAlloc() and CoTaskMemFree() functions 2016-02-20 21:44:03 +01:00
orbitcowboy 82c663090e windows.cfg, posix.cfg: Added support for more functions. 2016-01-21 15:48:08 +01:00
orbitcowboy b6fd9e2509 posix.cfg and windows.cfg: Added support for more functions. 2016-01-12 17:00:33 +01:00
Martin Ettl 999da2877e windows.cfg: Added support for _stat() functions. 2016-01-11 20:25:44 +01:00
orbitcowboy 2b3a12866a windows.cfg and posix.cfg: Added support for more functions, found by selfchecking cppchecks code. 2016-01-11 14:54:01 +01:00
Martin Ettl d357229da5 windows.cfg: Improved support for strdup functions. 2016-01-08 11:30:39 +01:00
Martin Ettl 1cb01bae09 windows.cfg: Added support for _vsnprintf and _vsnwprintf functions. 2016-01-07 20:41:26 +01:00
PKEuS 37572dc109 Small refactorizations:
- Improved formatting of unhandled-char-constant message (Side-effect: fixes #7206)
- Replace nr="-1" by nr="any" in windows.cfg
2015-12-10 15:47:46 +01:00
orbitcowboy f84af529af Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects. 2015-11-25 11:02:32 +01:00
orbitcowboy 78bd49c2ba windows.cfg: Added strtok_s and wcstok_s 2015-11-25 09:53:10 +01:00
PKEuS 8d926d7328 Moved some simple WinAPI/MFC-specific simplifications to windows.cfg 2015-08-20 15:59:59 +02:00
Pierre Schweitzer f27c787c4f Handle HeapCreate()/HeapDestroy() API for Windows 2015-05-19 18:37:22 +02:00
orbitcowboy 524585f566 windows.cfg: Added support for more Comm functions. 2015-03-31 08:33:27 +02:00
orbitcowboy f7c724e3eb windows.cfg: Added support for more windows functions. 2015-03-30 16:25:36 +02:00
Alexander Mai 34a61e0883 Additions to windows.cfg. Fix compiler warning in test/cfg/posix.c 2015-03-08 15:21:50 +01:00
Alexander Mai b5f0eec44a #6559 Regression/ false positive: Return value of allocation function OpenFile is not stored. Add required definitions to windows.cfg, include afx_msg. Add test file test/cfg/windows.cpp to check windows configuration. Fix for gnu.cfg. FileLister now features a non-recursive mode. 2015-03-05 06:48:44 +01:00
Daniel Marjamäki 7e50d7a1d0 windows.cfg: Added INVALID_HANDLE_VALUE define 2015-01-31 11:03:49 +01:00
Robert Reif 42f709c09d Fixed #6229 (Move Windows builtin types __intXX to library) 2014-10-21 06:11:19 +02:00
Robert Reif e2f72b4cb1 Fixed #6215 (Move Windows platform types into library) 2014-10-19 07:34:40 +02:00
Daniel Marjamäki 44420bdbf1 cfg: formatted the cfg files with the runastyle script 2014-10-14 06:46:47 +02:00
PKEuS cbb8360b30 Added version attribute to .cfg files (#5928) 2014-09-29 16:26:17 +02:00
Pierre Schweitzer cd69b000c4 Add a few more types for Windows 2014-06-14 17:11:28 +02:00
Pierre Schweitzer 2a027039c7 Add Windows type sizes when possible 2014-06-13 23:17:01 +02:00
Pierre Schweitzer d055d9e3dc Add sign information for a few Windows types 2014-06-13 18:17:06 +02:00
Daniel Marjamäki 42c3b3c89d Library: Change range operator in validation pattern to ':' 2014-06-08 18:12:11 +02:00
PKEuS 35f644542e Added HeapReAlloc to windows.cfg (as suggested in #3155) 2014-05-22 11:07:44 +02:00
Daniel Marjamäki a9990bbe33 windows.cfg: add allocation functions that use free to dealloc. This reverts b13e3ac5. 2014-04-19 13:19:08 +02:00
Pierre Schweitzer a9e53026bd Work on windows.cfg: - Add more resource/memory functions - Complete the information about some functions 2014-04-09 10:30:57 +02:00
Pierre Schweitzer 26a2a9ea37 Complete a bit windows.cfg:
- Add two noreturn functions (BSOD ;-))
- Add debuggers routine for printing messages
- Fix two prototypes of CRT which were described as secure whereas they aren't
2014-03-30 18:37:08 +02:00
Daniel Marjamäki b13e3ac549 Fixed #5542 (False positive: Mismatching allocation and deallocation) 2014-03-09 11:45:48 +01:00
Pierre Schweitzer 22104cc617 Fix & complete windows.cfg (likely not exhaustive) 2014-02-12 16:55:51 +01:00
Alexander Mai 59d43de5e9 Fixed #3535 (Leaking socket) 2014-01-26 09:42:46 +01:00
Robert Reif f82a2cc6af windows.cfg: improved cfg for _s functions 2014-01-17 21:30:58 +01:00
PKEuS b775714e3d Moved several hardcoded function names in format string checking into libraries (std.cfg and windows.cfg).
Added support for loading a library in test suite.
2014-01-12 03:44:24 -08:00
Daniel Marjamäki c56a432e2d Add windows.cfg library file 2013-12-29 19:23:34 +01:00