Commit Graph

64 Commits

Author SHA1 Message Date
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
PKEuS e87ebcc602 Added support for std::unique and std::remove_if to CheckStl::uselessCalls(). 2012-09-07 14:23:32 +02:00
PKEuS 046712aaec Removed --doc formating hack that removes more than three newlines and added format testing of Check::classInfo instead.
- Fixed test failures shown by new test.
Use const_iterator instead of iterator in testcppcheck.cpp when possible
2012-08-26 16:22:46 +02:00
PKEuS a5bca705a5 New check: Ensure that the return value of std::remove() is used. 2012-08-21 02:30:27 -07:00
PKEuS 1b40668e04 Refactorizations:
- Made several functions (Check*::myName and others) because they don't touch depend on a specific instance. (cppcheck findings)
- Removed description of a check in CheckConst that has moved to CheckIO
2012-08-02 09:50:48 -07:00
PKEuS 5a91d6a0f5 Check for useless calls of .empty() (#3816)
Messages from CheckStl::uselessCalls() only shown when correct severity is enabled.
2012-07-12 03:23:52 -07:00
PKEuS 4b80e91145 Implemented support for building cppcheck lib into a dll
Updated VS9 solution
New VS10 solution that builds cppcheck into a dll used by cli and testrunner.
Functional changes and advantages of new solution:
- Share code between testrunner and cli; ability to share code with gui as well (not yet implemented)
- Files of /lib are no longer compiled twice (should improve build time on single core machines)
- Added configuration for building with PCRE support
- Executables are build into /bin (/bin/debug in debug mode) folder (Should no longer require rebuild when switching between debug and release)
- Completely x64 compatible (contains also x64-debug configuration now)
2012-06-10 05:19:09 -07:00
PKEuS bef2caf489 Improved checks in CheckStl:
- Improved message of stlIfStrFind according to discussion on github (77d9ed1877)
- Generalized pattern for substr in CheckStl::uselessCalls; added check for substr calls like ".substr(%any%,0)" which result in an empty string.
2012-04-04 19:40:28 +02:00
PKEuS b37cf11d20 Refactorizations:
- Increased encapsulation by making some functions private
- Removed redundant function CheckBufferOverrun::ArrayInfo::declare
- Avoided copy of ArrayInfo object
- Removed unnecessary and suspicious "if(sizeof(int) == 4)"
2012-03-27 19:40:39 +02:00
PKEuS 9431fb1b7e Improved STL checks:
- Added performance checking for .c_str() for return values and function parameters (#1079)
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS b1ff900aaa Some refactorizations 2012-02-18 23:43:51 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
PKEuS 2fa0168e55 Patch that improves STL checking: Make use of SymbolDatabase, solved TODO (about returning .c_str() value), check for deleting iterators by value. 2011-12-17 11:21:34 +01:00
Marek Zmysłowski 9a8c48b36e Fixed #3255 (Error message for std::string::c_str() is not descriptive) 2011-11-20 19:26:07 +01:00
Thomas Jarosch 4342fd254c Fixed #3266 (False positive on dangerous usage of .c_str()) 2011-11-04 19:21:19 +01:00
Daniel Marjamäki b18778129c STL: updated error messages for 'useless call to find/swap/substr'. Ticket: #3258 2011-10-31 21:32:30 +01:00
Marek Zmysłowski 190139f441 Fixed #3174 (New check: Useless calls of STL functions) 2011-10-24 23:25:23 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
seb777 5b940c0c7f fix #747 and #748 (incorrect use of auto_ptr - new check) 2011-06-16 20:26:00 +02:00
Robert Reif 1aca09a8bf add support for checking struct/class member container in CheckStl::size() 2011-03-28 19:31:23 -04:00
Greg Hewgill be195a72c9 initialise Check::_name in constructor rather than relying on virtual Check::name() 2011-02-02 22:58:25 +13:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 38e7209d26 Fixed #2373 (Using XML2 in --errorlist output) 2010-12-29 12:43:29 +01:00
Daniel Marjamäki 335d164cdf Fixed #2356 (False positive reported with iterator deletion) 2010-12-24 10:33:48 +01:00
Daniel Marjamäki e54129fa8d STL: check for dangerous usage of string::c_str(). Ticket: #1116 2010-10-17 19:18:46 +02:00
Daniel Marjamäki 4e121c94ab some more comments 2010-10-15 18:37:48 +02:00
Daniel Marjamäki 835b511bee STL: Added double-increment check. 2010-10-10 10:52:41 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Daniel Marjamäki f843678a07 Redundant conditions: some refactorings
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
 * moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Erik Lax 0510d9a2b0 Fixed #1680 (Bad iterators checks fail to detect invalidation of iterator for deletion by value) 2010-05-15 19:46:42 +02:00
Zachary Blair c26e619b23 Fixed #855 (Refactoring: move conditions into checks) 2010-04-20 23:38:25 -07:00
Daniel Marjamäki 9cd8bd842e STL: fixed false negative when erasing invalidated iterator 2010-04-17 13:37:04 +02:00
Daniel Marjamäki c718a7c595 astyle: Update to astyle 1.24 2010-04-15 20:08:51 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki e9b4ea44a2 Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes 2010-04-10 14:05:33 +02:00