Commit Graph

684 Commits

Author SHA1 Message Date
orbitcowboy 2defdb7d4c wxwidgets.cfg: Added more deprecated functions. 2018-02-14 09:53:40 +01:00
Sebastian 6a3dc6ad45
Qt library: Add some function configurations (#1086) 2018-02-12 08:36:50 +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
Daniel Marjamäki 7b3898f0f4 astyle formatting
[ci skip]
2018-02-08 21:58:43 +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 80c2074ea7
cppcheck-cfg.rng: Allow return value by reference (#1077) 2018-02-06 08:33:20 +01:00
orbitcowboy ff3c0993ac std.cfg: Fixed FP for wcsxfrm(), mentioned in #6306. 2018-02-05 22:13:08 +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
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 6b5805041b std.cfg: Fixed remaining functions found to be redundant (#1055)
[std::]strtoimax and [std::]strtoumax:
They were nearly completely duplicates, i removed the ones with
less/missing configuration.
std::basic_string::empty:
It was found to be redundant because very likely someone forgot to
change "empty" to "clear" when copy&pasting the function names. The
empty function in all these clear functions makes no sense, and the
clear function also was missing.
std::queue::empty and std::array:empty:
They were both twice in the same function name list.
std::string::size, std::wstring::size:
They were already configured with many other size functions above.
std::basic_string::size:
This entry was twice in the same function name list directly one after
another. Very likely one of them should be the length function, which
does simply the same but was missing in the std.cfg.
2018-01-24 15:31:55 +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 a4deca3c98 posix.cfg: Remove redundant entries (#1049)
I carefully removed the duplicate/redundant entries with less/missing
configuration, so no information is lost.
2018-01-22 17:21:07 +01:00
Sebastian 4dbeffd615 std.cfg: Fix redundant function names (#1050)
This fixes some more redundant function configurations. Seems like they
are the result of copy & paste errors.
2018-01-22 17:18:36 +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
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
Sebastian d08709d10f windows.cfg: Add Semaphore function configuration (#1038) 2018-01-18 03:39:15 +01:00
Sebastian b5b84d1737 gnu.cfg Remove redundant function and resource configurations (#1036)
The epoll_* function and resource configurations somehow where added
twice.
This removes all duplicates (they have the same
attributes/configuration).
2018-01-16 17:13: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 2e2f8a00d6 posix.cfg: Fix getprotobynumber configuration (#1034)
It seems to be a copy & paste error.
The comment, the return value, the warn entry and the rest of the
configuration suggest that this must be the getprotobynumber function
configuration and not the getservbyport configuration which would be
redundant as it is configured a bit later.
2018-01-16 10:46:30 +01:00
Sebastian 6bd524baaf std.cfg: Fix copy&paste error or typo (#1033)
* Fixed copy&paste error or typo

It should be std::sinf here. std::sinl is described directly in the next function description and does not make sense here because of the return type.

* std.cfg: Fix another copy&paste error or typo

It should be std::tanf here.
2018-01-16 08:36:04 +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 a01c6c95eb std.cfg: Added missing non-namespace configuration for stoi()-like functions. 2017-12-15 21:42:39 +01:00
orbitcowboy c799206c73 windows.cfg: Fixed FN for some strncpy functions. 2017-12-14 15:43:15 +01:00
orbitcowboy d63897ff21 posix.cfg: Added support for stpncpy(). 2017-12-08 21:36:54 +01:00
orbitcowboy cdeb7fb25f posix.cfg: Added support for wcpncpy. 2017-12-08 21:28:48 +01:00
orbitcowboy b14146b853 std.cfg: Improved configuration of wcsncpy. 2017-12-08 21:21:26 +01:00
orbitcowboy 928727534a posix.cfg: Improved configuration for bcopy(): Warn for potential buffer access out of bounds issues. 2017-12-08 14:53:14 +01:00
orbitcowboy 77c43f2d24 #8293: Applied fix from versat. 2017-12-08 09:33:54 +01:00
Sebastian 27151f5014 MS SAL config: add more defines for annotations (#1006)
Add annotations which are not so well documented, but could be/are used
in custom code.
2017-11-29 08:25:43 +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
Daniel Marjamäki 1e870762a3 std.cfg: open/save with GUI 2017-11-12 15:17:58 +01:00
Daniel Marjamäki 1699775c3c std.cfg: Save from GUI 2017-11-12 15:11:37 +01:00
Daniel Marjamäki 511d14a051 astyle
[ci skip]
2017-11-05 17:56:24 +01:00
Daniel Marjamäki 4d8f069907 Renamed pro c sql to embedded sql 2017-11-03 21:04:12 +01:00
Daniel Marjamäki 4f6f1e20dd Hide Pro*C SQL simplification. Use pro_c_sql.cfg library file if this is wanted. 2017-11-03 13:02:29 +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