Skip to content

Commit

Permalink
build: remove some warning suppressions
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Aponte <[email protected]>
  • Loading branch information
federico-sysdig authored and poiana committed Nov 29, 2023
1 parent 89ec22f commit 8d269a8
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 134 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if(NOT MSVC)

if(BUILD_WARNINGS_AS_ERRORS)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
set(CMAKE_SUPPRESSED_WARNINGS "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-implicit-fallthrough -Wno-format-truncation")
set(CMAKE_SUPPRESSED_WARNINGS "-Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough -Wno-format-truncation")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -Wextra ${CMAKE_SUPPRESSED_WARNINGS}")
endif()

Expand Down
6 changes: 3 additions & 3 deletions test/libscap/test_suites/engines/gvisor/gvisor_parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ TEST(gvisor_parsers, parse_socketpair_x)
EXPECT_EQ(res.scap_events.size(), 1);

EXPECT_EQ(res.scap_events[0]->type, PPME_SOCKET_SOCKETPAIR_X);

struct scap_sized_buffer decoded_params[PPM_MAX_EVENT_PARAMS];
uint32_t n = scap_event_decode_params(res.scap_events[0], decoded_params);
EXPECT_EQ(n, 5);
Expand Down Expand Up @@ -405,7 +405,7 @@ TEST(gvisor_parsers, small_buffer)

