Add part of dummy fixes

This commit is contained in:
Marko Budiselic 2022-09-18 09:05:29 +02:00
parent 898c894a48
commit 0b716f2a8f
27 changed files with 82 additions and 28 deletions

View File

@ -26,14 +26,14 @@ endif(CCACHE_FOUND AND USE_CCACHE)
# choose a compiler
# NOTE: must be choosen before use of project() or enable_language()
find_program(CLANG_FOUND clang)
find_program(CLANGXX_FOUND clang++)
if (CLANG_FOUND AND CLANGXX_FOUND)
set(CMAKE_C_COMPILER ${CLANG_FOUND})
set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
else()
message(FATAL_ERROR "Couldn't find clang and/or clang++!")
endif()
# find_program(CLANG_FOUND clang)
# find_program(CLANGXX_FOUND clang++)
# if (CLANG_FOUND AND CLANGXX_FOUND)
# set(CMAKE_C_COMPILER ${CLANG_FOUND})
# set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
# else()
# message(FATAL_ERROR "Couldn't find clang and/or clang++!")
# endif()
# -----------------------------------------------------------------------------
@ -181,9 +181,15 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# c99-designator is disabled because of required mixture of designated and
# non-designated initializers in Python Query Module code (`py_module.cpp`).
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
# -Werror=switch -Werror=switch-bool -Werror=return-type \
# -Werror=return-stack-address \
# -Wno-c99-designator \
# -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
-Werror=switch -Werror=switch-bool -Werror=return-type \
-Werror=return-stack-address \
-Werror=return-local-addr \
-Wno-c99-designator \
-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")

View File

@ -79,6 +79,7 @@ inline nlohmann::json PropertyValueToJson(const storage::PropertyValue &pv) {
return ss.str();
}
}
throw 1;
};
ret = to_string(temporal_data);
break;

View File

@ -88,6 +88,7 @@ std::string PermissionToString(Permission permission) {
case Permission::WEBSOCKET:
return "WEBSOCKET";
}
return "";
}
std::string PermissionLevelToString(PermissionLevel level) {
@ -99,6 +100,7 @@ std::string PermissionLevelToString(PermissionLevel level) {
case PermissionLevel::DENY:
return "DENY";
}
return "";
}
#ifdef MG_ENTERPRISE
@ -129,6 +131,7 @@ std::string FineGrainedPermissionToString(const FineGrainedPermission level) {
case FineGrainedPermission::NOTHING:
return "NOTHING";
}
return "";
}
FineGrainedAccessPermissions Merge(const FineGrainedAccessPermissions &first,

View File

@ -122,7 +122,7 @@ class Client final {
const std::optional<std::string> &db);
private:
using ClientEncoder = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>;
using ClientEncoderX = ClientEncoder<ChunkedEncoderBuffer<communication::ClientOutputStream>>;
template <typename TException = FailureResponseException>
[[noreturn]] void HandleFailure(const std::map<std::string, Value> &response_map) {
@ -153,6 +153,6 @@ class Client final {
// encoder objects
ChunkedEncoderBuffer<communication::ClientOutputStream> encoder_buffer_{output_stream_};
ClientEncoder encoder_{encoder_buffer_};
ClientEncoderX encoder_{encoder_buffer_};
};
} // namespace memgraph::communication::bolt

View File

@ -425,6 +425,7 @@ std::ostream &operator<<(std::ostream &os, const Value &value) {
case Value::Type::Duration:
return os << value.ValueDuration();
}
return os;
}
std::ostream &operator<<(std::ostream &os, const Value::Type type) {
@ -460,5 +461,6 @@ std::ostream &operator<<(std::ostream &os, const Value::Type type) {
case Value::Type::Duration:
return os << "duration";
}
return os;
}
} // namespace memgraph::communication::bolt

View File

@ -207,8 +207,9 @@ class Listener final {
CloseSession(session);
} else {
// Unhandled epoll event.
spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_,
session.socket().endpoint(), event.events);
// TODO: GCC can't compile
// spdlog::error("Unhandled event occured in {} session associated with {} events: {}", service_name_,
// session.socket().endpoint(), event.events);
CloseSession(session);
}
}

View File

@ -65,8 +65,10 @@ Listener::Listener(boost::asio::io_context &ioc, ServerContext *context, tcp::en
}
void Listener::DoAccept() {
acceptor_.async_accept(
ioc_, [shared_this = shared_from_this()](auto ec, auto socket) { shared_this->OnAccept(ec, std::move(socket)); });
// TODO(gitbuda): GCC throws and error here can't convert context to executor
// acceptor_.async_accept(
// ioc_, [shared_this = shared_from_this()](auto ec, auto socket) { shared_this->OnAccept(ec, std::move(socket));
// });
}
void Listener::OnAccept(boost::beast::error_code ec, tcp::socket socket) {

View File

@ -66,6 +66,7 @@ bool TypedValueCompare(const TypedValue &a, const TypedValue &b) {
case TypedValue::Type::Null:
LOG_FATAL("Invalid type");
}
throw 1;
}
} // namespace impl

