Daniel Marjamäki
382d7a10e8
Uninitialized variables: improved checking of c++ code
2013-02-15 18:13:47 +01:00
PKEuS
ccd95d1749
Make redundantAssignment message inconclusive when printed on global variables to avoid false warning on semaphores/mutexes ( #4467 )
2013-02-15 09:01:10 -08:00
PKEuS
e2655da1ec
Properly handle return/break/continue in CheckIO::checkFileUsage() ( #4466 )
2013-02-15 08:30:43 -08:00
PKEuS
017b4a8a7f
Treat references like global variables in CheckOther::checkRedundantAssignment() as they might refer to such. ( #4425 )
2013-02-15 08:09:31 -08:00
Robert Reif
c5ee083c82
Fixed #4388 (false positive 'noConstructor' in 1.57)
2013-02-15 06:44:07 +01:00
Daniel Marjamki
452dc23742
Fixed #4480 (False positive : Inefficient usage of string::find)
2013-02-14 19:14:20 +01:00
Daniel Marjamäki
08ada4cc63
Fixed #2652 (container .size() check too strict)
2013-02-14 16:59:58 +01:00
Thomas Jarosch
72a40b4da4
Use Token::simpleMatch for simple patterns
...
"internal" check reported:
[lib/checkuninitvar.cpp:1101]: (warning) Found simple pattern inside Token::Match() call: "if ("
2013-02-14 12:35:13 +01:00
Robert Reif
a1da067b88
Fixed #4585 (false positive, Variable 'b' is assigned a value that is never used when using+loop)
2013-02-14 06:31:41 +01:00
Robert Reif
5de26bfeb9
Fixed #4574 (noConstructor false positives introduced in cppcheck 1.58)
2013-02-13 06:00:04 +01:00
Frank Zingsheim
213d31b360
Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
...
Local fix in CheckOther::checkDuplicateIf()
2013-02-12 21:43:12 +01:00
Daniel Marjamäki
1e550f9fdf
Reverted fix for #4547 : It causes fp. See #4573
2013-02-12 16:13:08 +01:00
Daniel Marjamäki
28e38a9e56
Fixed #4519 (false positive: (error) Uninitialized variable: eax (inline assembly usage))
2013-02-12 15:59:23 +01:00
Ettl Martin
c192e4d669
spellfixes
2013-02-12 15:21:27 +01:00
Ettl Martin
dade326a99
#4566 implemented new check: redundantGetAndSetUserId on posix systems
2013-02-11 20:26:27 +01:00
Daniel Marjamäki
442db6cdf9
Fixed #4569 (False Positive: Uninitialised variable)
2013-02-11 18:31:14 +01:00
Daniel Marjamäki
94f1d34dcb
Fixed #4560 (false positive: (error) Uninitialized variable: s)
2013-02-11 17:05:59 +01:00
Daniel Marjamäki
48e194dc56
Fixed #4572 (Analysis failed: sizeof final)
2013-02-10 23:54:15 +01:00
Daniel Marjamäki
b660cf89ef
astyle formatting
2013-02-10 23:53:01 +01:00
Mathias De Maré
dfd557888d
Fixed #4565 (false positive: dangerous usage (not null-terminated))
2013-02-10 13:36:40 +01:00
Andrew C. Martin
bd0d9b9639
fix misspellings & gcc v3.4.6 warnings
...
1. fix typos / misspellings
- Fix misspelling within comments, variable/function names, stdout messages
- changes the name of an error code: ```stlBoundries``` changed to ```stlBoundaries```. Alias old name (```stlBoundries```) to the new one.
2. fix gcc v3.4.6 32bit & 64bit warnings
- fixes gcc v3.4.6 warnings, except for those in tinyxml and "-Wmissing-declarations" makefile warnings
- in Preprocessor::handleIncludes(), replace a ```vector <bool>``` with ```stack<bool>``` (see ```vector<bool>``` warning below).
- this is the only ```vector<bool>``` in the codebase
- ```vector <bool>``` is actually a case of template specialization, and is not recommended, according to the following links:
http://stackoverflow.com/q/6461487
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html
http://stackoverflow.com/q/670308
- in the codebase before and after this change, testrunner SEGVs in a number of places on gcc v3.4.6, including ```Check::~Check()```, among others
- fc42fc95
fixes this particular runtime issue for DJGPP & __sun
2013-02-09 23:43:09 -07:00
Stefan Naewe
e786a2fa5e
lib/checkother: fix compiler warning about unused member
...
Found by clang:
lib/checkother.cpp:2992:31: warning: private field '_symbolDatabase' is not used
[-Wunused-private-field]
const SymbolDatabase *_symbolDatabase;
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
2013-02-08 12:15:42 +01:00
Stefan Naewe
46fb31f9e5
lib/tokenize: fix two compiler warnings about emtpy while loop
...
Fixes these warnings:
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenize(std::istream&, const char*, const std::string&)’:
lib/tokenize.cpp:1962: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenizeCondition(const std::string&)’:
lib/tokenize.cpp:2174: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
2013-02-08 12:15:42 +01:00
Robert Reif
fe5de60f32
Fixed #4567 (false negative: The class 'B' does not have a constructor.)
2013-02-08 06:55:45 +01:00
Daniel Marjamäki
463121be71
Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile)
2013-02-07 17:03:08 +01:00
Robert Reif
42588e9729
Fixed #4535 (Simplify checks by caching symbol database Variable pointer in Token)
2013-02-06 06:39:58 +01:00
Frank Zingsheim
d9de7f7052
Travis: Fixed Cppcheck warnings (related to #4547 )
2013-02-05 23:31:53 +01:00
Frank Zingsheim
5144307642
Raise syntax error for if-condition without parentheses according to #2518 #4171
2013-02-05 21:13:57 +01:00
Daniel Marjamäki
4ac5648656
Uninitialized struct: Fixed false positive in for loop
2013-02-05 17:01:46 +01:00
Robert Reif
1fd78d2b56
CheckPostfixOperator: Use Token::variable. ticket: #4535
2013-02-05 06:47:08 +01:00
Robert Reif
3e3b728a9c
CheckStl: Use Token::variable. ticket: #4535
2013-02-05 06:46:26 +01:00
Frank Zingsheim
b531195e08
Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
...
Change tokenizer: "else if" -->> "else { if"
2013-02-04 21:12:12 +01:00
Daniel Marjamäki
a39a2479da
Travis: Fixed false positive in lib/checkbufferoverrun. Ticket: #4486
2013-02-04 19:02:42 +01:00
Daniel Marjamäki
1de54ba88e
Fixed #4486 (False positive: Return of address from function with integer return type (p+1-q))
2013-02-04 18:14:52 +01:00
Robert Reif
8e35860fc2
CheckClass: Refactoring. Use Token::variable(). Ticket: #4535
2013-02-02 16:30:17 +01:00
Daniel Marjamki
9124847211
Uninitialized variable: Refactoring. Use Token::variable() instead of symboldatabase lookup. Ticket: #4535
2013-02-02 16:27:12 +01:00
Frank Zingsheim
89560564ed
Refactoring: Add braces to an if-block, for-block, etc. in tokenizer.
...
Fixed #4521 (Tokenizer: Wrong braces for triple if else)
2013-02-02 16:01:34 +01:00
Daniel Marjamki
abd536b84c
Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning
2013-02-02 15:46:29 +01:00
Daniel Marjamki
75e20a996d
assign function pointer: Fixed false positive when pointer is used also. Ticket: #2930
2013-02-02 15:26:14 +01:00
Daniel Marjamki
9c8d600ca9
Uninitialized variables: Refactor CheckUninitVar::isVariableUsage
2013-02-02 15:21:54 +01:00
Daniel Marjamki
6bb8dd605a
assign function parameters: only show warning when --enable=warning or --enable=style is used. Ticket: #2930
2013-02-02 15:08:43 +01:00
Daniel Marjamäki
cbbb582fc9
Fixed #2930 (new check: redundant assignment of pointer function parameter)
2013-02-01 19:16:17 +01:00
Daniel Marjamäki
a04f7b1a94
CheckNullPointer::isPointerDeRef: Refactoring - use tok->variable(). Ticket: #4535
2013-02-01 19:10:14 +01:00
Robert Reif
1a58ae4994
Symbol database: handle when forward declaration doesn't match declaration. Ticket: #4531
2013-02-01 06:31:02 +01:00
Robert Reif
94c953931d
Simplify checks by caching symbol database Variable pointer in Token
2013-01-31 20:08:48 +01:00
Daniel Marjamäki
e2faed355b
Fixed #4485 (False positive: Same expression of '-' when checking if float is inf)
2013-01-31 17:29:31 +01:00
Daniel Marjamäki
bd7e3cbac5
Fixed #4540 (memory leak not detected ('.' or '->' is used before Function))
2013-01-31 17:00:50 +01:00
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Daniel Marjamäki
fc42aa3a30
Fixed #4523 (false positive: (error) Possible null pointer dereference)
2013-01-30 16:52:12 +01:00
Daniel Marjamäki
bc6d31c7c7
unsigned division: don't warn about 'unsigned char' because it is promoted to int.
2013-01-30 16:50:12 +01:00