Commit Graph

285 Commits

Author SHA1 Message Date
Sebastian c990d10ffa
Check for JSON error when parsing addon .json files + fixes (#2374)
* cppcheck.cpp: Check for JSON error when parsing addon .json files

This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().

* naming.json: Fix missing comma

* CLI: Fix naming violations detected by addon naming.py via naming.json

* Addon naming: Add argument for validating names of constants

* LIB: Rename functions/variables so they are valid, loosen naming rules

* GUI: Fix naming violations
2019-11-20 15:37:09 +01:00
Oliver Stöneberg 9028b4a81d do not access static methods through instance (#2189) 2019-09-20 21:54:30 +02:00
Daniel Marjamäki a17f2a6f05 Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead. 2019-08-17 10:53:07 +02:00
Daniel Marjamäki 7e3626c84e Travis: Check the naming conventions again 2019-07-15 20:58:07 +02:00
Daniel Marjamäki 96a1c6dec5 Rename errorlist=>mShowAllErrors 2019-07-15 18:31:12 +02:00
Daniel Marjamäki a6194b81aa Rename _errorList=>mShownErrors 2019-07-15 18:29:09 +02:00
Daniel Marjamäki 5037ad3d42 Rename _settings=>mSettings 2019-07-15 18:24:27 +02:00
Daniel Marjamäki 0fa8a51815 Rename variable _files=>mFiles 2019-07-15 18:21:52 +02:00
Daniel Marjamäki 122ae198b7 Rename errorOutput=>mErrorOutput 2019-07-15 18:16:07 +02:00
Daniel Marjamäki 876d8c9829 Rename member variable exceptionOutput=>mExceptionOutput 2019-07-15 18:11:26 +02:00
Scott Furry a195477470 Correct Zero/Null as pointer constant (#1938)
Building with enhanced clang warnings indicated a large number of
instances with the warning:

`warning: zero as null pointer constant`

Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.

Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
Daniel Marjamäki a0dd853642 analyzing one vs config (first debug config that matches platform) 2019-04-13 20:01:40 +02:00
Daniel Marjamäki cb06aebdab Removed --std=posix. From now on, if you use --library=posix then the posix checks will be enabled. 2019-04-12 06:47:28 +02:00
Daniel Marjamäki c04cc02ee5 Refactoring; Use range for loop 2019-04-07 12:07:47 +02:00
Sebastian 08d41ab8af
Load std.cfg before all other libraries (#1740)
- CLI: Save the libraries that should be loaded to a list and load them
after the std.cfg has been loaded.
- GUI: Load std.cfg (and windows.cfg / posix.cfg when applicable) before
setting other options and loading the other libraries.
In the project-file-dialog the std.cfg is searched first. If some
other library fails to load is is retried with first loading std.cfg.
- boost.cfg: Enable containers that depend on std containers.
2019-03-15 06:59:37 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki d35a26c6f0 --check-library fix 2019-01-22 19:40:39 +01:00
Daniel Marjamäki 4119cfd3d1 Correct exit code when there are no unmatched suppressions 2019-01-21 20:33:22 +01:00
Daniel Marjamäki 0f19dfea82 Do not check unmatched suppressions in --check-library checking 2019-01-20 10:30:38 +01:00
Daniel Marjamäki 0945e827c6 Fixed #8931 (Missing error exitcode when an unmatched suppression is detected) 2019-01-19 21:42:01 +01:00
Daniel Marjamäki ade18d978a Inline suppression for knownConditionTrueFalse FP 2019-01-13 13:18:35 +01:00
Daniel Marjamäki 900e26f651 Fix Cppcheck warning
[ci skip]
2019-01-13 13:06:51 +01:00
Sebastian b51f19d530
Fix some doxygen warnings/issues in the comments (#1537) 2018-12-21 21:23:03 +01:00
Daniel Marjamäki 7c5058a42d Refactoring. Rename methods 2018-04-23 12:39:47 +02:00
Daniel Marjamäki f058d9ad08 CLI: Added more fields for --template and added a new --template-location. The gcc predefined template now matches latest gcc better. 2018-04-23 12:21:18 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
jrp2014 c2e54fa87f Refactor cli/cppcheckexecutor.cpp 2018-04-05 08:12:15 +02:00
jrp2014 b813a6d407 Refactoring 2018-04-04 21:11:23 +02:00
jrp2014 07b5afcdc6 Improve constness 2018-04-04 21:02:13 +02:00
amai dab99e83cd (Re-)Enable exception handling on cygwin 2018-04-03 00:41:13 +02:00
Daniel Marjamäki 25ef18ab11 astyle formatting
[ci skip]
2018-03-22 07:14:01 +01:00
amai2012 ab02595be1 Improve debug output in case of SIGABRT (add hint about assertion) and small refactoring 2018-03-20 14:24:45 +01:00
orbitcowboy 50844aa7fc checkType: Take into account the size of char. 2018-02-18 14:28:48 +01:00
Daniel Marjamäki db274e8308 Fix testrunner in cygwin 2018-02-10 15:34:49 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ivan Maidanski 97ffec85c0 Fixed #7502 (Correct exit code if never used function is found) (#1026) 2018-01-12 08:24:01 +01:00
Dmitry-Me 93e5140945 Better variable names 2017-10-14 23:05:58 +03:00
Oleksandr Redko 2bee664ec9 Return non-const object to enable move compiler optimization (#966) 2017-10-03 18:24:18 +02:00
Ayaz Salikhov 2604156fe7 Use C++ headers (#949) 2017-09-07 13:02:44 +02:00
Daniel Marjamäki 1a1f2069e9 astyle formatting
[ci skip]
2017-08-30 17:42:04 +02:00
Dmitry-Me 9d41b272a1 Brace macro parameter 2017-08-29 21:23:45 +03:00
Dmitry-Me 6f0d5aaee3 Adapt to cases when conversion is a no-op 2017-08-29 21:21:48 +03:00
Dmitry-Me c9e2b56b08 Make code easier to debug 2017-08-29 17:51:56 +03:00
Heiko Eißfeldt de9f8b8a3c refactoring ansiToOEM 2017-08-22 13:15:11 +02:00
Heiko Eißfeldt 04bcc86d59 Fixed #439 (Patch: Cppcheck reports wrong filename for filenames containing 8-bit ASCII) 2017-08-21 12:52:15 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki 91eb0f1fad Removed XML version 1 2017-07-29 18:56:22 +02:00
Ayaz Salikhov 4bbc830a85 Fix warnings 2017-07-17 10:13:11 +03:00
Alexander Mai 9da28d5f4c Signal handling: Don't mix sigaction and signal. SIGUSR1 can be used to print current callstack, SIGUSR2 is being ignored. Minor refactoring 2017-06-06 20:56:59 +02:00
Daniel Marjamäki dc79f9630f Fixed unit tests 2017-05-30 15:53:54 +02:00
Daniel Marjamäki 1f48b082d1 CLI: Add --output-file flag so results can be written to file directly. 2017-05-30 15:04:28 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
Daniel Marjamäki e9d950d4f5 Cppcheck build dir: Better handling when --project is used 2016-12-08 22:46:44 +01:00
Neszt Tibor 4bd6a75c48 execinfo.h is part of glibc
On systems where glibc is not available, execinfo.h should not be
included.
2016-11-29 09:44:50 +01:00
Daniel Marjamäki 7d7212c465 --cppcheck-build-dir: generate unique analyzeinfo filenames when source files have same names 2016-11-14 20:50:08 +01:00
Daniel Marjamäki 350e5a7142 UnusedFunctions: Perform checking using analyzeinfo 2016-11-05 21:26:56 +01:00
Daniel Marjamäki 324f68ca36 rename function 2016-10-28 12:10:19 +02:00
Daniel Marjamäki 606e31602c Fixed #7177 (Support compile_commands.json) 2016-08-13 10:50:03 +02:00
Daniel Marjamäki c586ae8cbe Revert 'project' - it is not ready yet 2016-08-07 17:10:37 +02:00
Daniel Marjamäki 4dbdb50317 split 2016-08-07 15:35:41 +02:00
Daniel Marjamäki e0f4ce9358 vs 2016-08-07 13:55:27 +02:00
Daniel Marjamäki 09d6f4f0a4 1 2016-08-06 21:04:50 +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
Alexander Mai 80f445bf6f #7425 Broken XML output due to information about missing include paths. Use stdout for warning message (in alignment with other warnings messages). Minor refactoring (move some function from anon. namespace to static,etc.) 2016-05-20 21:32:59 +02:00
Gleydson Soares 99a03b4d2a fix build on OpenBSD 2016-05-08 19:48:20 -03:00
Daniel Marjamäki e038dd9663 Fixed #7271 (Suppress warning about non-existing path given to -I with --quiet.) 2016-01-09 11:19:51 +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
Alexander Mai f762affea0 Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart' 2015-11-30 22:13:49 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Daniel Marjamäki 8bb8290a6f Fixed GCC warnings. unused variable, shadow variable. 2015-11-28 18:15:47 +01:00
PKEuS 93c02ce826 Fixed compiler error introduced in previous commit and several MSVC warnings 2015-11-28 10:49:08 +01:00
Alexander Mai fe7d5cd242 Fix small glitch in previous commit - causing a compile error on Windows 2015-11-25 22:45:06 +01:00
Alexander Mai 03ecb980a5 Small refactoring of stacktrace printing code 2015-11-25 22:37:38 +01:00
Alexander Mai 9757f5b5f4 Improve exception handling on un*x: try to print a callstack in out-of-memory situations as well 2015-11-21 16:50:57 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
amai2012 b788d96bb9 Repair build with VS2010 2015-11-15 10:45:01 +01:00
Alexander Mai bda9c8c2d5 --exception-handling now prints callstack on SIGINT, allows to debug program hangs. Also add handler for some more signals. 2015-11-14 19:59:22 +01:00
Alexander Mai ba2671e19a Fix possible segmentation fault in un*x signal handler. Use SIGUSR1 for debugging purposes 2015-09-29 12:56:13 +02:00
PKEuS 92b867dd2c Fixed behaviour of --quiet/-q and its description 2015-07-25 17:55:12 +02:00
Dmitry-Me 05a318f9e7 Resolve CID 1312126 and maybe also CID 1288510 2015-07-23 16:35:47 +03:00
PKEuS ce9272a4ed Refactorized file listing code (CLI):
- Apply PathMatch in FileLister::recursiveAddFiles() already to avoid touching directories that are ignored (#5775)
- Simplified code to warn about header exclusion; use Path::isHeader() instead of custom header filename detection
2015-07-23 14:28:17 +02:00
Alexander Mai 8b97f04de4 Try to address some Coverity issues. Add TODO testcase for #5783. Introduce TODO_ASSERT macro. 2015-07-19 15:03:35 +02:00
Martin Ettl 7ff4d10c43 Astyle formatting, no functional changes. 2015-06-28 19:25:13 +02:00
amai2012 5814c3b84c Fix some compiler warnings with VS
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai bacc5ac1cc Fix false positives ignoredReturnValue about some posix interfaces. Remove redundant strsignal() output from signal handler 2015-04-06 18:16:37 +02:00
Alexander Mai 4048c50a69 Minor improvements on signal handler 2015-04-01 21:17:13 +02:00
Dmitry-Me 618c038448 Resolve CID 1288510 2015-03-24 17:59:24 +03:00
Alexander Mai 39633ef26f Add more interfaces to posix.cfg 2015-03-08 14:24:54 +01:00
Alexander Mai 521e6c48b5 Minor fixes for signal handling: make global variables static, enhance stack vs. heap detection for recognizing stack overflows 2015-03-07 20:47:27 +01:00
Alexander Mai abde80f0d9 Use alternative stack for signal handler to allow catching stack overflow induced SIGSEGV/SIGILL 2015-03-07 18:15:25 +01:00
Dmitry-Me bd3428e039 Reduce code duplication 2015-02-20 10:26:02 +03:00
Thomas Jarosch ec21134817 Fix false negatives for local suppressions
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.

When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.

The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00
PKEuS 787cbcb02e Accept unknown elements in Library files, but print a warning. This fixes backward compatibility of libraries with older cppcheck versions 2015-01-10 22:18:57 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Thomas Jarosch 9438b49bfb Fix build on PowerPC
PowerPC does not provide ucontext.gregs or the REG_ERR define.

Found while testing big endian platform.
2014-12-31 01:44:50 +01:00
Ni2c2k 666fa04ed8 don't use USE_UNIX_BACKTRACE_SUPPORT on Qnx 2014-12-16 20:11:25 +05:00
Daniel Marjamäki 0b9d80c95d Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis 2014-12-02 06:41:18 +01:00
Daniel Marjamäki a002654c47 Reverted refactoring 828417c for now. It caused a major slowdown in the unused functions checking. 2014-11-24 06:37:08 +01:00