Commit Graph

481 Commits

Author SHA1 Message Date
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
BNT b913a04462 remove outputlist since its not moved and all subfunction check for (#1001)
nullptr
2017-11-29 08:29:19 +01:00
Daniel Marjamäki 5c7cf584ef bump simplecpp 2017-09-12 22:42:10 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki a024f339dd Fix issue detected by Coverity (ternary operator false expression is unreachable) 2017-07-31 17:55:15 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 099b4435c3 Fixed #8074 (Preprocessor::getConfigs: wrong configuration extracted 'A;B;;') 2017-05-24 11:16:41 +02:00
Daniel Marjamäki 899615c1e4 update simplecpp includes
[ci skip]
2017-05-18 22:26:07 +02:00
Daniel Marjamäki 1f4b84379d Fix for #pragma asm 2017-05-17 21:58:46 +02:00
Daniel Marjamäki 67e3187653 Preprocessor: Refactor handling of #pragma asm 2017-05-17 10:25:37 +02:00
Daniel Marjamäki 295e4fdfc2 Fixed #8049 (Preprocessor: Comment in system include not removed properly) 2017-05-02 22:18:24 +02:00
Daniel Marjamäki e72ec4282d Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well) 2017-04-22 12:44:57 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +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 d403a6a883 Preprocessor::getConfigs: Remove bad configurations when #error is seen 2017-04-02 12:15:53 +02:00
Daniel Marjamäki 7eb95aac2a Preprocessor::getConfigs: Handle #error in '#if !A' better 2017-04-02 10:06:39 +02:00
Daniel Marjamäki edd1c32e5b Preprocessor::getConfigs: Better handling of ! in #if 2017-04-02 09:03:43 +02:00
Daniel Marjamäki 62d4077dd0 Fix Cppcheck warning 2017-03-26 11:40:53 +02:00
Daniel Marjamäki 4a1c04cb33 Preprocessor: Removed redundant initialization 2017-03-26 11:10:48 +02:00
Daniel Marjamäki 865588950a Preprocessor: quick fix for #7939 2017-03-22 10:53:21 +01:00
Simon Martin 43e4364675 Ticket #7912: Properly preprocess files with decreasing line numbers, due to #line directives. 2017-03-05 16:46:43 +01:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
PKEuS 6e8ac13325 Refactorization:
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
Daniel Marjamäki 9c69546d72 Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well) 2016-12-03 11:59:48 +01:00
orbitcowboy 04d6b05da9 preprocessor: It is more efficient to seek for a single character rather than a string. 2016-12-01 17:54:45 +01:00
orbitcowboy 4a439b9308 It is more efficient to provide a character instead of a string when searching for a single character. This has been fixed in various places. 2016-11-30 12:01:22 +01:00
Daniel Marjamäki 2c3232affa cppcheck-build-dir: Use settings and cppcheck version in checksum so results will be recalculated if cppcheck is upgraded or there is significant changes on the command line. 2016-10-29 22:40:44 +02:00
Daniel Marjamäki 75f50e0bf8 try to fix VS compile error for std::uint32_t 2016-10-29 15:55:03 +02:00
Daniel Marjamäki a860c4c231 refactoring checksum calculations for --cppcheck-build-dir 2016-10-29 15:35:31 +02:00
Daniel Marjamäki 9ff3e85899 Added --cppcheck-build-dir flag 2016-10-29 12:18:11 +02:00
Miika-Petteri Matikainen 26816ed954 Fixes preprocessor regression causing hang
Cppcheck 1.76 introduced a regression in preprocessor which causes
the following code to hang:

    $ cat > test.c << EOF
    #ifndef Y
    #else
    #endif
    EOF
    $ cppcheck -D BAR --force test.c
    Checking test.c ...
    ^C

This used to work with version 1.75. Git bisect reveals that this
regression was caused by commit:
ff036c8742

This commit fixes the regression by avoiding infinite loop in
hasDefine(). If cfg is empty string "", we can skip the whole loop
and exit early.
2016-10-11 19:56:13 +03:00
Daniel Marjamäki 9dcad7115a Fixed #7743 (--config-exclude no longer supported) 2016-09-30 08:00:06 +02:00
Daniel Marjamäki b97bdb5300 bump simplecpp to rev b50ced8ac14f8debab9e85e78036f881ff2b3965 2016-09-03 12:29:45 +02:00
Dmitry-Me cd6aa27010 Clarify loop logic
* clearer variable names
* don't rely on npos being outside indices range - explicitly break the loop instead
2016-08-23 18:27:07 +03:00
Daniel Marjamäki d9ebdc6a10 Preprocessor: fix handling of -U in Preprocessor::getConfigs() 2016-08-21 15:01:04 +02:00
Daniel Marjamäki ff036c8742 Fixed #7700 (Using -D to force a configuration still checks the configuration as well as configurations that are not relevant) 2016-08-21 13:53:44 +02:00
Daniel Marjamäki 363605906f Fixed #7695 (Running with -U_WIN32 still checks related configurations) 2016-08-21 07:45:15 +02:00
Daniel Marjamäki b86c2689b3 TestPreprocessor: Fix output 2016-08-06 13:28:24 +02:00
Daniel Marjamäki 8983997a88 Fix GCC warning 2016-08-06 10:22:58 +02:00
Daniel Marjamäki 3777db39db Preprocessor: Mostly refactorings. Also added handling of --include. 2016-08-06 09:15:09 +02:00
Daniel Marjamäki 695b1f0ef3 Fixed #5692 (Preprocessor: ifdef symbol used indirectly in code leads to 'analysis failed') 2016-08-01 20:09:41 +02:00
Daniel Marjamäki b6246ecc55 bump simplecpp and update Preprocessor to handle new simplecpp::Output enum constants 2016-07-31 12:10:30 +02:00
Daniel Marjamäki 5546f052ef Preprocessor: the simplecpp begin() and end() has been renamed 2016-07-29 08:51:57 +02:00
Daniel Marjamäki 0777ecd071 Fixed #7640 (Preprocessor::getConfigs: -U is not honored) 2016-07-28 19:22:59 +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
Daniel Marjamäki 2feb86a6af Preprocessor: set platform info 2016-07-25 14:52:23 +02:00
Daniel Marjamäki 90faa80590 Preprocessor: Cleanup unused functions 2016-07-25 14:29:02 +02:00
Daniel Marjamäki e9fef003ac Preprocessor: refactoring directives, they are now only set once for each file 2016-07-24 14:02:21 +02:00
Daniel Marjamäki 48fc19b34c Remove unused function Preprocessor::preprocessCleanupDirectives() 2016-07-24 12:51:52 +02:00
Daniel Marjamäki f931c0cf2b Preprocessor::getConfigs: Handle invalid #else better 2016-07-23 14:40:01 +02:00