Commit Graph

17224 Commits

Author SHA1 Message Date
Sebastian eabe5787ba Add windows configuration tests (#1053)
Implemented tests for the following windows configurations (more will
follow):
-Semaphore usage
-lstrcat function configuration
-_countof macro configuration
-Mutex usage
-Library usage (LoadLibrary, GetProcAddress, ...)
2018-01-24 20:05:16 +01:00
Daniel Marjamäki 96e387a486 Fixed #8351 (segmentation fault on objective C code) 2018-01-24 18:06:11 +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
IOBYTE 558e0757c2 Fix simplifyTypedef crash on lambda. (#1054) 2018-01-24 15:04:33 +01:00
Daniel Marjamäki 0f561d0ed6 Fix crashes for garbage code, found by fuzzing 2018-01-24 13:53:03 +01:00
IOBYTE 4710d80a40 Fix #5766 (FP: typedef array throws off parser) (#1052)
* Fix #5766 (FP: typedef array throws off parser)

* Fix travis build.
2018-01-24 09:51:22 +01:00
Sebastian 26ff750848 windows.cfg: Add Mutex function configurations (#1051) 2018-01-24 09:50:05 +01:00
Daniel Marjamäki 6e8184f7cc cert.py: Added test for EXP46 2018-01-23 22:43:29 +01:00
Daniel Marjamäki ce44a5805c astyle formatting
[ci skip]
2018-01-23 18:15:37 +01:00
Daniel Marjamäki 8eae9cdd60 cert.py: Added testcases for EXP42 and fixed the code a little 2018-01-23 17:18:47 +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 402807b3b0 daca2.py Minor fix: fomat string argument (found by Codacity) (#1037)
* daca2.py Minor fix: fomat string argument (found by Codacity)

* daca2.py: Change print call to logging.critical call
2018-01-23 13:05:07 +01:00
amai2012 bddea350d3 Ignore generated files from man/ subfolder 2018-01-23 11:39:19 +01:00
amai2012 fcbe88ad2f Move test files to subfolder 2018-01-23 11:33:13 +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
IOBYTE e6d285d3ca Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) (#1046) 2018-01-22 08:06:56 +01:00
Daniel Marjamäki 512b9f512c Refactoring whole program analysis for CheckUninitVar and CheckNullPointer 2018-01-21 22:56:46 +01:00
IOBYTE 3159d151d3 Fix symbol database crash on template type aliases by ignoring them. (#1045) 2018-01-21 21:22:26 +01:00
Daniel Marjamäki 351b382a7b Null pointers: Whole program analysis 2018-01-21 19:51:15 +01:00
orbitcowboy 5b145c3ef6
Merge pull request #1044 from orbitcowboy/master
tokenize: simplify empty string creation string("")->string().
2018-01-21 18:23:18 +01:00
Daniel Marjamäki 28a44e25bc Manual: Added a chapter about misra 2018-01-21 16:43:47 +01:00
Daniel Marjamäki 84fda14684 GUI: cleanup settings dialog interface 2018-01-21 16:42:46 +01:00
Martin Ettl 17a54681b8 tokenize: simplify empty string creation string("")->string(). 2018-01-21 16:36:57 +01:00
Alexey Eryomenko 913fdf44b6 member access operators are allowed inside the embedded SQL block when (#1043)
passing arguments for a query
2018-01-21 15:58:12 +01:00
PKEuS 2b3def6be1 Windows Installer: Added missing addons and cfgs 2018-01-21 12:19:38 +01:00
Daniel Marjamäki ea63e52d98 UninitVar: Improved function/method matching in whole program analysis 2018-01-21 10:40:35 +01:00
Daniel Marjamäki 55b3004000 misra.py: minor tweaks 2018-01-21 10:39:18 +01:00
IOBYTE 5673348215 Fixed #8350 (False positive: enum class static_cast to int is treated as non-primitive when type inference is used) (#1042) 2018-01-21 07:26:37 +01:00
orbitcowboy ec0cc4e29c templatesimplifier: Removed redundant local string variable. (#1041) 2018-01-20 22:26:48 +01:00
orbitcowboy bf201328d1
Merge pull request #1039 from orbitcowboy/master
checkstring: Cleanup not needed variable.
2018-01-20 14:59:01 +01:00
Simon Martin b4f32206af Ticket #8337: Fix false positive in copy constructor detection. (#1040) 2018-01-20 14:46:09 +01:00
Daniel Marjamäki 6f2d4361df Misra: Integration of MISRA in the GUI. The misra addon can now extract the rule texts from the PDF. 2018-01-20 14:13:09 +01:00
Daniel Marjamäki 0a70b8794c astyle formatting
[ci skip]
2018-01-19 23:26:28 +01:00
Martin Ettl 9816358e8b Cleanup not needed variable. 2018-01-19 22:41:51 +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
Simon Martin 8878e6dd0d Ticket #8333: Properly report a syntax error for functions with invalid parameter types. (#1030) 2018-01-18 08:51:35 +01:00
Sebastian d08709d10f windows.cfg: Add Semaphore function configuration (#1038) 2018-01-18 03:39:15 +01:00
amai 594561b9ab #8344 Codacy: Ignore issues in tests/cfg/*.c*. Add codacy configuration file 2018-01-18 03:35:52 +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
Daniel Marjamäki c7c9b3cd65 Fixed Cppcheck warning about using const reference to avoid data copying 2018-01-15 22:31:15 +01:00
Daniel Marjamäki a0a04be011 Fix Cppcheck warning about mismatching argument names 2018-01-15 22:25:55 +01:00
Daniel Marjamäki b08c1868bc Fixed Cppcheck warning 2018-01-15 22:03:23 +01:00
Daniel Marjamäki c331a10fa7 Refactorings, and try to ensure that analyzer info is stored/loaded properly 2018-01-15 19:12:31 +01:00
Daniel Marjamäki f2b2e87fb6 Uninitialized Variables: some additional tweaks. Try to fix Travis 2018-01-15 17:35:21 +01:00
Daniel Marjamäki 100887429d Uninitialized variables: Whole program analysis for function calls 2018-01-15 15:54:09 +01:00