Commit Graph

376 Commits

Author SHA1 Message Date
Miika-Petteri Matikainen 1a8d0fd152 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-12 20:33:09 +02:00
Daniel Marjamäki b97bdb5300 bump simplecpp to rev b50ced8ac14f8debab9e85e78036f881ff2b3965 2016-09-03 12:29:45 +02: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 d982dc5ffe TestPreprocessor: Refactoring 2016-08-21 08:06:20 +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 cbfeae0ff7 bump simplecpp 2016-08-04 22:53:10 +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 d89a646ed9 TestPreprocessor refactorings 2016-07-30 20:22:07 +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 99307846cf Preprocessor: simplecpp optimisations 2016-07-21 19:42:26 +02:00
Daniel Marjamäki e16f0e500c Preprocessor: Parse comments and then remove them 2016-07-21 07:48:17 +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
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
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
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
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
Matthias Krüger c7bbc27130 Preprocessor: run paths of some error messages through Path::simplifyPath()
teach Path::simplifyPath() to recursively remove "./././" from beginning of paths.
2015-11-30 19:30:37 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 52be380ef0 Fixed fix for #7042 - support hexadecimal digits 2015-10-18 16:37:33 +02:00
PKEuS a97f6f973f Support C++14 digit separators (#7042) 2015-10-14 12:00:54 +02:00
PKEuS 70dce7701a Refactorization: Reduced code duplication in testpreprocessor.cpp 2015-10-09 12:27:39 +02:00
PKEuS 0fa3b8806c Refactorization: Use '\x..' syntax to avoid cast and "#pragma warning". 2015-10-07 19:41:54 +02:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
PKEuS 07b661ef62 Refactorization: Improved handling of preprocessor in test suite
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
Malcolm Parsons daf633ef78 Fixed #5028 Fix parsing of C++11 raw string literals 2015-08-12 13:11:55 +01:00
PKEuS 2342b604b0 Refactorized preprocessor (speedup of preprocessing time by ~10%):
- Reduced memory usage of PreprocessorMacro by 87,5% (removed redundant or unused members)
- Use char overload of std::string::find where possible
- Reordered conditions
2015-07-26 12:03:40 +02:00
Simon Shanks 9910c1fa0c Fixed #6617 (preprocessor performance improvement) 2015-07-24 13:30:41 +02:00
PKEuS dd9cb929bf Refactorization in Preprocessor: Support beginning/end of file in removeSpaceNearNL(), avoid string copying when calling replaceIfDefined() 2015-07-21 12:13:58 +02:00
PKEuS 4f00189ee1 Fixed crash #6684 2015-05-12 14:00:43 +02:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
orbitcowboy ff415871bd Fixed some const correctness issues in the test suite. 2015-01-19 18:00:05 +01: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
PKEuS a1b7ab277b Changed handling of unhandled characters:
- Don't abort checking (reverts 42140b6488)
- Modified error message: New Id unhandledCharacter, removed redundant line information, improved message text
2014-08-08 09:49:09 +02:00
PKEuS 188f9b4509 Fixed #error handling:
- Reporting them once is enough
- Don't report them if --force is used - since we silently drop these configurations when we check multiple configurations. Without the fix, -f combined with -D resulted in #error being shown erroneously.
- No redundant preprocessor instance to report them
2014-06-18 17:57:31 +02:00
Alexander Mai e1513090e2 #5909 crash: clang: test/Preprocessor/ifdef-recover.c. Avoid segfault in Preprocessor::getcfgs() on invalid code. 2014-06-08 10:02:16 +02:00