Commit Graph

60 Commits

Author SHA1 Message Date
chrchr-github c2d5aef435
Fix #12083 FN passedByValue with usage in ternary (#5575) 2023-10-31 16:12:38 +01:00
Oliver Stöneberg 499f566e9d
got rid of duplicated file/directory existence implementations / improved errorhandling and testing of `FileLister` (#5350) 2023-08-23 11:22:41 +02:00
Samuel Poláček b2511fb3ae
Check if --cppcheck-build-dir exists (#5254)
Cppcheck does not report that cppcheck build dir does not exist and also
does not report any write issues to the non-existent directory.

This means that cppcheck build dir is actually not used.

We should either create the directory or fail.
2023-08-04 17:38:43 +02:00
chrchr-github fb850a844b
Use path to executable when trying to load library (#5082)
* Use path to executable when trying to load library

* Fix function call, add support for more OS, add test

* Format

* Handle MacOS

* Amend

* Argument as fallback

* Use Path::getCurrentExecutablePath()

* Move to cmdlineparser.cpp

* Debug output

* Use argv[0] in Cygwin

* Revert "Debug output"

This reverts commit 5a68d71f1d27549c7b4a46363f3cd5cd912018e7.

* Use native python in Cygwin
2023-05-26 06:55:36 +02:00
Daniel Marjamäki e5a22e3436 Revert "improved `Path` handling of mixed separators (#4808)"
This reverts commit 0797867758.
2023-02-24 06:21:02 +01:00
Oliver Stöneberg 0797867758
improved `Path` handling of mixed separators (#4808) 2023-02-23 22:34:05 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +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
Daniel Marjamäki a400c94230 Update Copyrights 2022-08-28 14:22:12 +02:00
Daniel Marjamäki b387ae80f1 Fixed whole program analysis 2022-07-12 22:58:52 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Oliver Stöneberg 0a1012a273
fixed and enabled -Wdocumentation and -Wdocumentation-pedantic clang warnings (#2819) 2020-12-27 09:15:59 +01:00
Daniel Marjamäki c89512d8d6 Update copyright year 2020-12-05 09:28:33 +01:00
Falital 2e2d4a0055
Added Hash to plist file names (#2898) 2020-11-13 15:52:24 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki ea0232653f Fixed #8563 (CPPCheck not able to locate file through compilation database) 2019-01-05 23:11:43 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
hexcoder 051a18b120 pull request for ticket 8180 (better diagnostic output for bailouts) (#964)
* sync build instructions from readme.txt

* refactored the patch from ticket 8180. Moved logic from macros to the bailoutInternal function

* adapt to new bailout message format

* adapt to new bailout message format

* adapt to new bailout message format

* compile fix for Microsoft platform

* remove directory part from file locations in bailout message (normalize)

* remove directory part from valueflow message filter

* adapt tests to file format without directory part

* adapt tests to file format without directory part

* new line number agnostic assert_equals methods

* new line number agnostic assert_equals methods

* adapt to new method assertEqualsWithoutLineNumbers()

* adapt to new method assertEqualsWithoutLineNumbers()

* Bugfix: do not replace line number with spaces, remove it

* review changes: const char * -> std::string, size_t -> int, std::to_string() -> MathLib::toString()

* set #line at the beginning to guard against insertions from match compiler

* Bugfix: counting lines can be difficult :-) #line 1 -> #line 2

* added method stripDirectoryPart()

* added method stripDirectoryPart()

* used new method Path::stripDirectoryPart()

* new dependency path.h in lib/valueFlow.cpp

* code cleanup, removing redundant temporary objects and casts
2017-10-05 23:03:13 +02:00
Oleksandr Redko 2bee664ec9 Return non-const object to enable move compiler optimization (#966) 2017-10-03 18:24:18 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Alexander Mai c1cdcc158f Run astyle. Fix some Doxygen issues 2017-05-06 11:57:02 +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 91d97c556d Path: Add methods Path::isAbsolute() and Path::getCurrentPath() 2016-10-02 12:06:55 +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
PKEuS ce9272a4ed Refactorized file listing code (CLI):
- Apply PathMatch in FileLister::recursiveAddFiles() already to avoid touching directories that are ignored (#5775)
- Simplified code to warn about header exclusion; use Path::isHeader() instead of custom header filename detection
2015-07-23 14:28:17 +02: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
Robert Reif e2f72b4cb1 Fixed #6215 (Move Windows platform types into library) 2014-10-19 07:34:40 +02:00
Alexander Mai ead3f28e06 Small enhancements for doxygen 2014-04-27 21:42:10 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki e446a28b3d Refactoring FileLister and Path so they don't depend on Library 2013-10-31 19:09:01 +01:00
Sam Truscott 6806fd8135 Extended Qt support through Library 2013-10-20 14:09:10 +02:00
Daniel Marjamäki 0ba7e4d5ed astyle formatting 2013-09-05 01:47:22 +02:00
Ettl Martin 9ab6655d85 Fixed #5007 (Same include guard naming) 2013-09-04 20:59:49 +02:00
Alexander Mai 38ecdda076 Fixed #4859 (Update doxygen support) 2013-06-16 19:25:05 +02:00
Daniel Marjamäki d7a52eaecd Fixed #4608 (false positive: (style) struct or union member is never used.) 2013-03-01 16:13:04 +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
Simon Kagstrom 95b51d02c9 path: Add getPathFromFilename (returns the path part of a filename)
E.g.,

  /tmp/a.h -> /tmp/
  a.h ->

etc.
2012-12-28 12:44:26 +01:00
Daniel Marjamäki dbddbe75bf Path: Removed java/c# handling. Thanks amai. 2012-10-03 19:47:14 +02: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 25167b58a9 Implemented #2990: Print relative paths if -rp or --relative-paths is given 2012-04-06 10:49:21 +02:00
Reijo Tomperi e91d239ea5 Refactor: Move file extension checks from Tokenizer to Path class. This has also functional change as now also file.JAVA is considered a Java file. 2012-01-06 21:56:28 +02:00
Daniel Marjamäki de4a64332e Refactoring: Copy FileLister::acceptFile to Path::acceptFile. Use Path::getFilenameExtension and Path::acceptFile in Tokenizer. Use Path::acceptFile in CppCheck::processFile instead of hardcoded handling. 2012-01-06 17:31:10 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
PKEuS 6b6f780057 code cleanups and refactorings 2011-11-26 21:02:04 +01:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00