Skip to content

Commit

Permalink
fix: some issues with Clang 18
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Aponte <[email protected]>
  • Loading branch information
federico-sysdig committed Dec 13, 2024
1 parent 34cbe7e commit 0fae847
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
30 changes: 16 additions & 14 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
},
{
"name": "scap-drivers",
"inherits": "base",
"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"
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
},
{
"name": "sinsp-minimal",
"inherits": "base",
"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"
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions test/drivers/test_suites/syscall_exit_suite/getcwd_x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TEST(SyscallExit, getcwdX_success) {

/*=============================== TRIGGER SYSCALL ===========================*/

unsigned long size = 200;
const unsigned long size = 200;
char path[size];
uint32_t read_bytes = syscall(__NR_getcwd, path, size);
assert_syscall_state(SYSCALL_SUCCESS, "getcwd", read_bytes, NOT_EQUAL, -1);
Expand Down Expand Up @@ -49,7 +49,7 @@ TEST(SyscallExit, getcwdX_fail) {

/*=============================== TRIGGER SYSCALL ===========================*/

long size = 2;
const long size = 2;
char path[size];
assert_syscall_state(SYSCALL_FAILURE, "getcwd", syscall(__NR_getcwd, path, size));
int64_t errno_value = -errno;
Expand Down
2 changes: 1 addition & 1 deletion test/drivers/test_suites/syscall_exit_suite/readv_x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TEST(SyscallExit, readvX_success) {
strlen(test_string) + 1);

/* Try to read the string with readv using three buffers */
int32_t iovcnt = 3;
const int32_t iovcnt = 3;
iovec iov[iovcnt];
size_t buf_size = 15;
ASSERT_GT(iovcnt * buf_size, strlen(test_string) + 1);
Expand Down
2 changes: 1 addition & 1 deletion userspace/libscap/linux/scap_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ static int32_t scap_cgroup_resolve_v2(struct scap_cgroup_interface* cgi,
return SCAP_FAILURE;
}

struct scap_cgroup_set found_subsystems = {.len = 0, {'\0'}};
struct scap_cgroup_set found_subsystems = {.len = 0, .path = {'\0'}};
while(1) // not reached cgroup mountpoint yet
{
struct scap_cgroup_set current_subsystems;
Expand Down
2 changes: 2 additions & 0 deletions userspace/libsinsp/filter_check_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ using namespace std;
// sinsp_filter_check_list implementation
///////////////////////////////////////////////////////////////////////////////

filter_check_list::~filter_check_list() = default;

void filter_check_list::add_filter_check(std::unique_ptr<sinsp_filter_check> filter_check) {
// If a filtercheck already exists with this name and
// shortdesc, don't add it--this can occur when plugins are
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/filter_check_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class sinsp;
class filter_check_list {
public:
filter_check_list() = default;
virtual ~filter_check_list() = default;
virtual ~filter_check_list();

void add_filter_check(std::unique_ptr<sinsp_filter_check> filter_check);
void get_all_fields(std::vector<const filter_check_info*>&) const;
Expand Down

0 comments on commit 0fae847

Please sign in to comment.