View File

@ -85,9 +85,9 @@ class EdgeAccessor final {
bool IsCycle() const;
int64_t CypherId() const { return impl_.Gid().AsInt(); }
int64_t CypherId() const { return impl_.GidX().AsInt(); }
storage::Gid Gid() const noexcept { return impl_.Gid(); }
storage::Gid Gid() const noexcept { return impl_.GidX(); }
bool operator==(const EdgeAccessor &e) const noexcept { return impl_ == e.impl_; }
@ -170,9 +170,9 @@ class VertexAccessor final {
storage::Result<size_t> OutDegree(storage::View view) const { return impl_.OutDegree(view); }
int64_t CypherId() const { return impl_.Gid().AsInt(); }
int64_t CypherId() const { return impl_.GidX().AsInt(); }
storage::Gid Gid() const noexcept { return impl_.Gid(); }
storage::Gid Gid() const noexcept { return impl_.GidX(); }
bool operator==(const VertexAccessor &v) const noexcept {
static_assert(noexcept(impl_ == v.impl_));

View File

@ -1438,6 +1438,7 @@ cpp<#
case Type::SINGLE:
return false;
}
throw 1;
}
cpp<#)
(:protected

View File

@ -539,6 +539,7 @@ std::string_view ToString(const CommonStreamConfigKey key) {
case CommonStreamConfigKey::END:
LOG_FATAL("Invalid config key used");
}
throw 1;
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
@ -563,6 +564,7 @@ std::string_view ToString(const KafkaConfigKey key) {
case KafkaConfigKey::CREDENTIALS:
return "CREDENTIALS";
}
throw 1;
}
void MapCommonStreamConfigs(auto &memory, StreamQuery &stream_query) {
@ -689,6 +691,7 @@ std::string_view ToString(const PulsarConfigKey key) {
case PulsarConfigKey::SERVICE_URL:
return "SERVICE_URL";
}
throw 1;
}
} // namespace

View File

@ -590,6 +590,7 @@ TypedValue ValueType(const TypedValue *args, int64_t nargs, const FunctionContex
case TypedValue::Type::Graph:
throw QueryRuntimeException("Cannot fetch graph as it is not standardized openCypher type name");
}
throw 1;
}
// TODO: How is Keys different from Properties function?

View File

@ -377,6 +377,7 @@ bool CreateExpand::CreateExpandCursor::Pull(Frame &frame, ExecutionContext &cont
case EdgeAtom::Direction::BOTH:
return CreateEdge(self_.edge_info_, dba, &v1, &v2, &frame, &evaluator);
}
throw 1;
}();
context.execution_stats[ExecutionStats::Key::CREATED_EDGES] += 1;
@ -723,6 +724,7 @@ bool Expand::ExpandCursor::Pull(Frame &frame, ExecutionContext &context) {
case EdgeAtom::Direction::BOTH:
LOG_FATAL("Must indicate exact expansion direction here");
}
throw 1;
};
while (true) {
@ -2152,6 +2154,7 @@ UniqueCursorPtr ExpandVariable::MakeCursor(utils::MemoryResource *mem) const {
case EdgeAtom::Type::SINGLE:
LOG_FATAL("ExpandVariable should not be planned for a single expansion!");
}
throw 1;
}
class ConstructNamedPathCursor : public Cursor {

View File

@ -147,7 +147,9 @@ class ModuleRegistry final {
void *handle_;
};
#if __has_feature(address_sanitizer)
// TODO: Figure out for both clang and GCC
// #if __has_feature(address_sanitizer)
#if defined(__SANITIZE_ADDRESS__)
// This is why we need RTLD_NODELETE and we must not use RTLD_DEEPBIND with
// ASAN: https://github.com/google/sanitizers/issues/89
SharedLibraryHandle libstd_handle{"libstdc++.so.6", RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE};

View File

@ -116,6 +116,7 @@ inline bool operator==(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer
case PreviousPtr::Type::NULLPTR:
return b.type == PreviousPtr::Type::NULLPTR;
}
throw 1;
}
inline bool operator!=(const PreviousPtr::Pointer &a, const PreviousPtr::Pointer &b) { return !(a == b); }

View File

@ -354,6 +354,7 @@ std::optional<PropertyValue> Decoder::ReadPropertyValue() {
case Marker::VALUE_TRUE:
return std::nullopt;
}
return std::nullopt;
}
bool Decoder::SkipString() {
@ -453,6 +454,7 @@ bool Decoder::SkipPropertyValue() {
case Marker::VALUE_TRUE:
return false;
}
return false;
}
std::optional<uint64_t> Decoder::GetSize() { return file_.GetSize(); }

