Commit Graph

56 Commits

Author SHA1 Message Date
Oliver Stöneberg da09a92b0a
test/cfg: enabled `information` and `--inconclusive` in all cases / some cleanups (#4784) 2023-02-24 21:37:56 +01:00
Oliver Stöneberg a0b1285f4a
added CMake option `BUILD_CORE_DLL` to build lib as `cppcheck-core.dll` with Visual Studio (#4733) 2023-01-26 22:13:07 +01:00
Oliver Stöneberg e5572835c0
fixed `platforms` lookup / set proper platform type for `unix32-unsigned` and `unix64-unsigned` / copy `platforms` in CMake (#4464) 2023-01-26 22:05:40 +01:00
Oliver Stöneberg dc03a50414
some small cleanups and refactorings (#4488)
* moved `plistFile` from `ErrorLogger` to `CppCheck`

* got rid of global CWE objects

* lib/CMakeLists.txt: suppress some `-Wfloat-equal` clang warning in matchcompiled builds as well

* lib/CMakeLists.txt: moved a loop into proper block

* test/CMakeLists.txt: simplified `add_fixture`

* test/CMakeLists.txt: moved `fixture_cost`

* fixed `naming-privateMemberVariable` selfcheck warning
2022-09-24 11:59:13 +02:00
Oliver Stöneberg b3762cd76a
actually perform system tinyxml2 build on macos / fixed system tinyxml2 include (#4445)
* lib/CMakeLists.txt: removed unnecessary external include

* look up tinyxml2 include dir when using system one and specify it

* lib/CMakeLists.txt: do not treat bundled headers as system ones

* CI-unixish.yml: actually perform system tinyxml2 build on macos
2022-09-06 18:30:59 +02:00
Oliver Stöneberg c36320747f
some `missingInclude`/`missingIncludeSystem` fixes and tests (#4027)
* do not emit `missingInclude` and `missingIncludeSystem` errors when not enabled / fixed and improved TestPreprocessor::inline_suppression_for_missing_include()

* testpreprocessor.cpp: added missing tests for `missingInclude` and `missingIncludeSystem`

* cppcheckexecutor.cpp: `missingIncludeSystem` was not emitted in normal analysis if `missingInclude` existed

* dmake

* added `run-dmake` as `testrunner` dependency
2022-07-09 23:21:11 +02:00
Oliver Stöneberg b51aea5531
separated process execution code into `ProcessExecutor` (#4249) 2022-07-08 16:42:57 +02:00
Paul Fultz II 6843bf628b
Use the correct test name for SKIP_TESTS (#4221) 2022-06-19 19:26:49 +02:00
Oliver Stöneberg 133b9c2790
some `test/CMakeLists.txt` cleanups (#4067)
* test/CMakeLists.txt: removed unnecessary `CTest` include - gets rid of additional CTest/CDash targets

* test/CMakeLists.txt: adjusted CMake version - `CMAKE_MATCH_<n>` requires 3.9`

* test/CMakeLists.txt: sorted `add_cfg()` calls

* test/CMakeLists.txt: extract test fixtures based on `REGISTER_TEST` macro

* test/CmakeLists.txt: added TODO
2022-06-02 22:26:01 +02:00
Paul Fultz II 4fa2e3ac87
Use default template in the cfg tests (#4039) 2022-04-23 06:18:44 +02:00
Oliver Stöneberg f53ad2391a
CMakeLists.txt: removed left-over Z3 code (#4035) 2022-04-21 12:54:16 +02:00
Oliver Stöneberg 4ddd7e562d
runtests.sh: refactoring and cleanups (#4029)
* runtests.sh: avoid redundant `pkg-config` checks and simplified the check

* runtests.sh: write a message when something is completely missing

* runtests.sh: derive paths from script location

* runtests.sh: improved readability by using individual functions for each file

* runtests.sh: added helper function `get_pkg_config_cflags()` to clean up cflag lookup from `pkg-config`

* runtests.sh: simplified `xmlstarlet` calls
2022-04-20 17:27:12 +02:00
Georgi D. Sotirov 33315b0ae5
Replace tinyxml2_LIBRARY with tinyxml2_LIBRARIES (#3897) 2022-03-15 21:17:03 +01:00
Oliver Stöneberg 51371f7929
added CMake option USE_THREADS to be able to use threads instead of fork() / cleanups (#3852) 2022-02-23 09:04:35 +01:00
Oliver Stöneberg 974dd5d49f
only use bundled tinyxml2 in CMake when configured to do so (#3806) 2022-02-06 13:02:52 +01:00
Oliver Stöneberg b4704ba065
use target-specific configuration instead of global ones in CMake (#3534) 2021-10-30 09:08:07 +02:00
Paul Fultz II 2a3657154b
Dont require __main__ for an addon (#3363) 2021-08-12 20:17:51 +02:00
Paul Fultz II 8dc1fa7a59
Add colors to CLI reporting (#3304) 2021-07-08 21:21:35 +02:00
DGarry82 77716ee398
fix w64-mingw32-ld linking error (#3184)
* fix w64-mingw32-ld linking error

use shlwapi instead of Shlwapi.lib in mingw-w64 build environment
(prevents "/usr/bin/x86_64-w64-mingw32-ld: cannot find -lShlwapi" error)

* same MinGW shlwapi fix for {tests,tools}/CMakeLists.txt

Co-authored-by: Igor Rondarev <igor.rondarev@gmail.com>
2021-03-29 17:04:42 +02:00
Rikard Falkeborn fb35756126
TestLeakAutoVar: Split recursiveCountLimit test to separate class (#2995)
This test is by far the slowest one to run. Split it to a separate class
to make it easy to select if it should be run during development.
2020-12-31 09:34:53 +01:00
Wolfgang Stöggl 8ac55a8534
Add find_package(tinyxml2) to CMake builds (#2691)
So far, the cmake files of Cppcheck needed to be patched in order to
use installed tinyxml2 instead of the bundled version of tinyxml2.
- Introduce the CMake option USE_BUNDLED_TINYXML2 with a default value
  of ON. This preserves the behavior as in the past and uses the
  bundled version under externals/tinyxml2 by default.
- Usage of the installed tinyxml2 version of a system can be enabled
  now using -DUSE_BUNDLED_TINYXML2=OFF as a cmake parameter.
- Some Linux distros do not install tinyxml2*.cmake files, which are
  required to find tinyxml2 using find_package().
  Try first using find_package(tinyxml2 QUIET) and if this fails, try
  again using find_library(tinyxml2_LIBRARY tinyxml2)
2020-11-22 08:57:07 +01:00
Daniel Marjamäki c7cbe7f2d3 rename externals/tinyxml to externals/tinyxml2 2020-11-16 09:11:53 +01:00
Oliver Stöneberg 488813d00f
added validateCFG and checkcfg targets to CMake / some refactorings (#2687) 2020-11-02 20:16:15 +01:00
Oliver Stöneberg dae37f1c9f
disabled precompiled headers in CMake as they currently do not emit any compiler warnings / adjusted check for precompiled header (#2820) 2020-09-23 07:51:21 +02:00
firewave a49d60f0b3 use precompiled headers if CMake supports it 2020-06-16 19:56:53 +02:00
Oliver Stöneberg 3a90341961
some CMake cleanups and additions (#2639) 2020-05-27 05:15:46 +02:00
Sebastian f0e3f9e79a
gtk.cfg: Fix/enhance Gtk library configuration (g_abort and others) (#2558)
test/CMakeLists.txt: Fix missing INCONCLUSIVE for Gtk configuration test
2020-02-27 13:16:43 +01:00
Paul Fultz II 7368a54629
Add generic valueflow forward analysis (#2511) 2020-02-13 16:27:06 +01:00
Ken-Patrick Lehrmann 0b7649ca9b Fix 9298 (#2476)
* Fix 9298

Tell cppcheck that strcpy returns its first argument, and use that
knowledge in checkTokenInsideExpression.

* Add missing unit tests in cmake
2020-01-09 08:47:36 +01:00
Wolfgang Stöggl ad8bedebd7 Update cmake_minimum_required VERSION (#2457)
When tests are built, the minimum required cmake version is 3.4.
The file test/CMakeLists.txt uses cmake_policy(SET CMP0064 NEW),
which requires cmake 3.4 [1].

[1] https://cmake.org/cmake/help/v3.4/policy/CMP0064.html
2019-12-28 10:46:13 +01:00
KenPatrickLehrmann 1114dc0536 Enhance handling of assertion from googletest (#2331)
* Enhance handling of assertion from googletest

* Update googletest, and add it to cmake build

* Enhance ASSERT_STR* in googletest.cfg
2019-11-06 21:38:01 +01:00
Paul Fultz II ba037837c9 Track lifetime across multiple returns
This will now warn when doing something like this:

```cpp
template <class T, class K, class V>
const V& get_default(const T& t, const K& k, const V& v) {
    auto it = t.find(k);
    if (it == t.end()) return v;
    return it->second;
}
const int& bar(const std::unordered_map<int, int>& m, int k) {
    auto x = 0;
    return get_default(m, k, x);
}
```

The lifetime warning is considered inconclusive in this case.

I also updated valueflow to no tinject inconclusive values unless `--inconclusive` flag is passed. This creates some false negatives because library functions are not configured to not modify their input parameters, and there are some checks that do not check if the value is inconclusive or not.
2019-09-11 19:25:09 +02:00
Paul Fultz II b2ae835b4b cmake: Add dependency on cppcheck (#2165)
This adds a dependency on cppcheck so it will be built when calling `make check`
2019-09-10 06:21:59 +02:00
Paul Fultz II d20b1b2525 Add cfg tests to cmake (#2154)
* Add cfg tests to cmake

* Fix test
2019-09-09 21:44:30 +02:00
Paul Fultz II 255c1062e4 Run test fixtures as seperate tests so they can run in parallel (#2126) 2019-09-02 06:53:35 +02:00
Daniel Marjamäki b68f50ea25 appveyor: check that cmake builds work also. run test/cli tests. 2019-07-09 07:46:53 +02:00
Paul Fultz II d62ed420d8 Add a check target to cmake (#1465) 2018-11-05 18:13:04 +01:00
Frank Zingsheim 47c063e13f Fixed #7660 (cmake build does not handle simplecpp) 2016-08-06 18:21:54 +02:00
Alexander Mai 41dee7f970 #7399 CMake error: Cannot specify link libraries for target 'testrunner' (reported by user dbuchholz). Add comment to mathlib.h 2016-02-19 21:40:31 +01:00
Frank Zingsheim 1d7fac3ca9 Added testrunner test to cmake. #7098 2015-11-26 21:01:07 +01:00
Frank Zingsheim 70c20515a9 Cmake object linkage. Fix #7128: (cppcheck 1.70 doesn't report any warnings) 2015-11-26 20:25:09 +01:00
Luis Díaz Más 22424ba54a Add CMake files 2015-02-13 19:00:14 +01:00
Daniel Marjamäki c971fa0d4b cmake: cleanup unmaintained cmake files 2011-05-19 17:16:04 +02:00
Daniel Marjamäki 6f7e9a67b0 Fixed #2684 (TestFileLister test assumes there are source files in the same directory) 2011-04-07 17:36:42 +02:00
Markus Elfring ce198f85fc Addition of a file name in a CMake script (bug #2524, #1690)
A few source files were added because of the feature request "Ability to
exclude files and directories from checks".
6401271ceb

A CMake build script was updated for these changes.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-03-26 20:41:01 +01:00
Daniel Marjamaki c6b176014b cmake: removed the non-working pcre. ticket: #2679 2011-03-26 19:03:11 +01:00
Sebastien Debrard 29b7d4b9c3 sync cmake files with the master branch 2011-03-26 02:03:52 +01:00
Markus Elfring 9301ee28a8 Added CMake files 2011-03-25 07:14:53 +01:00
Daniel Marjamäki 40bb5144e1 removed some more cmake files 2010-02-23 20:12:53 +01:00
Kimmo Varis 6f47f77977 CMake - fix building tests for Visual Studio.
Need to include lib sources directly to test project also.
2010-02-01 20:16:30 +02:00