diff --git a/emper/io/Future.hpp b/emper/io/Future.hpp index 76baee9c64ddc1ca249c02ad1e18b36bf2edc410..772cd74ea707f402b2631f95d97b37d3c296b7f0 100644 --- a/emper/io/Future.hpp +++ b/emper/io/Future.hpp @@ -117,12 +117,12 @@ class Future : public Logger<LogSubsystem::IO> { cancel(); } - inline auto isRetrieved() -> bool { return state.retrieved; } - inline auto isSubmitted() -> bool { return state.submitted; } - inline auto isCompleted() -> bool { return state.completed; } - inline auto isCancelled() -> bool { return state.cancelled; } - inline auto isDependency() -> bool { return state.dependency; } - inline auto isForgotten() -> bool { return state.forgotten; } + [[nodiscard]] auto isRetrieved() const -> bool { return state.retrieved; } + [[nodiscard]] auto isSubmitted() const -> bool { return state.submitted; } + [[nodiscard]] auto isCompleted() const -> bool { return state.completed; } + [[nodiscard]] auto isCancelled() const -> bool { return state.cancelled; } + [[nodiscard]] auto isDependency() const -> bool { return state.dependency; } + [[nodiscard]] auto isForgotten() const -> bool { return state.forgotten; } /* * @brief reset the Future @@ -222,9 +222,9 @@ class Future : public Logger<LogSubsystem::IO> { friend auto operator<<(std::ostream& os, const Future* f) -> std::ostream& { if (f) { return os << *f; - } else { - return os << "Future nullptr"; } + + return os << "Future nullptr"; } }; @@ -280,7 +280,7 @@ class PartialCompletableFuture : public Future { /** * Used for Stats::recordCompletion double dispatch */ - virtual void recordCompletion(Stats& stats, int32_t res) override { + void recordCompletion(Stats& stats, int32_t res) override { if constexpr (emper::STATS) { recordCompletionInternal(stats, res); } diff --git a/emper/io/Stats.hpp b/emper/io/Stats.hpp index 08824aa151e47c2e57e46f75ef0ddd998ce79f22..95afacb111fab842b6158bb91c4e2adc710e210a 100644 --- a/emper/io/Stats.hpp +++ b/emper/io/Stats.hpp @@ -68,7 +68,7 @@ class Stats { * 6: immediate resubmissions */ - typedef std::map<Operation, std::map<CompletionType, uint64_t>> CompletionMap; + using CompletionMap = std::map<Operation, std::map<CompletionType, uint64_t>>; CompletionMap io_uring_completions = { {Operation::SEND, @@ -128,7 +128,7 @@ class Stats { void recordCompletion(const WritevFuture& f, const int32_t& res) { size_t exp = 0; - auto iov = reinterpret_cast<const struct iovec*>(f.buf); + const auto* iov = reinterpret_cast<const struct iovec*>(f.buf); for (unsigned i = 0; i < f.len; ++i) { exp += iov[i].iov_len; } diff --git a/emper/lib/adt/LockedSet.hpp b/emper/lib/adt/LockedSet.hpp index e3e1b1928a1e037cd3f2dbcf391c106c9f39a4a6..7c4cccfdd8c4324fbd67bb33f9242b660ade1857 100644 --- a/emper/lib/adt/LockedSet.hpp +++ b/emper/lib/adt/LockedSet.hpp @@ -27,7 +27,7 @@ class LockedSet { _set.insert(first, last); } - size_t erase(const Key& key) { + auto erase(const Key& key) -> size_t { std::lock_guard<std::mutex> lock(_mutex); return _set.erase(key); }