View File

@ -775,15 +775,15 @@ void CreateSnapshot(Transaction *transaction, const std::filesystem::path &snaps
const auto &in_edges = maybe_in_edges.GetValue();
snapshot.WriteUint(in_edges.size());
for (const auto &item : in_edges) {
snapshot.WriteUint(item.Gid().AsUint());
snapshot.WriteUint(item.FromVertex().Gid().AsUint());
snapshot.WriteUint(item.GidX().AsUint());
snapshot.WriteUint(item.FromVertex().GidX().AsUint());
write_mapping(item.EdgeType());
}
const auto &out_edges = maybe_out_edges.GetValue();
snapshot.WriteUint(out_edges.size());
for (const auto &item : out_edges) {
snapshot.WriteUint(item.Gid().AsUint());
snapshot.WriteUint(item.ToVertex().Gid().AsUint());
snapshot.WriteUint(item.GidX().AsUint());
snapshot.WriteUint(item.ToVertex().GidX().AsUint());
write_mapping(item.EdgeType());
}
}

View File

@ -94,6 +94,7 @@ Marker OperationToMarker(StorageGlobalOperation operation) {
case StorageGlobalOperation::UNIQUE_CONSTRAINT_DROP:
return Marker::DELTA_UNIQUE_CONSTRAINT_DROP;
}
throw 1;
}
Marker VertexActionToMarker(Delta::Action action) {
@ -120,6 +121,7 @@ Marker VertexActionToMarker(Delta::Action action) {
case Delta::Action::REMOVE_OUT_EDGE:
return Marker::DELTA_EDGE_CREATE;
}
throw 1;
}
// This function convertes a Marker to a WalDeltaData::Type. It checks for the
@ -184,6 +186,7 @@ WalDeltaData::Type MarkerToWalDeltaDataType(Marker marker) {
case Marker::VALUE_TRUE:
throw RecoveryFailure("Invalid WAL data!");
}
throw 1;
}
// Function used to either read or skip the current WAL delta data. The WAL
@ -457,6 +460,7 @@ bool operator==(const WalDeltaData &a, const WalDeltaData &b) {
return a.operation_label_properties.label == b.operation_label_properties.label &&
a.operation_label_properties.properties == b.operation_label_properties.properties;
}
return false;
}
bool operator!=(const WalDeltaData &a, const WalDeltaData &b) { return !(a == b); }

View File

@ -150,6 +150,7 @@ constexpr bool IsWalDeltaDataTypeTransactionEnd(const WalDeltaData::Type type) {
case WalDeltaData::Type::UNIQUE_CONSTRAINT_DROP:
return true;
}
return false;
}
/// Function used to read information about the WAL file.

View File

@ -68,7 +68,7 @@ class EdgeAccessor final {
/// @throw std::bad_alloc
Result<std::map<PropertyId, PropertyValue>> Properties(View view) const;
Gid Gid() const noexcept {
Gid GidX() const noexcept {
if (config_.properties_on_edges) {
return edge_.ptr->gid;
} else {
@ -107,6 +107,6 @@ class EdgeAccessor final {
namespace std {
template <>
struct hash<memgraph::storage::EdgeAccessor> {
size_t operator()(const memgraph::storage::EdgeAccessor &e) const { return e.Gid().AsUint(); }
size_t operator()(const memgraph::storage::EdgeAccessor &e) const { return e.GidX().AsUint(); }
};
} // namespace std

View File

@ -467,6 +467,7 @@ std::optional<std::pair<Type, Size>> EncodePropertyValue(Writer *writer, const P
return {{Type::TEMPORAL_DATA, Size::INT8}};
}
}
return std::nullopt;
}
namespace {
@ -604,6 +605,7 @@ std::optional<TemporalData> DecodeTemporalData(Reader &reader) {
return true;
}
}
return false;
}
// Function used to compare a PropertyValue to the one stored in the byte
@ -704,6 +706,7 @@ std::optional<TemporalData> DecodeTemporalData(Reader &reader) {
return *maybe_temporal_data == value.ValueTemporalData();
}
}
return false;
}
// Function used to encode a property (PropertyId, PropertyValue) into a byte

View File

