diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1ffe76d..1308b6ee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,7 +196,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \ -Werror=switch -Werror=switch-bool -Werror=return-type \ -Werror=return-stack-address \ - -Wno-c99-designator \ + -Wno-c99-designator -Wmissing-field-initializers \ -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT") # Don't omit frame pointer in RelWithDebInfo, for additional callchain debug. diff --git a/src/integrations/kafka/consumer.hpp b/src/integrations/kafka/consumer.hpp index 7ad3da4a5..34e8b1bdb 100644 --- a/src/integrations/kafka/consumer.hpp +++ b/src/integrations/kafka/consumer.hpp @@ -1,4 +1,4 @@ -// Copyright 2022 Memgraph Ltd. +// Copyright 2023 Memgraph Ltd. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source @@ -86,8 +86,8 @@ struct ConsumerInfo { std::string bootstrap_servers; std::chrono::milliseconds batch_interval; int64_t batch_size; - std::unordered_map public_configs; - std::unordered_map private_configs; + std::unordered_map public_configs{}; + std::unordered_map private_configs{}; }; /// Memgraphs Kafka consumer wrapper. diff --git a/src/query/context.hpp b/src/query/context.hpp index 251af64d9..6d84beeed 100644 --- a/src/query/context.hpp +++ b/src/query/context.hpp @@ -43,14 +43,14 @@ struct EvaluationContext { /// it as if the lifetime is only valid during the Pull. utils::MemoryResource *memory{utils::NewDeleteResource()}; int64_t timestamp{-1}; - Parameters parameters; + Parameters parameters{}; /// All properties indexable via PropertyIx - std::vector properties; + std::vector properties{}; /// All labels indexable via LabelIx - std::vector labels; + std::vector labels{}; /// All counters generated by `counter` function, mutable because the function /// modifies the values - mutable std::unordered_map counters; + mutable std::unordered_map counters{}; }; inline std::vector NamesToProperties(const std::vector &property_names, diff --git a/src/query/plan/preprocess.hpp b/src/query/plan/preprocess.hpp index 50b6a621f..684c6e534 100644 --- a/src/query/plan/preprocess.hpp +++ b/src/query/plan/preprocess.hpp @@ -270,15 +270,15 @@ struct FilterInfo { /// The original filter expression which must be satisfied. Expression *expression; /// Set of used symbols by the filter @c expression. - std::unordered_set used_symbols; + std::unordered_set used_symbols{}; /// Labels for Type::Label filtering. - std::vector labels; + std::vector labels{}; /// Property information for Type::Property filtering. - std::optional property_filter; + std::optional property_filter{}; /// Information for Type::Id filtering. - std::optional id_filter; + std::optional id_filter{}; /// Matchings for filters that include patterns - std::vector matchings; + std::vector matchings{}; }; /// Stores information on filters used inside the @c Matching of a @c QueryPart. diff --git a/src/query/procedure/py_module.cpp b/src/query/procedure/py_module.cpp index ccabc0e67..625161771 100644 --- a/src/query/procedure/py_module.cpp +++ b/src/query/procedure/py_module.cpp @@ -218,7 +218,7 @@ static PyMethodDef PyVerticesIteratorMethods[] = { "Get the current vertex pointed to by the iterator or return None."}, {"next", reinterpret_cast(PyVerticesIteratorNext), METH_NOARGS, "Advance the iterator to the next vertex and return it."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -290,7 +290,7 @@ static PyMethodDef PyEdgesIteratorMethods[] = { "Get the current edge pointed to by the iterator or return None."}, {"next", reinterpret_cast(PyEdgesIteratorNext), METH_NOARGS, "Advance the iterator to the next edge and return it."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -406,7 +406,7 @@ static PyMethodDef PyGraphMethods[] = { {"iter_vertices", reinterpret_cast(PyGraphIterVertices), METH_NOARGS, "Return _mgp.VerticesIterator."}, {"must_abort", reinterpret_cast(PyGraphMustAbort), METH_NOARGS, "Check whether the running procedure should abort"}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -560,7 +560,7 @@ static PyMethodDef PyQueryProcMethods[] = { "Add a result field to a procedure."}, {"add_deprecated_result", reinterpret_cast(PyQueryProcAddDeprecatedResult), METH_VARARGS, "Add a result field to a procedure and mark it as deprecated."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -585,7 +585,7 @@ static PyMethodDef PyMagicFuncMethods[] = { "Add a required argument to a function."}, {"add_opt_arg", reinterpret_cast(PyMagicFuncAddOptArg), METH_VARARGS, "Add an optional argument with a default value to a function."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -737,7 +737,7 @@ static PyMethodDef PyMessageMethods[] = { {"key", reinterpret_cast(PyMessageGetKey), METH_NOARGS, "Get message key."}, {"timestamp", reinterpret_cast(PyMessageGetTimestamp), METH_NOARGS, "Get message timestamp."}, {"offset", reinterpret_cast(PyMessageGetOffset), METH_NOARGS, "Get message offset."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; void PyMessageDealloc(PyMessage *self) { @@ -816,7 +816,7 @@ static PyMethodDef PyMessagesMethods[] = { "Get number of messages available"}, {"message_at", reinterpret_cast(PyMessagesGetMessageAt), METH_VARARGS, "Get message at index idx from messages"}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // NOLINTNEXTLINE @@ -1372,7 +1372,7 @@ static PyMethodDef PyQueryModuleMethods[] = { "Register a transformation with this module."}, {"add_function", reinterpret_cast(PyQueryModuleAddFunction), METH_O, "Register a function with this module."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -1466,7 +1466,7 @@ static PyMethodDef PyMgpModuleMethods[] = { {"type_local_time", PyMgpModuleTypeLocalTime, METH_NOARGS, "Get the type representing a LocalTime."}, {"type_local_date_time", PyMgpModuleTypeLocalDateTime, METH_NOARGS, "Get the type representing a LocalDateTime."}, {"type_duration", PyMgpModuleTypeDuration, METH_NOARGS, "Get the type representing a Duration."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -1541,7 +1541,7 @@ static PyMethodDef PyPropertiesIteratorMethods[] = { "Get the current proprety pointed to by the iterator or return None."}, {"next", reinterpret_cast(PyPropertiesIteratorNext), METH_NOARGS, "Advance the iterator to the next property and return it."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -1699,7 +1699,7 @@ static PyMethodDef PyEdgeMethods[] = { "Return edge property with given name."}, {"set_property", reinterpret_cast(PyEdgeSetProperty), METH_VARARGS, "Set the value of the property on the edge."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; PyObject *PyEdgeRichCompare(PyObject *self, PyObject *other, int op); @@ -1987,7 +1987,7 @@ static PyMethodDef PyVertexMethods[] = { "Return vertex property with given name."}, {"set_property", reinterpret_cast(PyVertexSetProperty), METH_VARARGS, "Set the value of the property on the vertex."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; PyObject *PyVertexRichCompare(PyObject *self, PyObject *other, int op); @@ -2141,7 +2141,7 @@ static PyMethodDef PyPathMethods[] = { "Return the vertex from a path at given index."}, {"edge_at", reinterpret_cast(PyPathEdgeAt), METH_VARARGS, "Return the edge from a path at given index."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off @@ -2259,7 +2259,7 @@ static PyMethodDef PyLoggerMethods[] = { "Logs a message with level TRACE on this logger."}, {"debug", reinterpret_cast(PyLoggerLogDebug), METH_VARARGS, "Logs a message with level DEBUG on this logger."}, - {nullptr}, + {nullptr, {}, {}, {}}, }; // clang-format off diff --git a/tests/benchmark/query/execution.cpp b/tests/benchmark/query/execution.cpp index 1d1f26d3f..0aa06e637 100644 --- a/tests/benchmark/query/execution.cpp +++ b/tests/benchmark/query/execution.cpp @@ -138,7 +138,8 @@ static void Distinct(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = plan_and_cost.first->MakeCursor(memory.get()); @@ -184,7 +185,8 @@ static void ExpandVariable(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = expand_variable.MakeCursor(memory.get()); @@ -223,7 +225,8 @@ static void ExpandBfs(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = expand_variable.MakeCursor(memory.get()); @@ -258,7 +261,8 @@ static void ExpandShortest(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = expand_variable.MakeCursor(memory.get()); @@ -299,7 +303,8 @@ static void ExpandWeightedShortest(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = expand_variable.MakeCursor(memory.get()); @@ -344,7 +349,8 @@ static void Accumulate(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = accumulate.MakeCursor(memory.get()); @@ -393,7 +399,8 @@ static void Aggregate(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = aggregate.MakeCursor(memory.get()); @@ -443,7 +450,8 @@ static void OrderBy(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); auto cursor = order_by.MakeCursor(memory.get()); @@ -481,7 +489,8 @@ static void Unwind(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); frame[list_sym] = memgraph::query::TypedValue(std::vector(state.range(1))); @@ -517,7 +526,8 @@ static void Foreach(benchmark::State &state) { TMemory per_pull_memory; memgraph::query::EvaluationContext evaluation_context{per_pull_memory.get()}; while (state.KeepRunning()) { - memgraph::query::ExecutionContext execution_context{&dba, symbol_table, evaluation_context}; + memgraph::query::ExecutionContext execution_context{ + .db_accessor = &dba, .symbol_table = symbol_table, .evaluation_context = evaluation_context}; TMemory memory; memgraph::query::Frame frame(symbol_table.max_position(), memory.get()); frame[list_sym] = memgraph::query::TypedValue(std::vector(state.range(1))); diff --git a/tests/unit/bfs_common.hpp b/tests/unit/bfs_common.hpp index e11fd507d..3b16e4141 100644 --- a/tests/unit/bfs_common.hpp +++ b/tests/unit/bfs_common.hpp @@ -294,7 +294,7 @@ class Database { std::vector edge_types, bool known_sink, FilterLambdaType filter_lambda_type) { auto storage_dba = db->Access(); memgraph::query::DbAccessor dba(storage_dba.get()); - memgraph::query::ExecutionContext context{&dba}; + memgraph::query::ExecutionContext context{.db_accessor = &dba}; memgraph::query::Symbol blocked_sym = context.symbol_table.CreateSymbol("blocked", true); memgraph::query::Symbol source_sym = context.symbol_table.CreateSymbol("source", true); memgraph::query::Symbol sink_sym = context.symbol_table.CreateSymbol("sink", true); @@ -458,7 +458,7 @@ class Database { FineGrainedTestType fine_grained_test_type) { auto storage_dba = db->Access(); memgraph::query::DbAccessor db_accessor(storage_dba.get()); - memgraph::query::ExecutionContext context{&db_accessor}; + memgraph::query::ExecutionContext context{.db_accessor = &db_accessor}; memgraph::query::Symbol blocked_symbol = context.symbol_table.CreateSymbol("blocked", true); memgraph::query::Symbol source_symbol = context.symbol_table.CreateSymbol("source", true); memgraph::query::Symbol sink_symbol = context.symbol_table.CreateSymbol("sink", true); diff --git a/tests/unit/query_plan_common.hpp b/tests/unit/query_plan_common.hpp index cf5f2224d..ca1106cc0 100644 --- a/tests/unit/query_plan_common.hpp +++ b/tests/unit/query_plan_common.hpp @@ -35,7 +35,7 @@ using Bound = ScanAllByLabelPropertyRange::Bound; ExecutionContext MakeContext(const AstStorage &storage, const SymbolTable &symbol_table, memgraph::query::DbAccessor *dba) { - ExecutionContext context{dba}; + ExecutionContext context{.db_accessor = dba}; context.symbol_table = symbol_table; context.evaluation_context.properties = NamesToProperties(storage.properties_, dba); context.evaluation_context.labels = NamesToLabels(storage.labels_, dba); @@ -45,7 +45,7 @@ ExecutionContext MakeContext(const AstStorage &storage, const SymbolTable &symbo ExecutionContext MakeContextWithFineGrainedChecker(const AstStorage &storage, const SymbolTable &symbol_table, memgraph::query::DbAccessor *dba, memgraph::glue::FineGrainedAuthChecker *auth_checker) { - ExecutionContext context{dba}; + ExecutionContext context{.db_accessor = dba}; context.symbol_table = symbol_table; context.evaluation_context.properties = NamesToProperties(storage.properties_, dba); context.evaluation_context.labels = NamesToLabels(storage.labels_, dba);