Commit Graph

378 Commits

Author SHA1 Message Date
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
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 a01bfcb62d Fixed a few cppcheck messages 2014-03-28 18:55:16 +01:00
PKEuS f71a4ad216 Improved information message on missing headers when included with <> (#4772) 2014-03-26 15:22:22 +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
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki 644004573b Preprocessor: fixed 8.0E+007 in macros 2014-01-08 18:05:14 +01:00
Daniel Marjamäki 2f91539d1d Preprocessor: don't insert macroChar inside .1 and 1. tokens 2014-01-02 11:21:23 +01:00
Daniel Marjamäki cd65d8e54f Fixed #5169 (Preprocessor::removeComments : Bad handling of __asm) 2014-01-01 12:44:59 +01:00
Daniel Marjamäki 7e71c41ba7 Preprocessor: Don't insert macroChar inside 1.f and 1.e+7 as that mess it up later. Thanks ettlmartin for telling me about this. 2013-12-31 10:24:14 +01:00
Daniel Marjamäki 99703e1a3f Preprocessor: make sure 1E-7, 1E+7, 1e+7 in macros is output as a single token. Putting a macroChar before the 7 mess it up later. 2013-12-30 18:03:24 +01:00
Daniel Marjamäki 582baa5648 Preprocessor: make sure 1e-7 is output as a single token. puttin a macroChar before the 7 mess it up later. 2013-12-29 21:51:01 +01:00
Daniel Marjamäki 8c7e3d14aa Fixed #5119 (Preprocessor: Using -D suppresses __cplusplus for C++ files) 2013-11-15 19:21:21 +01:00
Daniel Marjamäki 11abd23fa7 astyle formatting 2013-11-02 22:58:47 +01:00
Simon Martin 95c08d5613 Ticket #5139: Properly simplify recursive macro definitions 2013-11-01 16:47:22 +01:00
Daniel Marjamäki ec3ab74631 Preprocessor: Use set instead of list to track '#pragma once' usage 2013-10-27 10:33:37 +01:00
Daniel Marjamäki f8710cb984 Fixed #5102 (Crash if -D is used when scanning simple preprocessor code.) 2013-10-18 06:47:55 +02:00
Daniel Marjamäki bb0385321f Fixed #5074 (False positive: Duplicate expression (macro)) 2013-10-13 17:42:06 +02:00
Daniel Marjamäki a781a83822 Preprocessor: Quicker response for --check-config. No 'normal' code is needed so skip it. 2013-09-01 07:13:48 +02:00
Daniel Marjamäki 342142b783 Fixed #4256 (Preprocessor: '#pragma once' doesn't work properly when using -D) 2013-08-18 18:04:06 +02:00
Daniel Marjamäki c58c9d80e1 astyle formatting 2013-08-13 06:36:03 +02:00
Daniel Marjamäki ff71c94f6e Fixed #4949 (define symbol used in code => 'Analysis failed' message is written.) 2013-08-12 18:12:49 +02:00
Simon Martin 40887ca99c Ticket #4703: Trim macro parameters. 2013-08-11 09:41:03 +02:00
Simon Martin c9884c30a1 Fix ticket #4922 (segmentation fault upon invalid code). 2013-08-05 20:28:22 +02:00
Daniel Marjamäki 44333f316a Added terminate() handling to get quicker response when the user wants to terminate 2013-07-24 13:06:59 +02:00
Zachary Blair a381170886 Fixed #4874 (Minor spelling corrections) 2013-06-26 00:47:02 -07:00
Simon Martin 75c8dcc664 Fixed #4873 (Preprocessor: Cppcheck is unable to scan a file with a single quote in a comment inside assembler section) 2013-06-25 06:45:11 +02:00
Daniel Marjamäki bfc40ffe9f Fixed #4868 (Segmentation fault in Preprocessor::handleIncludes()) 2013-06-21 20:10:46 +02:00
Daniel Marjamäki e4270bab78 Fixed #4863 (macros not propagated) 2013-06-19 21:29:39 +02:00
Daniel Marjamäki 15c92384f4 Fixed #4851 (Preprocessor: problem when using #ifndef symbol in the code) 2013-06-15 12:08:18 +02:00
Daniel Marjamki 4e09b06bc1 Fixed #4827 (allow checking multiple configurations when using -D by also using --max-configs or --force) 2013-06-08 16:46:54 +02:00
Daniel Marjamäki 9eac4489ac Fixed #4838 (False positive for ... seems to be invalid) 2013-06-06 12:44:19 +02:00
XhmikosR 8ac9b8e7a9 remove duplicate ";" and fours dots 2013-04-09 17:49:09 +02:00
Robert Reif a3f9b5c07d Fixed #4686 (Prefer prefix ++/-- operators for non-primitive types with template iterator) 2013-03-30 13:49:56 +01:00
Alexander Mai f43ea5c491 Fixed #4594 (Analyzing errors about system headers not being found) 2013-03-13 19:50:50 +01:00
Alexander Mai 59d636742e Fixed #4594 (Analyzing errors about system headers not being found) 2013-03-13 06:48:33 +01:00
Daniel Marjamäki 42dd956dff Preprocessor: Better fix for hangs. And added proper unit test. 2013-01-27 02:53:29 +01:00
Daniel Marjamki f69b1f426e Preprocessor: Improved handling of expressions in simplifyVarMap. Ticket: #4516 2013-01-26 16:21:33 +01:00
Daniel Marjamki 641e7cba28 Fixed #4516 (Preprocessor: wrong #if evaluation) 2013-01-26 12:37:46 +01:00
Daniel Marjamki d33341a21a Fixed #4502 (Preprocessor: Treat SystemInclude and UserInclude the same) 2013-01-20 14:42:04 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Daniel Marjamäki d46789ee4a varFuncNullUB: fixed false positive when non-variadic argument is NULL (#4482) 2013-01-14 06:44:52 +01:00
Daniel Marjamäki f0ce26a2aa Preprocessor: Let the Tokenizer handle NULL 2013-01-13 15:01:31 +01:00
Daniel Marjamäki 70059c06de Fixed #4456 (std::string::compare(char const*) crash) 2013-01-03 08:44:32 +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
Daniel Marjamäki cb06d07ae7 Fixed #4351 (Escaped whitespace gives wrong error) 2012-12-02 18:04:19 +01:00
Daniel Marjamäki 45b77554ea Fixed #4308 (C++11 raw string literals not parsed correctly) 2012-11-30 13:46:46 +01:00
Daniel Marjamäki fe8b6f0f95 astyle formatting 2012-11-28 08:48:00 +01:00
Daniel Marjamäki 7d94230329 Fixed #4079 (#if condition does not evaluate numbers with sign) 2012-11-28 07:33:24 +01:00
PKEuS 4cd96158ae Fixed parsing of "__asm__ volatile {""};" 2012-11-04 12:21:34 +01:00
Daniel Marjamäki 24e71c479c Fixed #4301 (htmlreport broken) 2012-11-03 11:25:40 +01:00
Daniel Marjamäki c65ac603e9 Fixed #3837 (False positive: national locale inline asm comments are reported as unsupported) 2012-09-30 09:35:32 +02:00
Kamil Dudka b4d78e3d05 Fixed #3651 (Preprocessor: Wrong handling of #elif) 2012-09-15 09:34:41 +02:00
Daniel Marjamäki 6ebfbf42e1 Fixed #4191 (wrong syntax error if 'error' substring of stringification) 2012-09-12 16:10:45 +02:00
Daniel Marjamäki 2a9eaebcaa replaced tabs with spaces 2012-09-05 20:50:25 +02:00
Daniel Marjamäki 4eeec75b73 TestPreprocessor: Encode extended ASCII characters to avoid VS compiler warnings. 2012-09-04 16:29:06 +02:00
Daniel Marjamäki 41797d409d Fixed #4036 (cppcheck hangs with 100% cpu load) 2012-08-25 13:24:17 +02:00
Daniel Marjamäki 730935efdd Fixed testrunner assertions in TestPreprocessor 2012-08-25 11:45:18 +02:00
PKEuS f238f3fad5 Support sizeof in preprocessor directives
Applied "patch" provided by michaeln123 in #4071
2012-08-22 17:28:06 +02:00
Daniel Marjamäki dc6c3228d7 Fixed #3834 (Preprocessor: -U doesn't work) 2012-07-18 20:57:00 +02:00
Edoardo Prezioso aedaacba95 Don't report 'warning unknown pragma' message with GCC. 2012-07-18 00:48:45 +02:00
Daniel Marjamäki c6fdd2733b Test 'Preprocessor: Proper fix for #3690' 2012-07-13 13:04:10 +02:00
Daniel Marjamäki e4ad193b40 Fixed #3690 (CppCheck is stuck on evaluating false preprocessor expression( = 0)) 2012-07-13 11:28:45 +02:00
Daniel Marjamäki 8dd5270be3 Preprocessor: skip preprocessor directives in the Preprocessor::validateCfg function 2012-07-11 21:20:31 +02:00
Daniel Marjamäki 4f4be79f20 Preprocessor: Fixed bugs in my #3643 fix 2012-07-11 18:29:33 +02:00
Daniel Marjamäki 17cf24ed34 Fixed #3643 (Preprocessor: Invalid configuration (macro is used in code)) 2012-07-10 20:29:04 +02:00
Daniel Marjamäki 160fa94a02 Visual Studio: Hide VS compiler warnings for '(char)0xff' and '(char)0xfe' 2012-06-10 15:51:56 +02:00
Daniel Marjamäki 171f570639 Handle UTF-16 files. Partial fix for ticket #2083 2012-06-10 11:00:27 +02:00
PKEuS 279b0c59bb Don't set Preprocessor::missingIncludeFlag if missingInclude warning is suppressed (#3487). 2012-05-16 02:59:45 -07:00
Daniel Marjamäki dad2fb6db1 Fixed #3737 (Preprocessor: __cplusplus always defined for c++ code) 2012-05-08 11:49:43 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
Daniel Marjamäki 005ce81689 Fixed #3640 (False positive: statement begins with numeric code) 2012-05-04 17:53:47 +02:00
Ahti Legonkov 79af6f65d7 Fixed #3699 (cppcheck hangs with 100% cpu load on parsing preprocessor code) 2012-04-22 06:49:42 +02:00
PKEuS 88aa08e71b Refactorizations in test suite:
- Removed redundant tokenization helper functions in testtokenize.cpp and testsimplifytokens.cpp
- Pass arguments as const char[] or const std::string& to avoid instanciation or at least copying of strings
- Removed redundant calls to Tokenizer::validate() - This function is already called implicitly by tokenize() and simplifyTokenList()
2012-04-17 09:51:08 +02:00
Daniel Marjamäki 2ffb3baaed Preprocessor: fixed tests 2012-03-27 20:48:22 +02:00
Daniel Marjamäki 01ddfb6f80 Fixed #3534 (Broken support for dollar signs in identifiers) 2012-03-27 19:35:41 +02:00
Daniel Marjamäki c07044b3d3 Fixed #3573 (Preprocessor: handle '!(X)' the same as '!X') 2012-03-26 19:01:45 +02:00
Ahti Legonkov 780481e82a Fixed ticket #3675. 2012-03-23 01:45:47 +02:00
Stefan Weil f079ee7c31 test: Fix preprocessor code in test data
This is not valid preprocessor code: #ifdef A == 1

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-03-18 16:50:16 +01:00
Daniel Marjamäki fc84f55f80 Fixed #3536 (Preprocessor #if fails to correctly compare two #defined values) 2012-03-15 20:04:34 +01:00
Daniel Marjamäki db1205cdb3 Preprocessor: better handling of '#if A==1' 2012-02-29 19:08:01 +01:00
Daniel Marjamaki fbb5ebe3c6 Fixed #3577 (Preprocessor: Defines given on command line are not used in the code) 2012-02-05 20:48:28 +01:00
Daniel Marjamäki 8e2c40b4b3 Fixed #3323 (#undef needs different handling) 2012-01-24 07:43:26 +01:00
Ahti Legonkov 78461093f0 Fixed #3531 (When macro definition contains parenthesis, the #defined symbol does not get #defined.) 2012-01-21 12:51:54 +01:00
Daniel Marjamäki bd8c21fc6b Refactoring: Made Preprocessor::simplifyCondition nonstatic 2012-01-06 08:42:07 +01:00
Daniel Marjamäki 66472b09c0 Refactoring: Made Preprocessor::match_cfg_def nonstatic 2012-01-06 08:15:48 +01:00
Daniel Marjamäki 94d220e370 Refactoring: Made Preprocessor::getcode nonstatic 2012-01-06 08:01:50 +01:00
Daniel Marjamäki 07776e90ad Preprocessor: cleanup 2012-01-05 18:37:15 +01:00
PKEuS 38ddcde7b0 - Refactorizations in preprocessor.cpp and tokenizer.cpp
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 12:58:34 +01:00
PKEuS 064e0ea0d0 Revert "- Refactorizations in preprocessor.cpp and tokenizer.cpp"
Committing with subversion seems to have issues. Sorry for that. I'll the changes again, now using git.

This reverts commit 69498de6ca.
2012-01-02 12:10:53 +01:00
Philipp K 69498de6ca - Refactorizations in preprocessor.cpp and tokenizer.cpp
- Bugfix: tok->stringify(tok) returns now "".
- Removed most of the inline-asm handling in preprocessor; improved the remaining handling of #asm/#endasm: Simplified to "asm(...);" statement
2012-01-02 03:15:02 -08:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 2bb5de4c89 Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro)) 2011-12-18 13:33:23 +01:00
Daniel Marjamäki 322f46c761 Fixed #3426 ((error) Invalid number of character ({) when these macros are defined:) 2011-12-17 15:23:55 +01:00
Daniel Marjamäki fd78816181 Fixed #3418 (preprocessor define assignment not propagated) 2011-12-15 18:49:35 +01:00
Daniel Marjamäki 34fba9e1ea Fixed #3405 ((error) Invalid number of character ({) when these macros are def ined: 'WIN32'.) 2011-12-13 21:14:41 +01:00