From 7022726b0d07936110adb1f8eb2d100998340379 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Wed, 11 Sep 2024 13:22:12 +0200 Subject: [PATCH 1/2] chore: update presets and add a basic clang-tidy config Signed-off-by: Andrea Terzolo --- .clang-tidy | 5 +++ CMakePresets.json | 82 +++++++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 39 deletions(-) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..c73338048c --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,5 @@ +Checks: ' clang-diagnostic-*, clang-analyzer-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-nullability.*, clang-analyzer-unix.*, performance-*, bugprone-use-after-move, bugprone-move-forwarding-reference, cppcoreguidelines-rvalue-reference-param-not-moved, misc-unused-parameters ' +WarningsAsErrors: 'bugprone-use-after-move' +# UseColor true causes sarif conversion and reviewdog fail +UseColor: false +ExtraArgsBefore: ['-Wno-unknown-warning-option'] diff --git a/CMakePresets.json b/CMakePresets.json index 97a9c5e873..47d1e4a89c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,41 +1,45 @@ { - "version": 3, - "configurePresets": [ - { - "name": "scap-drivers", - "displayName": "Build scap drivers and their tests", - "description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests", - "generator": "Unix Makefiles", - "binaryDir": "${sourceDir}/build-scap-drivers", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "BUILD_BPF": "ON", - "BUILD_DRIVER": "ON", - "USE_BUNDLED_DEPS": "ON", - "ENABLE_DRIVERS_TESTS": "ON", - "MODERN_BPF_DEBUG_MODE": "ON", - "BUILD_LIBSCAP_MODERN_BPF": "ON", - "BUILD_LIBSCAP_GVISOR": "OFF", - "CREATE_TEST_TARGETS": "ON", - "ENABLE_LIBSCAP_TESTS": "ON", - "SCAP_FILES_SUITE_ENABLE": "OFF" - } - }, - { - "name": "sinsp-minimal", - "displayName": "Build sinsp in minimal build", - "description": "Build sinsp in minimal build with its tests", - "generator": "Unix Makefiles", - "binaryDir": "${sourceDir}/build-sinsp-minimal", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "BUILD_DRIVER": "ON", - "BUILD_BPF": "ON", - "USE_BUNDLED_DEPS": "ON", - "CREATE_TEST_TARGETS": "ON", - "MINIMAL_BUILD": "ON", - "SCAP_FILES_SUITE_ENABLE": "OFF" - } - } - ] + "version": 3, + "configurePresets": [ + { + "name": "scap-drivers", + "displayName": "Build scap drivers and their tests", + "description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests", + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build-scap-drivers", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "BUILD_BPF": "ON", + "BUILD_DRIVER": "ON", + "USE_BUNDLED_DEPS": "ON", + "ENABLE_DRIVERS_TESTS": "ON", + "MODERN_BPF_DEBUG_MODE": "ON", + "BUILD_LIBSCAP_MODERN_BPF": "ON", + "BUILD_LIBSCAP_GVISOR": "OFF", + "CREATE_TEST_TARGETS": "ON", + "ENABLE_LIBSCAP_TESTS": "ON", + "SCAP_FILES_SUITE_ENABLE": "OFF", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "BUILD_WARNINGS_AS_ERRORS": "ON" + } + }, + { + "name": "sinsp-minimal", + "displayName": "Build sinsp in minimal build", + "description": "Build sinsp in minimal build with its tests", + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build-sinsp-minimal", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "BUILD_DRIVER": "ON", + "BUILD_BPF": "ON", + "USE_BUNDLED_DEPS": "ON", + "CREATE_TEST_TARGETS": "ON", + "MINIMAL_BUILD": "ON", + "SCAP_FILES_SUITE_ENABLE": "OFF", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "BUILD_WARNINGS_AS_ERRORS": "ON" + } + } + ] } From 8d86d9676de16d1612e6c69212ecef3bed9f4594 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Wed, 11 Sep 2024 17:04:08 +0200 Subject: [PATCH 2/2] Update .clang-tidy Co-authored-by: Mauro Ezequiel Moltrasio Co-authored-by: Mauro Ezequiel Moltrasio Signed-off-by: Andrea Terzolo --- .clang-tidy | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index c73338048c..0085136261 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,15 @@ -Checks: ' clang-diagnostic-*, clang-analyzer-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-nullability.*, clang-analyzer-unix.*, performance-*, bugprone-use-after-move, bugprone-move-forwarding-reference, cppcoreguidelines-rvalue-reference-param-not-moved, misc-unused-parameters ' +Checks: + - clang-diagnostic-* + - clang-analyzer-* + - clang-analyzer-core.* + - clang-analyzer-cplusplus.* + - clang-analyzer-nullability.* + - clang-analyzer-unix.* + - performance-* + - bugprone-use-after-move + - bugprone-move-forwarding-reference + - cppcoreguidelines-rvalue-reference-param-not-moved + - misc-unused-parameters WarningsAsErrors: 'bugprone-use-after-move' # UseColor true causes sarif conversion and reviewdog fail UseColor: false