Commit Graph

200 Commits

Author SHA1 Message Date
Daniel Marjamäki b53a2ff9eb Command line: Added --template=clang formatting 2017-05-19 17:09:49 +02:00
Daniel Marjamäki 90a952d8c2 Add col and info in plist 2017-05-17 15:22:51 +02:00
Daniel Marjamäki ecb3f0a934 ErrorLogger: Write ErrorPath info in the xml report 2017-05-16 22:58:02 +02:00
Daniel Marjamäki c617851567 ErrorLogger: Added ErrorPath where each item has token and info 2017-05-16 22:38:13 +02:00
Daniel Marjamäki 6967d68137 Add --plist-output argument 2017-05-16 14:07:23 +02:00
Matthias Krüger 79010eecea lib: fix a bunch of warnings about differing function arguments in definition and declaration.
[lib/token.h:72] -> [lib/token.cpp:36]: (style, inconclusive) Function 'Token' argument 1 names different: declaration 'tokensBack' definition 't'.
    [lib/token.h:445] -> [lib/token.cpp:497]: (style, inconclusive) Function 'multiCompare' argument 1 names different: declaration 'needle' definition 'tok'.
    [lib/checkio.h:73] -> [lib/checkio.cpp:1385]: (style, inconclusive) Function 'ArgumentInfo' argument 3 names different: declaration 'isCPP' definition '_isCPP'.
    [lib/checkother.h:216] -> [lib/checkother.cpp:2136]: (style, inconclusive) Function 'checkComparisonFunctionIsAlwaysTrueOrFalseError' argument 2 names different: declaration 'strFunctionName' definition 'functionName'.
    [lib/errorlogger.h:214] -> [lib/errorlogger.cpp:51]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/errorlogger.h:215] -> [lib/errorlogger.cpp:65]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/library.h:327] -> [lib/library.cpp:1043]: (style, inconclusive) Function 'ignorefunction' argument 1 names different: declaration 'function' definition 'functionName'.
    [lib/mathlib.h:112] -> [lib/mathlib.cpp:1275]: (style, inconclusive) Function 'isNullValue' argument 1 names different: declaration 'tok' definition 'str'.
    [lib/preprocessor.h:91] -> [lib/preprocessor.cpp:122]: (style, inconclusive) Function 'setDirectives' argument 1 names different: declaration 'tokens' definition 'tokens1'.
    [lib/symboldatabase.h:860] -> [lib/symboldatabase.cpp:1801]: (style, inconclusive) Function 'argsMatch' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1171] -> [lib/symboldatabase.cpp:2048]: (style, inconclusive) Function 'addClassFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1174] -> [lib/symboldatabase.cpp:2208]: (style, inconclusive) Function 'addNewFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1090] -> [lib/symboldatabase.cpp:3648]: (style, inconclusive) Function 'findVariableType' argument 2 names different: declaration 'type' definition 'typeTok'.
    [lib/symboldatabase.h:1101] -> [lib/symboldatabase.cpp:4308]: (style, inconclusive) Function 'findType' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1176] -> [lib/symboldatabase.cpp:4349]: (style, inconclusive) Function 'findTypeInNested' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1193] -> [lib/symboldatabase.cpp:4501]: (style, inconclusive) Function 'setValueType' argument 2 names different: declaration 'enumerators' definition 'enumerator'.
    [lib/path.h:159] -> [lib/path.cpp:247]: (style, inconclusive) Function 'isCPP' argument 1 names different: declaration 'extensionInLowerCase' definition 'path'.
    [lib/path.h:145] -> [lib/path.cpp:266]: (style, inconclusive) Function 'acceptFile' argument 1 names different: declaration 'filename' definition 'path'.
