Commit Graph

749 Commits

Author SHA1 Message Date
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
Daniel Marjamäki fa8e5cd7d8 AST: Simple AST. Not used in the clients. Only part of the testing for now. 2012-12-15 20:21:09 +01:00
Daniel Marjamäki df03e3a8d2 Fixed #4395 (Wrong simplification of known variables in nested assignment) 2012-12-10 06:08:33 +01:00
PKEuS 4737966caf Unit test cleanup: Removed some empty lines and whitespaces before \n. 2012-12-06 10:19:22 -08:00
Daniel Marjamäki c91250cd6e Fixed #4277 (duplicateExpression finds false positive for floats in a union as a member of a class) 2012-12-03 17:05:37 +01:00
Daniel Marjamäki 672831f41a Fixed #4187 (False positive: Variable inside a lambda is reported as uninitialized) 2012-11-30 10:30:26 +01:00
Daniel Marjamäki 3372657a07 Fixed #4227 (False positive: Comparison of a boolean with an integer (double dResult=false)) 2012-11-29 09:29:25 +01:00
Daniel Marjamäki 509721d6d0 Fixed #4304 (False positive during an array declaration) 2012-11-29 08:44:12 +01:00
Daniel Marjamäki 5d1b4e6dbb Tokenizer: Remove redundant '+' 2012-11-28 07:09:56 +01:00
Edoardo Prezioso f3029ce6bb Fixed a bug in Tokenizer::simplifyKnownVariables.
When we find constant variables, check if there's a usage of its reference in the code (for example: don't simplify 'f(&x)' to 'f(&100)').
2012-11-26 17:06:52 +01:00
Edoardo Prezioso 5fb2115e9d Fixed a bug in Tokenizer::concatenateNegativeNumber.
The first negative number inside a '{}' list was not simplified correctly.
2012-11-20 19:14:58 +01:00
PKEuS e5ebb49312 Added support for sizeof(wchar_t). Improved <Windows.h> type testing for Win64 platform. 2012-11-11 16:16:17 +01:00
PKEuS 5555e055f1 Refactorized <Windows.h> type support:
- Changed some more Win32 simplifications of wide-character/string types to use wchar_t
- Added support for LPWSTR
- Fixed test case to ensure that simplifications also work for Win32W
2012-11-11 15:40:06 +01:00
PKEuS b15ff0c0e3 Fixed unit test failures caused by previous commit 2012-11-11 15:16:08 +01:00
Edoardo Prezioso 1d4cacb3f1 Add more testcases for simplifyPlatformTypes:
these should cover up some unused branches.
2012-11-05 00:35:34 +01:00
Edoardo Prezioso 960dad0c21 Related to commit 71150e987ddf935237578aec3a4c6e02247882c2:
indent-separate test cases of the same kind.
2012-11-05 00:33:02 +01:00
Edoardo Prezioso 4d38dd4f2c Add testcase for Tokenizer::simplifyVarDecl.
A branch was not executed in coverity, but there was a testcase which needed it.
2012-11-04 23:49:23 +01:00