Commit Graph

490 Commits

Author SHA1 Message Date
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
PKEuS 70767a30c4 Small refactorizations:
- Avoid calling c_str() for functions that take std::string
- Avoid copying std::list
2015-12-03 14:19:30 +01:00
Dmitry-Me cb84b88cb1 Better variable names, more linear code 2015-12-03 14:20:46 +03:00
Dmitry-Me be49abf460 Eliminate repeated lookup 2015-12-03 11:03:18 +03:00
orbitcowboy 1a94b876f1 preprocessor: Improved constness of local variable. 2015-12-02 13:58:24 +01:00
PKEuS c79bc6c59d Refactorization: Call std::string::find_first_of() only once. 2015-12-01 23:11:24 +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 6b124a37d8 Cleanup some casts 2015-11-28 10:11:07 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS b775603e93 Revert "Removed bailout in case a file (without include guards) is included twice. (#5455)"
This reverts commit 34ec1112a9.
2015-10-26 21:37:08 +01:00
PKEuS 34ec1112a9 Removed bailout in case a file (without include guards) is included twice. (#5455) 2015-10-26 12:17:29 +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
Dmitry-Me 78ed37ca86 Explicit continue, break loop early 2015-09-10 12:54:35 +03:00
Alexander Mai b90b751b54 Cure some doxygen warnings 2015-08-30 20:12:02 +02:00
Malcolm Parsons daf633ef78 Fixed #5028 Fix parsing of C++11 raw string literals 2015-08-12 13:11:55 +01:00
Dmitry-Me 51ee9b0e06 Merge overlapping patterns 2015-08-11 12:19:59 +03:00
PKEuS 7f9a313b94 Fixed hang in VS10 debug mode (AppVeyor) 2015-07-26 14:20:18 +02:00
Daniel Marjamäki 7f1af06df0 Preprocessor: fixed gcc -Wreorder warning 2015-07-26 13:48:01 +02: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
PKEuS 8ed0180279 Use C++11 string.back() instead of string[string.length()-1] 2015-07-25 17:19:53 +02:00
Daniel Marjamäki f939381673 Preprocessor: Fix buffer overflow if line is empty 2015-07-24 19:19:07 +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 149d11d9ad Improved handling of inline assembly (#6813):
- Add ; after asm {} block if required
- Fixed inline suppressions
2015-07-20 23:09:54 +02:00
Alexander Mai e28e9be82f Add TODO testcase for #5738. Refactoring: add some const 2015-05-25 08:20:14 +02:00
PKEuS 4f00189ee1 Fixed crash #6684 2015-05-12 14:00:43 +02:00
Alexander Mai 96891dface #6276 clang: -fsanitize=integer warnings. Fix remaining issues in preprocessor.cpp. 2015-05-09 19:26:31 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02:00
Dmitry-Me 7c402afeb7 Preprocessor: Reduce overhead from searching for fallthrough comments when not needed 2015-03-29 09:28:17 +02:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
Daniel Marjamäki 014f8e3c71 Fixed #6396 (There are false negatives when --include is used) 2015-01-03 18:22:52 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 4d81945ac5 Fixed a couple of #6276 integer over/underflow issues 2014-12-09 23:28:22 +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
Dmitry-Me e12d280e90 Code cleanup. Omit redundant actions. 2014-11-18 06:38:19 +01:00
Dmitry-Me b022afae75 Resolve CID 1132030 2014-08-12 13:04:32 +04:00
PKEuS 2d06786c3f Merge pull request #388 from Dmitry-Me/resolveIssue1037100
Resolve CID 1037100: possible dereference of _errorLogger nullpointer
2014-08-09 10:35:18 +02: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
Dmitry-Me 51fab1f9f1 Resolve CID 1037100 2014-08-06 11:20:04 +04:00
Daniel Marjamäki 216ecd06e1 Fix Cppcheck warning. Make function Preprocessor::readpreprocessor static instead of const. 2014-07-25 12:43:55 +02:00
amai2012 9b38ae73c1 Attempt to fix 2 Coverity messages.
Replace a few unsigned int by std::size_t
2014-07-07 21:25:30 +02:00
PKEuS ec1bd420a7 Refactorizations optimizing std::string usage:
1) Added global static const std::string emptyString; object:
-> Replaces some static variables in functions which might be not threadsafe
-> Avoids constructor call (std::string::string(""))
-> Even functions that return an empty string in some branches can return by reference now.
Added to config.h to ensure that it is available everywhere

2) Added overloads for TestFixture::assertEquals for the most common use cases:
-> Moves conversion from const char[] to std::string into a function, reducing code duplication in binary.
2014-06-26 11:51:02 +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
Dmitry-Me 6e1568a6db Simplify code - bail out early, vreak loops early, reorder checks and declarations. 2014-06-09 13:35:30 +04: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
PKEuS 8db0790407 Tokenizer::tokenize() can now be called without AST being created 2014-06-04 18:45:28 +02:00
Daniel Marjamäki 42140b6488 Preprocessor: set error flag when unhandled characters are found so checking can bailout 2014-06-01 11:24:10 +02:00
Daniel Marjamäki 1903d95015 Fixed #5661 (--suppress=missingInclude has no effect) 2014-05-03 19:31:15 +02:00
Alexander Mai 9412f9d216 #5717 Segmentation fault when providing multiple --include=/path/to/header arguments. 2014-04-23 20:50:16 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
PKEuS f71a4ad216 Improved information message on missing headers when included with <> (#4772) 2014-03-26 15:22:22 +01:00
PKEuS b564986d5d Added missing casts causing assertion failures on Windows (#5391)
-> Changed much more occurences, especially in preprocessor.cpp.
2014-03-18 21:41:47 +01:00
Daniel Marjamäki 3b4d024e06 Reverted info message that only applies to CLI 2014-03-11 20:55:02 +01:00
Daniel Marjamäki 94454df14f Fixed #2732 (Make it easier for users to tell 'How to supply header files') 2014-03-11 16:05:19 +01:00
Julian Santander fae8ef48b8 Fixed #5529 (Further control in selecting what configurations to consider) 2014-03-10 15:49:02 +01:00
Frank Zingsheim bc1ab4c48a Optimization preprocessor.cpp use string::compare for charT 2014-03-09 14:26:16 +01:00
Daniel Marjamäki 9eb789bdb2 use nullptr in lib/preprocessor.cpp 2014-02-15 08:37:57 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki 8305015dea astyle formatting 2014-02-08 08:51:38 +01:00
Pavel Roschin 19a8cfd960 Library: add new "define" tag
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Alexander Mai 86763b401c Fixed #5340 (Preprocessor: not using errorLogger when reporting syntax errors) 2014-01-12 13:15:54 +01:00