Commit Graph

765 Commits

Author SHA1 Message Date
Daniel Marjamäki 2d70af2c82 Reverted fix. It might be possible to make a better fix 2013-03-25 19:55:35 +01:00
Daniel Marjamäki 2b02013fa7 Fixed #4668 (False positive: uninitialized Variable after unknown macro) 2013-03-25 19:52:33 +01:00
Daniel Marjamäki 1b18bfc93c Fixed #3585 (errors not recognized when class has extra specification) 2013-03-18 19:09:04 +01:00
Daniel Marjamäki 369e80b021 Fixed #4465 (syntax error on valid C++ source file) 2013-03-14 18:52:22 +01:00
Frank Zingsheim e91e7148de Test case for #4644 (Tokenizer: Wrong varId after typename):
Added equivalent test with "class"
2013-03-12 19:50:24 +01:00
PKEuS 796c3e101f Implemented better fix for #4644 2013-03-12 08:05:03 -07:00
PKEuS 14feaa8d39 Refactorizations:
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -07:00
PKEuS b3a9ac5c3b Fixed #4644: Don't assign varid to template parameter when 'typename' is used 2013-03-10 06:11:25 -07:00
Daniel Marjamäki 1f40af2ae2 Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining)) 2013-03-09 17:55:49 +01:00
PKEuS 99a73fe1d3 Don't assign a varid to a variadic function 2013-03-05 08:32:52 -08:00
PKEuS 75799446aa Added unit test for #4619 2013-03-01 04:06:51 -08:00
Daniel Marjamäki 94da3bd57f Fixed #4617 (False positive (style): noexcept for constructors) 2013-02-28 06:38:57 +01:00
Daniel Marjamäki 71b66209b7 Fixed #4300 (segmentation fault of cppcheck (invalid code)) 2013-02-20 06:58:27 +01:00
Alexander Mai 34c3697750 Added unit test for #4525 2013-02-19 21:56:13 +01:00
Daniel Marjamki 2a660fa3b4 Tokenizer: Fixed removeCast bug. Don't simplify (A)&b to A&b if A might be a type. Related with ticket: #4439 2013-02-16 16:58:36 +01:00
Daniel Marjamki 635b7d5a0e Fixed #4423 (Variable is assigned a value that is never used.) 2013-02-16 16:07:05 +01:00
Robert Reif c5ee083c82 Fixed #4388 (false positive 'noConstructor' in 1.57) 2013-02-15 06:44:07 +01:00
Daniel Marjamäki 1e550f9fdf Reverted fix for #4547: It causes fp. See #4573 2013-02-12 16:13:08 +01:00
Ettl Martin c192e4d669 spellfixes 2013-02-12 15:21:27 +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
Daniel Marjamäki 463121be71 Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile) 2013-02-07 17:03:08 +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
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
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 Marjamäki 4391f0880f Tokenizer: Add special tokenize method for the Preprocessor with only basic simplifications 2013-01-27 17:58:54 +01:00
Erik Lax c2608108dd Fixed #3928 (Tokenizer: Wrong simplification of inner if-else 'if (a) while (b) if (c) x; else y;') 2013-01-24 16:53:20 +01:00
Erik Lax 444f80c4bb Fixed #4505 2013-01-22 13:49:54 +01:00
Daniel Marjamäki 67c9720299 Tokenizer: fixed simplification of static constants 2013-01-19 21:14:15 +01:00
Daniel Marjamki bff6ed7af0 Fixed #3500 (false negative: (error) Returning pointer to local array variable) 2013-01-19 13:39:23 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Daniel Marjamäki 2e56928834 Fixed #4482 (add test for UB due to usage of NULL in variadic functions) 2013-01-13 12:02:10 +01:00
Daniel Marjamäki eebfea2b23 Fixed #4381 (Inline type declaration on statics causes warning) 2013-01-07 19:20:15 +01:00
Edoardo Prezioso 4c73c29cdd Revert partially the previous commit:
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso 1c0c0471df Simplify some generalized math formulas:
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso 5485e6866f Fixed wrong tokenization of some math formulas:
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Daniel Marjamäki a3ee72a51d Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code)) 2013-01-03 19:14:44 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki 4378357d7e Fixed #4372 (Tokenizer misidentifying which function a variable belongs to) 2012-12-29 21:07:41 +01:00
Daniel Marjamäki 4d085dd3fd Fixed #4316 (False positive: (constStatement) Redundant code) 2012-12-29 17:13:06 +01:00
Daniel Marjamäki 9af51a75e6 Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444' 2012-12-29 08:54:39 +01:00
Daniel Marjamäki bf9b900c30 Tokenizer::setVarId: Fixed problem with initializer lists (#4436) 2012-12-27 18:15:00 +01:00
Robert Reif 3e6d601982 Fixed #4436 (FP: Member variable is not initialized in the constructor. (with two parameters)) 2012-12-27 17:15:38 +01:00
Simon Kagstrom ef28bde3e4 Fixed #4408 (Force inclusion of files (a la -include /.../ in GCC)) 2012-12-27 16:52:31 +01:00
Daniel Marjamäki b3301a9ef9 Fixed #4433 (Wrong array size for string with \0) 2012-12-26 12:10:09 +01:00
Daniel Marjamäki 56b7670468 Tokenizer::setVarId: Fixed problem in initializer list when parameter and class member has same name 2012-12-23 19:55:09 +01:00
Robert Reif dae232015e Fixed #4430 (FP: Member variable is not initialized in the constructor.) 2012-12-23 08:04:44 +01:00
Daniel Marjamäki 8e1e894dff AST: Added some tests to ensure operator precedence is handled properly 2012-12-16 11:56:23 +01:00
Daniel Marjamäki bca7927913 AST: generate tree from bottom and upwards 2012-12-16 11:48:19 +01:00
Daniel Marjamäki aad3a041ad AST: Handle function calls 2012-12-16 10:06:55 +01:00
Daniel Marjamäki 1ad9c933ec AST: Improved handling of unary operators 2012-12-16 08:41:04 +01:00