Alexey Eryomenko
02461753f3
Fix for embedded PL/SQL blocks (Oracle Pro*C) ( #985 )
...
* fix for correct parsing of embedded PL/SQL blocks (Oracle Pro*C)
* enforce SQL block end at the end of nearest outer C block, when
appropriate terminator is not found
* added check for ; at the end of END-EXEC and made SQL block detection
more readable
2017-11-03 11:31:33 +01:00
Alexey Eryomenko
22483baf72
missed simplification in parsing of std function declaration resulted in ( #967 )
...
wrong type detection
2017-10-03 22:10:13 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
59335f80d2
Try to fix windows build. Reduce header dependencies
2017-05-17 15:38:31 +02:00
Daniel Marjamäki
6230919976
Skip 'Stringification => Tokenize' step
2017-05-17 14:57:54 +02:00
Alexander Mai
c1cdcc158f
Run astyle. Fix some Doxygen issues
2017-05-06 11:57:02 +02:00
Daniel Marjamäki
8ffed6862d
Tokenizer: Add --check-config warning for macro with semicolon in argument
2017-04-07 19:19:10 +02:00
Daniel Marjamäki
50da7d4919
Tokenizer: Write syntax error if there is C++ code in C file.
2017-04-06 08:50:35 +02:00
IOBYTE
7cae057615
Add missing varid or variable for member variables.
...
Add an optional extended description…
2017-03-30 10:07:58 +02:00
Matthias Krüger
ce3bc006e7
fix build with -DMAXTIME=123
2017-02-27 14:00:06 +01:00
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
Alexander Mai
6ba9c21fb9
#6786 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses. Small refactoring for Tokenizer::simplifyTokenList2() including additional calls to validate() - which prevents heap corruption on invalid code
2015-06-24 20:22:28 +02:00
orbitcowboy
06e818f89d
Running astyle, no functional change.
2015-06-17 09:09:23 +02:00
amai2012
919fcb38f5
Refactoring Tokenizer
...
Create Tokenizer::simplifyAsm2(), skip simplifyExternC() in C code and
simplifyBorland() on non-Microsoft or C code
2015-06-16 20:53:11 +02:00
amai2012
d36c84553f
#6748 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw error from now (member-function) Tokenizer::processFunc
2015-06-03 08:59:38 +02:00
PKEuS
77c5381612
Support C++14 [[deprecated]]
2015-05-10 12:36:28 +02:00
PKEuS
713d993f71
Some refactorizations in Tokenizer:
...
- Refactorized simplifyTypedef
- Perform some template specific code only on non-C code
2015-03-15 10:04:44 +01:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
Robert Reif
193645318b
Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later
2015-01-17 07:42:49 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
Daniel Marjamäki
051d42ae6b
astyle formatting
2014-11-20 14:20:09 +01:00
orbitcowboy
f5d804f71a
running astyle
2014-11-20 10:13:03 +01:00
PKEuS
c7d315fba3
Refactorization: Changed simplifyMathFunctions() to a single pass simplifier
2014-10-31 23:08:11 +01:00
Dmitry-Me
c3fa85b282
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 16:02:35 +04:00
PKEuS
59cccb83ce
Reimplemented version.h:
...
- Use macros to form version number and string. CPPCHECK_MAJOR, CPPCHECK_MINOR and CPPCHECK_DEVMINOR now contain the parts of the version number.
- "dev" status is now detected by comparison of CPPCHECK_MINOR and CPPCHECK_DEVMINOR, version string created accordingly.
Fixed two comments.
2014-09-01 08:48:25 +02:00
Daniel Marjamäki
8db5836e3f
Fixed #5982 (Add xml dump)
2014-07-14 15:51:45 +02:00
Zachary D. Blair
f6523e384b
Fixed 4979 (Doesn't allow any ordering of int modifiers)
2014-07-01 23:59:04 -07:00
PKEuS
ec1bd420a7
Refactorizations optimizing std::string usage:
...
1) Added global static const std::string emptyString; object:
-> Replaces some static variables in functions which might be not threadsafe
-> Avoids constructor call (std::string::string(""))
-> Even functions that return an empty string in some branches can return by reference now.
Added to config.h to ensure that it is available everywhere
2) Added overloads for TestFixture::assertEquals for the most common use cases:
-> Moves conversion from const char[] to std::string into a function, reducing code duplication in binary.
2014-06-26 11:51:02 +02:00
Daniel Marjamäki
a4a6f3e1be
Tokenizer: Removed Tokenizer::simplifyConditionOperator(). Using the AST and ValueFlow, it should be much easier to parse ?: than before.
2014-06-10 19:30:13 +02:00
Daniel Marjamäki
a41f6077e1
Tokenizer: Use 'podtype' info from library. Partial fix for #5623
2014-06-08 13:28:15 +02:00
PKEuS
8db0790407
Tokenizer::tokenize() can now be called without AST being created
2014-06-04 18:45:28 +02:00
PKEuS
d93d7401c6
Moved getSourceFilePath(), isC() and isCPP() from Tokenizer to TokenList
...
Conflicts:
lib/tokenize.cpp
2014-06-04 18:36:25 +02:00
Alexander Mai
be9a566d48
Refactoring/small corrections to fix warnings from clang -fsanitize=undefined 'member call on null pointer'
2014-05-20 21:55:08 +02:00
Alexander Mai
ead3f28e06
Small enhancements for doxygen
2014-04-27 21:42:10 +02:00
Robert Reif
ca9386859b
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:31:56 +02:00
Alexander Mai
b5c580a59e
Fix some clang warnings - most related to semantic doxygen errors
2014-04-26 16:17:26 +02:00
PKEuS
efe3f834be
Refactorized handling of syntaxError: Print debug output, removed a few return values that are no longer required
2014-03-27 18:41:52 +01:00
Lucas Manuel Rodriguez
9a08da17be
Fixed #4928 (C++ operator aliases result in false 'assigned a value that is never used' warning)
2014-03-16 14:51:05 -03:00
Sam Truscott
385478d89e
Reflection no longer part of markup. Some tokeniser not done on markup.
2014-03-11 15:57:28 +01:00
Lauri Nurmi
70a67eaf85
Change some more 0 literals into nullptr.
2014-02-16 13:38:50 +02:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Daniel Marjamäki
0203a4a6f5
Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see
2014-01-17 17:36:45 +01:00
Daniel Marjamäki
4eb746d7cc
Tokenizer: Removed simplifyComparisonOrder
2014-01-17 17:25:56 +01:00
PKEuS
4f0121ee2f
Splitted simplification out of tokenize()
2013-12-30 17:45:28 +01:00
Daniel Marjamäki
47b98470eb
Tokenizer: Simplify float casts of integer constants
2013-11-19 18:07:12 +01:00
Daniel Marjamäki
5f0cfa0ee4
Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0])
2013-11-02 23:56:10 +01:00
Daniel Marjamäki
f0a621a952
Tokenizer: Added MAXTIME so cppcheck can be compiled with a hard max time. Will be used for the daca2.
2013-11-02 17:31:14 +01:00
Martin Ettl
f8bd33f2bc
Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made.
2013-10-03 20:52:07 +02:00
Martin Ettl
548e2f3fbf
Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities.
2013-10-03 15:41:12 +02:00
Martin Ettl
fa5ee8fd13
Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions.
2013-10-01 20:30:59 +02:00
Ettl Martin
9ab6655d85
Fixed #5007 (Same include guard naming)
2013-09-04 20:59:49 +02:00