Commit Graph

98 Commits

Author SHA1 Message Date
Daniel Marjamäki dd94bfede9 CheckStl: Improving checking of container access out of bounds 2018-11-28 19:27:28 +01:00
Daniel Marjamäki 4983a6a5dc astyle formatting 2018-10-18 20:08:32 +02:00
Igor 0a9be3e734 Improve STL iterators checking (#1380)
* Improve STL interators checking

* Improve error messages for container iterators from different scopes

* Mini refactoring

* Replace hardcoded pattern to ValueType::Type::ITERATOR

* Error messages improvements, more tests and refactoring

* Refactoring after code review

* Put getting operand data into separate function

* Update getErrorMessages and iterator errors ids

* Refactoring

* Fix error

* Refactoring, early return implementation

* Delete redundant code

* Tiny changes in comments
2018-10-17 06:36:51 +02:00
orbitcowboy a26ac4d266 Running astyle. There is no functional change intended. 2018-09-21 08:53:09 +02:00
Paul Fultz II 1e347f6cde Initial check for recommending algorithms (#1352)
Add initial check for loop algorithms
2018-09-19 18:58:59 +02:00
Daniel Marjamäki 772939476d Remove inconclusive warnings about reading empty stl container. We have better ValueFlow-based checking. 2018-09-09 11:25:04 +02:00
Matthias Krüger a9ae897f8c checkstl: fix inconsistent-missing-override warning reported by clang.
Warning was:

lib/checkstl.h:57:18: warning: 'runChecks' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
    virtual void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
                 ^
lib/check.h:67:18: note: overridden virtual function is here
    virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) {
                 ^
2018-08-11 21:33:44 +02:00
Daniel Marjamäki 1f427eda8f CheckStl: rewrite and refactor out of bounds checker 2018-08-11 11:40:48 +02:00
Daniel Marjamäki 81f54f7094 Fixed #8681 (ValueFlow: Container size) 2018-08-10 11:29:16 +02:00
Paul Fultz II ed197f235a Fix issue 4693: Diagnostic when using the same iterators to an algorithm (#1326)
* Fix issue 4693: Diagnostic when using the same iterators to an algorithm

* Update classinfo
2018-08-05 09:10:54 +02:00
Paul Fultz II 0d35a96594 Improve checking of mismatch iterators (#1293) 2018-07-26 22:00:48 +02:00
Sebastian 0b65a52224 Add some missing errors to --errorlist output. (#1292)
Partly fixes https://trac.cppcheck.net/ticket/7772.
2018-06-20 10:43:13 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
amai2012 b17807c568 #6572 False positive eraseDereference - in iterator class - flag error inconclusive if iterator is not STL type 2018-01-10 09:37:21 +01:00
Daniel Marjamäki 2679b576c2 Fixed #1693 (false negative: std::vector, negative index) 2017-08-22 11:04:02 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki abf525e46d Fix Cppcheck warning 2017-07-29 11:58:00 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 633ed23c0d Fix Cppcheck warnings about mismatching function argument names 2017-04-01 09:31:27 +02:00
Daniel Marjamäki c8667096e0 Fixed #7658 (False positive: Same iterator is used with different containers) 2016-08-14 10:49:48 +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
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
PKEuS c0e33e20b4 Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries 2015-11-20 15:53:14 +01:00
PKEuS 53b2eca983 Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries 2015-11-20 15:53:14 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 795e5de903 Refactorization: Cleaned up after ExecutionPath removal 2015-07-23 20:37:09 +02:00
Daniel Marjamäki 3dbf290220 Refactor CheckStl::erase so it doesn't use ExecutionPath 2015-07-23 18:53:31 +02:00
PKEuS 4cbbd44d49 Fixed false positive #6663: Better support for loops in CheckStl::readingEmptyStlContainer() 2015-05-02 14:09:48 +02:00
Jakub Melka a49efb13f6 Added auto_ptr checking for malloc 2015-03-19 06:41:54 +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
Daniel Marjamäki fbc6323a9b doc: changed --doc output to Markdown syntax 2014-09-30 14:56:12 +02:00
PKEuS 8f79dc3ff8 Cleaned up includes and forward declarations in checkers:
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
 - Removed unused includes
2014-05-24 12:50:03 +02:00
Pranav Khanna f8a4fb91fe Fixed #3796 (new check: redundant initialization with empty string) 2014-03-03 18:27:45 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Ettl Martin 9ab6655d85 Fixed #5007 (Same include guard naming) 2013-09-04 20:59:49 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
PKEuS 917acea2ca Fixed two spelling mistakes found by ettlmartin 2013-06-12 13:13:05 -07:00
zblair ecfe4eb5be Fixed #3372 (New check: dereference iterator and then checking it) 2013-04-04 21:14:59 -07:00
Daniel Marjamäki 08ada4cc63 Fixed #2652 (container .size() check too strict) 2013-02-14 16:59:58 +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
Robert Reif 3e3b728a9c CheckStl: Use Token::variable. ticket: #4535 2013-02-05 06:46:26 +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
Edoardo Prezioso b50e1f4451 Attempt to fix all doxygen warnings. 2012-10-24 01:32:07 +02:00
Edoardo Prezioso c1718ae38d Fixed g++ -Wshadow warning message. 2012-10-17 00:29:06 +02:00
PKEuS 2aae8381cc Message refactorization: checkstl.cpp 2012-10-14 11:16:48 +02:00
XhmikosR 6e4e3dfbfb lib: tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-17 13:51:23 +02:00
PKEuS 5940d77a62 Disabled C++ specific checks and simplifications when checking a C or non-C++ file. 2012-09-10 19:02:32 +02:00