Commit Graph

244 Commits

Author SHA1 Message Date
orbitcowboy 360823203f windows.cfg: Ensure the return value is taken into account for memory (re)-allocation functions. 2019-03-01 08:58:53 +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
orbitcowboy 7b5c010c31 windows.cfg: Added support for more interfaces. 2019-02-13 08:10:50 +01:00
orbitcowboy f5edc221f8 windows.cfg: Added support for MAKEINTRESOURCE-macros. 2019-02-12 13:05:41 +01:00
orbitcowboy 2727a959b2 windows.cfg: Added missing <use-retval/>-tags for strcmp-functions. 2019-02-04 11:54:24 +01:00
amai2012 8e85aef4ea Add more interfaces 2019-02-03 22:13:30 +01:00
orbitcowboy acebfac176 Added missing <use-retval/>-tag to strdup()-like functions. In case the return value is not taken in account, a logical error is revealed. 2019-02-03 20:38:33 +01:00
amai2012 2515b015ea Improve configuration for bind() 2019-01-25 10:47:36 +01:00
orbitcowboy cdae767bd8 windows.cfg: Added support for some constants from WinBase.h 2019-01-16 15:54:18 +01:00
orbitcowboy 705fa1820c windows.cfg: Added support for some constants from winnt.h and WinBase.h 2019-01-16 15:51:14 +01:00
orbitcowboy 270bceb1b6 windows.cfg: Added support for some return flags from GetHandleInformation(), ref.: https://msdn.microsoft.com/en-us/library/ms724329%28v=vs.85%29.aspx 2019-01-16 14:53:02 +01:00
amai2012 97bf5de133 Add more Windows (Microsoft) macros and a few lines of related test code 2019-01-08 21:15:04 +01:00
amai2012 58b8cef822 Add a few more macros to windows.cfg 2019-01-08 13:40:58 +01:00
Daniel Marjamäki 2ba5302e90 Fixed #8909 (false positive: (style) Variable 'li.LowPart' is assigned a value that is never used.) 2019-01-06 11:09:59 +01:00
Sebastian 79d9c5b283
windows.cfg: Enhance support for IO/IOCTL functionality (#1532) 2018-12-20 14:43:48 +01:00
Sebastian f8b8597a9b
windows.cfg: Add support for CreateFileA and CreateFileW (#1529)
References:
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilea
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew
2018-12-19 20:20:05 +01:00
orbitcowboy 7bf5cc1ce7 windows.cfg: Added support for _finite() and _finitef(). 2018-12-06 08:54:21 +01:00
orbitcowboy ef77452444 windows.cfg: Added support for _putenv() and _wputenv(). 2018-11-27 13:36:39 +01:00
orbitcowboy 18c234e277 windows.cfg: Add support for _getche() and _getwche(). 2018-11-26 14:34:40 +01:00
orbitcowboy e18c846ed9 windows.cfg: Added support for _gettch() and _getch(). 2018-11-26 13:53:13 +01:00
Sebastian c74ec34da8 windows.cfg: Add _TCHAR platform type. (#1291)
_TCHAR is simply the same as TCHAR. Defined in tchar.h.
More information about it:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/0073fa7b-5cf5-469c-978f-2961f9d4ecb2/tchar-vs-tchar?forum=vcgeneral
2018-06-20 10:25:39 +02:00
orbitcowboy 5ad1b2bdd1 windows.cfg: Added some error codes from WinInet.h: Error codes Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385465(v=vs.85).aspx. 2018-06-13 15:33:26 +02:00
orbitcowboy 77d4601fee windows.cfg: Added System Error Codes (0-15999) Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681384(v=vs.85).aspx 2018-06-13 15:20:39 +02:00
orbitcowboy e029fe016a windows.cfg: Added constants from Winerror.h: COM Error Codes (VOLMGR, BCD, VHD, SDIAG) Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/dd542650(v=vs.85).aspx 2018-06-13 10:16:05 +02:00
orbitcowboy efe652f034 windows.cfg: Added constants from Winerror.h: COM Error Codes (FWP, WS, NDIS, HyperV) Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/dd542649(v=vs.85).aspx 2018-06-13 10:11:13 +02:00
orbitcowboy 3383fc6938 windows.cfg: Added Winerror.h: COM Error Codes (Security and Setup) Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/dd542646(v=vs.85).aspx 2018-06-13 09:55:11 +02:00
orbitcowboy 284da2f72e windows.cfg: Added more constants from Winerror.h: COM Error Codes (STG, RPC) Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/dd542645(v=vs.85).aspx 2018-06-13 09:40:08 +02:00
orbitcowboy c1668ff294 windows.cfg: Added more COM error constants. 2018-06-13 08:44:29 +02:00
orbitcowboy 4d99300339 windows.cfg: Added COM Error Codes (WPN, MBN, P2P, Bluetooth) from https://msdn.microsoft.com/en-us/library/windows/desktop/hh404142(v=vs.85).aspx 2018-06-12 15:39:08 +02:00
orbitcowboy 8354a75f66 windows.cfg: Added COM Error Codes (UI, Audio, DirectX, Codec) from Winerror.h. Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/hh404141(v=vs.85).aspx 2018-06-12 15:27:05 +02:00
orbitcowboy 4a81f6be9a windows.cfg: Added support for some constants from PortableDevice.h. Ref.: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319335(v=vs.85).aspx 2018-06-12 11:29:51 +02:00
orbitcowboy d9f9bdda73 windows.cfg: CreatePen() removed not required <leak-ignore/>-tag. 2018-06-08 17:04:09 +02:00
orbitcowboy 64ce5dfece windows.cfg: Added support for CreatePen(). 2018-06-08 15:57:11 +02:00
orbitcowboy d10788164a windows.cfg: Added support for _locale_t 2018-06-08 14:41:56 +02:00
orbitcowboy 7bb806c22b windows.cfg: Added support for CLSTX constants which are defined at https://msdn.microsoft.com/en-us/library/windows/desktop/ms693716(v=vs.85).aspx. 2018-06-08 14:33:13 +02:00
orbitcowboy cb2880e7c1 windows.cfg: Added support for _mbsncpy_s_l() and _mbsncpy_s(). 2018-06-07 15:35:00 +02:00
orbitcowboy c31503557d windows.cfg: Added support for _wcsncpy_s_l(). 2018-06-07 15:24:26 +02:00
orbitcowboy cc0f3f6cec Formatted code, there are no functional changes [ci skip]. 2018-06-06 11:15:47 +02:00
amai2012 3619aece02 Add support for umask functions 2018-06-06 10:59:34 +02:00
orbitcowboy 74b18d7fd9 windows.cfg: Added support for _strncpy_s_l(). 2018-06-04 16:58:09 +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 53c53db312 windows.cfg: Added support for _mbscat_s(). 2018-05-28 21:52:44 +02:00
orbitcowboy 601b3f888d windows.cfg: Added more COM Error codes (Generic) Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd542643(v=vs.85).aspx. 2018-05-28 21:34:12 +02:00
orbitcowboy 0f1eb0a9b2 windows.cfg: Added missing COM macros, defined at https://msdn.microsoft.com/en-us/library/windows/desktop/dd542715(v=vs.85).aspx. 2018-05-28 15:35:40 +02:00
orbitcowboy 4414bb0f1e windows.cfg: Added support for some error codes. Ref. https://msdn.microsoft.com/en-us/library/windows/desktop/dd542643(v=vs.85).aspx. 2018-05-28 10:21:36 +02:00
orbitcowboy 75e28e46c5 windows.cfg: Added support for _mbscat(). 2018-05-28 10:08:11 +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
orbitcowboy c07abdd382 windows.cfg: Added more constants from Rpcdce.h. 2018-05-24 16:00:06 +02:00
orbitcowboy 18b452111f windows.cfg: Added constants from Rpcdce.h. 2018-05-24 15:54:01 +02:00
orbitcowboy df8a5966bb windows.cfg: Added constant definitions from AccCtrl.h 2018-05-24 15:49:28 +02:00
orbitcowboy 792d5a7cf4 windows.cfg: Added missing COM macros, defined at https://msdn.microsoft.com/en-us/library/windows/desktop/dd542715(v=vs.85).aspx. 2018-05-24 15:27:40 +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
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
orbitcowboy 3ad8fa5288 windows.cfg: Improved support for more types. 2018-05-16 16:26:40 +02:00
Sebastian 748f50cf85
windows.cfg: Add 32/64 bit time related functions and types. (#1236)
Fix declaration comments for _localtime32_s() and _localtime64_s().
Add functions _time32 and _time64, and types __time32_t and __time64_t.
References: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64
2018-05-16 12:42:50 +02:00
orbitcowboy 4e38627a3d windows.cfg: Improved support for Windows types (ref. https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx ). 2018-05-16 09:16:12 +02:00
orbitcowboy 98e64e76f7 windows.cfg: Improved support for Windows types (ref. https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx ). 2018-05-16 00:23:58 +02:00
orbitcowboy 3e3a8af267 windows.cfg: Improved support for Windows types (ref. https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx ). 2018-05-16 00:09:45 +02:00
orbitcowboy d0089fe305 windows.cfg: Added missing PFLOAT definition. 2018-05-15 09:43:28 +02:00
Sebastian 9e623b15b1
windows.cfg: Add SetFilePointer() function configuration (#1167) 2018-04-12 16:09:11 +02:00
Sebastian c39a3e3f1c
windows string macros: Handle _T, _TEXT and TEXT internally, add tests (#1163)
Remove TEXT() macro from windows.cfg and handle it internally where it
can be correctly simplified (Ansi vs. Unicode).
Also add handling of _TEXT() macro which is just a synonym for _T().
Add tests to verify correct function and macro simplification.
2018-04-12 08:52:31 +02:00
versat 8aa71d62a0 Revert "windows.cfg: Add macros _TEXT() and _T() (#1161)"
This reverts commit 9db64ca934.
2018-04-11 08:37:15 +02:00
Sebastian 9db64ca934
windows.cfg: Add macros _TEXT() and _T() (#1161) 2018-04-10 18:39:59 +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 e38ec41ded
windows.cfg: Add some commonly used macros (#1127) 2018-03-22 08:31:50 +01:00
Sebastian 8cff60b461
windows.cfg: Add missing documentation and returnValue types (#1125)
Additionally a few minor issues were fixed.
2018-03-19 16:18:48 +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
orbitcowboy c31c54f1a4 wxwidgets.cfg: Improved support to for some wxSizerItem functions. 2018-03-05 00:25:47 +01:00
Martin Ettl 6af8aa63f6 windows.cfg: Improved support for _tolower()/_toupper() functions. 2018-02-25 16:38:29 +01:00
Martin Ettl 1df0ac15a3 windows.cfg: Added support for _toupper() and _tolower(). 2018-02-25 13:30:12 +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
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 c62abee07a
windows library: Add _malloca/_freea and _alloca configuration with tests (#1071) 2018-01-30 16:40:38 +01:00
Sebastian 30b9391461
windows library: Enhance Event function configuration, add tests (#1064) 2018-01-29 14:08:56 +01:00
Sebastian 26ff750848 windows.cfg: Add Mutex function configurations (#1051) 2018-01-24 09:50:05 +01:00
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