From ad1aa138cefba99f9c28d369a0f3c737e2db287b Mon Sep 17 00:00:00 2001 From: Trent Houliston Date: Fri, 9 Aug 2024 13:13:45 +1000 Subject: [PATCH] Remove redundant inlines --- src/PowerPlant.hpp | 2 +- src/dsl/Parse.hpp | 14 +++++------ src/dsl/fusion/BindFusion.hpp | 9 +++---- src/dsl/fusion/GetFusion.hpp | 4 +-- src/dsl/fusion/GroupFusion.hpp | 4 +-- src/dsl/fusion/NoOp.hpp | 14 +++++------ src/dsl/fusion/PoolFusion.hpp | 4 +-- src/dsl/fusion/PostconditionFusion.hpp | 4 +-- src/dsl/fusion/PreconditionFusion.hpp | 4 +-- src/dsl/fusion/PriorityFusion.hpp | 4 +-- src/dsl/operation/CacheGet.hpp | 2 +- src/dsl/operation/ChronoTask.hpp | 8 +++--- src/dsl/operation/TypeBind.hpp | 2 +- src/dsl/word/Always.hpp | 8 +++--- src/dsl/word/Buffer.hpp | 2 +- src/dsl/word/Every.hpp | 5 ++-- src/dsl/word/Group.hpp | 2 +- src/dsl/word/IO.hpp | 7 +++--- src/dsl/word/Idle.hpp | 4 +-- src/dsl/word/Last.hpp | 6 ++--- src/dsl/word/MainThread.hpp | 4 +-- src/dsl/word/Network.hpp | 5 ++-- src/dsl/word/Optional.hpp | 4 +-- src/dsl/word/Pool.hpp | 4 +-- src/dsl/word/Priority.hpp | 10 ++++---- src/dsl/word/TCP.hpp | 8 +++--- src/dsl/word/UDP.hpp | 32 ++++++++++++------------ src/dsl/word/Watchdog.hpp | 5 ++-- src/dsl/word/emit/UDP.hpp | 12 ++++----- src/extension/network/NUClearNetwork.hpp | 2 +- src/threading/scheduler/Pool.hpp | 2 +- src/util/FunctionFusion.hpp | 8 +++--- src/util/MergeTransient.hpp | 2 +- src/util/serialise/Serialise.hpp | 18 ++++++------- tests/tests/dsl/ArgumentFission.cpp | 18 ++++++------- tests/tests/dsl/CustomGet.cpp | 2 +- tests/tests/dsl/FusionInOrder.cpp | 2 +- tests/tests/dsl/Transient.cpp | 2 +- tests/tests/dsl/emit/EmitFusion.cpp | 20 +++++++-------- 39 files changed, 131 insertions(+), 138 deletions(-) diff --git a/src/PowerPlant.hpp b/src/PowerPlant.hpp index 2d50d89a2..34cb82b00 100644 --- a/src/PowerPlant.hpp +++ b/src/PowerPlant.hpp @@ -77,7 +77,7 @@ class PowerPlant { template struct EmitCaller { template - static inline auto call(Arguments&&... args) + static auto call(Arguments&&... args) // THIS IS VERY IMPORTANT, the return type must be dependent on the function call // otherwise it won't check it's valid in SFINAE (the comma operator does it again!) -> decltype(Handler::emit(std::forward(args)...), true) { diff --git a/src/dsl/Parse.hpp b/src/dsl/Parse.hpp index e02773302..98e183615 100644 --- a/src/dsl/Parse.hpp +++ b/src/dsl/Parse.hpp @@ -35,39 +35,39 @@ namespace dsl { using DSL = Fusion; template - static inline auto bind(const std::shared_ptr& r, Arguments&&... args) + static auto bind(const std::shared_ptr& r, Arguments&&... args) -> decltype(DSL::template bind>(r, std::forward(args)...)) { return DSL::template bind>(r, std::forward(args)...); } - static inline auto get(threading::ReactionTask& task) + static auto get(threading::ReactionTask& task) -> decltype(std::conditional_t::value, DSL, fusion::NoOp>::template get< Parse>(task)) { return std::conditional_t::value, DSL, fusion::NoOp>::template get>( task); } - static inline bool precondition(threading::ReactionTask& task) { + static bool precondition(threading::ReactionTask& task) { return std::conditional_t::value, DSL, fusion::NoOp>::template precondition< Parse>(task); } - static inline int priority(threading::ReactionTask& task) { + static int priority(threading::ReactionTask& task) { return std::conditional_t::value, DSL, fusion::NoOp>::template priority< Parse>(task); } - static inline std::set group(threading::ReactionTask& task) { + static std::set group(threading::ReactionTask& task) { return std::conditional_t::value, DSL, fusion::NoOp>::template group< Parse>(task); } - static inline util::ThreadPoolDescriptor pool(threading::ReactionTask& task) { + static util::ThreadPoolDescriptor pool(threading::ReactionTask& task) { return std::conditional_t::value, DSL, fusion::NoOp>::template pool< Parse>(task); } - static inline void postcondition(threading::ReactionTask& task) { + static void postcondition(threading::ReactionTask& task) { std::conditional_t::value, DSL, fusion::NoOp>::template postcondition< Parse>(task); } diff --git a/src/dsl/fusion/BindFusion.hpp b/src/dsl/fusion/BindFusion.hpp index 71a140685..8c73f3d91 100644 --- a/src/dsl/fusion/BindFusion.hpp +++ b/src/dsl/fusion/BindFusion.hpp @@ -47,7 +47,7 @@ namespace dsl { */ struct Return { template - static inline auto call(const std::shared_ptr& reaction, Arguments&&... args) { + static auto call(const std::shared_ptr& reaction, Arguments&&... args) { return Function::template bind(reaction, std::forward(args)...); } }; @@ -60,8 +60,7 @@ namespace dsl { */ struct NoReturn { template - static inline std::tuple<> call(const std::shared_ptr& reaction, - Arguments&&... args) { + static std::tuple<> call(const std::shared_ptr& reaction, Arguments&&... args) { Function::template bind(reaction, std::forward(args)...); return {}; } @@ -69,7 +68,7 @@ namespace dsl { template - static inline auto call(const std::shared_ptr& reaction, Arguments&&... args) + static auto call(const std::shared_ptr& reaction, Arguments&&... args) -> decltype(std::conditional_t( reaction, std::forward(args)...))>::value, @@ -125,7 +124,7 @@ namespace dsl { struct BindFuser> { template - static inline auto bind(const std::shared_ptr& reaction, Arguments&&... args) + static auto bind(const std::shared_ptr& reaction, Arguments&&... args) -> decltype(util::FunctionFusion, decltype(std::forward_as_tuple(reaction, std::forward(args)...)), diff --git a/src/dsl/fusion/GetFusion.hpp b/src/dsl/fusion/GetFusion.hpp index 64614a47b..cd8ddc2c6 100644 --- a/src/dsl/fusion/GetFusion.hpp +++ b/src/dsl/fusion/GetFusion.hpp @@ -40,7 +40,7 @@ namespace dsl { */ template struct GetCaller { - static inline auto call(threading::ReactionTask& task) -> decltype(Function::template get(task)) { + static auto call(threading::ReactionTask& task) -> decltype(Function::template get(task)) { return Function::template get(task); } }; @@ -86,7 +86,7 @@ namespace dsl { struct GetFuser> { template - static inline auto get(threading::ReactionTask& task) + static auto get(threading::ReactionTask& task) -> decltype(util::FunctionFusion, decltype(std::forward_as_tuple(task)), GetCaller, diff --git a/src/dsl/fusion/GroupFusion.hpp b/src/dsl/fusion/GroupFusion.hpp index 64417617b..3a766f860 100644 --- a/src/dsl/fusion/GroupFusion.hpp +++ b/src/dsl/fusion/GroupFusion.hpp @@ -78,7 +78,7 @@ namespace dsl { struct GroupFuser> { template - static inline std::set group(threading::ReactionTask& task) { + static std::set group(threading::ReactionTask& task) { // Return our group return Word::template group(task); @@ -90,7 +90,7 @@ namespace dsl { struct GroupFuser> { template - static inline std::set group(threading::ReactionTask& task) { + static std::set group(threading::ReactionTask& task) { // Merge the list of groups together std::set groups = Word1::template group(task); auto remainder = GroupFuser>::template group(task); diff --git a/src/dsl/fusion/NoOp.hpp b/src/dsl/fusion/NoOp.hpp index 630f608a7..87052a291 100644 --- a/src/dsl/fusion/NoOp.hpp +++ b/src/dsl/fusion/NoOp.hpp @@ -42,37 +42,37 @@ namespace dsl { struct NoOp { template - static inline void bind(const std::shared_ptr& /*reaction*/, Args... /*args*/) { + static void bind(const std::shared_ptr& /*reaction*/, Args... /*args*/) { // Empty as this is a no-op placeholder } template - static inline std::tuple<> get(const threading::ReactionTask& /*task*/) { + static std::tuple<> get(const threading::ReactionTask& /*task*/) { return {}; } template - static inline bool precondition(const threading::ReactionTask& /*task*/) { + static bool precondition(const threading::ReactionTask& /*task*/) { return true; } template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return word::Priority::NORMAL::value; } template - static inline std::set group(const threading::ReactionTask& /*task*/) { + static std::set group(const threading::ReactionTask& /*task*/) { return {}; } template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { return util::ThreadPoolDescriptor{}; } template - static inline void postcondition(const threading::ReactionTask& /*task*/) { + static void postcondition(const threading::ReactionTask& /*task*/) { // Empty as this is a no-op placeholder } }; diff --git a/src/dsl/fusion/PoolFusion.hpp b/src/dsl/fusion/PoolFusion.hpp index 5c4ad9a51..87743e0d5 100644 --- a/src/dsl/fusion/PoolFusion.hpp +++ b/src/dsl/fusion/PoolFusion.hpp @@ -77,7 +77,7 @@ namespace dsl { struct PoolFuser> { template - static inline util::ThreadPoolDescriptor pool(threading::ReactionTask& task) { + static util::ThreadPoolDescriptor pool(threading::ReactionTask& task) { // Return our pool return Word::template pool(task); @@ -89,7 +89,7 @@ namespace dsl { struct PoolFuser> { template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { throw std::invalid_argument("Can not be a member of more than one pool"); } }; diff --git a/src/dsl/fusion/PostconditionFusion.hpp b/src/dsl/fusion/PostconditionFusion.hpp index 9fabc86e4..391aa9704 100644 --- a/src/dsl/fusion/PostconditionFusion.hpp +++ b/src/dsl/fusion/PostconditionFusion.hpp @@ -76,7 +76,7 @@ namespace dsl { struct PostconditionFuser> { template - static inline void postcondition(threading::ReactionTask& task) { + static void postcondition(threading::ReactionTask& task) { // Run our remaining postcondition Word::template postcondition(task); @@ -88,7 +88,7 @@ namespace dsl { struct PostconditionFuser> { template - static inline void postcondition(threading::ReactionTask& task) { + static void postcondition(threading::ReactionTask& task) { // Run our postcondition Word1::template postcondition(task); diff --git a/src/dsl/fusion/PreconditionFusion.hpp b/src/dsl/fusion/PreconditionFusion.hpp index 90067a4bc..05a7107fb 100644 --- a/src/dsl/fusion/PreconditionFusion.hpp +++ b/src/dsl/fusion/PreconditionFusion.hpp @@ -76,7 +76,7 @@ namespace dsl { struct PreconditionFuser> { template - static inline bool precondition(threading::ReactionTask& task) { + static bool precondition(threading::ReactionTask& task) { // Run our remaining precondition return Word::template precondition(task); @@ -88,7 +88,7 @@ namespace dsl { struct PreconditionFuser> { template - static inline bool precondition(threading::ReactionTask& task) { + static bool precondition(threading::ReactionTask& task) { // Perform a recursive and operation ending with the first false return Word1::template precondition(task) diff --git a/src/dsl/fusion/PriorityFusion.hpp b/src/dsl/fusion/PriorityFusion.hpp index be6a45c76..659e0c90e 100644 --- a/src/dsl/fusion/PriorityFusion.hpp +++ b/src/dsl/fusion/PriorityFusion.hpp @@ -74,7 +74,7 @@ namespace dsl { struct PriorityFuser> { template - static inline int priority(threading::ReactionTask& task) { + static int priority(threading::ReactionTask& task) { // Return our priority return Word::template priority(task); @@ -86,7 +86,7 @@ namespace dsl { struct PriorityFuser> { template - static inline int priority(threading::ReactionTask& task) { + static int priority(threading::ReactionTask& task) { // Choose our maximum priority return std::max(Word1::template priority(task), diff --git a/src/dsl/operation/CacheGet.hpp b/src/dsl/operation/CacheGet.hpp index 4a4b79cb4..818945b41 100644 --- a/src/dsl/operation/CacheGet.hpp +++ b/src/dsl/operation/CacheGet.hpp @@ -43,7 +43,7 @@ namespace dsl { struct CacheGet { template - static inline std::shared_ptr get(const threading::ReactionTask& /*task*/) { + static std::shared_ptr get(const threading::ReactionTask& /*task*/) { return store::ThreadStore>::value == nullptr ? store::DataStore::get() diff --git a/src/dsl/operation/ChronoTask.hpp b/src/dsl/operation/ChronoTask.hpp index 3431e9427..b0825a060 100644 --- a/src/dsl/operation/ChronoTask.hpp +++ b/src/dsl/operation/ChronoTask.hpp @@ -59,7 +59,7 @@ namespace dsl { * * @return true if the task updated the time to run to a new time */ - inline bool operator()() { + bool operator()() { return task(time); } @@ -70,7 +70,7 @@ namespace dsl { * * @return true if the other task is after this task */ - inline bool operator<(const ChronoTask& other) const { + bool operator<(const ChronoTask& other) const { return time < other.time; } @@ -81,7 +81,7 @@ namespace dsl { * * @return true if the other task is before this task */ - inline bool operator>(const ChronoTask& other) const { + bool operator>(const ChronoTask& other) const { return time > other.time; } @@ -92,7 +92,7 @@ namespace dsl { * * @return true if the other task is at the same time as this task */ - inline bool operator==(const ChronoTask& other) const { + bool operator==(const ChronoTask& other) const { return time == other.time; } diff --git a/src/dsl/operation/TypeBind.hpp b/src/dsl/operation/TypeBind.hpp index 3cb713370..83ab76172 100644 --- a/src/dsl/operation/TypeBind.hpp +++ b/src/dsl/operation/TypeBind.hpp @@ -58,7 +58,7 @@ namespace dsl { struct TypeBind { template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { // Set this reaction as no stats emitting reaction->emit_stats &= EmitStats::value; diff --git a/src/dsl/word/Always.hpp b/src/dsl/word/Always.hpp index 38aeab22d..03ca5e7ea 100644 --- a/src/dsl/word/Always.hpp +++ b/src/dsl/word/Always.hpp @@ -74,7 +74,7 @@ namespace dsl { struct Always { template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& task) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& task) { static std::map pool_ids; static std::mutex mutex; @@ -97,7 +97,7 @@ namespace dsl { } template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { // Create an unbinder for the always reaction reaction->unbinders.push_back([](threading::Reaction& r) { @@ -111,7 +111,7 @@ namespace dsl { } template - static inline void postcondition(threading::ReactionTask& task) { + static void postcondition(threading::ReactionTask& task) { // Get a task for the always reaction and submit it to the scheduler PowerPlant::powerplant->submit(task.parent->get_task()); } @@ -126,7 +126,7 @@ namespace dsl { * @return a unique pointer to the idle task which will resubmit the Always task and itself */ template - static inline std::unique_ptr make_idle_task( + static std::unique_ptr make_idle_task( const std::shared_ptr& reaction) { auto idle_task = std::make_unique( diff --git a/src/dsl/word/Buffer.hpp b/src/dsl/word/Buffer.hpp index 4f941db64..fbdd98dea 100644 --- a/src/dsl/word/Buffer.hpp +++ b/src/dsl/word/Buffer.hpp @@ -48,7 +48,7 @@ namespace dsl { struct Buffer { template - static inline bool precondition(const threading::ReactionTask& task) { + static bool precondition(const threading::ReactionTask& task) { // We only run if there are less than the target number of active tasks return task.parent->active_tasks.load(std::memory_order_acquire) < (n + 1); } diff --git a/src/dsl/word/Every.hpp b/src/dsl/word/Every.hpp index 069c49630..0169e3976 100644 --- a/src/dsl/word/Every.hpp +++ b/src/dsl/word/Every.hpp @@ -87,8 +87,7 @@ namespace dsl { struct Every<0, period> { template - static inline void bind(const std::shared_ptr& reaction, - NUClear::clock::duration jump) { + static void bind(const std::shared_ptr& reaction, NUClear::clock::duration jump) { reaction->unbinders.push_back([](const threading::Reaction& r) { r.reactor.emit(std::make_unique>(r.id)); @@ -113,7 +112,7 @@ namespace dsl { struct Every { template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { Every<>::bind(reaction, period(ticks)); } }; diff --git a/src/dsl/word/Group.hpp b/src/dsl/word/Group.hpp index ad0b31875..f7e0259aa 100644 --- a/src/dsl/word/Group.hpp +++ b/src/dsl/word/Group.hpp @@ -71,7 +71,7 @@ namespace dsl { static const util::GroupDescriptor group_descriptor; template - static inline std::set group(const threading::ReactionTask& /*task*/) { + static std::set group(const threading::ReactionTask& /*task*/) { return {group_descriptor}; } }; diff --git a/src/dsl/word/IO.hpp b/src/dsl/word/IO.hpp index 27bed57f3..f7398a561 100644 --- a/src/dsl/word/IO.hpp +++ b/src/dsl/word/IO.hpp @@ -23,7 +23,6 @@ #ifndef NUCLEAR_DSL_WORD_IO_HPP #define NUCLEAR_DSL_WORD_IO_HPP -#include "../../Reactor.hpp" #include "../../id.hpp" #include "../../threading/Reaction.hpp" #include "../../util/platform.hpp" @@ -132,7 +131,7 @@ namespace dsl { using ThreadEventStore = dsl::store::ThreadStore; template - static inline void bind(const std::shared_ptr& reaction, fd_t fd, event_t watch_set) { + static void bind(const std::shared_ptr& reaction, fd_t fd, event_t watch_set) { reaction->unbinders.push_back([](const threading::Reaction& r) { r.reactor.emit(std::make_unique>(r.id)); @@ -145,7 +144,7 @@ namespace dsl { } template - static inline Event get(const threading::ReactionTask& /*task*/) { + static Event get(const threading::ReactionTask& /*task*/) { // If our thread store has a value if (ThreadEventStore::value) { @@ -157,7 +156,7 @@ namespace dsl { } template - static inline void postcondition(threading::ReactionTask& task) { + static void postcondition(threading::ReactionTask& task) { task.parent->reactor.emit(std::make_unique(task.parent->id)); } }; diff --git a/src/dsl/word/Idle.hpp b/src/dsl/word/Idle.hpp index 6b156e7f3..3ef4a7125 100644 --- a/src/dsl/word/Idle.hpp +++ b/src/dsl/word/Idle.hpp @@ -68,7 +68,7 @@ namespace dsl { template struct Idle { template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { // Make a fake task to use for finding an appropriate descriptor threading::ReactionTask task(reaction, DSL::priority, DSL::pool, DSL::group); @@ -79,7 +79,7 @@ namespace dsl { template <> struct Idle { template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { bind_idle(reaction, util::ThreadPoolDescriptor::AllPools()); } }; diff --git a/src/dsl/word/Last.hpp b/src/dsl/word/Last.hpp index 2dd23530d..d2b012bf7 100644 --- a/src/dsl/word/Last.hpp +++ b/src/dsl/word/Last.hpp @@ -155,14 +155,14 @@ namespace dsl { private: template - static inline auto wrap(std::tuple&& data, util::Sequence /*s*/) + static auto wrap(std::tuple&& data, util::Sequence /*s*/) -> decltype(std::make_tuple(LastItemStorage(std::move(std::get(data)))...)) { return std::make_tuple(LastItemStorage(std::move(std::get(data)))...); } public: template - static inline auto get(threading::ReactionTask& task) + static auto get(threading::ReactionTask& task) -> decltype(wrap( Fusion::template get(task), util::GenerateSequence< @@ -191,7 +191,7 @@ namespace util { template struct MergeTransients> { - static inline bool merge(dsl::word::LastItemStorage& t, dsl::word::LastItemStorage& d) { + static bool merge(dsl::word::LastItemStorage& t, dsl::word::LastItemStorage& d) { // We put the contents from data into the transient storage list t.list.insert(t.list.end(), d.list.begin(), d.list.end()); diff --git a/src/dsl/word/MainThread.hpp b/src/dsl/word/MainThread.hpp index 197be3378..0ff524aac 100644 --- a/src/dsl/word/MainThread.hpp +++ b/src/dsl/word/MainThread.hpp @@ -41,7 +41,7 @@ namespace dsl { struct MainThread { /// the description of the thread pool to be used for this PoolType - static inline util::ThreadPoolDescriptor descriptor() { + static util::ThreadPoolDescriptor descriptor() { return util::ThreadPoolDescriptor{"Main", NUClear::id_t(util::ThreadPoolDescriptor::MAIN_THREAD_POOL_ID), 1, @@ -49,7 +49,7 @@ namespace dsl { } template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { return descriptor(); } }; diff --git a/src/dsl/word/Network.hpp b/src/dsl/word/Network.hpp index 2da4f1e97..c4e9f0750 100644 --- a/src/dsl/word/Network.hpp +++ b/src/dsl/word/Network.hpp @@ -76,7 +76,7 @@ namespace dsl { struct Network { template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { auto task = std::make_unique(); @@ -91,8 +91,7 @@ namespace dsl { } template - static inline std::tuple, NetworkData> get( - threading::ReactionTask& /*task*/) { + static std::tuple, NetworkData> get(threading::ReactionTask& /*task*/) { auto* data = store::ThreadStore>::value; auto* source = store::ThreadStore::value; diff --git a/src/dsl/word/Optional.hpp b/src/dsl/word/Optional.hpp index 1cd9b4e51..45ea84ff6 100644 --- a/src/dsl/word/Optional.hpp +++ b/src/dsl/word/Optional.hpp @@ -68,14 +68,14 @@ namespace dsl { private: template - static inline auto wrap(std::tuple&& data, util::Sequence /*s*/) + static auto wrap(std::tuple&& data, util::Sequence /*s*/) -> decltype(std::make_tuple(OptionalWrapper(std::move(std::get(data)))...)) { return std::make_tuple(OptionalWrapper(std::move(std::get(data)))...); } public: template - static inline auto get(threading::ReactionTask& task) + static auto get(threading::ReactionTask& task) -> decltype(wrap( Fusion::template get(task), util::GenerateSequence< diff --git a/src/dsl/word/Pool.hpp b/src/dsl/word/Pool.hpp index 074a79202..97d5cc844 100644 --- a/src/dsl/word/Pool.hpp +++ b/src/dsl/word/Pool.hpp @@ -78,7 +78,7 @@ namespace dsl { * @tparam DSL the DSL used for this reaction */ template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { return pool_descriptor; } }; @@ -87,7 +87,7 @@ namespace dsl { template <> struct Pool { template - static inline util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { + static util::ThreadPoolDescriptor pool(const threading::ReactionTask& /*task*/) { return util::ThreadPoolDescriptor{}; } }; diff --git a/src/dsl/word/Priority.hpp b/src/dsl/word/Priority.hpp index 426fcab64..7b84212ba 100644 --- a/src/dsl/word/Priority.hpp +++ b/src/dsl/word/Priority.hpp @@ -71,7 +71,7 @@ namespace dsl { static constexpr int value = 1000; template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return value; } }; @@ -81,7 +81,7 @@ namespace dsl { static constexpr int value = 750; template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return value; } }; @@ -91,7 +91,7 @@ namespace dsl { static constexpr int value = 500; template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return value; } }; @@ -101,7 +101,7 @@ namespace dsl { static constexpr int value = 250; template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return value; } }; @@ -111,7 +111,7 @@ namespace dsl { static constexpr int value = 0; template - static inline int priority(const threading::ReactionTask& /*task*/) { + static int priority(const threading::ReactionTask& /*task*/) { return value; } }; diff --git a/src/dsl/word/TCP.hpp b/src/dsl/word/TCP.hpp index 96865ff27..ffe59649c 100644 --- a/src/dsl/word/TCP.hpp +++ b/src/dsl/word/TCP.hpp @@ -97,9 +97,9 @@ namespace dsl { }; template - static inline std::tuple bind(const std::shared_ptr& reaction, - in_port_t port = 0, - const std::string& bind_address = "") { + static std::tuple bind(const std::shared_ptr& reaction, + in_port_t port = 0, + const std::string& bind_address = "") { // Resolve the bind address if we have one util::network::sock_t address{}; @@ -165,7 +165,7 @@ namespace dsl { } template - static inline Connection get(threading::ReactionTask& task) { + static Connection get(threading::ReactionTask& task) { // Get our file descriptor from the magic cache auto event = IO::get(task); diff --git a/src/dsl/word/UDP.hpp b/src/dsl/word/UDP.hpp index 56b3e1798..e6de3c738 100644 --- a/src/dsl/word/UDP.hpp +++ b/src/dsl/word/UDP.hpp @@ -145,8 +145,8 @@ namespace dsl { }; template - static inline std::tuple connect(const std::shared_ptr& reaction, - const ConnectOptions& options) { + static std::tuple connect(const std::shared_ptr& reaction, + const ConnectOptions& options) { // Resolve the addresses util::network::sock_t bind_address{}; @@ -344,7 +344,7 @@ namespace dsl { } template - static inline RecvResult read(threading::ReactionTask& task) { + static RecvResult read(threading::ReactionTask& task) { // Get our file descriptor from the magic cache auto event = IO::get(task); @@ -422,14 +422,14 @@ namespace dsl { } template - static inline std::tuple bind(const std::shared_ptr& reaction, - const in_port_t& port = 0, - const std::string& bind_address = "") { + static std::tuple bind(const std::shared_ptr& reaction, + const in_port_t& port = 0, + const std::string& bind_address = "") { return connect(reaction, ConnectOptions{ConnectOptions::Type::UNICAST, bind_address, port, ""}); } template - static inline Packet get(threading::ReactionTask& task) { + static Packet get(threading::ReactionTask& task) { RecvResult result = read(task); Packet p{}; @@ -466,15 +466,15 @@ namespace dsl { struct Broadcast : public IO { template - static inline std::tuple bind(const std::shared_ptr& reaction, - const in_port_t& port = 0, - const std::string& bind_address = "") { + static std::tuple bind(const std::shared_ptr& reaction, + const in_port_t& port = 0, + const std::string& bind_address = "") { return UDP::connect(reaction, ConnectOptions{ConnectOptions::Type::BROADCAST, bind_address, port, ""}); } template - static inline Packet get(threading::ReactionTask& task) { + static Packet get(threading::ReactionTask& task) { RecvResult result = read(task); // Broadcast is only IPv4 @@ -511,17 +511,17 @@ namespace dsl { struct Multicast : public IO { template - static inline std::tuple bind(const std::shared_ptr& reaction, - const std::string& multicast_group, - const in_port_t& port = 0, - const std::string& bind_address = "") { + static std::tuple bind(const std::shared_ptr& reaction, + const std::string& multicast_group, + const in_port_t& port = 0, + const std::string& bind_address = "") { return UDP::connect( reaction, ConnectOptions{ConnectOptions::Type::MULTICAST, bind_address, port, multicast_group}); } template - static inline Packet get(threading::ReactionTask& task) { + static Packet get(threading::ReactionTask& task) { RecvResult result = read(task); const auto& a = result.local; diff --git a/src/dsl/word/Watchdog.hpp b/src/dsl/word/Watchdog.hpp index fdd33ee30..232dee6e7 100644 --- a/src/dsl/word/Watchdog.hpp +++ b/src/dsl/word/Watchdog.hpp @@ -25,7 +25,6 @@ #include -#include "../../Reactor.hpp" #include "../../threading/Reaction.hpp" #include "../../util/demangle.hpp" #include "../operation/ChronoTask.hpp" @@ -209,7 +208,7 @@ namespace dsl { * @param data the runtime argument for the current watchdog in the WatchdogGroup/RuntimeType group */ template - static inline void bind(const std::shared_ptr& reaction, const RuntimeType& data) { + static void bind(const std::shared_ptr& reaction, const RuntimeType& data) { // Make sure the store is initialised WatchdogDataStore::init(data); @@ -236,7 +235,7 @@ namespace dsl { * Binder for Watchdog reactions with no runtime argument */ template - static inline void bind(const std::shared_ptr& reaction) { + static void bind(const std::shared_ptr& reaction) { // Make sure the store is initialised WatchdogDataStore::init(); diff --git a/src/dsl/word/emit/UDP.hpp b/src/dsl/word/emit/UDP.hpp index c93563198..6ee2f441d 100644 --- a/src/dsl/word/emit/UDP.hpp +++ b/src/dsl/word/emit/UDP.hpp @@ -61,12 +61,12 @@ namespace dsl { template struct UDP { - static inline void emit(const PowerPlant& /*powerplant*/, - std::shared_ptr data, - const std::string& to_addr, - in_port_t to_port, - const std::string& from_addr = "", - in_port_t from_port = 0) { + static void emit(const PowerPlant& /*powerplant*/, + std::shared_ptr data, + const std::string& to_addr, + in_port_t to_port, + const std::string& from_addr = "", + in_port_t from_port = 0) { // Resolve our addresses const util::network::sock_t remote = util::network::resolve(to_addr, to_port); diff --git a/src/extension/network/NUClearNetwork.hpp b/src/extension/network/NUClearNetwork.hpp index 81492d3aa..ec09593e3 100644 --- a/src/extension/network/NUClearNetwork.hpp +++ b/src/extension/network/NUClearNetwork.hpp @@ -91,7 +91,7 @@ namespace extension { std::chrono::steady_clock::duration round_trip_time{std::chrono::seconds(1)}; - inline void measure_round_trip(std::chrono::steady_clock::duration time) { + void measure_round_trip(std::chrono::steady_clock::duration time) { // Make our measurement into a float seconds type const std::chrono::duration m = diff --git a/src/threading/scheduler/Pool.hpp b/src/threading/scheduler/Pool.hpp index 4cb69375a..ad6dd2965 100644 --- a/src/threading/scheduler/Pool.hpp +++ b/src/threading/scheduler/Pool.hpp @@ -65,7 +65,7 @@ namespace threading { * * @return true if this task should be executed before the other task */ - inline bool operator<(const Task& other) const { + bool operator<(const Task& other) const { return *task < *other.task; } }; diff --git a/src/util/FunctionFusion.hpp b/src/util/FunctionFusion.hpp index 27b78de9b..2c76ef552 100644 --- a/src/util/FunctionFusion.hpp +++ b/src/util/FunctionFusion.hpp @@ -93,7 +93,7 @@ namespace util { */ template struct FunctionFusionCaller, Shared, std::tuple<>, std::tuple> { - static inline std::tuple<> call(Arguments&&... /*args*/) { + static std::tuple<> call(Arguments&&... /*args*/) { return {}; } }; @@ -135,7 +135,7 @@ namespace util { * @return the result of calling this specific function */ template - static inline auto call_one(const Sequence& /*e*/, Arguments&&... args) + static auto call_one(const Sequence& /*e*/, Arguments&&... args) -> decltype(apply_function_fusion_call(std::forward_as_tuple(args...))) { return apply_function_fusion_call(std::forward_as_tuple(args...)); @@ -151,7 +151,7 @@ namespace util { * @return ignore */ template - static inline bool call_one(...); + static bool call_one(...); /// The FunctionFusionCaller next step in the recursion using NextStep = @@ -166,7 +166,7 @@ namespace util { * @return A tuple of the returned values, or if the return value was a tuple fuse it */ template - static inline auto call(Args&&... args) + static auto call(Args&&... args) -> decltype(std::tuple_cat(tuplify(call_one(CurrentRange(), std::forward(args)...)), NextStep::call(std::forward(args)...))) { diff --git a/src/util/MergeTransient.hpp b/src/util/MergeTransient.hpp index 718fdfd09..8967240af 100644 --- a/src/util/MergeTransient.hpp +++ b/src/util/MergeTransient.hpp @@ -28,7 +28,7 @@ namespace util { template struct MergeTransients { - static inline bool merge(T& t, T& d) { + static bool merge(T& t, T& d) { d = t = d ? d : t; return true; }; diff --git a/src/util/serialise/Serialise.hpp b/src/util/serialise/Serialise.hpp index 8611b8334..32f4247ee 100644 --- a/src/util/serialise/Serialise.hpp +++ b/src/util/serialise/Serialise.hpp @@ -55,20 +55,20 @@ namespace util { template struct Serialise::value, T>> { - static inline std::vector serialise(const T& in) { + static std::vector serialise(const T& in) { std::vector out(sizeof(T)); std::memcpy(out.data(), &in, sizeof(T)); return out; } - static inline T deserialise(const std::vector& in) { + static T deserialise(const std::vector& in) { if (in.size() != sizeof(T)) { throw std::length_error("Serialised data is not the correct size"); } return *reinterpret_cast(in.data()); } - static inline uint64_t hash() { + static uint64_t hash() { // Serialise based on the demangled class name const std::string type_name = demangle(typeid(T).name()); @@ -85,7 +85,7 @@ namespace util { using V = std::remove_reference_t>; - static inline std::vector serialise(const T& in) { + static std::vector serialise(const T& in) { std::vector out; out.reserve(sizeof(V) * size_t(std::distance(std::begin(in), std::end(in)))); @@ -97,7 +97,7 @@ namespace util { return out; } - static inline T deserialise(const std::vector& in) { + static T deserialise(const std::vector& in) { if (in.size() % sizeof(V) != 0) { throw std::length_error("Serialised data is not the correct size"); @@ -112,7 +112,7 @@ namespace util { return out; } - static inline uint64_t hash() { + static uint64_t hash() { // Serialise based on the demangled class name std::string type_name = demangle(typeid(T).name()); @@ -127,14 +127,14 @@ namespace util { || std::is_base_of<::google::protobuf::MessageLite, T>::value, T>> { - static inline std::vector serialise(const T& in) { + static std::vector serialise(const T& in) { std::vector output(in.ByteSize()); in.SerializeToArray(output.data(), output.size()); return output; } - static inline T deserialise(const std::vector& in) { + static T deserialise(const std::vector& in) { // Make a buffer T out; @@ -143,7 +143,7 @@ namespace util { return out; } - static inline uint64_t hash() { + static uint64_t hash() { // We have to construct an instance to call the reflection functions T type; diff --git a/tests/tests/dsl/ArgumentFission.cpp b/tests/tests/dsl/ArgumentFission.cpp index bb09557a7..511fd6dc5 100644 --- a/tests/tests/dsl/ArgumentFission.cpp +++ b/tests/tests/dsl/ArgumentFission.cpp @@ -33,9 +33,7 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-gl struct BindExtensionTest1 { template - static inline int bind(const std::shared_ptr& /*unused*/, - const int& v1, - const bool& v2) { + static int bind(const std::shared_ptr& /*unused*/, const int& v1, const bool& v2) { events.push_back("Bind1 with " + std::to_string(v1) + " and " + (v2 ? "true" : "false") + " called"); return 5; } @@ -43,9 +41,9 @@ struct BindExtensionTest1 { struct BindExtensionTest2 { template - static inline bool bind(const std::shared_ptr& /*reaction*/, - const std::string& v1, - const std::chrono::nanoseconds& v2) { + static bool bind(const std::shared_ptr& /*reaction*/, + const std::string& v1, + const std::chrono::nanoseconds& v2) { events.push_back("Bind2 with " + v1 + " and " + std::to_string(v2.count()) + " called"); return true; } @@ -53,10 +51,10 @@ struct BindExtensionTest2 { struct BindExtensionTest3 { template - static inline std::string bind(const std::shared_ptr& /*reaction*/, - const int& v1, - const int& v2, - const std::chrono::nanoseconds& v3) { + static std::string bind(const std::shared_ptr& /*reaction*/, + const int& v1, + const int& v2, + const std::chrono::nanoseconds& v3) { events.push_back("Bind3 with " + std::to_string(v1) + ", " + std::to_string(v2) + " and " + std::to_string(v3.count()) + " called"); return "return from Bind3"; diff --git a/tests/tests/dsl/CustomGet.cpp b/tests/tests/dsl/CustomGet.cpp index 46f1ab46c..95f233152 100644 --- a/tests/tests/dsl/CustomGet.cpp +++ b/tests/tests/dsl/CustomGet.cpp @@ -33,7 +33,7 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-gl struct CustomGet : public NUClear::dsl::operation::TypeBind { template - static inline std::shared_ptr get(const NUClear::threading::ReactionTask& /*task*/) { + static std::shared_ptr get(const NUClear::threading::ReactionTask& /*task*/) { return std::make_shared("Data from a custom getter"); } }; diff --git a/tests/tests/dsl/FusionInOrder.cpp b/tests/tests/dsl/FusionInOrder.cpp index 6136f2554..4cf28f418 100644 --- a/tests/tests/dsl/FusionInOrder.cpp +++ b/tests/tests/dsl/FusionInOrder.cpp @@ -30,7 +30,7 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-global-var template struct Extension { template - static inline void bind(const std::shared_ptr& /*reaction*/) { + static void bind(const std::shared_ptr& /*reaction*/) { events.push_back(i); } }; diff --git a/tests/tests/dsl/Transient.cpp b/tests/tests/dsl/Transient.cpp index 2d867c0f9..1d019f229 100644 --- a/tests/tests/dsl/Transient.cpp +++ b/tests/tests/dsl/Transient.cpp @@ -60,7 +60,7 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-gl struct TransientGetter : public NUClear::dsl::operation::TypeBind { template - static inline TransientMessage get(NUClear::threading::ReactionTask& task) { + static TransientMessage get(NUClear::threading::ReactionTask& task) { // Get the real message and return it directly so transient can activate auto raw = NUClear::dsl::operation::CacheGet::get(task); diff --git a/tests/tests/dsl/emit/EmitFusion.cpp b/tests/tests/dsl/emit/EmitFusion.cpp index 610a5343a..3b7639bf7 100644 --- a/tests/tests/dsl/emit/EmitFusion.cpp +++ b/tests/tests/dsl/emit/EmitFusion.cpp @@ -34,28 +34,28 @@ std::vector events; // NOLINT(cppcoreguidelines-avoid-non-const-gl template struct E1 { - static inline void emit(const NUClear::PowerPlant& /*powerplant*/, - std::shared_ptr p, - const int& a, - const std::string& b) { + static void emit(const NUClear::PowerPlant& /*powerplant*/, + std::shared_ptr p, + const int& a, + const std::string& b) { events.push_back("E1a " + *p + " " + std::to_string(a) + " " + b); } - static inline void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const std::string& c) { + static void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const std::string& c) { events.push_back("E1b " + *p + " " + c); } }; template struct E2 { - static inline void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const bool& d) { + static void emit(const NUClear::PowerPlant& /*powerplant*/, std::shared_ptr p, const bool& d) { events.push_back("E2a " + *p + " " + (d ? "true" : "false")); } - static inline void emit(const NUClear::PowerPlant& /*powerplant*/, - std::shared_ptr p, - const int& e, - const std::string& f) { + static void emit(const NUClear::PowerPlant& /*powerplant*/, + std::shared_ptr p, + const int& e, + const std::string& f) { events.push_back("E2b " + *p + " " + std::to_string(e) + " " + f); } };