Daniel Marjamäki
f64930b7f5
Fixed #7343 (SymbolDatabase: handling of override)
2016-01-22 19:22:24 +01:00
Daniel Marjamäki
8568a80208
Fixed #6883 (Template parsing error)
2016-01-20 16:10:58 +01:00
Dmitry-Me
58541f7ffa
Check string has expected format before processing it
2016-01-20 16:46:15 +03:00
Daniel Marjamäki
642cc57428
CheckMemoryLeak: Fix FP when overloaded new is used
2016-01-20 10:34:03 +01:00
Daniel Marjamäki
4a3ece5847
CheckNullPointer: Fix FP for 'buf[p]' when p is NULL
2016-01-20 08:42:58 +01:00
Daniel Marjamäki
ab441f3fb1
Tokenizer:vardecl: split up reference variables declared in class better
2016-01-19 15:27:11 +01:00
Daniel Marjamäki
a434e0fb1a
Fixed #7272 (Tokenizer:setVarId: handle namespaces better)
2016-01-19 14:32:27 +01:00
Daniel Marjamäki
dc5e2d5c8d
xml: output file0 whenever it is different to filename, both for included files and when #line is used.
2016-01-19 07:01:21 +01:00
Daniel Marjamäki
79aec559d5
Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause)
2016-01-18 16:10:51 +01:00
Daniel Marjamäki
5a28bce631
Merge pull request #763 from Dmitry-Me/changeSuspiciosVariableType
...
This variable type looks very suspicious
2016-01-18 15:46:57 +01:00
Daniel Marjamäki
b9a4a950a2
Fixed #7144 (Tokenizer::isScopeNoReturn: handling '{ { throw new string(..); } }')
2016-01-18 15:39:20 +01:00
Dmitry-Me
afe659cc88
This variable type looks very suspicious
2016-01-18 09:52:35 +03:00
Daniel Marjamäki
d656e3a056
Fixed #7103 (isReturnScope: handling 'return (bstr){0};')
2016-01-17 12:38:49 +01:00
Daniel Marjamäki
522de81cc7
Refactoring: Move isReturn() to astutils and rename it to isReturnScope()
2016-01-16 18:52:34 +01:00
Daniel Marjamäki
d39097f52a
Removed redundant null pointer check
2016-01-16 14:15:51 +01:00
Daniel Marjamäki
ca7ec25b92
Merge pull request #708 from siemens/preprocessor-directives-for-addons-v2
...
Add preprocessor directives dump and Y2038 addon
2016-01-16 12:28:14 +01:00
Matthias Krüger
7b1710a44f
redundantAssignment: change from severity 'performance' to 'style' since avoiding unneccessary stores is a basic optimization done by compilers.
2016-01-15 22:01:40 +01:00
Roberto Martelloni
bb6880919c
CWE mapping
2016-01-15 17:07:14 +01:00
Akhilesh Nema
4aa2876ca0
Fixed #7278 (GUI: error rechecking with some files)
2016-01-15 16:52:22 +01:00
Dmitry-Me
26788a1dc1
Remove repeated code, better variable name
2016-01-15 17:20:40 +03:00
Albert ARIBAUD (3ADEV)
38e70dfb74
Preprocessor directives for addons
...
This patch augments the XML dumps with a 'directivelist'
subnode which lists all raw preprocessor directives met
while reading the source code in each configuration.
Also, the addons/cppcheckdata.py file has been extended
to give easy access to the list of directives and to
provide Python support for the --template (or short -t)
option.
Finally, an new addon, addons/y2038/y2038.py, is created
to detect when a glibc symbol might be Y2038-sensitive,
based on whether and how _TIME_BITS and _USE_TIME_BITS64
are defined when meeting the symbol.
2016-01-15 12:36:35 +01:00
Dmitry-Me
7bf88fbb09
Use substr() instead of assignment plus erase()
2016-01-15 14:22:08 +03:00
Robert Reif
966d078dcc
CheckIO: Fix FN when using '%x' as format specifier for a 'signed int' variable
2016-01-15 09:29:29 +01:00
PKEuS
1bbb82ab2b
Merge pull request #753 from Dmitry-Me/mergePatterns
...
Merge overlapping patterns
2016-01-14 08:25:07 +01:00
Dmitry-Me
f14814e002
Reorganize duplicated patterns
2016-01-14 10:00:07 +03:00
Daniel Marjamäki
8e2f7812fd
CheckString: Fix FP when macros are used.
2016-01-13 20:32:40 +01:00
Matthias Krüger
e9e496199c
CheckOther::memsetZeroBytesError: remove now unused parameter.
...
was:
lib/checkother.cpp:1116:76: warning: unused parameter ‘varname’ [-Wunused-parameter]
void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname)
^
2016-01-12 23:55:02 +01:00
Alexander Mai
7802517a69
#7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg.
2016-01-12 23:20:48 +01:00
Daniel Marjamäki
8e79e5c1d3
Fixed #7147 (TemplateSimplifier: specialized template class with inheritance)
2016-01-11 18:45:12 +01:00
Dmitry-Me
499e15d96a
Cleanup variable names, omit redundant actions
2016-01-11 13:04:52 +03:00
Daniel Marjamäki
f8306383b1
Remove redundant variable
2016-01-10 22:30:24 +01:00
Daniel Marjamäki
414bdc30a9
Fixed #7276 (VarId: Missing varId in template class constructor initialization lists)
2016-01-10 22:10:49 +01:00
Daniel Marjamäki
760d5ab7f9
Try to fix travis. use Token::simpleMatch instead of Token::Match.
2016-01-10 21:00:42 +01:00
Daniel Marjamäki
4269702755
Fixed #7266 (False positive shiftTooManyBits with macros)
2016-01-10 20:44:52 +01:00
Daniel Marjamäki
b3208fb4b3
Fixed #7211 (False positive: Finding the same expression on both sides of an operator (enumconstant == 0))
2016-01-10 11:21:43 +01:00
PKEuS
f47e05b6a7
Set version to 1.72.99/1.73 dev
2016-01-10 10:10:33 +01:00
Daniel Marjamäki
890ceea3bf
1.72: Set version
2016-01-09 14:41:54 +01:00
Daniel Marjamäki
7191733981
Fixed #7192 (False positive: uninitMemberVar when base class is in another namespace)
2016-01-09 12:18:36 +01:00
Daniel Marjamäki
bcba1a7130
platforms: set bit values when --platform=<file> is used
2016-01-09 10:26:48 +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
0b9d8ae0f1
astyle formatting
...
[ci skip]
2016-01-08 15:24:05 +01:00
Aleksandr Pikalev
e92bbf6481
Fixed #7275 - Make GUI tests buildable
...
* Use -std=c++11 flag for gcc and clang
* Use $$PWD variable in qmake files to have correct paths
* Change tokenizer.simplifyTokenList() to tokenizer.simplifyTokenList2()
* Add build-generated files to .gitignore
* Link libpcre only if rules are enabled
2016-01-08 15:21:36 +01:00
amai2012
bd2892fde4
Ticket #7270 segmentation fault (invalid code) in Tokenizer::simplifyLabelsCaseDefault. include fix for cygwin
2016-01-08 11:59:02 +01:00
Daniel Marjamäki
794e64bb29
Platforms files: Added unix32-unsigned and unix64-unsigned. Not sure what extension to use for platform files, chose .xml now.
2016-01-08 11:17:32 +01:00
Daniel Marjamäki
ec733e7e71
CLI: added --platform=<file> interface
2016-01-07 20:19:08 +01:00
Daniel Marjamäki
a014920280
Fixed #7260 (ValueType: in C++ the result of 'sint >> unknowntype' has unknown type)
2016-01-07 10:46:19 +01:00
Daniel Marjamäki
88a525aca7
Fixed #7267 (Tokenizer::setVarId: wrongly sets varId in cast with unknown type)
2016-01-06 17:47:59 +01:00
Daniel Marjamäki
b2386fa011
minor refactoring, use 'else if' when appropriate
2016-01-06 15:49:44 +01:00
Daniel Marjamäki
c70764631f
Merge pull request #749 from Godin/master
...
"cppcheck --errorlist" should include "assignBoolToFloat"
2016-01-05 20:39:57 +01:00
Roberto Martelloni
5c1965a6e0
Added mapped CWE IDs to reportErr function calls
2016-01-05 20:37:39 +01:00
Daniel Marjamäki
58e28cb00e
ValueType: Better handling of unsigned unknown types
2016-01-05 19:47:11 +01:00
Evgeny Mandrikov
fed4bb1b8f
"cppcheck --errorlist" should include "assignBoolToFloat"
2016-01-05 18:42:49 +01:00
Daniel Marjamäki
125d2f7a36
Some initial support for platforms that doesn't have 8-bit char
2016-01-05 13:16:00 +01:00
Daniel Marjamäki
a0971355b7
Tweaked Tokenizer::simplifyAsm2()
2016-01-04 19:18:10 +01:00
Albert ARIBAUD (3ADEV)
df91caafa1
Fix trim() in lib/Preprocessor.cpp
...
Currently, if its argument is all spaces and tabs,
trim() returns it without actually trimming it.
Fix this by returning an empty string in this case.
Also, drop a useless test: if we did not return ""
then beg is not equal to std::string::npos, and in
that case, neither is end.
2016-01-04 16:37:36 +01:00
Daniel Marjamäki
1db9cf4d09
SymbolDatabase: Add '#include <cctype>' for std::isalpha
2016-01-04 14:20:07 +01:00
Daniel Marjamäki
b748453b30
Tokenizer: Improve handling of block declarations (C extension)
2016-01-04 09:59:53 +01:00
Daniel Marjamäki
036306d7c2
Refactoring Tokenizer::startOfExecutableScope(). Improve and reuse Tokenizer::isFunctionHead().
2016-01-03 22:52:24 +01:00
Alexander Mai
d6fd4705cf
#7255 segmentation fault (invalid code) in CheckMemoryLeakInFunction::getcode
2016-01-03 20:53:03 +01:00
Daniel Marjamäki
7e585d37bc
Tokenizer: Remove startOfFunction() and use isFunctionHead() instead.
2016-01-03 19:06:11 +01:00
Daniel Marjamäki
79e663dd6f
Settings: Remove '_' prefix for public member variables
2016-01-03 16:18:17 +01:00
Daniel Marjamäki
8dccbfefcf
ValueType: handle lowercase number suffix, for instance '0ll'
2016-01-03 13:34:47 +01:00
Daniel Marjamäki
cd89e68f60
Fixed #6931 (noexcept and override qualifiers plus less than operator results in a syntax error)
2016-01-03 12:22:07 +01:00
Daniel Marjamäki
91d0f0fee0
astyle formatting
...
[ci skip]
2016-01-03 09:38:03 +01:00
Daniel Marjamäki
ed12b4dc44
Fixed #7253 (AST wrong on nested reinterpret_cast)
2016-01-03 09:37:38 +01:00
Daniel Marjamäki
4ff7fa3f3b
SymbolDatabase,Tokenizer: Refactor handling of noexcept
2016-01-03 08:36:00 +01:00
Daniel Marjamäki
9dabd17eae
Tokenizer::isFunctionHead(): Handling of C++ methods only in isCPP() condition.
2016-01-03 08:23:48 +01:00
Daniel Marjamäki
be8fc0f89f
SymbolDatabase: Better handling of default and delete when reusing Tokenizer::isFunctionHead()
2016-01-03 00:01:29 +01:00
Alexander Mai
b22071cb54
#7185 : Add Assertion to detect memory corruption.
2016-01-02 23:56:40 +01:00
Daniel Marjamäki
66e047ee7d
Refactoring SymbolDatabase. Reuse Tokenizer::isFunctionHead().
2016-01-02 23:49:06 +01:00
Daniel Marjamäki
0a1d10bf2f
Tokenizer: Add &|&&| to Tokenizer::isFunctionHead()
2016-01-02 23:09:44 +01:00
Alexander Mai
1d3e39df7e
Adjust message text for signConversion for constant negative epxressions
2016-01-02 22:56:15 +01:00
Daniel Marjamäki
746d024e3d
SymbolDatabase: Fix Token::Match pattern
2016-01-02 20:00:18 +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
Robert Reif
db6dfa2d22
Fixed #7195 (crash: valueFlowSwitchVariable())
2016-01-02 18:53:51 +01:00
Daniel Marjamäki
599327bfb1
cmdlineparser: Added -E option
2016-01-02 11:48:36 +01:00
Alexander Mai
ee5a5e8bb5
Minor modification of previous changeset (compare token with literal using str())
2016-01-01 23:37:38 +01:00
Alexander Mai
37c3d5da7b
#6731 Tokenizer::eraseDeadCode causes heap corruption on invalid code. Better detection of invalid code inside Tokenizer::simplifyFlowControl()
2016-01-01 23:32:10 +01:00
Daniel Marjamäki
ca4f55ec4c
Cleanup Copyrights. Now all should be just for Cppcheck team.
2016-01-01 23:04:16 +01:00
Daniel Marjamäki
95009a4630
Merge pull request #745 from lanurmi/2016_ad
...
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki
416861b530
ValueType: only use default signedness for char/short/int/long/longlong
2016-01-01 20:03:31 +01:00
Daniel Marjamäki
b457ceef0e
Settings: Added defaultSign
2016-01-01 17:33:59 +01:00
Daniel Marjamäki
f5715c1496
Rename Unspecified platform type to Native
2016-01-01 16:39:41 +01:00
Daniel Marjamäki
3bd5a4d10e
CheckUnusedVar: Fix FP when there is class initialization
2016-01-01 16:04:13 +01:00
Daniel Marjamäki
2f26195b23
Fixed #7248 (crash in ValueType::str())
2016-01-01 15:13:50 +01:00
Lauri Nurmi
996c9244d8
Update copyright year to 2007-2016.
2016-01-01 15:34:45 +02:00
Daniel Marjamäki
1e0979779e
Print type information in AST dump
2016-01-01 13:54:07 +01:00
Daniel Marjamäki
dea41e2390
CheckUnusedVar: Fix FP for assignment in while
2016-01-01 12:14:18 +01:00
Daniel Marjamäki
e69e952c46
Fixed #7245 (ValueType: Wrong result type for 'sint << uint')
2015-12-31 20:18:35 +01:00
Daniel Marjamäki
98756ea7f5
Fixed #7247 (False positive CastAddressToIntegerAtReturn - returning std::string)
2015-12-31 18:53:07 +01:00
Daniel Marjamäki
350908d0e9
Fix FP in CheckUnusedVar. Caused by #7230 fix.
2015-12-31 15:30:33 +01:00
Daniel Marjamäki
17ab0a4e9a
Fixed #7246 (crash: CheckType::checkLongCast())
2015-12-31 14:07:38 +01:00
Daniel Marjamäki
9f6890512c
Refactoring CheckType checkers. Use ValueType.
2015-12-31 12:05:23 +01:00
Daniel Marjamäki
5dc42ccd49
try to fix Travis. teach checkinternal about %assign%
2015-12-31 01:56:48 +01:00
Daniel Marjamäki
67435af06a
Refactor CheckType::checkTooBigBitwiseShift. Use ValueType.
2015-12-31 01:51:21 +01:00
Daniel Marjamäki
1de21a8356
try to fix Travis. teach checkinternal about %assign%
2015-12-31 01:32:34 +01:00
Daniel Marjamäki
8ee3a8d168
Updated Token::Match documentation
2015-12-31 01:25:36 +01:00
Daniel Marjamäki
8171154e12
Fixed #7230 (Confusing code snippet in error message)
2015-12-31 01:15:49 +01:00
Daniel Marjamäki
fae9c2159c
Fix Travis. The 'Assign integer to pointer' checker should allow 0.
2015-12-30 20:59:22 +01:00
Daniel Marjamäki
5216f904e7
Refactoring Check64BitPortability. Use ValueType.
2015-12-30 19:59:23 +01:00
Daniel Marjamäki
7f1b43e79c
Use simpleMatch to fix travis build
2015-12-30 12:28:55 +01:00
Daniel Marjamäki
c0e8654649
Refactor void* checking. Use ValueType.
2015-12-30 11:48:20 +01:00
Daniel Marjamäki
fdcab8f1bb
ValueType: better handling of struct member
2015-12-30 11:36:46 +01:00
Daniel Marjamäki
c5c386ceb8
ValueType: Handle void pointers
2015-12-29 19:58:51 +01:00
Daniel Marjamäki
bd1037e95b
Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument)
2015-12-29 12:06:42 +01:00
Daniel Marjamäki
83cb028963
Preprocessor: insert space between ++ or -- in macro expansion
2015-12-29 06:54:44 +01:00
Daniel Marjamäki
b38559774d
Removed the CPPCHECK2 ifdefs. I have no plan to remove simplifications anymore.
2015-12-28 16:26:51 +01:00
Daniel Marjamäki
15ecb26a6c
Tokenizer: Moved simplifyAssignmentInFunctionCall from simplifyTokenList1 to simplifyTokenList2
2015-12-28 13:58:41 +01:00
Daniel Marjamäki
0ddb5c12ce
Fixed #7238 (False positive unknownEvaluationOrder for comma operator on C code)
2015-12-28 13:45:55 +01:00
Alexander Mai
5b6758b03b
Add some debugging code (inspired by #6021 )
2015-12-27 17:38:15 +01:00
Daniel Marjamäki
f09dded7b1
TokenList: Better handling of '1++a' and 'a++1'
2015-12-27 14:57:22 +01:00
Daniel Marjamäki
908bc664a4
Evaluation order: ignore usage in sizeof
2015-12-27 14:08:16 +01:00
Alexander Mai
e9635fd393
#7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration
2015-12-26 23:51:10 +01:00
amai2012
081f443b2a
#7235 segmentation fault (invalid code) in TokenList::createAst
2015-12-26 20:26:07 +01:00
amai2012
36a6599386
#7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-12-26 20:16:01 +01:00
Daniel Marjamäki
c672210e06
Evaluation order: don't warn for 'dostuff(expr++, &expr)'
2015-12-26 15:48:43 +01:00
Daniel Marjamäki
32455e8441
Fixed #7214 (ValueType: does not handle static_cast)
2015-12-26 15:20:17 +01:00
Daniel Marjamäki
34449ae857
Use simpleMatch instead of Match for simple pattern, hope this makes Travis happy
2015-12-26 02:21:52 +01:00
Daniel Marjamäki
cea40168e0
Code fix. Used wrong variable in condition, leading to segfaults.
2015-12-26 01:52:43 +01:00
Daniel Marjamäki
293bd2eead
Fixed #6990 (false negative: Invalid abs() argument nr 1. A non-boolean value is required.)
2015-12-26 01:38:41 +01:00
Alexander Mai
87767fb666
#7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead
2015-12-26 00:21:56 +01:00
Daniel Marjamäki
e6ff77d825
Evaluation order: Don't use this checker on C++11 code
2015-12-25 18:57:59 +01:00
Daniel Marjamäki
90148ce2a1
Evaluation order: Only use this checker on non-C++11 code
2015-12-25 18:49:34 +01:00
Daniel Marjamäki
55779a5772
Evaluation order: Only use this checker on non-C++11 code
2015-12-25 18:45:46 +01:00
Daniel Marjamäki
24438c326e
Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro)
2015-12-25 18:31:21 +01:00
Daniel Marjamäki
27af1bcfd8
Fixed #7229 (Improve check; unknown evaluation order, write different message for self assignment)
2015-12-25 18:00:19 +01:00
Daniel Marjamäki
90a54b1fae
Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );)
2015-12-25 16:45:11 +01:00
PKEuS
0bdd353062
Merge pull request #744 from Dmitry-Me/useSetInsteadofList
...
Use set instead of list
2015-12-25 15:57:22 +01:00
Dmitry-Me
7fdbd8f0ca
Use set instead of list
2015-12-25 16:19:27 +03:00
Dmitry-Me
05cb4e16fe
Fix misspelled word
2015-12-25 11:51:08 +03:00
Dmitry-Me
458f0da197
Reduce variable scope, better name
2015-12-24 17:08:49 +03:00
PKEuS
940d569980
Refactorization: Removed redundant %any% patterns.
2015-12-24 14:40:48 +01:00
PKEuS
0052896c41
Merge pull request #738 from Dmitry-Me/reduceMatchCalls
...
Pre-check to reduce number of match checks
2015-12-24 13:48:56 +01:00
Dmitry-Me
7303790a73
Pre-check to reduce number of match checks
2015-12-24 13:07:47 +03:00
PKEuS
93cb73ebcf
Merge pull request #741 from Dmitry-Me/useArrowForDereferencing
...
Use arrow as in surrounding code
2015-12-24 09:37:40 +01:00
PKEuS
ae740e28fd
Merge pull request #740 from Dmitry-Me/donClearEmptyStrings
...
No need to clear empty strings
2015-12-24 09:37:20 +01:00
Daniel Marjamäki
81f0597316
Fixed #3206 and #7226 (New check: Undefined execution order)
2015-12-24 09:13:20 +01:00
Dmitry-Me
1d614f2e5b
Use arrow as in surrounding code
2015-12-24 10:21:48 +03:00
Dmitry-Me
bd45c71d8d
No need to clear empty strings
2015-12-24 10:16:58 +03:00
PKEuS
1b7f23daa5
Merge pull request #737 from Dmitry-Me/omitDeepCopy
...
Omit unneeded deep copy
2015-12-23 16:26:44 +01:00
PKEuS
d5e9bb4323
Merge pull request #739 from Dmitry-Me/repeatedSearch
...
Omit repeated search
2015-12-23 16:24:50 +01:00
Dmitry-Me
3e9ef0894f
Omit repeated search
2015-12-23 16:10:39 +03:00
Daniel Marjamäki
3f386af21c
astyle formatting
2015-12-23 10:26:12 +01:00
Dmitry-Me
5cba4ac602
Omit unneeded deep copy
2015-12-23 10:32:59 +03:00
Dmitry-Me
398da8ea7c
Cache and reuse result of expensive operation
2015-12-22 14:03:45 +03:00
Dmitry-Me
155ccecf2f
Drop useless braces
2015-12-22 10:31:49 +03:00
Alexander Mai
28a625abd8
#7218 Improve performance in TokenList::validateAst(): Keep a list of 'verified' tokens during recursion check.
2015-12-19 20:36:30 +01:00
PKEuS
a6b719eb10
Refactorization: Fixed true positive when self-checking cppcheck
2015-12-18 18:13:13 +01:00
Dmitry-Me
06ff877415
Typo in variable name
2015-12-18 15:46:12 +03:00