From 3407f3e932326d952d64b7bb5d1e4fac43fa85bd Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 25 May 2018 11:50:12 +0200 Subject: [PATCH] windows.cfg: Added test cases for CreateThread(). --- cfg/windows.cfg | 1 + test/cfg/windows.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 8095ac734..3412e793c 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -3268,6 +3268,7 @@ HFONT CreateFont( + diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index c46a31246..ea688a7bb 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -715,3 +715,53 @@ void oppositeInnerCondition_SUCCEEDED_FAILED(HRESULT hr) } } } + +/*HANDLE WINAPI CreateThread( + _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, + _In_ SIZE_T dwStackSize, + _In_ LPTHREAD_START_ROUTINE lpStartAddress, + _In_opt_ LPVOID lpParameter, + _In_ DWORD dwCreationFlags, + _Out_opt_ LPDWORD lpThreadId +);*/ +HANDLE test_CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, + SIZE_T dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPDWORD lpThreadId) +{ + // Create uninitialized variables + LPSECURITY_ATTRIBUTES uninit_lpThreadAttributes; + SIZE_T uninit_dwStackSize; + LPTHREAD_START_ROUTINE uninit_lpStartAddress; + LPVOID uninit_lpParameter; + DWORD uninit_dwCreationFlags; + + // cppcheck-suppress leakReturnValNotUsed + // cppcheck-suppress uninitvar + (void) CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, uninit_dwCreationFlags, lpThreadId); + // cppcheck-suppress leakReturnValNotUsed + // cppcheck-suppress uninitvar + (void) CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, uninit_lpParameter, dwCreationFlags, lpThreadId); + // @todo uninitvar shall be reported + // cppcheck-suppress leakReturnValNotUsed + (void) CreateThread(lpThreadAttributes, dwStackSize, uninit_lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); + // cppcheck-suppress leakReturnValNotUsed + // cppcheck-suppress uninitvar + (void) CreateThread(lpThreadAttributes, uninit_dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); + // @todo uninitvar shall be reported + // cppcheck-suppress leakReturnValNotUsed + (void) CreateThread(uninit_lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); + + // cppcheck-suppress leakReturnValNotUsed + // cppcheck-suppress nullPointer + (void) CreateThread(lpThreadAttributes, dwStackSize, 0, lpParameter, dwCreationFlags, lpThreadId); + + // cppcheck-suppress leakReturnValNotUsed + // cppcheck-suppress invalidFunctionArg + (void) CreateThread(lpThreadAttributes, -1, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); + + // no warning shall be shown for + return CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); +}