Commit Graph

307 Commits

Author SHA1 Message Date
Matthias Krüger 35e7697474 switch some functions from const to static, as cppcheck suggests. 2017-02-27 13:51:33 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
orbitcowboy 2f8a24764f tokenize: Improved const correctness. There are no functional changes. 2016-10-31 17:18:27 +01:00
orbitcowboy b3c60bf6b2 tokenize: Improved const correctness. There are no functional changes. 2016-10-31 16:11:11 +01:00
Daniel Marjamäki efa3aba32a Remove Tokenizer::simplifyNull() 2016-10-18 21:44:02 +02:00
Harald Scheidl 58eb644003 Improved Check: Warn about number and char literals in boolean expressions (#7750) 2016-10-09 13:21:00 +02:00
Daniel Marjamäki 383b815cca Tokenizer: refactoring garbage code handling 2016-07-26 08:16:10 +02:00
Daniel Marjamäki 7ef02a7469 Cleanup Tokenizer 2016-07-25 12:12:11 +02:00
Daniel Marjamäki adf16fae8b Remove handling of ##, __FILE__, __LINE__ from tokenizer 2016-07-25 07:58:03 +02:00
Daniel Marjamäki cd3818088f Remove unused function Tokenizer::tokenizeCondition 2016-07-24 14:37:43 +02:00
Daniel Marjamäki ed4a47de45 Tokenizer: Improve syntax checking of switch,if,while 2016-07-22 16:54:24 +02:00
Daniel Marjamäki 372763c85e Tokenizer: Refactoring, split up the big Tokenizer::setVarId() function 2016-05-12 18:20:20 +02:00
Daniel Marjamäki 1caa79c45f Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code (#6900). This fixes #7485. 2016-05-08 21:32:34 +02:00
amai2012 eba1b0881d Minor refactoring: use nullptr (instead of 0/NULL), change signature of Tokenizer::createTokens 2016-05-07 16:30:54 +02:00
Daniel Marjamäki dc2a92263a Fixed #7426 (RFC: time to replace simplifyEnum?) 2016-04-22 06:02:54 +02:00
Daniel Marjamäki cef6b35bb8 Improve MAXTIME handling 2016-02-11 16:10:52 +01:00
PKEuS f8bf2b5776 Removed rest of variableHidingTypedef and variableHidingEnum checking 2016-02-06 20:55:41 +01:00
amai2012 d25258359a #7251 Remove checks variableHidingTypedef and variableHidingEnum 2016-02-06 15:37:58 +01:00
PKEuS 8f493612e6 Refactorization: Removed unused function declaration from Tokenizer and fixed prototype of SymbolDatabase::cppcheckError 2016-01-09 09:34:31 +01:00
PKEuS 37fefe3479 Removed non-standard code annotations with __attribute__ 2016-01-09 09:33:56 +01:00
Daniel Marjamäki 036306d7c2 Refactoring Tokenizer::startOfExecutableScope(). Improve and reuse Tokenizer::isFunctionHead(). 2016-01-03 22:52:24 +01:00
Daniel Marjamäki 7e585d37bc Tokenizer: Remove startOfFunction() and use isFunctionHead() instead. 2016-01-03 19:06:11 +01:00
Daniel Marjamäki 0a1d10bf2f Tokenizer: Add &|&&| to Tokenizer::isFunctionHead() 2016-01-02 23:09:44 +01:00
Alexander Mai ce12e1cea6 Remove unnecessaryForwardDeclaration check. It had false positives (e.g. #3663), was implemented in the Tokenizer and of little value. 2016-01-02 19:14:03 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Dmitry-Me 05cb4e16fe Fix misspelled word 2015-12-25 11:51:08 +03:00
Albert ARIBAUD (3ADEV) 58031147b2 Optimize tokenizing
Reorganize cppcheck.cpp to separate actual checking from
tokenizing and XML dumping. This implies splitting checkFile()
in three parts, checkRawTokens, checkNormalTokens() and
checkSimplifiedTokens().
2015-12-13 09:29:47 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 41b1b9d850 Support case ranges (gcc extension, #6490) 2015-11-06 18:39:03 +01:00
PKEuS 72bc6d1f33 Refactorization: Fixed VS warning about variable shadowing. 2015-11-06 17:35:08 +01:00
Alexander Mai 3177d73fb0 #7089 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1. Refactor some functions to accept argument as refernce instead of pointer 2015-11-05 19:00:08 +01:00
Alexander Mai 8667184f12 #7062 Remove unnecessaryQualification check 2015-10-18 17:00:09 +02:00
PKEuS 05b5275110 Improved AST:
- Fixed TODO for ternary operator. Add parantheses between ? and : where necessary as a preparation for createAst()
- Improved AST validation:
-- Better message for binary operator with only one operand
-- Ensure ? has : as second operand (#7035)
2015-10-12 19:21:48 +02:00
Daniel Marjamäki 7148ad4239 Tokenizer: Fix sloppy syntax error 2015-10-12 08:51:41 +02:00
Daniel Marjamäki df67e0efb6 Tokenizer: Try to hide attributes for non-gcc and non-clang compilers 2015-10-12 08:50:52 +02:00
Daniel Marjamäki 8b8870cb5e Added noreturn attributes for methods that throws 2015-10-12 08:33:53 +02:00
PKEuS 2ace3d3144 Rewritten handling of declaration specifiers:
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
PKEuS c8c59aa92b Removed Tokenizer::simplifyIfSameInnerCondition(). It covered only very simple patterns and is unlikely to have an impact on real-world code. 2015-08-26 13:04:00 +02:00
PKEuS 8d926d7328 Moved some simple WinAPI/MFC-specific simplifications to windows.cfg 2015-08-20 15:59:59 +02:00
PKEuS 4e2d56242c Refactorization: Removed unreachable and duplicate code in tokenize.cpp 2015-08-19 19:29:48 +02:00
Alexander Mai a5aba110a4 Replace Tokenizer::simplifyBuiltinExpect by a suitable addition to gnu.cfg 2015-08-10 20:21:30 +02:00
Daniel Marjamäki 72706cd0b8 Fixed #6868 (Tokenizer: wrong simplification of the unlikely keyword) 2015-08-08 12:49:42 +02:00
Alexander Mai 4400f2ac85 #6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks. 2015-07-31 20:24:06 +02:00
Daniel Marjamäki a17f4d0a2d CLI: Added --debug-normal option that will show --debug output after 1st simplifications. This output is relevant for the 'normal' checkers. 2015-07-28 12:46:32 +02:00
Daniel Marjamäki f9d22f70db Removed simplifyIfNot simplification (#6072) 2015-07-21 20:56:47 +02:00
Daniel Marjamäki 1b8252181d Tokenizer: Removed Tokenizer::simplifyIfNotNull (#6072) 2015-07-21 17:58:44 +02:00
amai2012 e8ac4d8e87 #6847 segmentation fault (invalid code) in Token::multiCompare. Fix and simple refactoring in Tokenizer 2015-07-21 13:40:50 +02:00
Alexander Mai d45aa6170b Minor refactoring in Tokenizer: Optimize for C code and use nullptr instead of 0 2015-07-16 00:29:48 +02:00
amai2012 4a47b8b3ae Refactoring: Better distinguish between C and C++ in a few checks. 2015-06-28 16:49:16 +02:00
Alexander Mai 8946fcd960 #6772 segmentation fault (invalid code) in Tokenizer::setVarId. Add another validate() call to Tokenizer::simplifyTokenList1. Small refactoring to Tokenizer: mark many methods as private. 2015-06-24 20:47:04 +02:00