Robert Reif
51baca0359
fix #1982 (simplifyTypedef: scope info is lost)
2011-05-02 22:42:52 -04:00
Daniel Marjamäki
d998477c69
renamed --check-includes to --check-config
2011-05-02 21:28:33 +02:00
Daniel Marjamäki
8603919b2d
Missing includes - normally just report that there are missing includes. The --check-includes can then be used to check what missing includes there are. Ticket: #2719
2011-05-02 14:58:16 +02:00
Daniel Marjamäki
cc8a5fd23e
reverted 761dd419
- reporting excessive missing include messages
2011-05-02 14:02:49 +02:00
Daniel Marjamaki
297ca63868
Fixed #2721 (Tokenizer::simplifyTemplates: fail when using template argument 'char[2]')
2011-05-01 19:05:18 +02:00
Daniel Marjamäki
761dd419af
Fixed #2719 (Fix excessive false positives in include-file handling)
2011-05-01 12:59:08 +02:00
Daniel Marjamäki
bb3c135d81
Tokenizer: Moved a few basic simplifications from simplifyTokenList to tokenize
2011-05-01 08:36:27 +02:00
Daniel Marjamäki
168bd2ebfc
Fixed #2760 (false positive: uninitialized variable ', (a) =')
2011-05-01 08:27:59 +02:00
Daniel Marjamäki
fb32d5111e
Fixed #2755 (cppcheck goes into infinite loop while scanning OpenSSL sources)
2011-04-29 19:47:39 +02:00
Robert Reif
e30852200e
fix tokenizer bug where 'class B : private ::A { };' was tokenized to 'class B : private: : A { } ;'
2011-04-29 09:19:22 -04:00
Robert Reif
e8eb20c6ef
fix debug warning for function parameters with template with varid of 0
2011-04-28 20:53:31 -04:00
Robert Reif
a2938b7212
fix
2011-04-28 19:08:18 -04:00
Kimmo Varis
c7d99fe9a7
Remove ErrorLogger::reportStatus() method.
...
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.
Also the recent commit (6d858b6
) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.
This is admittedly a hack. But it allow us to build all modules
again.
2011-04-27 23:27:02 +03:00
Daniel Marjamäki
6e48ab4384
astyle formatting
2011-04-27 18:30:37 +02:00
Greg Hewgill
d8a4383f5f
Use tolowerWrapper wherever appropriate
2011-04-27 21:13:05 +12:00
Greg Hewgill
f0468952f8
Portability: Raise an error if a platform-specific filename compare function is not specified
2011-04-27 21:08:10 +12:00
Robert Reif
6abf29bd22
fix spelling of initialized in checkclass messages
2011-04-26 20:37:16 -04:00
Robert Reif
29c73e0571
fix false positive introduced in CheckAutoVariables::autoVariables conversion to use symbol database
2011-04-26 20:16:09 -04:00
Daniel Marjamäki
e22f69daf4
Fixed #2753 (False negative: dereference uninitialized pointer 'buf[0] = 0;')
2011-04-26 20:26:09 +02:00
Greg Hewgill
6d858b63a1
Report percentage complete based on file size
...
This patch makes the (reasonable) assumption that the total size of all checked
files fits in a 'long' type.
2011-04-26 22:26:23 +12:00
Zachary Blair
46645ab327
Fixed #2722 (new check: statement that is always true (strcmp))
2011-04-25 22:45:27 -07:00
Kimmo Varis
f240574107
Modify the Cppcheck class to check one file at a time.
...
Unify usage and API of CppCheck class. Allow only one file checked
at a time, instead of list of files. Clients can then handle file
lists more naturally and as they see fit. Also clients have better
knowledge of how checking status should be handled.
The single-threaded CLI checking was only one using the file list.
Other clients were giving files (to list) one file at a time.
2011-04-24 19:17:52 +03:00
Robert Reif
3c415e7833
fix #2745 (Enum vs local variable - conflict)
2011-04-23 22:08:03 -04:00
Robert Reif
670741271e
fix #2746 (false positive: syntax error (typedef in __attribute__ )))
2011-04-23 21:04:02 -04:00
Robert Reif
55898c0dfc
convert last check in checkautovariables to use the symbol database
2011-04-23 09:50:56 -04:00
Robert Reif
cd64d8476c
fixed #2614 (missing varid on function parameter)
2011-04-23 09:37:50 -04:00
Robert Reif
6750c7b492
don't debug warn about class function definitions without body having missing varid on function parameters
2011-04-22 21:41:55 -04:00
Daniel Marjamäki
6fc59b0257
Fixed #2740 (inline cmd // cppcheck-suppress does not work anymore for 1.48)
2011-04-22 20:25:17 +02:00
Greg Hewgill
3fc1db51d1
Change symbol database such that the typestart token skips over type modifiers (const/static/mutable).
...
This fixes checking for the case of a memset() on a static variable.
2011-04-23 01:13:23 +12:00
Robert Reif
04309f74f5
fix #2738 (syntax error on valid code)
2011-04-20 19:09:28 -04:00
Robert Reif
79e5d2db15
run astyle
2011-04-20 19:07:28 -04:00
Daniel Marjamäki
061eab4d22
Virtual destructors: Enabled the check again. I think it is conclusive now. Ticket: #2728
2011-04-20 18:03:16 +02:00
Daniel Marjamäki
a79e979ae4
Memory leaks: Fixed TODO test case. Ticket: #2733
2011-04-20 17:16:09 +02:00
Robert Reif
b1d3d291e6
fix #2736 (segmentation fault of cppcheck)
2011-04-20 07:49:04 -04:00
Daniel Marjamäki
46afc54c10
astyle formatting
2011-04-20 06:41:26 +02:00
Daniel Marjamäki
aac65247ba
Fixed #2733 (Memory leak: not all branch are checked)
2011-04-20 06:41:14 +02:00
Daniel Marjamäki
8417c4eb28
const parameter: Added comment to reduce false negatives for various classes in the std namespace
2011-04-20 05:40:06 +02:00
Daniel Marjamäki
68e7003bb1
Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff)
2011-04-19 20:07:54 +02:00
Ettl Martin
47a1332e6a
#2733 added sizeof to checkmemory-leaks white list, added a todo-testcase
2011-04-19 16:55:27 +02:00
Robert Reif
c238b1bba6
fix #2730 (The same expression on both sides of != is OK when checking for NaN)
2011-04-18 19:20:27 -04:00
Martin Exner
2b08744b97
Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids)
2011-04-18 06:56:39 +02:00
Daniel Marjamäki
05f59a1567
Tokenizer: Fixed bug. When varid is 0 then %varid% doesn't work. Ticket: #2723
2011-04-16 17:45:14 +02:00
Robert Reif
877a233145
fix #2716 (Easy to reproduce crash)
2011-04-16 10:35:23 -04:00
Daniel Marjamäki
0beef13794
ErrorLogger: Refactoring/fixing the serializer/deserializer for inconclusive messages
2011-04-16 13:42:48 +02:00
Daniel Marjamäki
739b6a93e2
Fixed #2713 (False positive (Redundant assignment))
2011-04-16 12:07:56 +02:00
Robert Reif
3159df958d
fix #2720 (false positive: syntax error with c++0x code)
2011-04-14 19:50:17 -04:00
Daniel Marjamäki
58dbbb0cab
Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError.
2011-04-14 18:02:01 +02:00
Daniel Marjamäki
7021e3224b
Fixed #2714 (False positive: ternary operator and += style warning.)
2011-04-14 17:30:50 +02:00
Robert Reif
75e5353b6d
fix #2718 (Analysis failed. If the code is valid then please report this failure.)
2011-04-13 23:58:58 -04:00
Robert Reif
257197bdd1
fix #2717 (false positive: syntax error (typedef void f(int) const;))
2011-04-13 23:24:41 -04:00
Robert Reif
50a1f28d86
run astyle
2011-04-13 21:12:35 -04:00
Daniel Marjamäki
7d6e923bd4
inconclusive: don't report such messages in xml version 1 format. until we decide how they will be reported in xml version 2 format I don't report it.
2011-04-10 21:51:27 +02:00
Daniel Marjamäki
11bd6bcd30
Fixed #2712 (false positive: Division by zero)
2011-04-10 21:27:09 +02:00
Daniel Marjamäki
f6b23e1d90
ErrorLogger: Added severities for inconclusive error and inconclusive warning
2011-04-10 16:39:36 +02:00
Robert Reif
56212370d1
add check for same expression on both sides of an operator (part of #2700 )
2011-04-10 10:25:02 -04:00
Robert Reif
434783530a
Merge branch 'master' of github.com:danmar/cppcheck
2011-04-10 09:57:34 -04:00
Robert Reif
4a50aca7b2
fix a bug in checkDuplicateBranch where removed type info like signed/unsigned was not checked for difference
2011-04-10 09:57:09 -04:00
Daniel Marjamäki
e5d43d4ed2
Renamed Settings::stupid to Settings::experimental
2011-04-10 15:55:08 +02:00
Daniel Marjamäki
30ee9ba6e4
Added Settings::stupid flag that can be used to hide checking that generates false positives.
2011-04-10 13:23:45 +02:00
Daniel Marjamäki
1178d47a9b
--inconclusive : Added command line flag that enable inconclusive checking. It is added for experimental purposes.
2011-04-10 12:52:59 +02:00
Daniel Marjamäki
1d86fb1738
Tokenizer: Code cleanup. Use %oror% to simplify code.
2011-04-10 11:55:15 +02:00
Daniel Marjamäki
f284c3a11f
CheckOther: Code cleanup. Use %oror%
2011-04-10 11:52:12 +02:00
Daniel Marjamäki
76679255a3
Preprocessor: Use %oror% in multiCompare pattern
2011-04-10 11:50:19 +02:00
Daniel Marjamäki
e94e3eca82
Preprocessor: Use %oror% in multiCompare pattern
2011-04-10 11:47:49 +02:00
Daniel Marjamäki
ec5ddb16b4
CheckOther: Use %op% in CheckUnsignedDivision
2011-04-10 11:31:04 +02:00
Daniel Marjamäki
ad8fb37fb0
CheckUninitVar: Use %op%
2011-04-10 11:28:18 +02:00
Daniel Marjamäki
0a1d6efe8c
Tokenizer: Use %op% in simplifyOperatorName
2011-04-10 11:24:57 +02:00
Daniel Marjamäki
f179df1f10
Tokenizer: Use %op% in simplifyCalculations
2011-04-10 11:22:00 +02:00
Daniel Marjamäki
57869e96e3
Tokenizer: Use %op% to clean up pattern
2011-04-10 11:09:49 +02:00
Daniel Marjamäki
970c989023
Tokenizer: Code cleanup. Removed redundant variable
2011-04-10 09:20:37 +02:00
Daniel Marjamäki
f4f8aeca03
Tokenizer: Fixed bug in last commit
2011-04-10 09:18:37 +02:00
Daniel Marjamäki
4c753ca5ac
Tokenizer: Use the %oror% in multiCompare patterns
2011-04-10 09:16:29 +02:00
Daniel Marjamäki
747a2331c6
Token::Match : Allow that %oror% and %or% is used in multiCompare patterns
2011-04-10 08:39:55 +02:00
Robert Reif
66de41b313
partial fix for #2700 (common logic or cut and paste errors)
2011-04-09 17:05:27 -04:00
Robert Reif
d22fcb8184
fix bug in previous commit: fix #311 (add detection of duplicated if else-cases)
2011-04-09 16:34:16 -04:00
Robert Reif
7e403ae210
fix #311 (add detection of duplicated if else-cases)
2011-04-09 15:14:01 -04:00
Robert Reif
77aebd357e
Refactoring: add Token::isAssignmentOp and use it in CheckClass::checkConstFunc
2011-04-09 14:36:05 -04:00
Daniel Marjamäki
7d93bfb42e
Refactoring: Use Token::isArithmeticalOp instead of hardcoded conditions
2011-04-09 18:50:05 +02:00
Daniel Marjamäki
f76eb5541c
Refactoring: Use %op% instead of Token::isOp
2011-04-09 18:47:01 +02:00
Daniel Marjamäki
7320bbd8fd
Refactoring: Use %op%
2011-04-09 18:44:07 +02:00
Daniel Marjamäki
bd93997e4f
Refactoring: Use %op% instead of Token::isOp in CheckBufferOverrun
2011-04-09 18:37:03 +02:00
Daniel Marjamäki
a4471bc150
Refactoring: Use %op%
2011-04-09 18:33:37 +02:00
Daniel Marjamäki
447f61e9c7
Refactoring: Use %op%
2011-04-09 18:30:47 +02:00
Daniel Marjamäki
0730fad778
Refactoring: Use %op%
2011-04-09 18:24:41 +02:00
Daniel Marjamäki
6c4f5fc496
Token::multiCompare : allow that %op% is used in multiCompare pattern
2011-04-09 18:09:13 +02:00
Daniel Marjamäki
575cb242c2
Refactoring: Use Token::isOp
2011-04-09 16:22:47 +02:00
Daniel Marjamäki
f6d910ab3d
Refactoring: Use Token::isOp
2011-04-09 15:54:36 +02:00
Daniel Marjamäki
e75acd7476
Release: Updated versions to 1.48
2011-04-09 07:55:07 +02:00
Daniel Marjamäki
a3f177fc97
Fixed cppcheck warnings: Removed extra 'Token::' from statement
2011-04-09 06:56:31 +02:00
Daniel Marjamäki
8e711b7925
Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead.
2011-04-08 19:40:22 +02:00
Daniel Marjamaki
fbc8223a6b
Preprocessor: Fixed expandMacros problem. Ticket: #2707
2011-04-07 16:53:42 +02:00
Stefan Weil
8482eb9d5c
Obsolete functions: Fix messages for gethostbyaddr, gethostbyname
2011-04-07 00:33:54 +02:00
Daniel Marjamäki
b5bdb9eeae
fixed gcc compiler warning
2011-04-06 21:40:50 +02:00
Daniel Marjamaki
cb473a48b7
Preprocessor: Use Settings::debugwarnings instead of NDEBUG to determine if 'missing system include' should be reported or not
2011-04-06 19:49:04 +02:00
Robert Reif
23e4f020e9
fix #2706 (Analysis failed. If the code is valid then please report this failure.)
2011-04-04 22:18:12 -04:00
Daniel Marjamäki
4ac3c7fe3b
clarify calculation: fixed false negative for 'int x = a - b ? 2 : 3'
2011-04-04 21:33:16 +02:00
Daniel Marjamäki
0d3874693a
Buffer overrun: broke out duplicate code
2011-04-04 17:33:43 +02:00
Daniel Marjamäki
63acd9bb3e
Clarify calculation: Added warnings for << and >>
2011-04-03 22:12:22 +02:00
Daniel Marjamäki
266d1cc4d3
Null pointer: cleanup the code. Ticket: #2642
2011-04-03 21:55:21 +02:00
Martin Exner
bc3507118d
Fixed #2696 (False positive nullpointer)
2011-04-03 21:06:42 +02:00
Daniel Marjamäki
ed8cdddcf5
Tokenizer: execute the simplifyIfNot and simplifyIfNotNull in the normal token list. ticket #2642
2011-04-02 21:21:05 +02:00
Daniel Marjamäki
29422b8552
clarify precedence: made the short message shorter
2011-04-02 17:27:36 +02:00
Daniel Marjamäki
8a28a63e68
Merge commit 'elfring/2679d'
2011-04-02 14:16:14 +02:00
Markus Elfring
8cde24597f
Determination of rule support in CMake scripts (bug #2679 , #2524 )
...
The support for check rules will be automatically included in the generated
software if build settings were accordingly selected for PCRE.
https://sourceforge.net/apps/trac/cppcheck/ticket/2679
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-04-02 13:25:18 +02:00
Daniel Marjamäki
ea57e10c7f
Tokenizer::simplifyCalculations: simplify division result if it's a whole number, even though it doesn't have precedence
2011-04-02 12:52:11 +02:00
Daniel Marjamäki
855b01cd5a
Clarify precedence 'a*b?c:d' : warn for addition, subtraction and division also. tried to clarify the message more
2011-04-02 11:43:20 +02:00
Daniel Marjamäki
f34e9e6623
Tokenizer: better simplification of calculations in conditions
2011-04-02 11:08:58 +02:00
Robert Reif
64fa7bf8d4
symbol database: add support for anonymous struct and union
2011-03-31 20:54:23 -04:00
Robert Reif
a39444a40f
change CheckClass::operatorEqToSelf to make better use of the symbol database
2011-03-31 19:53:35 -04:00
Robert Reif
cf65a73c47
fix CheckClass::operatorEq to check return type more closely (to match check description)
2011-03-31 19:40:28 -04:00
Daniel Marjamäki
0dbf5c6151
fixed doxygen warnings about undocumented function parameters
2011-03-31 19:16:43 +02:00
Robert Reif
faaff942d2
symbol database: improve function argument count and default argument count
2011-03-30 21:59:43 -04:00
Robert Reif
d17a204096
symbol database: get function argument count using argument list size rather than counting commas
2011-03-30 21:14:24 -04:00
Daniel Marjamäki
b8cda19ca6
Fixed #2655 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant)
2011-03-30 21:57:01 +02:00
Lieven de Cock
97328f08de
Improve/cleanup Path::removeQuotationMarks().
2011-03-30 21:46:41 +03:00
Daniel Marjamäki
ae2a8d839b
Fixed #2693 (__declspec attribute not removed properly)
2011-03-30 19:49:55 +02:00
Stefan Weil
675e63b6a7
Spell checks
2011-03-30 16:45:31 +02:00
Stefan Weil
0e4cf7a2d6
Spell checks
2011-03-30 16:44:16 +02:00
Robert Reif
ce934f03a4
symbol database: handle default values for function arguments properly
2011-03-29 23:16:13 -04:00
Robert Reif
9612573d8e
add support for array of unnamed struct and union to symbol database
2011-03-29 19:48:12 -04:00
Kimmo Varis
4d4b28b075
Remove './' at begin of path in Path::simplifyPath.
...
The './' is not needed at begin of path for files we check. And it
only makes paths longer. This also makes it easier to match paths.
2011-03-29 20:53:18 +03:00
Daniel Marjamäki
0a2f11c2cd
Fixed #2695 (False positive: null pointer dereference and ternary operator (?:))
2011-03-29 18:45:32 +02:00
Robert Reif
b31da161a7
more support for anonymous struct to symbol database
2011-03-29 07:47:39 -04:00
Robert Reif
678486f0db
add support for anonymous struct to symbol database
2011-03-29 07:08:59 -04:00
Robert Reif
e9a23d9cb5
fix #2692 (False positive: if parsed as function in operator >>)
2011-03-28 20:02:06 -04:00
Robert Reif
1aca09a8bf
add support for checking struct/class member container in CheckStl::size()
2011-03-28 19:31:23 -04:00
Kimmo Varis
b889f663ae
Add Path::removeQuotationMarks() to clean path.
2011-03-28 22:14:19 +03:00
Daniel Marjamäki
a1dba61cee
Null pointer: prefer longer error message that says 'otherwise condition at line X is redundant'
2011-03-28 18:48:27 +02:00
Daniel Marjamäki
7426bd3daf
Null pointer: prefer longer error message that says 'otherwise condition at line X is redundant'
2011-03-28 18:44:25 +02:00
Daniel Marjamäki
4a7b60942b
Fixed #2691 (False positive: struct dereference and check (switch-break))
2011-03-28 17:28:21 +02:00
Robert Reif
31f8ff723b
skip nested anonymous unions when searching for variables in symbol database
2011-03-27 18:37:31 -04:00
Daniel Marjamäki
57056bcf61
Fixed #2689 (False positive: Possible null pointer dereference)
2011-03-27 21:29:49 +02:00
Robert Reif
dd5e15b40c
output a debug message when a member variable is used that has a varid of 0
2011-03-27 14:27:14 -04:00
Robert Reif
1e1434e191
make member variable change detection simpler and more accurate for CheckClass::checkConst
2011-03-27 13:59:12 -04:00
Robert Reif
20853fe273
add anonymous union support to the symbol database
2011-03-27 13:48:41 -04:00
Daniel Marjamäki
c87037c29d
Fixed #2674 (False positive: possible null pointer dereference (check if pointer is null in one function, dereference it in another function))
2011-03-27 11:04:58 +02:00
Daniel Marjamäki
e89f6d6ec0
Fixed #2660 (False positive: Variable 'v' is assigned a value that is never used)
2011-03-27 08:19:09 +02:00
Daniel Marjamäki
3c2d3ca3a4
Fixed #2653 (segmentation fault of cppcheck 'x=b=0;')
2011-03-26 12:20:23 +01:00
Daniel Marjamäki
7d9872a134
Tokenizer::setVarId: Prevent that wrong varid is given when uncertain. Ticket: #2680
2011-03-26 10:05:07 +01:00
Daniel Marjamäki
0ff5320d19
CMake: There is no need for PCRE when building the lib
2011-03-26 09:33:21 +01:00
Daniel Marjamäki
2b1277aa64
Fixed #2680 (setVarId: variables with class qualification don't get varid)
2011-03-26 08:56:41 +01:00
Robert Reif
c27ecf5aeb
only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc
2011-03-25 23:22:28 -04:00
Robert Reif
168db82fd6
better checking of assignment to array element in CheckClass::checkConstFunc
2011-03-25 23:02:13 -04:00
Robert Reif
f8e1735b0f
add support to CheckClass::checkConstFunc for ++/-- array elements
2011-03-25 22:37:32 -04:00
Robert Reif
ca50bc7850
move 2 CheckClass helper functions to follow externally called functions so code matches comments
2011-03-25 22:21:40 -04:00
Markus Elfring
9301ee28a8
Added CMake files
2011-03-25 07:14:53 +01:00
Robert Reif
710eb8ffd9
add support for global namespace to Tokenizer::simplifyVarDecl()
2011-03-24 23:06:20 -04:00
Robert Reif
fc258164cd
fix #2675 (false positive: syntax error)
2011-03-24 22:26:42 -04:00
Robert Reif
d643918761
symbol database: add a link from a Function to its Function Scope namd make function parameters belong to Function Scope
2011-03-24 22:08:18 -04:00
Daniel Marjamäki
74105f5d83
Fixed #2673 (false positive: memory leak (address stored in list))
2011-03-24 17:14:12 +01:00