TEST(gvisor_parsers, procfs_entry)
{
scap_gvisor::parsers::procfs_result res = {0};
scap_gvisor::parsers::procfs_result res;
std::string not_json = "not a json string";
std::string sandbox_id = "deadbeef";

Expand Down Expand Up @@ -504,7 +504,7 @@ TEST(gvisor_parsers, config_socket)
"name": "Default",
"points": [
{
"name": "container/start",
"name": "container/start",
"context_fields": [
"cwd",
"time"
Expand Down
12 changes: 6 additions & 6 deletions userspace/chisel/chisel_viewinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ chisel_view_info::chisel_view_info()
m_valid = false;
}

chisel_view_info::chisel_view_info(viewtype type,
chisel_view_info::chisel_view_info(viewtype type,
string id,
string name,
string description,
Expand All @@ -99,7 +99,7 @@ chisel_view_info::chisel_view_info(viewtype type,
m_description = description;
m_does_groupby = false;
m_type = type;
m_tags = tags;
m_tags = tags;
m_tips = tips;
m_columns = columns;
m_drilldown_target = drilldown_target;
Expand All @@ -110,7 +110,7 @@ chisel_view_info::chisel_view_info(viewtype type,
m_propagate_filter = propagate_filter;

m_use_defaults = use_defaults;

//
// Make sure the keys go at the beginning
//
Expand All @@ -133,9 +133,9 @@ void chisel_view_info::set_col_sorting_hotkeys()
{
const char shift_number_keys [] = {'!', '@', '#', '$', '%', '^', '&', '*', '('};
uint32_t size = sizeof(shift_number_keys) / sizeof(shift_number_keys[0]);
for(uint32_t i=0; i<size; i++)
for(uint32_t i=0; i<size; i++)
{
m_col_sort_hotkeys.push_back(shift_number_keys[i]);
m_col_sort_hotkeys.push_back(shift_number_keys[i]);
}
max_col_sort_hotkeys = m_col_sort_hotkeys.size();
}
Expand Down Expand Up @@ -179,7 +179,7 @@ void chisel_view_info::set_sorting_col()
throw sinsp_exception("view format error: more than one sorting column");
}

if((int64_t)m_sortingcol < 0)
if(m_sortingcol < 0)
{
ASSERT(false);
throw sinsp_exception("view sorting column configuration error");
Expand Down
8 changes: 4 additions & 4 deletions userspace/chisel/chisel_viewinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
*/

#pragma once
#pragma once

#define VIEW_ID_SPY -1
#define VIEW_ID_DIG -2
Expand All @@ -32,7 +32,7 @@ typedef enum chisel_field_aggregation
A_AVG,
A_TIME_AVG,
A_MIN,
A_MAX,
A_MAX,
} chisel_field_aggregation;

//
Expand All @@ -53,7 +53,7 @@ class chisel_view_column_info
chisel_view_column_info()
{
}

chisel_view_column_info(std::string field,
std::string name,
std::string description,
Expand Down Expand Up @@ -169,7 +169,7 @@ class chisel_view_info
std::string m_description;
std::vector<std::string> m_tags;
std::vector<std::string> m_tips;
uint32_t m_sortingcol;
int32_t m_sortingcol;
std::vector<std::string> m_applies_to;
std::vector<chisel_view_column_info> m_columns;
bool m_use_defaults;
Expand Down
22 changes: 11 additions & 11 deletions userspace/libscap/engine/gvisor/gvisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,25 @@ namespace scap_gvisor {

#define SCAP_HANDLE_T scap_gvisor::engine

#include "scap.h"
#include "gvisor.h"
#include "gvisor_platform.h"
#include "scap.h"
#include "scap-int.h"
#include "scap_proc_util.h"
#include "strerror.h"
#include "strl.h"

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <pthread.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/epoll.h>
#include <sys/stat.h>
#include <stdint.h>
#include <unistd.h>
#include <utility>

#include "strerror.h"
#include "strl.h"

#ifdef __cplusplus
extern "C"{
#endif
Expand Down Expand Up @@ -217,10 +216,11 @@ static uint64_t gvisor_get_max_buf_used(struct scap_engine_handle engine)

extern const struct scap_vtable scap_gvisor_engine = {
.name = GVISOR_ENGINE,
.savefile_ops = NULL,
.savefile_ops = nullptr,

.alloc_handle = gvisor_alloc_handle,
.init = gvisor_init,
.get_flags = nullptr,
.free_handle = gvisor_free_handle,
.close = gvisor_close,
.next = gvisor_next,
Expand All @@ -232,6 +232,6 @@ extern const struct scap_vtable scap_gvisor_engine = {
.get_n_tracepoint_hit = gvisor_get_n_tracepoint_hit,
.get_n_devs = gvisor_get_n_devs,
.get_max_buf_used = gvisor_get_max_buf_used,
.get_api_version = NULL,
.get_schema_version = NULL,
.get_api_version = nullptr,
.get_schema_version = nullptr
};
10 changes: 5 additions & 5 deletions userspace/libscap/engine/gvisor/gvisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

#include <stdint.h>
#include <string>
#include <thread>
#include <thread>
#include <atomic>
#include <deque>
#include <vector>
Expand All @@ -46,7 +46,7 @@ namespace parsers {

struct parse_result {
// the scap status of the operation
uint32_t status;
uint32_t status = 0;
// description of the error in case of failure
std::string error;
// the total encoded event(s) size
Expand All @@ -59,7 +59,7 @@ struct parse_result {

struct procfs_result {
// the scap status of the operation
uint32_t status;
uint32_t status = 0;
// description of the error in case of failure
std::string error;
// the resulting thread information
Expand All @@ -81,7 +81,7 @@ struct config_result {
\brief Translate a gVisor seccheck protobuf into one, or more, scap events
\param gvisor_buf the source buffer that contains the raw event coming from gVisor
\param scap_buf the buffer that will be used to store the encoded scap events
\return a parse_result struct.
\return a parse_result struct.
If the encoding is successful:
- the status field will be set as SCAP_SUCCESS
- the scap_events vector will contain pointers to each encoded event, all located within scap_buf's memory
Expand All @@ -107,7 +107,7 @@ namespace runsc
{

struct result {
int error;
int error = 0;
std::vector<std::string> output;
};

Expand Down
Loading

0 comments on commit 8d269a8

Please sign in to comment.