From: Tomasz Swierczek Date: Thu, 13 Jul 2023 12:33:23 +0000 (+0200) Subject: Fix build for new toolchain X-Git-Tag: accepted/tizen/unified/dev/20230726.115946^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen;p=platform%2Fcore%2Fsecurity%2Fvist.git Fix build for new toolchain Change-Id: Ic1bf9f35869ad1be940f02be03835bddbb3c4d6b --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9861864..9fe104d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,8 @@ IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "DEBUG") ENDIF(NOT CMAKE_BUILD_TYPE) -SET(CMAKE_CXX_FLAGS_DEBUG "-g -std=c++1z -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") -SET(CMAKE_CXX_FLAGS_RELEASE "-g -std=c++1z -O2 -DNDEBUG") +SET(CMAKE_CXX_FLAGS_DEBUG "-g -std=c++1z -O0 -ggdb -Wp,-U_FORTIFY_SOURCE -Wno-overloaded-virtual -Wno-class-memaccess") +SET(CMAKE_CXX_FLAGS_RELEASE "-g -std=c++1z -O2 -DNDEBUG -Wno-overloaded-virtual -Wno-class-memaccess") SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") diff --git a/src/osquery/core/query.cpp b/src/osquery/core/query.cpp index 8231e30..8a925fe 100644 --- a/src/osquery/core/query.cpp +++ b/src/osquery/core/query.cpp @@ -70,7 +70,6 @@ Status Query::addNewResults(QueryDataTyped current_qd, { // The current results are 'fresh' when not calculating a differential. bool fresh_results = !calculate_diff; - bool new_query = false; if (!isQueryNameInDatabase()) { // This is the first encounter of the scheduled query. fresh_results = true; @@ -82,7 +81,6 @@ Status Query::addNewResults(QueryDataTyped current_qd, << name_; } else if (isNewQuery()) { // This query is 'new' in that the previous results may be invalid. - new_query = true; INFO(OSQUERY) << "Scheduled query has been updated: " + name_; saveQuery(name_, query_); } @@ -90,8 +88,6 @@ Status Query::addNewResults(QueryDataTyped current_qd, // Use a 'target' avoid copying the query data when serializing and saving. // If a differential is requested and needed the target remains the original // query data, otherwise the content is moved to the differential's added set. - const auto* target_gd = ¤t_qd; - bool update_db = true; if (!fresh_results && calculate_diff) { // Get the rows from the last run of this query name. QueryDataSet previous_qd; @@ -102,11 +98,8 @@ Status Query::addNewResults(QueryDataTyped current_qd, // Calculate the differential between previous and current query results. dr = diff(previous_qd, current_qd); - - update_db = (!dr.added.empty() || !dr.removed.empty()); } else { dr.added = std::move(current_qd); - target_gd = &dr.added; } return Status::success(); diff --git a/src/osquery/core/tables.cpp b/src/osquery/core/tables.cpp index 15ceb56..95d972c 100644 --- a/src/osquery/core/tables.cpp +++ b/src/osquery/core/tables.cpp @@ -86,7 +86,7 @@ QueryContext TablePlugin::getContextFromRequest(const PluginRequest& request) co if (document.exist("colsUsed")) { UsedColumns colsUsed; Array array = document.get("colsUsed"); - for (auto i = 0; i < array.size(); i++) { + for (unsigned i = 0; i < array.size(); i++) { std::string name = array.at(i); colsUsed.insert(name); } @@ -94,7 +94,7 @@ QueryContext TablePlugin::getContextFromRequest(const PluginRequest& request) co } Array constraints = document.get("constraints"); - for (auto i = 0; i < constraints.size(); i++) { + for (unsigned i = 0; i < constraints.size(); i++) { auto constraint = Object::Create(constraints.at(i)); std::string name = constraint["name"]; context.constraints[name].deserialize(constraint); @@ -485,7 +485,7 @@ void ConstraintList::deserialize(vist::json::Object& obj) { using namespace vist::json; Array list = obj.get("list"); - for (auto i = 0; i < list.size(); i++) { + for (unsigned i = 0; i < list.size(); i++) { auto element = vist::json::Object::Create(list.at(i)); int op = element["op"]; Constraint constraint(static_cast(op)); diff --git a/src/vist/common/tests/archive.cpp b/src/vist/common/tests/archive.cpp index ab8c69b..8e84505 100644 --- a/src/vist/common/tests/archive.cpp +++ b/src/vist/common/tests/archive.cpp @@ -117,7 +117,7 @@ TEST(ArchiveTests, serializer_fundamental_char) TEST(ArchiveTests, serializer_fundamental_nullptr) { - std::nullptr_t input; + std::nullptr_t input = nullptr; Archive archive; archive << input; @@ -287,9 +287,9 @@ TEST(ArchiveTests, parameter_pack_transform) Archive archive; archive.pack(input1, input2, input3, input4, input5); - int output1; - float output2; - double output3; + int output1 = 0; + float output2 = 1.0; + double output3 = 2.0; std::string raw; std::string& output4 = raw; std::shared_ptr output5;