Commit Graph

73 Commits

Author SHA1 Message Date
Oliver Stöneberg e7dd490fed
adjusted tests to reduce the amount of `friend` declarations necessary (#5435)
We were calling several interface functions through their inherited
classes instead of using the base classes requiring us to add `friend`
declarations to make the implementations accessible. This adjusts
several of those cases.
2023-09-11 20:26:22 +02:00
Oliver Stöneberg bbe45ff0eb
cleaned up access of the check classes (#5387) 2023-09-11 11:12:42 +02:00
Oliver Stöneberg bfb50ca9d8
removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference (#5308)
There was no need for the `Tokenizer` parameter to be a pointer as it
could never be `nullptr` and was also dereferenced without checking
first.

As a reference to the `Settings` was already available via the
`Tokenizer` there was no need to pass it separately. In the production
code there will only be one instance of it but in the tests we could
have accidentally passed a different one.
2023-08-18 12:03:50 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg a8fd5cbaf4
added `entrypoint` to library configuration and got rid of hard-coded ones (#4691) 2023-01-18 20:52:33 +01:00
Oliver Stöneberg 7ead32f96e
various optimizations (#4535)
* avoid potentially duplicated `strTolower()` call in `Path::getFilenameExtensionInLowerCase()`

* avoid unnecessary copies

* use `unordered_*` containers for faster lookups

* symboldatabase.cpp: do not perform call in `checkReturns()` until needed

* astutils.cpp: do not perform calls in `isVariableChangedByFunctionCall()` until necessary

* tokenize.cpp: small `hasIfDef()` optimization

* use `unordered_map` for `CheckUnusedFunctions::FunctionUsage::mFunctions` / adjusted test case
2022-10-06 20:12:07 +02:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck (#3862)
* fixed functionConst findings and enabled it in selfcheck

* fixed functionStatic findings and enabled it in selfcheck

* .travis_suppressions: adjusted comment

* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly (#3767) 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Daniel Marjamäki 08f9de95e2 Update copyright year 2021-09-26 11:34:56 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Rikard Falkeborn 0111b4afdc Silence unused variable warning (#2223) 2019-09-27 08:19:45 +02:00
Oliver Stöneberg 9028b4a81d do not access static methods through instance (#2189) 2019-09-20 21:54:30 +02:00
Daniel Marjamäki 3dc34f1515 Disable all simplified checks 2019-03-16 09:17:50 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8b5f36670a Introduce macro OVERRIDE for gcc-4.6 compatibility. 2019-01-12 07:37:42 +01:00
Daniel Marjamäki 271763e680 CTU: Refactoring 2018-12-25 21:11:23 +01:00
Daniel Marjamäki 2a495184d2 Rename private member variables 2018-06-17 18:58:27 +02:00
Matthias Krüger 2320034f4a fix -Winconsistent-missing-override warnings reported by clang 6.0. 2018-05-17 08:47:19 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki db274e8308 Fix testrunner in cygwin 2018-02-10 15:34:49 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ivan Maidanski 97ffec85c0 Fixed #7502 (Correct exit code if never used function is found) (#1026) 2018-01-12 08:24:01 +01:00
Ayaz Salikhov 0fc35c1350 Name all params (#956) 2017-09-07 12:59:53 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
Daniel Marjamäki e9d950d4f5 Cppcheck build dir: Better handling when --project is used 2016-12-08 22:46:44 +01:00
Daniel Marjamäki 1245f1d621 Unused Functions: Fix checking when --cppcheck-build-dir is used. 2016-11-07 21:49:58 +01:00
Daniel Marjamäki 350e5a7142 UnusedFunctions: Perform checking using analyzeinfo 2016-11-05 21:26:56 +01:00
Matthias Krüger 13bfe873f6 resolve mismatching tag reported by clang4.0-dev
was:

In file included from lib/checkunusedfunctions.cpp:21:
lib/checkunusedfunctions.h:114:15: warning: struct 'FunctionDecl' was previously declared as a class [-Wmismatched-tags]
    std::list<struct FunctionDecl> _functionDecl;
              ^
lib/checkunusedfunctions.h:108:23: note: previous use is here
    class CPPCHECKLIB FunctionDecl {
                      ^
lib/checkunusedfunctions.h:114:15: note: did you mean class here?
    std::list<struct FunctionDecl> _functionDecl;
              ^~~~~~
              class
1 warning generated.
2016-11-04 15:51:36 +01:00
Matthias Krüger 892a81055d CheckUnusedFunctions::analyzerInfo(): remove unused parameter 'filename'.
Was:

lib/checkunusedfunctions.cpp: In member function ‘std::__cxx11::string CheckUnusedFunctions::analyzerInfo(const string&) const’:
lib/checkunusedfunctions.cpp:292:67: warning: unused parameter ‘filename’ [-Wunused-parameter]
 std::string CheckUnusedFunctions::analyzerInfo(const std::string &filename) const
                                                                   ^~~~~~~~
2016-11-01 13:34:26 +01:00
Frank Zingsheim 34e8ed6e31 Fix travis; fix [lib/checkunusedfunctions.h:110]: (style) Class 'FunctionDecl' has a constructor with 1 argument that is not explicit. 2016-11-01 11:18:03 +01:00
Daniel Marjamäki e77d76525e CheckUnusedFunction: generate better analyzerinfo 2016-10-31 20:43:57 +01:00
Daniel Marjamäki 9ff3e85899 Added --cppcheck-build-dir flag 2016-10-29 12:18:11 +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
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Alexander Mai 0b225fa02f 2nd attempt to fix crash in CheckUnusedFunctions::check. CheckBufferOverrun::checkBufferAllocatedWithStrlen: Don't check for 'new' in C code. 2015-06-28 18:34:09 +02:00
Alexander Mai 02a3a01eca Fix compiler warnings 2015-06-28 18:07:31 +02:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki 0b9d80c95d Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis 2014-12-02 06:41:18 +01:00
Daniel Marjamäki a002654c47 Reverted refactoring 828417c for now. It caused a major slowdown in the unused functions checking. 2014-11-24 06:37:08 +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 828417c934 CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun 2014-11-15 18:44:23 +01: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
PKEuS 9bfc2b618b Fixed crashes random crashes in multithreading caused by useless creation of CheckUnusedFunctions instance per thread. 2014-04-13 11:56:38 +02:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00