Commit Graph

453 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 99307846cf Preprocessor: simplecpp optimisations 2016-07-21 19:42:26 +02:00
Daniel Marjamäki 79ac409c7d Preprocessor: Refactoring Preprocessor::getConfigs() 2016-07-21 19:11:49 +02:00
Daniel Marjamäki b2f1b95e38 Bump simplecpp. Preprocessor: Warn about missing includes 2016-07-21 12:47:00 +02:00
Daniel Marjamäki 9899e81f2e handle inline suppressions in included files 2016-07-21 07:57:23 +02:00
Daniel Marjamäki e16f0e500c Preprocessor: Parse comments and then remove them 2016-07-21 07:48:17 +02:00
Daniel Marjamäki f1839ebfaf Preprocessor: Fix crashes for invalid code 2016-07-20 20:39:03 +02:00
Daniel Marjamäki 03d2829fb9 Merge simplecpp branch 2016-07-20 12:21:00 +02:00
Daniel Marjamäki 3eef225b36 Revert preprocessor fix for struct tag macros. There are performance problems. 2016-07-19 18:59:58 +02:00
Matthias Krüger 18d5a7317e fix travis; fix [lib/preprocessor.cpp:2772]: (style) The scope of the variable 'noprescan' can be reduced. 2016-07-19 17:28:31 +02:00
Mavik 3e86c7b637 Fixed #5700 (Defect: False positives due to failure to expand struct tag macros) 2016-07-19 16:52:53 +02:00
Daniel Marjamäki a87b4368cb Revert "Preprocessor: Start replacing our Preprocessor code with simplecpp"
This reverts commit 9820783b60.

There was Travis errors I'll need to look more at.
2016-07-07 23:45:42 +02:00
Daniel Marjamäki 9820783b60 Preprocessor: Start replacing our Preprocessor code with simplecpp 2016-07-07 22:58:56 +02:00
Simon Martin 3095f47a7b Ticket #7137: Properly detect C++14 digit separators. (#802)
Add an optional extended description…
2016-06-04 22:55:55 +02:00
Daniel Marjamäki 2b2f12bcd5 Fixed #6758 (Preprocessor: handle #__VA_ARGS__) 2016-05-28 11:27:45 +02:00
PKEuS c7b3836379 Small refactorizations:
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
Daniel Marjamäki c5c376513b Fixed #7102 (Preprocessor: skip __cplusplus sections in headers when .c file is checked) 2016-02-29 07:34:06 +01:00
Alexander Mai 17bb07d522 #6913 max-configs=1 buggs out includefile resolving in case of circular dependency. Use simplified paths for internal list of includes parsed already 2016-02-14 11:51:18 +01:00
PKEuS b3a0d418e6 Refactorization: Compare only as much characters as necessary in Preprocessor
Fixed internal message
2016-02-05 21:06:07 +01:00
Daniel Marjamäki ca7ec25b92 Merge pull request #708 from siemens/preprocessor-directives-for-addons-v2
Add preprocessor directives dump and Y2038 addon
2016-01-16 12:28:14 +01:00
Albert ARIBAUD (3ADEV) 38e70dfb74 Preprocessor directives for addons
This patch augments the XML dumps with a 'directivelist'
subnode which lists all raw preprocessor directives met
while reading the source code in each configuration.

Also, the addons/cppcheckdata.py file has been extended
to give easy access to the list of directives and to
provide Python support for the --template (or short -t)
option.

Finally, an new addon, addons/y2038/y2038.py, is created
to detect when a glibc symbol might be Y2038-sensitive,
based on whether and how _TIME_BITS and _USE_TIME_BITS64
are defined when meeting the symbol.
2016-01-15 12:36:35 +01:00
Dmitry-Me 7bf88fbb09 Use substr() instead of assignment plus erase() 2016-01-15 14:22:08 +03:00
Albert ARIBAUD (3ADEV) df91caafa1 Fix trim() in lib/Preprocessor.cpp
Currently, if its argument is all spaces and tabs,
trim() returns it without actually trimming it.
Fix this by returning an empty string in this case.
Also, drop a useless test: if we did not return ""
then beg is not equal to std::string::npos, and in
that case, neither is end.
2016-01-04 16:37:36 +01:00
Daniel Marjamäki 79e663dd6f Settings: Remove '_' prefix for public member variables 2016-01-03 16:18:17 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 83cb028963 Preprocessor: insert space between ++ or -- in macro expansion 2015-12-29 06:54:44 +01:00
Dmitry-Me 1d614f2e5b Use arrow as in surrounding code 2015-12-24 10:21:48 +03:00
Dmitry-Me 3e9ef0894f Omit repeated search 2015-12-23 16:10:39 +03:00
PKEuS 46d6623182 Refactorization: Improved performance of Tokenizer::isFunctionParameterPassedByValue()
- Skip it for C code
- Improved performance by around 80% on C++ code (3,5% of entire runtime)
2015-12-03 14:44:59 +01:00