Commit Graph

741 Commits

Author SHA1 Message Date
Martin Ettl 1df0ac15a3 windows.cfg: Added support for _toupper() and _tolower(). 2018-02-25 13:30:12 +01:00
Sebastian 51fce24d95 std.cfg: Add offsetof configuration (#1097) 2018-02-23 18:49:52 +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 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 2ab347606a std.cfg: Improved support for some std::ofstream functions. 2018-02-20 22:36:45 +01:00
orbitcowboy 31399e556b std.cfg: Improved configuration for ptrdiff_t. 2018-02-20 01:00:12 +01:00
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
orbitcowboy b73d4ce62e wxwidgets.cfg: There is no need to use the return value from wxMenu::Append(). 2017-10-20 11:01:37 +02:00
orbitcowboy 589ce19822 Added support for std::ios::clear. 2017-10-18 14:16:36 +02:00
orbitcowboy f1e5f64690 wxwidgets.cfg: Added support for wxMenu:Append(). 2017-10-17 10:59:23 +02:00
orbitcowboy 51eb4ffe9b std.cfg: Added support for std::string::reserve(). 2017-10-15 11:22:42 +02:00
orbitcowboy a886f4f649 std.cfg: Added support for std::string::erase(). 2017-10-15 11:17:17 +02:00
orbitcowboy db787369b9 #8243: Changed order of includes. Moved mathlib include at first place. 2017-10-14 16:30:10 +02:00
Daniel Marjamäki 81beb47e5c std.cfg: Added std::...::insert configurations 2017-10-13 15:39:08 +02:00
orbitcowboy 3c96924c56 std.cfg: Improved support for std::string::resize(). 2017-10-13 10:22:59 +02:00
orbitcowboy 43de937a4e Removed not needed <use-retval/> from std::string::resize(). 2017-10-13 10:15:53 +02:00
orbitcowboy 8160cc2fc6 std.cfg: Improved support for find, std::string functions. 2017-10-13 09:58:23 +02:00
orbitcowboy 3eb84fa980 std.cfg: Warn when parameters of std::swap() are not initialized. 2017-10-11 15:54:49 +02:00
orbitcowboy dc2aff42a8 std.cfg: Added support for std::string::rfind(). 2017-10-11 15:50:59 +02:00
orbitcowboy 5bc61e35a0 std.cfg: Added support for std::swap. 2017-10-11 13:12:00 +02:00
Daniel Marjamäki 29a0dfc152 std.cfg: add configuration for std::string::find_first_of and std::string::find_last_of 2017-10-11 08:33:12 +02:00
Daniel Marjamäki 247810a186 qt.cfg: split configuration for QSettings::setValue and QSettings::value 2017-10-11 08:30:10 +02:00
Daniel Marjamäki 7f9571c4e6 std: added std find methods 2017-10-10 22:15:56 +02:00
Daniel Marjamäki 4009f11475 qt: Add configurations for QSettings::setValue, QSettings::value 2017-10-10 22:05:00 +02:00
Daniel Marjamäki 917317ad3d cppcheck-lib.cfg: fix invalid XML 2017-10-10 11:27:54 +02:00
Daniel Marjamäki 4afa8ef9d7 cppcheck-lib.cfg: Added cfg file for internal use 2017-10-10 11:25:30 +02:00
orbitcowboy ee6e4c3ccd std.cfg: Fixed FP in std::string:swap(). 2017-10-07 00:49:09 +02:00
orbitcowboy c978e66936 std.cfg: Added support for std::string:swap(). 2017-10-07 00:46:34 +02:00
orbitcowboy 702a213175 std.cfg: Added support for std::vector::at(). 2017-10-06 17:02:25 +02:00
orbitcowboy 4b4796a35f std.cfg: Added support for std::string::push_back(). 2017-10-06 16:51:10 +02:00
orbitcowboy 91202c47e6 windows.cfg: Added more returnValue-types. 2017-10-05 11:55:27 +02:00
orbitcowboy cbc95c5662 gnu.cfg: Added more returnValue-types. 2017-10-05 11:45:46 +02:00
orbitcowboy 1a4c25243c posix.cfg: Added more returnValue-types. 2017-10-05 11:38:11 +02:00
orbitcowboy beb9223b6f std.cfg: Added more returnValue-types. 2017-10-05 10:23:48 +02:00
orbitcowboy f3d5e526d0 std.cfg: Added more returnValue-types. 2017-10-05 09:58:12 +02:00
orbitcowboy 0d888ba82d std.cfg: Added more return value types. 2017-10-03 09:39:43 +02:00
orbitcowboy c133e1d6f3 std.cfg: Added more returnValue-types. 2017-10-02 19:15:38 +02:00
orbitcowboy e9b4cbbd87 std.cfg: Added more returnValue-types. 2017-10-02 17:01:10 +02:00
Alexander Mai 8d4c2d3145 Fix typo 2017-09-26 20:59:23 +02:00
orbitcowboy 9647793af9 wxwidgets.cfg: Added support for some wxStaticBoxSizer functions. 2017-09-21 14:47:24 +02:00
orbitcowboy 7e6aeb6394 wxwidgets.cfg: Added support for some wxBoxSizer functions. 2017-09-21 14:37:42 +02:00
orbitcowboy fbb5c3b942 wxwidgets.cfg: Added support for some wxSpinCtrlDouble functions. 2017-09-21 11:29:59 +02:00
orbitcowboy c0f92b2409 posix.cfg: Added support for tcsendbreak. 2017-09-19 21:25:19 +02:00
orbitcowboy 7a56cfbb66 windows.cfg: Added support for more functions. 2017-09-19 21:17:15 +02:00
orbitcowboy c4e2ca2996 posix.cfg: Added support of ioctl. 2017-09-19 21:12:03 +02:00
orbitcowboy 6d69845737 posix.cfg: Added support for some <termios.h>-functions. 2017-09-19 15:10:37 +02:00
Daniel Marjamäki b9b47809f9 Fixed #8197 (iscast: '(b)&1' is not a cast) 2017-09-08 22:52:16 +02:00
orbitcowboy 7e92535b59 std.cfg: Improved support for std::ios std::ios_base std::ofstream and std::ostream functions. 2017-09-08 16:43:40 +02:00
orbitcowboy 27be75b224 std.cfg: Improved support for returnValue types for some math functions. 2017-09-05 16:27:02 +02:00
orbitcowboy 94c1809f26 std.cfg: Improved support for returnValue types for some math functions. 2017-09-05 16:01:33 +02:00