@ -265,6 +265,7 @@ inline std::ostream &operator<<(std::ostream &os, const PropertyValue &value) {
return os << fmt::format("type: {}, microseconds: {}", TemporalTypeTostring(value.ValueTemporalData().type),
value.ValueTemporalData().microseconds);
}
return os;
}
// NOTE: The logic in this function *MUST* be equal to the logic in
@ -298,6 +299,7 @@ inline bool operator==(const PropertyValue &first, const PropertyValue &second)
case PropertyValue::Type::TemporalData:
return first.ValueTemporalData() == second.ValueTemporalData();
}
return false;
}
inline bool operator<(const PropertyValue &first, const PropertyValue &second) noexcept {
@ -328,6 +330,7 @@ inline bool operator<(const PropertyValue &first, const PropertyValue &second) n
case PropertyValue::Type::TemporalData:
return first.ValueTemporalData() < second.ValueTemporalData();
}
return false;
}
inline PropertyValue::PropertyValue(const PropertyValue &other) : type_(other.type_) {

View File

@ -66,6 +66,7 @@ std::string RegisterReplicaErrorToString(Storage::RegisterReplicaError error) {
case Storage::RegisterReplicaError::COULD_NOT_BE_PERSISTED:
return "COULD_NOT_BE_PERSISTED";
}
throw 1;
}
} // namespace
@ -173,6 +174,7 @@ VerticesIterable::Iterator VerticesIterable::begin() {
case Type::BY_LABEL_PROPERTY:
return Iterator(vertices_by_label_property_.begin());
}
throw 1;
}
VerticesIterable::Iterator VerticesIterable::end() {
@ -184,6 +186,7 @@ VerticesIterable::Iterator VerticesIterable::end() {
case Type::BY_LABEL_PROPERTY:
return Iterator(vertices_by_label_property_.end());
}
throw 1;
}
VerticesIterable::Iterator::Iterator(AllVerticesIterable::Iterator it) : type_(Type::ALL) {
@ -285,6 +288,7 @@ VertexAccessor VerticesIterable::Iterator::operator*() const {
case Type::BY_LABEL_PROPERTY:
return *by_label_property_it_;
}
throw 1;
}
VerticesIterable::Iterator &VerticesIterable::Iterator::operator++() {
@ -311,6 +315,7 @@ bool VerticesIterable::Iterator::operator==(const Iterator &other) const {
case Type::BY_LABEL_PROPERTY:
return by_label_property_it_ == other.by_label_property_it_;
}
throw 1;
}
Storage::Storage(Config config)
@ -1760,6 +1765,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE:
return false;
}
throw 1;
});
}
// 2. Process all Vertex deltas and store all operations that create edges.
@ -1782,6 +1788,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_IN_EDGE:
return false;
}
throw 1;
});
}
// 3. Process all Edge deltas and store all operations that modify edge data.
@ -1804,6 +1811,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE:
return false;
}
throw 1;
});
}
// 4. Process all Vertex deltas and store all operations that delete edges.
@ -1826,6 +1834,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE:
return false;
}
throw 1;
});
}
// 5. Process all Vertex deltas and store all operations that delete vertices.
@ -1848,6 +1857,7 @@ bool Storage::AppendToWalDataManipulation(const Transaction &transaction, uint64
case Delta::Action::REMOVE_OUT_EDGE:
return false;
}
throw 1;
});
}

View File

@ -31,6 +31,7 @@ constexpr std::string_view TemporalTypeTostring(const TemporalType type) {
case TemporalType::Duration:
return "Duration";
}
return "";
}
struct TemporalData {
@ -48,6 +49,7 @@ struct TemporalData {
case TemporalType::Duration:
return os << "DURATION(\"" << utils::Duration(t.microseconds) << "\")";
}
throw 1;
}
TemporalType type;
int64_t microseconds;

View File

@ -94,7 +94,7 @@ class VertexAccessor final {
Result<size_t> OutDegree(View view) const;
Gid Gid() const noexcept { return vertex_->gid; }
Gid GidX() const noexcept { return vertex_->gid; }
bool operator==(const VertexAccessor &other) const noexcept {
return vertex_ == other.vertex_ && transaction_ == other.transaction_;
@ -123,6 +123,6 @@ class VertexAccessor final {
namespace std {
template <>
struct hash<memgraph::storage::VertexAccessor> {
size_t operator()(const memgraph::storage::VertexAccessor &v) const noexcept { return v.Gid().AsUint(); }
size_t operator()(const memgraph::storage::VertexAccessor &v) const noexcept { return v.GidX().AsUint(); }
};
} // namespace std

View File

@ -217,6 +217,7 @@ std::string LicenseCheckErrorToString(LicenseCheckError error, const std::string
"SET DATABASE SETTING \"enterprise.license\" TO \"your-license-key\"",
feature);
}
return "";
}
LicenseCheckResult LicenseChecker::IsValidLicense(const utils::Settings &settings) const {

View File

@ -74,6 +74,7 @@ class Synchronized {
template <class... Args>
explicit Synchronized(Args &&...args) : object_(std::forward<Args>(args)...) {}
Synchronized() = default;
Synchronized(const Synchronized &) = delete;
Synchronized(Synchronized &&) = delete;
Synchronized &operator=(const Synchronized &) = delete;