Daniel Marjamäki
a733c9b603
Fixed #3914 (false positive null pointer dereference, assignment in conditional)
2012-07-23 10:05:55 +02:00
Zhao Qifa
188d2e143d
add a performance checker for const assignment
2012-07-22 09:17:00 +02:00
Ville Skyttä
7ab2f6a9fa
Spelling fixes.
2012-07-21 18:11:20 +02:00
Ettl Martin
4312d31b87
#3979 added todo testcases
2012-07-19 09:44:06 +02:00
Daniel Marjamäki
dc6c3228d7
Fixed #3834 (Preprocessor: -U doesn't work)
2012-07-18 20:57:00 +02:00
Daniel Marjamäki
17c27f51ff
Fixed #3791 (False positive: returnTempReference)
2012-07-18 07:22:29 +02:00
Edoardo Prezioso
aedaacba95
Don't report 'warning unknown pragma' message with GCC.
2012-07-18 00:48:45 +02:00
Daniel Marjamäki
a768b0e8b2
Fixed #3954 (Pointer reference memory leak false positive)
2012-07-17 16:28:34 +02:00
Daniel Marjamäki
d34924ba6d
Uninitialized variables: Fixed false positive when there is assignment in condition
2012-07-17 07:03:40 +02:00
Daniel Marjamäki
ddfc968028
Fixed #3891 (False positive 'Double deallocation:' due to ((void*)1))
2012-07-16 17:07:51 +02:00
PKEuS
2103811291
Refactorizations in testrunner:
...
- Removed unnecessary space characters
- Removed comments from test cases which are not preprocessed
2012-07-16 05:02:33 -07:00
PKEuS
7d33181fba
Refactorizations in testrunner:
...
- Avoid creation of std::string instances of static strings where possible in testrunner.
- Removed unnecessary include of tinyxml.h in testcppcheck.cpp
2012-07-16 04:17:14 -07:00
Daniel Marjamäki
a96ec0ad46
Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))
2012-07-16 07:28:59 +02:00
PKEuS
e9182f1fcc
Implemented support for 'using namespace std;': Add std:: prefix to names that are known to be in std namespace. Simplify namespace (std::)tr1:: if C++11 flag is set.
2012-07-15 02:05:19 -07:00
PKEuS
1e704edbd5
Message refactorization: checkio.h/cpp
2012-07-13 10:36:58 -07:00
PKEuS
41fecb2e6d
Fixed evaluation of redundant conditions ( #3972 )
2012-07-13 06:01:19 -07:00
PKEuS
247d820027
Fixed #3972 : Don't issue auto variable error when the address is assigned to a reference to a non-pointer.
2012-07-13 05:21:45 -07:00
PKEuS
4ed15d87b6
Properly fixed test failure and line numbers in uselessCallsEmpty error
2012-07-13 05:15:58 -07:00
Daniel Marjamäki
c6fdd2733b
Test 'Preprocessor: Proper fix for #3690 '
2012-07-13 13:04:10 +02:00
Daniel Marjamäki
e4ad193b40
Fixed #3690 (CppCheck is stuck on evaluating false preprocessor expression( = 0))
2012-07-13 11:28:45 +02:00
Daniel Marjamäki
aa4fe3a1e2
fixed unit test
2012-07-13 08:38:27 +02:00
Daniel Marjamäki
6018bb4636
Fixed #3442 (unmatchedSuppression can't be suppressed)
2012-07-13 08:29:49 +02:00
PKEuS
5a91d6a0f5
Check for useless calls of .empty() ( #3816 )
...
Messages from CheckStl::uselessCalls() only shown when correct severity is enabled.
2012-07-12 03:23:52 -07:00
Daniel Marjamäki
8dd5270be3
Preprocessor: skip preprocessor directives in the Preprocessor::validateCfg function
2012-07-11 21:20:31 +02:00
PKEuS
2bd1f1d8dc
Improved check: Sign checking in printf format string ( #3511 )
...
Removed some redundant code (already covered by token list simplifications and symboldatabase)
2012-07-11 10:46:35 -07:00
Daniel Marjamäki
4f4be79f20
Preprocessor: Fixed bugs in my #3643 fix
2012-07-11 18:29:33 +02:00
PKEuS
e8f4dce25f
Added check to CheckInternal: detect invalid patterns like "%typ%"
...
Replaced some Token::Match by Token::simpleMatch (suggestions of internal checks)
2012-07-11 08:45:16 -07:00
PKEuS
524df179af
Fixed (unexpected) compilation error: Cast argv to 'const char**'
2012-07-11 02:29:20 -07:00
PKEuS
0ea1124a19
Fixed warning of Intel Compiler:
...
- standard conformant main function in testrunner.cpp
Fixed warning of Intel and MSVC Compilers:
- commented out unused parameter
2012-07-11 01:26:32 -07:00
Daniel Marjamäki
17cf24ed34
Fixed #3643 (Preprocessor: Invalid configuration (macro is used in code))
2012-07-10 20:29:04 +02:00
PKEuS
68e19b33ff
Fixed parsing of C++11 initializatation in initializer list ( #3957 )
2012-07-10 06:15:11 -07:00
PKEuS
37d9d6fd7e
Improved parsing of C++11 initializer list ( #3956 ) in CheckClass::initializeVarList.
2012-07-10 05:47:51 -07:00
PKEuS
a93c47988c
Restored comment that was modified by accident.
2012-07-09 11:40:49 -07:00
PKEuS
4b3ee97f54
Fixed test failures.
2012-07-09 11:36:28 -07:00
PKEuS
b5589e41f9
Cleanup of VS10 solutions (As suggested by XhmikosR). Fixed problems:
...
- UNICODE set correctly
- Fixed path to pcre.lib; use external library directories
- Removed several unnecessary and redundant flags from projects
Thank you for your help, XhmikosR!
2012-07-09 08:09:54 -07:00
Edoardo Prezioso
fae40c4782
Change every C version of 'size_t' to C++ 'std::size_t'.
2012-07-09 13:30:18 +02:00
PKEuS
639f15645a
Message refactorization: checkbufferoverrun.cpp (2), checkclass.cpp, checkexceptionsafety.h
2012-07-09 02:11:05 -07:00
PKEuS
ed7e950671
Message refactorization: checkbufferoverrun.cpp
2012-07-08 06:51:24 -07:00
Daniel Marjamäki
848fd59cbd
Fixed #3913 (boundcheck, false positive continue in loop)
2012-07-08 14:34:47 +02:00
PKEuS
1032312fe1
Committed forgotten test64bit.cpp; tests should work again.
2012-07-08 05:28:17 -07:00
Daniel Marjamäki
bf98e952c1
Fixed #3927 (false positive: (error) Uninitialized variable: new)
2012-07-08 13:59:00 +02:00
PKEuS
0f1cb4c98c
Message refactorization: checkassignif.cpp, checkautovariables.cpp
2012-07-07 11:31:18 -07:00
PKEuS
43c060b630
Removed preprocessor directives from tests that aren't preprocessed before being tokenized.
2012-07-07 11:21:08 -07:00
Pino Toscano
5262ba16d9
Fixed #3947 (build failure if PATH_MAX is not defined)
2012-07-07 19:55:43 +02:00
Daniel Marjamäki
49198f52c4
Fixed #3934 (False positive for logical conjunction with enum and define)
2012-07-07 15:34:26 +02:00
PKEuS
d3c44c20ff
Refactorized checking of scanf field width specifiers ( #3946 ):
...
- Removed duplicate check
- Changed severity to portability, when a crash only happens with certain libc versions
- Fixed handling of * in format string (#3877 )
- Added support for [...] pattern
- Removed garbage from tests
2012-07-07 04:34:37 -07:00
PKEuS
dec4844c10
Define _WIN64 in VS10 solution when compiling for x64
2012-07-07 02:41:41 -07:00
PKEuS
2c9545f603
Fixed #3797 : _ is a valid character in suppression IDs
2012-07-06 09:16:43 -07:00
PKEuS
5caab6ba10
Fixed crash on garbage code ( #3870 )
2012-07-06 09:03:33 -07:00
Daniel Marjamäki
7122aeff58
Fixed #3617 (CLI: '-DMACRO' should be considered as '-DMACRO=1')
2012-07-05 19:35:41 +02:00
Daniel Marjamäki
f9da83f4b5
Fixed #3926 (false postive: (error) Uninitialized variable: exitpattern)
2012-07-03 18:52:23 +02:00
Robert Morin
25c1cc4c8e
Improve check: warn when comparing boolean value with < <= > >=. Ticket: #2617
2012-07-03 06:39:13 +02:00
Thomas Sondergaard
f72ddbb2e9
Fixed #3912 (Analysis failed)
2012-07-03 06:34:14 +02:00
Ettl Martin
7401104f45
#2773 added missing testcase
2012-07-02 10:01:37 +02:00
Daniel Marjamäki
325414e354
CheckLeakAutoVar: Updated error messages
2012-06-30 16:23:10 +02:00
Daniel Marjamäki
bb9f114d84
Fixed #3924 (False positive: Uninitialized variable (const pointer))
2012-06-30 12:12:36 +02:00
Daniel Marjamäki
cb7757f650
CheckUnusedVar: dont report false positives for extern variables
2012-06-28 17:22:56 +02:00
Daniel Marjamäki
2e3a08a8c1
Fixed #3916 (false positive: uninitialized variable when using assignment and , in rhs)
2012-06-27 20:44:19 +02:00
Daniel Marjamäki
9da3373876
Fixed #3919 (False positive: uninitialized variable (extern))
2012-06-26 18:28:41 +02:00
Daniel Marjamäki
0042ee7bc8
Fixed #3660 (False positive memleak (allocation function uses non-local variable))
2012-06-25 20:00:50 +02:00
PKEuS
f5c42660de
Fixed #3909 : Handle constructor syntax initialization.
2012-06-24 09:57:17 -07:00
Daniel Marjamäki
25b24d149f
Fixed #3910 (False positive: Variable is not assigned a value (pointerArray alias))
2012-06-24 16:54:37 +02:00
Daniel Marjamäki
8af044255d
Tokenizer: Added new function isFunctionParameterPassedByValue that check if a parameter is passed by value
2012-06-24 13:40:09 +02:00
Ettl Martin
8c39b95aae
#3873 added testcase to make sure false positive does not appear again.
2012-06-24 00:00:15 +02:00
Daniel Marjamäki
abde1d0ec1
added comment in test case
2012-06-23 20:20:11 +02:00
Daniel Marjamäki
72d24ab4b4
Fixed #3904 (false positive memory leak with linked list)
2012-06-23 20:15:58 +02:00
Daniel Marjamäki
162a430354
Fixed #3868 (false positive: (style) Same expression on both sides of '|'.)
2012-06-23 19:54:15 +02:00
Daniel Marjamäki
f59078fad9
Refactoring TestUninitVar. Added TODO test case.
2012-06-23 16:44:02 +02:00
Daniel Marjamäki
1e1b20d113
Refactoring TestUninitVar. Created TestUninitVar::uninitvar_return
2012-06-23 16:27:57 +02:00
Daniel Marjamäki
b6f4dbd067
Uninitialized variables: Fixed TODO assertion (related with ticket #3106 )
2012-06-23 16:06:20 +02:00
Daniel Marjamäki
d3ce3e78bd
Uninitialized variables: Added test case
2012-06-23 15:52:35 +02:00
Daniel Marjamäki
7f5950967e
Reviewed handling of >> in return statements in C files in UninitVar checking
2012-06-23 15:47:48 +02:00
Daniel Marjamäki
f0f69ed818
Reviewed handling of << and >> in C files in CheckUninitVar
2012-06-23 12:41:00 +02:00
Daniel Marjamäki
e2964c0c9e
Uninitialized variables: Fixed false negative when ? operator is used in rhs
2012-06-23 12:19:03 +02:00
Daniel Marjamäki
5de82c1c42
Updated arrayIndexOutOfBounds error message. Thank you Kimmo for the suggestion.
2012-06-23 09:51:32 +02:00
Daniel Marjamäki
4e98cb3ed9
Fixed #3907 (improve check: detect buffer overrun when using && or || in for loop)
2012-06-23 09:23:14 +02:00
Daniel Marjamäki
ac524c56ad
Reviewed handling of unknown types in ExecutionPathBufferOverrun
2012-06-23 08:15:59 +02:00
Robert Reif
dc4982115a
Improved checking of scanf format strings
2012-06-23 07:52:52 +02:00
Daniel Marjamäki
3db58bb57f
Reviewed C handling in CheckOther::clarifyCondition, never treat x<..> as a template in C files.
2012-06-23 07:29:49 +02:00
Daniel Marjamäki
d2dbaca24b
Reviewed handling of unknown types in C files in UninitVar
2012-06-22 19:57:07 +02:00
Daniel Marjamäki
abaa044e03
Reviewed handling of unknown types in CheckUninitVar
2012-06-22 16:39:39 +02:00
Daniel Marjamäki
354406441a
Fixed #3906 (false positive uninitvar for vector pointer)
2012-06-22 16:26:43 +02:00
Daniel Marjamäki
951da02f89
Reviewed handling of unknown types in C files in checkunusedvar
2012-06-22 15:59:41 +02:00
Daniel Marjamäki
8aba801360
Fixed #3800 (False negative: Self-assignement of variable declared as 'extern')
2012-06-22 11:23:50 +02:00
Daniel Marjamäki
935351c601
Fixed #3895 (Improve check: double deallocation not detected (if-else))
2012-06-22 09:10:30 +02:00
Daniel Marjamäki
3d0e090a13
Fixed #3899 (false positive: (error) Returning/using deallocated pointer fp)
2012-06-20 17:09:41 +02:00
Daniel Marjamäki
974225626d
Fixed #3901 (false positive: (error) Uninitialized variable: temp)
2012-06-19 20:07:39 +02:00
Daniel Marjamäki
ce5c38f52c
Fixed #3890 (False positive Uninitialized variable on returning default value on a class member)
2012-06-19 20:04:10 +02:00
Kimmo Varis
fe9e6130cf
Add general PRO file for console builds.
...
It is easier to maintain PRO files when we keep all the console-
build specific general options in one file. For example changes to
compiler options affect to all console builds.
2012-06-18 09:28:32 +03:00
Daniel Marjamäki
2f280332ef
Merge pull request #99 from kimmov/tests-generate-pri
...
Generate a test file listing with dmake.
2012-06-17 10:49:42 -07:00
Daniel Marjamäki
a37c3144ed
Fixed #3858 (Throw exception in destructor BUT inside a try-catch shouldn't be reported)
2012-06-17 14:33:18 +02:00
Daniel Marjamäki
62f92fe253
Fixed #3866 (false positive: memory leak (UNLIKELY))
2012-06-17 07:54:24 +02:00
Daniel Marjamäki
2481b80875
Code cleanup. Removed CheckLeakAutoVar::doubleDeallocationError since the same checking is already done by CheckOther::checkDoubleFree
2012-06-17 07:22:15 +02:00
Zachary Blair
fa2bca1e09
Ticket #3876 : Improved check by only bailing of loops that contain break or continue
2012-06-16 13:11:09 -07:00
Daniel Marjamäki
7d59d86ed6
Fixed #3893 (Improve check: Array index out of bounds not detected when down conting)
2012-06-16 17:44:51 +02:00
Daniel Marjamäki
89b1b4ea6e
Fixed #3892 (False positive: 'if (var >= 0.0) then if (var >= 0.0) always returns true
2012-06-15 16:54:02 +02:00
Daniel Marjamäki
f967142436
Fixed #3875 (Static member method called with class name is considered unused)
2012-06-14 22:04:21 +02:00
Daniel Marjamäki
5174f7ff5e
Fixed #3723 (Preprocessor evaluation order)
2012-06-14 21:47:03 +02:00
PKEuS
8b294a2d4f
Disabled C4512 in VS10 ( #3882 )
2012-06-14 09:39:31 -07:00
Daniel Marjamäki
4b6e1c6946
Fixed #3855 (false positive: (error) Instance of 'locale' object destroyed immediately)
2012-06-13 19:21:20 +02:00
Daniel Marjamäki
cc5e06b5d2
Fixed #3861 (uninitialized variables)
2012-06-13 19:09:51 +02:00
August Sodora
90f92250dd
Fixed #3618 (segmentation fault of cppcheck)
2012-06-12 21:07:17 +02:00
Daniel Marjamäki
54a66391d8
Fixed #3750 (false positive: C-style pointer casting)
2012-06-12 18:45:31 +02:00
Kimmo Varis
d1197315c1
Tests: Add generated testfiles.pri.
...
Add the generated testfiles.pri file. Previous commits modified
the dmake and test.pro to generate and use the testfiles.pri
containing listing of all source files with tests.
2012-06-11 22:11:29 +03:00
Kimmo Varis
734d4af007
Tests: Generate test file listing with dmake.
...
Use dmake to generate a test/testfiles.pri with all the files
containing tests. The testfiles.pri is included by the test/test.pro,
which compiles the test runner. This automates the test file listing
instead of former way to hand-edit the file list.
Fixes ticket #3885 (dmake needs to create a list of test files for qmake)
2012-06-11 22:05:55 +03:00
Daniel Marjamäki
08a3d0737e
Memory leaks: Write error message when deallocated pointer is returned
2012-06-11 18:28:31 +02:00
PKEuS
ef65202a79
Bugfix ( #3844 ): Added 3 missing files to testrunner
2012-06-11 03:55:33 -07:00
Zachary Blair
e2348560e4
Fixed Ticket #3876 (Error (double free) detected that can't possibly happen)
2012-06-10 17:50:31 -07:00
seb777
5b763a9f0a
Fixed #3579 (object destroyed immediately:False positive & negative)
2012-06-10 21:52:32 +02:00
Ettl Martin
c9cb492bc7
#3874 added missing testcase to avoid false positives
2012-06-10 18:36:19 +02:00
Daniel Marjamäki
160fa94a02
Visual Studio: Hide VS compiler warnings for '(char)0xff' and '(char)0xfe'
2012-06-10 15:51:56 +02:00
PKEuS
4b80e91145
Implemented support for building cppcheck lib into a dll
...
Updated VS9 solution
New VS10 solution that builds cppcheck into a dll used by cli and testrunner.
Functional changes and advantages of new solution:
- Share code between testrunner and cli; ability to share code with gui as well (not yet implemented)
- Files of /lib are no longer compiled twice (should improve build time on single core machines)
- Added configuration for building with PCRE support
- Executables are build into /bin (/bin/debug in debug mode) folder (Should no longer require rebuild when switching between debug and release)
- Completely x64 compatible (contains also x64-debug configuration now)
2012-06-10 05:19:09 -07:00
Daniel Marjamäki
171f570639
Handle UTF-16 files. Partial fix for ticket #2083
2012-06-10 11:00:27 +02:00
Daniel Marjamäki
905615e991
Fixed #3878 (Sign extension with unsigned char false positive)
2012-06-09 08:43:13 +02:00
PKEuS
c463d97386
Refactorization:
...
- Implemented consistent behaviour of Variable::typeStartToken/typeEndToken: Skip const and static on all variables.
- Simplified patterns containing "static|" or "const|" when matching typeStartToken.
2012-06-08 09:05:02 -07:00
Daniel Marjamäki
69846b2a06
Fixed #3872 ('char variables in bit operations' warning)
2012-06-08 17:24:54 +02:00
Daniel Marjamäki
c5da030674
Fixed #3869 (References to items in array result it 'Uninitialized variable' errors)
2012-06-08 16:17:55 +02:00
Daniel Marjamäki
2b3e5abef8
Fixed #3865 (Suspicious condition. The result of find is an iterator, but it is not properly checked.)
2012-06-07 19:33:18 +02:00
Daniel Marjamäki
74422e1258
Fixed TODO test case (replaced tabs with spaces in test code)
2012-06-06 13:37:56 +02:00
PKEuS
7c1b0a7602
Issue useInitializationList message only on variables of class types.
2012-06-06 03:03:51 -07:00
Ettl Martin
8a9d1048bf
#3370 changed testcase to TODO, because it is not fixed yet.
2012-06-05 09:36:23 +02:00
Daniel Marjamäki
3c103e520b
Fixed #3854 (false positive: (style) Variable '_S_c_name' is assigned a value that is never used)
2012-06-05 06:37:55 +02:00
Ettl Martin
c42b21c503
added additional tests to ticket #3862
2012-06-04 21:32:11 +02:00
Ettl Martin
1245abe094
added missing testcase for ticket #3370
2012-06-04 21:21:14 +02:00
August Sodora
e146591b5d
Fixed #3544 (segmentation fault of cppcheck)
2012-06-02 16:15:12 +02:00
Daniel Marjamäki
0cf2c2b327
Fixed #3862 (Double deallocation does not take throws into account)
2012-06-01 19:08:50 +02:00
Daniel Marjamäki
a823d29da3
Fixed #3809 (false positive: memory leak)
2012-06-01 19:01:19 +02:00
Daniel Marjamäki
d1b4bea304
Fixed #3807 (False positive: possible null pointer dereference)
2012-05-31 18:41:00 +02:00
Ettl Martin
d7c1907601
added tests for duplicated branches. Inspired by http://www.viva64.com/en/b/0149/ ( Comparision between PVS-Studio and cppcheck): Errors detected in Quake 3: Arena by PVS-Studio: Fragement 2
2012-05-30 01:30:37 +02:00
Ettl Martin
1620c5b797
added todo testcase for ticket #3809
2012-05-29 21:44:39 +02:00
Daniel Marjamäki
2e41510e30
Fixed #3806 (Possible leak in public function. The pointer '' is not deallocated before it is allocated)
2012-05-29 21:13:34 +02:00
Daniel Marjamäki
8d0f315097
Fixed #3851 (False positive memory leak (condition))
2012-05-29 21:10:19 +02:00
Ettl Martin
da5278f90c
Added testcase for ticket #3852
2012-05-29 13:20:51 +02:00
Ettl Martin
474dccf8ad
added a testcase for detecting duplicate if else branches.
2012-05-29 09:22:42 +02:00
Zachary Blair
2bd171dded
Fixed #3794 (New check: Missing break in switch (duplicate bitwise operation))
2012-05-28 21:19:22 -07:00
Ettl Martin
e584544915
added testcase for ticket #3844
2012-05-28 12:56:24 +02:00
Daniel Marjamäki
92c5cffeb0
Memory leaks: Fixed false positive when allocated pointer is assigned
2012-05-26 21:28:35 +02:00
Daniel Marjamäki
200390e7ad
VS: Generated new VS project files
2012-05-26 10:48:04 +02:00
Daniel Marjamäki
bd8fb0a6b5
Memory leaks: Added new checking for memory leaks
2012-05-26 08:53:46 +02:00
PKEuS
f4bf94ca4f
Fixed #3845
2012-05-25 07:28:32 -07:00
PKEuS
e2bab4b6a3
Implemented Function::nestedIn to be able to identify the scope the function belongs to, even if Function::functionScope.functionOf is not available.
...
Refactorized usage of SymbolDatabase in checkOther:
- Don't copy Function instances in checkExpressionRange
- Simplifications by more accurate usage of information in database
2012-05-24 08:40:43 -07:00
PKEuS
97c4af44ca
Refactorizations in checkOther:
...
- More accurate usage of symbolDatabase to reduce code and false negatives
- Avoided unnecessary construction of pattern string
- Only search for class/struct definition before usage
2012-05-24 06:34:59 -07:00
Ettl Martin
ffb9342084
Added array index out of bounds tests to testsuite.
2012-05-23 23:59:14 +02:00
Ettl Martin
b3d862e27e
#3838 added todo-testcase
2012-05-23 23:32:58 +02:00
PKEuS
9ca7f6a8c3
Fixed crashes #3830 and #3832
2012-05-23 01:04:21 -07:00
PKEuS
dc64ac2918
Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart.
2012-05-22 12:58:46 -07:00
PKEuS
26f5f08614
Initialize Function::start when the function is implemented, not when its defined. ( Fixes #3826 )
2012-05-22 12:30:10 -07:00
Daniel Marjamäki
77e9106ec0
Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples)
2012-05-22 19:01:21 +02:00
Daniel Marjamäki
5b0551054a
varid: better templates handling
2012-05-22 18:58:13 +02:00
PKEuS
a8382ea553
Implemented file pointer usage checking:
...
- File I/O without positioning function call (#1742 )
- Read/Write to a file that was opened for writing/reading (#463 )
- Operations on closed file
Old fflushOnInputStream check is now part of the new check.
2012-05-22 05:30:22 -07:00
PKEuS
f3f46b4861
Fixed #3820
2012-05-22 02:27:21 -07:00
PKEuS
f5ef6f255e
Hande try and do in initialization list usage check ( #3823 )
2012-05-22 01:35:56 -07:00
PKEuS
e8dfe2407a
Fixed crash in Variable::evaluate ( #3825 )
2012-05-22 01:29:33 -07:00
PKEuS
829a52dc51
Added testio.cpp (I forgot to add it in previous commit)
2012-05-20 12:26:48 -07:00
PKEuS
b81eafe0dc
Splitted CheckIO from CheckOther.
2012-05-20 02:57:07 -07:00
PKEuS
e77f348d82
New check: Suggest to use initialization list instead of assignment in constructor. ( #489 )
2012-05-18 07:54:58 -07:00
PKEuS
4825f78663
Fixed #2477 and #2669
2012-05-17 02:15:21 -07:00
PKEuS
3f5712bfb8
Fixed false positive "Function can be const" when 'this' is passed to a Memberfunction
2012-05-17 01:49:52 -07:00
PKEuS
4bb2a1b27b
Made some functions static or const according to cppcheck results
2012-05-17 01:33:24 -07:00
PKEuS
ea601ef2b0
Fixed false positives about const correctness caused by incorrect handling of default arguments
2012-05-17 01:05:36 -07:00
Daniel Marjamäki
f803a18d50
Fixed #3749 (false positive: same expression on both sides of operator)
2012-05-17 07:26:57 +02:00
PKEuS
6a05ad1cf8
Improved fix for #2698 and added test case
2012-05-16 12:36:05 -07:00
PKEuS
77df633904
Improved handling of function calls in const correctness check: Fixed #2702 , #2698 , #2729 .
2012-05-16 11:57:12 -07:00
Daniel Marjamäki
0bb0fdedc2
Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums)
2012-05-16 18:48:33 +02:00
PKEuS
c976325086
Refactorizations in test suite:
...
- Implement createOnly mode in givenACodeSampleToTokenize so that only createTokens is called instead of tokenize
-> Ensures that no simplifications are done which could make the testing basic functions (like Token::Match) less accurate. We often don't need this simplifications in testtoken.cpp.
-> Ensures that no validation of the source is done (Fix #2104 )
- reduced overhead of givenACodeSampleToTokenize: Don't store a std::istringstream instance, avoid creation of std::string when ctor is called
2012-05-16 09:04:03 -07:00
PKEuS
279b0c59bb
Don't set Preprocessor::missingIncludeFlag if missingInclude warning is suppressed ( #3487 ).
2012-05-16 02:59:45 -07:00
PKEuS
0157f937bf
Fixed #3760 : Added explicit to C++ keyword list in setVarId
...
Made some constant arrays static
2012-05-16 01:59:52 -07:00
PKEuS
e8cd119ebd
Improved parsing of functions that accept nullpointers but no uninitialized data ( Fixed #3811 )
2012-05-16 00:56:39 -07:00
PKEuS
132a95b5f2
Fixed bug in symboldatabase: Don't ignore const or static on variables declared that are declared with both keywords. ( Fixes #3805 )
2012-05-15 12:03:43 -07:00
Daniel Marjamäki
4ae8e4f382
Tokenizer::setVarId: Minor fix of sizeof handling
2012-05-15 18:40:24 +02:00
PKEuS
4871cef351
Refactorized test cases for uninitMemberVar check:
...
- Moved all test cases to a single file (testconstructors.cpp)
- Removed some redundant test cases that became unnecessary after the symbolDatabase was established as independant from this check
2012-05-15 02:36:27 -07:00
Daniel Marjamäki
a0e5fad6a9
Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration)
2012-05-15 07:17:31 +02:00
PKEuS
42fd19fb37
Refactorization in checkclass.cpp:
...
- Improved handling of pointers and constants in constructor checking (-> Fixed #3801 )
2012-05-14 12:50:23 -07:00
PKEuS
1dee3b04b9
Bugfixes in SymbolDatabase:
...
- Constant pointers are now detected as variable declarations
- Probably fixed #3802
2012-05-14 12:47:02 -07:00
Edoardo Prezioso
eacf74be8d
Changed the order of some structures in order to improve, even if for a bit, their padding.
2012-05-14 20:49:03 +02:00
Daniel Marjamäki
fc7f78244e
Fixed #3708 (False positive: uninitialized variable (allocation, unknown nonpointer type))
2012-05-14 18:34:39 +02:00
Ettl Martin
8a7b141246
added testcase for ticket 3689
2012-05-14 09:57:30 +02:00
Daniel Marjamäki
895ee61ed5
Visual Studio: Updated VS2008 project files
2012-05-13 18:07:22 +02:00
Daniel Marjamäki
62f9875f90
Fixed #3799 (Bug: Function gets varId)
2012-05-13 07:55:35 +02:00
PKEuS
06a77679d4
Refactorizations:
...
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS
0452b03f53
Refactorizations in SymbolDatabase:
...
- Moved complete evaluation of variables type into one function executed when the variable is constructed
- Moved SymbolDatabase::ArrayDimensions to Variable::ArrayDimensions
2012-05-11 17:56:47 +02:00
Daniel Marjamäki
8236cd4d50
Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used)
2012-05-08 12:04:54 -07:00
Daniel Marjamäki
dad2fb6db1
Fixed #3737 (Preprocessor: __cplusplus always defined for c++ code)
2012-05-08 11:49:43 -07:00
Daniel Marjamäki
99a29eafc9
Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch)
2012-05-07 12:11:23 -07:00
Daniel Marjamäki
2fbd77c5a1
Fixed #3715 (false positive checking a map bounds)
2012-05-07 12:03:33 -07:00
PKEuS
ec00824fd3
Fixed #3357 :
...
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
PKEuS
6ef92c4fd7
Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp
...
Fixed test failure introduced in f105bf75a6
2012-05-06 04:01:56 -07:00
Daniel Marjamäki
37cdb515af
Generated new VS2008/VS2010 project files (testrunner)
2012-05-05 11:18:50 -07:00
PKEuS
1a5fbd61d2
Splitted class TokenList from Tokenizer
2012-05-05 09:33:26 -07:00
Daniel Marjamäki
11614021e8
Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string')
2012-05-05 09:59:43 +02:00
Daniel Marjamäki
005ce81689
Fixed #3640 (False positive: statement begins with numeric code)
2012-05-04 17:53:47 +02:00
Daniel Marjamäki
119b24e363
Fixed #3756 (False positive: uninitvar in malloc)
2012-05-03 19:10:51 +02:00
PKEuS
04704ac5fa
Refactorizations in checkmemoryleak.cpp:
...
- Use symbolDatabase more often to increase performance and accuracy.
- Replaced indendation counter
- Replaced custom stringify implementation
Benchmark results (sqlite checking):
4% complete, 7% on "Memory leaks (function variables)", 9% on "Memory leaks (address not taken)" and 82% on "Memory leaks (struct members)"
2012-05-03 10:43:47 +02:00
Ettl Martin
f01c244212
added testcase to ticket 3727
2012-05-01 14:36:42 +02:00
Ettl Martin
28510bdd38
added todo testcase for ticket 3597
2012-05-01 14:26:34 +02:00
Daniel Marjamäki
d5442280b1
Fixed #3597 (Errors in evaluation of chained assignment operators)
2012-05-01 07:06:14 +02:00
PKEuS
8e362ad5f7
Fixed #3771
...
Stronger testing for false positives in inconclusive checking in checknullpointer.cpp
2012-04-30 12:36:41 +02:00
Edoardo Prezioso
5d6a257c86
Fixed #3770 (Segmentation fault in K&R function parameters simplification)
2012-04-29 12:58:52 +02:00
Daniel Marjamäki
082e6d506b
#3744 (Unexpected unused value warning for char ptr types set in switch)
2012-04-28 15:43:42 +02:00
PKEuS
a0d92f5ed9
Refactorizations in SymbolDatabase:
...
- Skip struct keywords in argument list so that Variables declared like "Struct Foo bar" get a type
- Remvoved redundant argument from Function::addArguments
- Set Function::functionScope for global functions
- Replaced some indendation counters by Token::findClosingBracket
2012-04-27 21:51:13 +02:00
Edoardo Prezioso
6fd6f0998b
Improvement to 5b8840c6b02bd648dc2b75e60145474ae12f8e67: handle also 'const struct|union' types as template parameters.
2012-04-27 20:51:55 +02:00
Daniel Marjamäki
5b8840c6b0
Fixed #3764 (Tokenizer::setVarId: no varid for templated variables with const/struct/union types)
2012-04-27 18:02:07 +02:00
Ettl Martin
bf0ed17a16
added testcase for ticket #3602
2012-04-27 02:05:45 +02:00
Ettl Martin
bb8342fbb4
fixed misspelled word 'Comparision' --> 'Comparison'
2012-04-26 23:04:55 +02:00
Daniel Marjamäki
df6f88b4fe
Fixed #3755 (Tokenizer::setVarId: improve varid inside class for struct/class variables)
2012-04-26 18:38:47 +02:00
PKEuS
746beb98bf
Added support for delete and delete[] in invalidDeallocation check ( fixes #1773 )
2012-04-26 16:44:33 +02:00
PKEuS
5ac7552e4e
New check: Comparision of modulo results that are always true/false.
2012-04-26 15:23:47 +02:00
PKEuS
2a2d76749e
Improve check: Check for 64-bit portability issues when returning pointers/integers
2012-04-26 13:39:19 +02:00
Ettl Martin
2848c61e88
#3344 added missing testcase
2012-04-26 13:37:13 +02:00
Ettl Martin
8494df74e6
#2540 : added missing testcase.
2012-04-26 13:16:46 +02:00
PKEuS
30e8e389a7
Fixed #2980
2012-04-26 10:58:35 +02:00
PKEuS
1e708e10d0
Fixed #2875
2012-04-26 10:35:40 +02:00
PKEuS
a4c4c66a4c
Added test case for #3466
2012-04-25 21:14:25 +02:00
PKEuS
31a252b057
Fixed #3746 : Issue operatorEqToSelf error only if the operator takes an object of the class as argument.
2012-04-25 20:25:51 +02:00
Daniel Marjamäki
f84a4344ae
Fixed #3754 (Tokenizer::simplifyKnownVariables: wrong for loop simplification)
2012-04-25 19:23:17 +02:00
Edoardo Prezioso
08ae15e42d
Fixed the grammar in some reportError messages in the Tokenizer class, thanks to kimmov's suggestion.
2012-04-25 15:09:46 +02:00
Daniel Marjamäki
fb6c7f33f0
Fixed #3707 (Uninitialized variable with operator >> and templates)
2012-04-24 19:50:54 +02:00
PKEuS
e0a3ca0845
Refactorizations in class Token: changed handling of different types of tokens.
...
- Replace _isNumber, _isName, _isBoolean attributes by a single _type attribute (enum Token::Type), because not two of the old booleans could be true at the same time.
-> Add support for lots of different other kinds of tokens. (More precise checking of token type possible)
-> Replaced instant checking of type for Operators, etc. by a value calculated at creation time. (Faster checking)
2012-04-23 21:05:26 +02:00
Daniel Marjamäki
6ae135124e
Tokenizer::setVarId: better handling of initializer lists
2012-04-23 18:26:27 +02:00
Ettl Martin
d0b7a3514b
added unittest to fix sample code #3721
2012-04-22 17:28:27 +02:00
Daniel Marjamäki
706631f527
Fixed #3748 (False positive out of bounds with postincrement)
2012-04-22 12:22:49 +02:00
Daniel Marjamäki
d5f6cfcfa8
Tokenizer: Use new setVarId function. Removed the old one.
2012-04-22 11:36:31 +02:00
Daniel Marjamäki
aeac38b673
Tokenizer::setVarIdNew: Removed test case in TestUnusedVar that fails with the new setVarId function. The new setVarId function assumes that 'static int i(a);' is a variable declaration if it's in a executable scope (it is unknown if 'a' is a type or a variable so this assumption could be wrong).
2012-04-22 10:42:55 +02:00
Daniel Marjamäki
807f49ce83
testrunner: fixed test case when TestTokenizer::setVarIdOld is used
2012-04-22 09:56:02 +02:00
Daniel Marjamäki
71050bc586
Tokenizer::setVarIdNew: fixed TestTokenizer::varid_in_class2 test case
2012-04-22 08:51:19 +02:00
Ahti Legonkov
79af6f65d7
Fixed #3699 (cppcheck hangs with 100% cpu load on parsing preprocessor code)
2012-04-22 06:49:42 +02:00
Edoardo Prezioso
8dfde7def8
Added missing testcase from previous commit.
2012-04-22 02:41:51 +02:00
Edoardo Prezioso
be5a61b794
Fixed ticket #3721 (false positive: syntax error on valid C code ( K&R function style )).
2012-04-22 01:56:40 +02:00
Daniel Marjamäki
f3cbb3f05d
TestTokenizer: Removed varid test cases that have impossible source code
2012-04-21 19:07:35 +02:00
Daniel Marjamäki
bd60dd46d0
Tokenizer::setVarIdNew: handle special case when there is an unknown macro. Ticket #2638
2012-04-21 17:57:20 +02:00
Ettl Martin
2840b19fb3
removed some c++-comments within testcases ( from my last commit ). No functional change.
2012-04-19 10:15:29 +02:00
Ettl Martin
7699d5bf87
#3742 added testcases to ensure it works correctly.
2012-04-19 10:08:51 +02:00
PKEuS
af80344ab7
Refactorizations in checkclass.cpp:
...
- Removed local isVirtual implementation in checkclass.cpp, use Function::isImplicitlyVirtual instead
- Don't bailout when we see C++-style casts in checkConst
- Don't bailout for this pattern "any << member << any"
- Improved/Fixed some test cases (-> #1305 )
2012-04-18 18:51:38 +02:00
PKEuS
6a37c36ee8
Fixed #3741
...
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS
cb064dc20e
Implemented generic mechanism for '<'-'>' "linkage" before link() works (Taken from Scope::findClosingBracket, but C++11 right angle bracket support added): Token::findClosingBracket
...
-> Replaced several indendation-counting mechanisms in tokenize.cpp
Fixed build failure in checkclass.cpp
2012-04-18 16:02:03 +02:00
PKEuS
f6fd44910a
Refactorizations in SymbolDatabase:
...
- Replaced Scope::access by a locally stored std::map, because its a temporary status variable that is only necessary when creating the symboldatabase
- Moved SymbolDatabase::argsMatch to Function::argsMatch, because its function specific
- Improved Scope::findClosingBracket: Improved reliability, made it static and faster
2012-04-18 13:00:34 +02:00
PKEuS
1793bf8928
Fixed false positive in stlBoundries check ( #3740 )
2012-04-18 10:08:59 +02:00
PKEuS
c6f6194008
Added Function::isImplicitlyVirtual to symboldatabase.cpp
...
Made SymbolDatabase::argsMatch static because its possible and necessary for Function::isImplicitlyVirtual
2012-04-17 19:50:44 +02:00
PKEuS
a971e1530b
Refactorizations in test suite:
...
- Removed another custom stringify implementation (testtoken.cpp)
- Removed unnecessary forward declaration (testsuite.h)
- Use std::ostringstream instead of std::stringstream (redirect.h)
2012-04-17 12:57:16 +02:00
PKEuS
8e5949c6ce
Added several C++11 algorithms and containers to CheckStl
...
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320 )
2012-04-17 12:54:01 +02:00
PKEuS
82cd022646
Refactorized CheckStl::mismatchingContainersError:
...
- Improved error message
- Made patterns more generic by using Token::nextArgument()
2012-04-17 12:21:41 +02:00
PKEuS
88aa08e71b
Refactorizations in test suite:
...
- Removed redundant tokenization helper functions in testtokenize.cpp and testsimplifytokens.cpp
- Pass arguments as const char[] or const std::string& to avoid instanciation or at least copying of strings
- Removed redundant calls to Tokenizer::validate() - This function is already called implicitly by tokenize() and simplifyTokenList()
2012-04-17 09:51:08 +02:00
Ettl Martin
09d41b2f84
ticket 2669: added todo testcase
2012-04-17 00:31:32 +02:00
PKEuS
4dcb2ef57b
Refactorizations in test suite:
...
- Removed again one custom stringify implementation
- Avoided unnecessary std::string creation in testbufferoverrun.cpp
2012-04-16 20:02:52 +02:00
PKEuS
bac8ed7127
Refactorized stringification of tokens:
...
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
PKEuS
1c3c94dc67
New simplification: Remove 'extern "C"' from C++ code.
...
Refactorization in cppcheck.cpp: Catch exception as const reference instead of non-const reference.
2012-04-16 16:25:04 +02:00
Daniel Marjamäki
c58d02f146
Tokenizer::setVarIdNew: in C code, allow that variable declaration starts with delete and throw
2012-04-15 18:23:12 +02:00
Daniel Marjamäki
46bfe27831
Tokenizer::setVarIdNew: Better handling of function calls
2012-04-15 17:44:51 +02:00
Daniel Marjamäki
31f8a71f84
Tokenizer::setVarIdNew: Better handling for catch-exception-by-reference
2012-04-15 17:39:22 +02:00
Daniel Marjamäki
3c1dfc658c
Tokenizer::setVarIdNew: use the new setVarId with a few more test cases. Improved setVarId: references in executable scopes must be initialized.
2012-04-15 14:32:47 +02:00