2017-04-03 00:06:46 +02:00
Daniel Marjamäki 1faca91c1d Added 'endsWith' utility function. This will make compiling the democlient easier. 2017-04-01 18:14:18 +02:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
Daniel Marjamäki faa32fd51d Fix Cppcheck warnings and remove Travis suppressions 2016-10-29 15:50:08 +02:00
Daniel Marjamäki 9ff3e85899 Added --cppcheck-build-dir flag 2016-10-29 12:18:11 +02:00
PKEuS 9a6569fde1 Always set ErrorMessage::file0 to ensure that the source file that cppcheck is checking when an error occurs can be identified
Removed unused function and unused includes from preprocessor.h/cpp
2016-07-26 16:28:40 +02:00
Alexander Mai 0533d7bf9c Run astyle + minor refactoring 2016-02-27 16:03:50 +01:00
Roberto Martelloni d3645d874e Mapped toomanyconfigs ,AssignmentAddressToInteger
,AssignmentIntegerToAddress ,CastIntegerToAddressAtReturn
,CastAddressToIntegerAtReturn ,assertWithSideEffect ,assignmentInAssert
,uselessAssignmentArg ,uselessAssignmentPtrArg
,comparisonOfFuncReturningBoolError
,comparisonOfTwoFuncsReturningBoolError ,comparisonOfBoolWithBoolError
,incrementboolean ,comparisonOfBoolWithInt ,compareBoolExpressionWithInt
,negativeIndex ,pointerOutOfBounds ,arrayIndexThenCheck
,possibleBufferAccessOutOfBounds ,argumentSize
,arrayIndexOutOfBoundsCond ,noConstructor ,copyCtorPointerCopying
,noCopyConstructor ,uninitMemberVar ,operatorEqVarError
,unusedPrivateFunction ,memsetClassFloat ,mallocOnClassWarning
,operatorEq ,thisSubtraction ,operatorEqRetRefThis ,operatorEqToSelf
,useInitializationList ,duplInheritedMember ,assignIfError
,comparisonError ,multiCondition ,mismatchingBitAnd
,oppositeInnerCondition ,incorrectLogicOperator ,redundantCondition
,moduloAlwaysTrueFalse to their CWEs ids.
2016-02-26 23:53:52 +00:00
Daniel Marjamäki 39a5400b7d Fix xml output for invalid chars (#6431) 2016-02-01 18:53:46 +01:00
Dmitry-Me 58541f7ffa Check string has expected format before processing it 2016-01-20 16:46:15 +03: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
Akhilesh Nema 4aa2876ca0 Fixed #7278 (GUI: error rechecking with some files) 2016-01-15 16:52:22 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Albert ARIBAUD (3ADEV) b8dd71c577 Factorize toxml() into a single member function
lib/symboldatabase.cpp and lib/tokenize.cpp both
define a static toxml() function. Make it a single
static ErrorLogger::toxml() member function.
2015-12-07 18:21:01 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Dmitry-Me cdf1521258 Further fix search replace 2015-09-02 17:06:19 +03:00
Dmitry-Me 969b1bfbe9 Fix search-replace 2015-08-31 17:44:33 +03:00
PKEuS 1627b19dd6 Refactorizations:
- Call std::string::find() with char instead of char* where possible
- Avoid string copying
- Optimized several Token::tokAt/strAt calls
2015-08-16 10:33:51 +02:00
Dmitry-Me c85112bdad Break list traversal once first match is found 2015-08-06 17:10:43 +03:00
PKEuS 8ed0180279 Use C++11 string.back() instead of string[string.length()-1] 2015-07-25 17:19:53 +02:00
Daniel Marjamäki b0df668975 fix VS warning 2015-07-25 13:23:48 +02:00
Daniel Marjamäki f3b4c1d0db Remove some useless casts, probably added to avoid false positives. 2015-07-04 13:19:21 +02:00
amai2012 5814c3b84c Fix some compiler warnings with VS
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai 712919a691 #6431 Invalid XML created - Invalid encoding of string literal. Partial fix: ensure the short message string is also processed to avoid problems with non-terminated string. 2015-06-18 21:16:25 +02:00
Alexander Mai 60f5bd97df Refactoring: missing include added, (potential) multi-threading issue fixed, expose static method to allow unit testing 2015-06-18 19:07:51 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Thomas Jarosch e6f042dadc Multi process check: Sanitize error messages for illegal characters
before sending them across the pipe.

The deserializer died while deserializing
a string containing a binary zero.
2015-01-17 16:12:00 +01:00
Thomas Jarosch 36bcefc39d Don't crash when the deserialization of an error message fails
Found while scanning the code of an
open source project related to onions.
2015-01-17 16:09:58 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 4d81945ac5 Fixed a couple of #6276 integer over/underflow issues 2014-12-09 23:28:22 +01:00
PKEuS 71264fb672 Fixed assertion failure in VS debug mode 2014-04-30 21:06:01 +02:00
Alexander Mai 73fc3d6a13 #5300 - Invalid encoding in XML output (use escape sequence string for non-printable characters) 2014-04-13 09:50:57 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
PKEuS 7e4081f7f5 Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268) 2014-03-27 13:15:21 +01:00
PKEuS 357f5076db Updated tinyxml 2014-03-01 11:15:08 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
PKEuS 758d68519d Use TinyXML to write XML files 2013-08-07 16:30:55 +02:00
Alexander Mai b7bb16ea77 Fixed #4897 (callStackToString is not available when using custom message template) 2013-07-08 06:44:25 +02:00
Daniel Marjamäki 67979f00be ErrorLogger: Make sure Token class is known 2013-05-07 18:18:15 +02:00
Daniel Marjamki b9aba17b23 astyle formatting 2013-03-02 15:48:22 +01:00
Alexander Mai 0dca6e51a0 Fixed #4622 (Patch: Improve formatting for custom templates) 2013-03-02 15:16:18 +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
Daniel Marjamäki 6018bb4636 Fixed #3442 (unmatchedSuppression can't be suppressed) 2012-07-13 08:29:49 +02:00
Edoardo Prezioso eacf74be8d Changed the order of some structures in order to improve, even if for a bit, their padding. 2012-05-14 20:49:03 +02:00
PKEuS ec00824fd3 Fixed #3357:
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
PKEuS f105bf75a6 Refactorizations in ErrorLogger:
- Implemented constructor for ErrorLogger::ErrorMessage that takes a callstack of tokens -> replaced duplicate code in Check and Tokenizer
- Implemented strigify() for ErrorLogger::ErrorMessage::FileLocation to replace two identical implementations of it.
2012-05-06 01:17:15 -07:00
PKEuS 7de545f0fe Refactorizations:
- Added forgotten initialization of Settings::_relativePaths
- Some PCRE-Rules specific code hidden behind HAVE_RULES
- Use initialization list in ErrorLogger::ErrorMessage::ErrorMessage() and CppCheck::CppCheck
- Avoided unnecessary copies of std::strings in cppcheck.cpp
- Moved "// Alert only about unique errors"-code to make it work in debugFalsePositive mode
2012-04-06 18:16:59 +02:00
Daniel Marjamäki 4773384ff4 xml: Add attribute 'inconclusive' to the xml (format version 2) 2012-03-25 11:59:30 +02:00
PKEuS 4b52df675a Some refactorizations 2012-02-18 14:44:04 +01:00
PKEuS 2ba2a4e6ae Some refactorizations 2012-02-18 11:55:05 +01:00
Reijo Tomperi 194327048a Add InternalError and change MathLib to throw it in case of an error.
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Reijo Tomperi 65b58bcb99 Partial fix to #3452 (ErrorLogger: complain/raise assertion when error message has extra newlines etc)
http://sourceforge.net/apps/trac/cppcheck/ticket/3452
Add assert for newlines.
2011-12-30 01:22:16 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Kimmo Varis 716679ec7d Move Suppressions class to own source files.
I want to use Suppressions class also in GUI. And that is easier
to do when it is not internal class of Settings class. And in
general is it more natural that Settings class only contains list
of suppressions and implementation is separate.
2011-08-22 19:57:28 +03:00
Daniel Marjamäki 0beef13794 ErrorLogger: Refactoring/fixing the serializer/deserializer for inconclusive messages 2011-04-16 13:42:48 +02:00
Daniel Marjamäki 58dbbb0cab Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError. 2011-04-14 18:02:01 +02:00
Daniel Marjamäki 7d6e923bd4 inconclusive: don't report such messages in xml version 1 format. until we decide how they will be reported in xml version 2 format I don't report it. 2011-04-10 21:51:27 +02:00
Greg Hewgill 5d74325015 implement unmatchedSuppression information message 2011-02-16 23:02:37 +13:00
Daniel Marjamäki 447d29938e Fixed #2544 (XML output does not specify encoding used) 2011-02-04 20:14:19 +01:00
Daniel Marjamäki 9a383388be xml2: added <errors> element 2011-02-02 18:46:07 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 3d60d33280 Added comments 2010-12-30 22:07:27 +01:00
Daniel Marjamäki 65041cf0ff Fixed #2349 (Empty 'msg' in output when using '-j') 2010-12-24 11:13:57 +01:00
Daniel Marjamäki 22a1f3332f xml2: changed the format of the cppcheck-version info 2010-12-22 18:45:09 +01:00
Daniel Marjamäki 3a612d7cd8 xml2: Added cppcheck-version 2010-12-22 10:29:23 +01:00
Daniel Marjamäki af80384ae7 xml2: replace --xml2 with --xmlver=2. Ticket: #2106 2010-12-02 17:32:51 +01:00
Daniel Marjamäki 12c8eeff2c xml2: Added experimental --xml2 result format. Ticket: #2106 2010-12-01 21:24:17 +01:00
Daniel Marjamäki a605bdc8a2 Fixed #2195 (unit tests failing) 2010-11-12 15:43:16 +01:00
Daniel Marjamäki ba7a3b376e Fixed #2167 (Drop linefeeds from error messages) 2010-11-11 19:54:43 +01:00
Kimmo Varis 9627b667a1 Move simplifyPath method from FileLister to Path class.
simplifyPath() "fits" better to Path class conceptually. It handles
paths, not lists them. Also this way we get rid of few unneeded
dependencies to FileLister class.
2010-10-29 22:21:27 +03:00
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Daniel Marjamäki 3f79faac2a Fixed #2059 (cppcheck gives wrong path in error description) 2010-09-22 19:52:14 +02:00
Daniel Marjamäki 00dc3adc18 ErrorLogger: Added better \n handling to the XML output 2010-08-14 18:36:36 +02:00
Daniel Marjamäki 9edecd4a3f Added ErrorLogger::reportProgress and removed ErrorLogger::ReportProgress. This will make it easier for GUI and other clients to display progress information. 2010-08-03 16:36:21 +02:00
Daniel Marjamäki a274cb1015 cleanup headers 2010-07-31 08:52:28 +02:00
Ettl Martin 9fa6b20b9d checkheaders: removed redundant include (token.h) from errorlogger.cpp 2010-07-27 21:40:38 +02:00
Daniel Marjamäki 94acebc3d0 Cleanup redundant include 2010-07-27 09:32:20 +02:00
Daniel Marjamäki e358af9018 Refactoring: Report progress when checking takes a long time. Ticket: #1868 2010-07-25 18:19:37 +02:00
Daniel Marjamäki b8146271a2 Report progress when checking a file takes a long time. Ticket: #1868 2010-07-24 18:58:52 +02:00
Kimmo Varis dc77bc69a0 Move path simplifying code to Path class. 2010-07-19 14:27:05 +03:00
Kimmo Varis 006c9f17d4 GUI: Avoid unnecessary path separator conversion. 2010-07-18 11:20:10 +03:00
Kimmo Varis 3c12d23fd9 Add Path class for path handling routines.
In this initial commit the Path class contains two methods for
converting path separators. I want to move cppcheck path handling
to direction that we internally have paths with / separator. And
convert from/to native separators when needed.
2010-07-17 17:38:36 +03:00
Kimmo Varis 6db365e6f7 Improve path name handling in ErrorLogger.
This commit adds setfile() method to FileLocation class. The setfile
method converts in Windows path separators to internally used Unix
separators. And getfile() converts path separators back to Windows
separators. This fixes bugs that error reports had mixed path
separators in paths.
2010-07-17 01:27:40 +03:00
Kimmo Varis 6362e50e73 Fix comment. 2010-07-16 22:47:46 +03:00
Kimmo Varis 3fa4e8a1d5 Remove unused ErrorLogger::_writemsg() methods. 2010-07-16 21:40:02 +03:00
Kimmo Varis ad0394939a Refactor ErrorMessage constructor to take Severity::SeverityType.
This removes lots of unneeded casting as everybody now uses the
Severity::SeverityType.
2010-07-14 23:11:32 +03:00
Kimmo Varis 5f8af2e1e8 Refactor ErrorMessage's severity to Severity::SeverityType. 2010-07-14 21:12:39 +03:00
Kimmo Varis fa0f6edacf Rename ErrorMessage::toText() to ErrorMessage::toString(). 2010-07-14 18:31:05 +03:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Daniel Marjamäki 8e3123ec1c Fixed #854 (invalid XML generated for folders containing &) 2009-10-27 22:10:14 +01:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00