From 0f6f3c207c46fa28059403e5f16af774d20c7ea2 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 20 Nov 2024 18:03:33 +0100 Subject: More [[nodiscard]] boyscouting --- src/cancel.cpp | 6 +++-- src/deep.cpp | 3 ++- src/intercopycontext.cpp | 69 ++++++++++++++++++++++++++++++++---------------- src/keeper.cpp | 27 ++++++++++++------- src/lane.cpp | 21 ++++++++++----- src/lanes.cpp | 3 ++- src/linda.cpp | 6 +++-- src/luaerrors.hpp | 12 ++++++--- src/nameof.cpp | 3 ++- src/threading.cpp | 3 ++- src/tools.cpp | 3 ++- src/tracker.cpp | 6 +++-- src/universe.cpp | 9 ++++--- 13 files changed, 114 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/cancel.cpp b/src/cancel.cpp index 9248b25..8fa68d5 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp @@ -50,7 +50,8 @@ THE SOFTWARE. * Returns CANCEL_SOFT/HARD if any locks are to be exited, and 'raise_cancel_error()' called, * to make execution of the lane end. */ -[[nodiscard]] CancelRequest CheckCancelRequest(lua_State* const L_) +[[nodiscard]] +CancelRequest CheckCancelRequest(lua_State* const L_) { auto const* const _lane{ kLanePointerRegKey.readLightUserDataValue(L_) }; // 'lane' is nullptr for the original main state (and no-one can cancel that) @@ -103,7 +104,8 @@ CancelOp WhichCancelOp(std::string_view const& opString_) // ################################################################################################# -[[nodiscard]] static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) +[[nodiscard]] +static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) { if (luaG_type(L_, idx_) == LuaType::STRING) { std::string_view const _str{ luaG_tostring(L_, idx_) }; diff --git a/src/deep.cpp b/src/deep.cpp index 9d5b839..6f4da9f 100644 --- a/src/deep.cpp +++ b/src/deep.cpp @@ -68,7 +68,8 @@ namespace { * End of life for a proxy object; reduce the deep reference count and clean it up if reaches 0. * */ - [[nodiscard]] static int DeepGC(lua_State* const L_) + [[nodiscard]] + static int DeepGC(lua_State* const L_) { DeepPrelude* const* const _proxy{ luaG_tofulluserdata(L_, StackIndex{ 1 }) }; DeepPrelude* const _p{ *_proxy }; diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index 672d49e..568e4cb 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp @@ -40,7 +40,8 @@ THE SOFTWARE. // we have to do it that way because we can't unbalance the stack between buffer operations // namely, this means we can't push a function on top of the stack *after* we initialize the buffer! // luckily, this also works with earlier Lua versions -[[nodiscard]] static int buf_writer(lua_State* L_, void const* b_, size_t size_, void* ud_) +[[nodiscard]] +static int buf_writer(lua_State* L_, void const* b_, size_t size_, void* ud_) { luaL_Buffer* const _B{ static_cast(ud_) }; if (!_B->L) { @@ -53,7 +54,8 @@ THE SOFTWARE. // ################################################################################################# // function sentinel used to transfer native functions from/to keeper states -[[nodiscard]] static int func_lookup_sentinel(lua_State* L_) +[[nodiscard]] +static int func_lookup_sentinel(lua_State* L_) { raise_luaL_error(L_, "function lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); } @@ -61,7 +63,8 @@ THE SOFTWARE. // ################################################################################################# // function sentinel used to transfer native table from/to keeper states -[[nodiscard]] static int table_lookup_sentinel(lua_State* L_) +[[nodiscard]] +static int table_lookup_sentinel(lua_State* L_) { raise_luaL_error(L_, "table lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); } @@ -69,7 +72,8 @@ THE SOFTWARE. // ################################################################################################# // function sentinel used to transfer cloned full userdata from/to keeper states -[[nodiscard]] static int userdata_clone_sentinel(lua_State* L_) +[[nodiscard]] +static int userdata_clone_sentinel(lua_State* L_) { raise_luaL_error(L_, "userdata clone sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); } @@ -77,7 +81,8 @@ THE SOFTWARE. // ################################################################################################# // retrieve the name of a function/table in the lookup database -[[nodiscard]] std::string_view InterCopyContext::findLookupName() const +[[nodiscard]] +std::string_view InterCopyContext::findLookupName() const { LUA_ASSERT(L1, lua_isfunction(L1, L1_i) || lua_istable(L1, L1_i)); // L1: ... v ... STACK_CHECK_START_REL(L1, 0); @@ -141,7 +146,8 @@ THE SOFTWARE. static constexpr RegistryUniqueKey kMtIdRegKey{ 0xA8895DCF4EC3FE3Cull }; // get a unique ID for metatable at [i]. -[[nodiscard]] static lua_Integer get_mt_id(Universe* U_, lua_State* L_, StackIndex const idx_) +[[nodiscard]] +static lua_Integer get_mt_id(Universe* U_, lua_State* L_, StackIndex const idx_) { StackIndex const _absidx{ luaG_absindex(L_, idx_) }; @@ -399,7 +405,8 @@ void InterCopyContext::copyCachedFunction() const // ################################################################################################# // Push a looked-up table, or nothing if we found nothing -[[nodiscard]] bool InterCopyContext::lookupTable() const +[[nodiscard]] +bool InterCopyContext::lookupTable() const { // get the name of the table we want to send std::string_view const _fqn{ findLookupName() }; @@ -585,7 +592,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::pushCachedMetatable() const +[[nodiscard]] +bool InterCopyContext::pushCachedMetatable() const { STACK_CHECK_START_REL(L1, 0); if (!lua_getmetatable(L1, L1_i)) { // L1: ... mt @@ -637,7 +645,8 @@ LuaType InterCopyContext::processConversion() const // local functions to point to the same table, also in the target. // Always pushes a table to 'L2'. // Returns true if the table was cached (no need to fill it!); false if it's a virgin. -[[nodiscard]] bool InterCopyContext::pushCachedTable() const +[[nodiscard]] +bool InterCopyContext::pushCachedTable() const { void const* const _p{ lua_topointer(L1, L1_i) }; @@ -669,7 +678,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::tryCopyClonable() const +[[nodiscard]] +bool InterCopyContext::tryCopyClonable() const { SourceIndex const _L1_i{ luaG_absindex(L1, L1_i).value() }; void* const _source{ lua_touserdata(L1, _L1_i) }; @@ -773,7 +783,8 @@ LuaType InterCopyContext::processConversion() const // Copy deep userdata between two separate Lua states (from L1 to L2) // Returns false if not a deep userdata, else true (unless an error occured) -[[nodiscard]] bool InterCopyContext::tryCopyDeep() const +[[nodiscard]] +bool InterCopyContext::tryCopyDeep() const { DeepFactory* const _factory{ DeepFactory::LookupFactory(L1, L1_i, mode) }; // L1: ... deep ... if (_factory == nullptr) { @@ -817,7 +828,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyBoolean() const +[[nodiscard]] +bool InterCopyContext::interCopyBoolean() const { int const _v{ lua_toboolean(L1, L1_i) }; DEBUGSPEW_CODE(DebugSpew(nullptr) << (_v ? "true" : "false") << std::endl); @@ -827,7 +839,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyFunction() const +[[nodiscard]] +bool InterCopyContext::interCopyFunction() const { if (vt == VT::KEY) { return false; @@ -921,7 +934,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyLightuserdata() const +[[nodiscard]] +bool InterCopyContext::interCopyLightuserdata() const { void* const _p{ lua_touserdata(L1, L1_i) }; // recognize and print known UniqueKey names here @@ -952,7 +966,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyNil() const +[[nodiscard]] +bool InterCopyContext::interCopyNil() const { if (vt == VT::KEY) { return false; @@ -968,7 +983,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyNumber() const +[[nodiscard]] +bool InterCopyContext::interCopyNumber() const { // LNUM patch support (keeping integer accuracy) #if defined LUA_LNUM || LUA_VERSION_NUM >= 503 @@ -988,7 +1004,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyString() const +[[nodiscard]] +bool InterCopyContext::interCopyString() const { std::string_view const _s{ luaG_tostring(L1, L1_i) }; DEBUGSPEW_CODE(DebugSpew(nullptr) << "'" << _s << "'" << std::endl); @@ -998,7 +1015,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyTable() const +[[nodiscard]] +bool InterCopyContext::interCopyTable() const { if (vt == VT::KEY) { return false; @@ -1055,7 +1073,8 @@ LuaType InterCopyContext::processConversion() const // ################################################################################################# -[[nodiscard]] bool InterCopyContext::interCopyUserdata() const +[[nodiscard]] +bool InterCopyContext::interCopyUserdata() const { STACK_CHECK_START_REL(L1, 0); STACK_CHECK_START_REL(L2, 0); @@ -1120,7 +1139,8 @@ namespace { * * Returns true if value was pushed, false if its type is non-supported. */ -[[nodiscard]] InterCopyResult InterCopyContext::interCopyOne() const +[[nodiscard]] +InterCopyResult InterCopyContext::interCopyOne() const { STACK_GROW(L2, 1); STACK_CHECK_START_REL(L1, 0); @@ -1185,7 +1205,8 @@ namespace { // returns InterCopyResult::Success if everything is fine // returns InterCopyResult::Error if pushed an error message in L1 // else raise an error in whichever state is not a keeper -[[nodiscard]] InterCopyResult InterCopyContext::interCopyPackage() const +[[nodiscard]] +InterCopyResult InterCopyContext::interCopyPackage() const { DEBUGSPEW_CODE(DebugSpew(U) << "InterCopyContext::interCopyPackage()" << std::endl); @@ -1268,7 +1289,8 @@ namespace { // Akin to 'lua_xmove' but copies values between _any_ Lua states. // NOTE: Both the states must be solely in the current OS thread's possession. -[[nodiscard]] InterCopyResult InterCopyContext::interCopy(int const n_) const +[[nodiscard]] +InterCopyResult InterCopyContext::interCopy(int const n_) const { LUA_ASSERT(L1, vt == VT::NORMAL); @@ -1328,7 +1350,8 @@ namespace { // ################################################################################################# -[[nodiscard]] InterCopyResult InterCopyContext::interMove(int const n_) const +[[nodiscard]] +InterCopyResult InterCopyContext::interMove(int const n_) const { assert(L1_i == 0); // we can only move stuff off the top of the stack InterCopyResult const _ret{ interCopy(n_) }; diff --git a/src/keeper.cpp b/src/keeper.cpp index af8bd1a..8a99a36 100644 --- a/src/keeper.cpp +++ b/src/keeper.cpp @@ -75,21 +75,28 @@ class KeyUD LindaLimit limit{ -1 }; // a fifo full userdata has one uservalue, the table that holds the actual fifo contents - [[nodiscard]] static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv(L_, UserValueCount{ 1 }); } + [[nodiscard]] + static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv(L_, UserValueCount{ 1 }); } // always embedded somewhere else or "in-place constructed" as a full userdata // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] KeeperState L_) { LUA_ASSERT(L_, !"should never be called"); } - [[nodiscard]] bool changeLimit(LindaLimit limit_); - [[nodiscard]] static KeyUD* Create(KeeperState K_); - [[nodiscard]] static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); + [[nodiscard]] + bool changeLimit(LindaLimit limit_); + [[nodiscard]] + static KeyUD* Create(KeeperState K_); + [[nodiscard]] + static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); void peek(KeeperState K_, int count_) const; // keepercall_get - [[nodiscard]] int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] + [[nodiscard]] + int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] void prepareAccess(KeeperState K_, StackIndex idx_) const; - [[nodiscard]] bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set + [[nodiscard]] + bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set void pushFillStatus(KeeperState K_) const; static void PushFillStatus(KeeperState K_, KeyUD const* key_); - [[nodiscard]] bool reset(KeeperState K_); + [[nodiscard]] + bool reset(KeeperState K_); }; // ################################################################################################# @@ -840,7 +847,8 @@ void Keepers::close() // ################################################################################################# -[[nodiscard]] Keeper* Keepers::getKeeper(KeeperIndex const idx_) +[[nodiscard]] +Keeper* Keepers::getKeeper(KeeperIndex const idx_) { if (isClosing.test(std::memory_order_acquire)) { return nullptr; @@ -859,7 +867,8 @@ void Keepers::close() // ################################################################################################# -[[nodiscard]] int Keepers::getNbKeepers() const +[[nodiscard]] +int Keepers::getNbKeepers() const { if (isClosing.test(std::memory_order_acquire)) { return 0; diff --git a/src/lane.cpp b/src/lane.cpp index 00f857e..923eabd 100644 --- a/src/lane.cpp +++ b/src/lane.cpp @@ -484,7 +484,8 @@ int Lane::LuaErrorHandler(lua_State* L_) // ########################################## Finalizer ############################################ // ################################################################################################# -[[nodiscard]] static int PushStackTrace(lua_State* const L_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const rc_, [[maybe_unused]] StackIndex const stk_base_) +[[nodiscard]] +static int PushStackTrace(lua_State* const L_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const rc_, [[maybe_unused]] StackIndex const stk_base_) { // Lua 5.1 error handler is limited to one return value; it stored the stack trace in the registry StackIndex const _top{ lua_gettop(L_) }; @@ -536,7 +537,8 @@ int Lane::LuaErrorHandler(lua_State* L_) // TBD: should we add stack trace on failing finalizer, wouldn't be hard.. // -[[nodiscard]] static LuaError run_finalizers(Lane* const lane_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const lua_rc_) +[[nodiscard]] +static LuaError run_finalizers(Lane* const lane_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const lua_rc_) { // if we are a coroutine, we can't run the finalizers in the coroutine state! lua_State* const _L{ lane_->S }; @@ -641,7 +643,8 @@ void Lane::selfdestructAdd() // ################################################################################################# // A free-running lane has ended; remove it from selfdestruct chain -[[nodiscard]] bool Lane::selfdestructRemove() +[[nodiscard]] +bool Lane::selfdestructRemove() { bool _found{ false }; std::lock_guard _guard{ U->selfdestructMutex }; @@ -938,7 +941,8 @@ CancelResult Lane::cancel(CancelOp const op_, std::chrono::time_point const until_, WakeLane const wakeLane_) +[[nodiscard]] +CancelResult Lane::internalCancel(CancelRequest const rq_, std::chrono::time_point const until_, WakeLane const wakeLane_) { cancelRequest.store(rq_, std::memory_order_relaxed); // it's now signaled to stop if (rq_ == CancelRequest::Hard) { @@ -992,7 +996,8 @@ void Lane::changeDebugName(StackIndex const nameIdx_) // / "error" finished at an error, error value is there // / "cancelled" execution cancelled by M (state gone) // -[[nodiscard]] std::string_view Lane::errorTraceLevelString() const +[[nodiscard]] +std::string_view Lane::errorTraceLevelString() const { std::string_view const _str{ (errorTraceLevel == ErrorTraceLevel::Minimal) ? "minimal" : @@ -1107,7 +1112,8 @@ void Lane::pushIndexedResult(lua_State* const L_, int const key_) const // ################################################################################################# -[[nodiscard]] std::string_view Lane::pushErrorTraceLevel(lua_State* L_) const +[[nodiscard]] +std::string_view Lane::pushErrorTraceLevel(lua_State* L_) const { std::string_view const _str{ errorTraceLevelString() }; LUA_ASSERT(L_, !_str.empty()); @@ -1287,7 +1293,8 @@ int Lane::storeResults(lua_State* const L_) // "error" finished at an error, error value is there // "cancelled" execution cancelled (state gone) // -[[nodiscard]] std::string_view Lane::threadStatusString() const +[[nodiscard]] +std::string_view Lane::threadStatusString() const { static constexpr std::string_view kStrs[] = { "pending", diff --git a/src/lanes.cpp b/src/lanes.cpp index c65fc1c..39caee9 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp @@ -881,7 +881,8 @@ LANES_API int luaopen_lanes_core(lua_State* const L_) // ################################################################################################# -[[nodiscard]] static int default_luaopen_lanes(lua_State* const L_) +[[nodiscard]] +static int default_luaopen_lanes(lua_State* const L_) { LuaError const _rc{ luaL_loadfile(L_, "lanes.lua") || lua_pcall(L_, 0, 1, 0) }; if (_rc != LuaError::OK) { diff --git a/src/linda.cpp b/src/linda.cpp index 99d0cbe..43d2a91 100644 --- a/src/linda.cpp +++ b/src/linda.cpp @@ -83,7 +83,8 @@ namespace { // ############################################################################################# template - [[nodiscard]] static inline Linda* ToLinda(lua_State* const L_, StackIndex const idx_) + [[nodiscard]] + static inline Linda* ToLinda(lua_State* const L_, StackIndex const idx_) { Linda* const _linda{ static_cast(LindaFactory::Instance.toDeep(L_, idx_)) }; if constexpr (!OPT) { @@ -104,7 +105,8 @@ namespace { */ template - [[nodiscard]] static int LindaToString(lua_State* const L_, StackIndex const idx_) + [[nodiscard]] + static int LindaToString(lua_State* const L_, StackIndex const idx_) { Linda* const _linda{ ToLinda(L_, idx_) }; if (_linda != nullptr) { diff --git a/src/luaerrors.hpp b/src/luaerrors.hpp index ef32c60..57c2e2e 100644 --- a/src/luaerrors.hpp +++ b/src/luaerrors.hpp @@ -5,7 +5,8 @@ // ################################################################################################# // use this instead of Lua's lua_error -[[noreturn]] static inline void raise_lua_error(lua_State* const L_) +[[noreturn]] +static inline void raise_lua_error(lua_State* const L_) { std::ignore = lua_error(L_); // doesn't return assert(false); // we should never get here, but i'm paranoid @@ -15,7 +16,8 @@ // use this instead of Lua's luaL_error template -[[noreturn]] static inline void raise_luaL_error(lua_State* const L_, std::string_view const& fmt_, ARGS... args_) +[[noreturn]] +static inline void raise_luaL_error(lua_State* const L_, std::string_view const& fmt_, ARGS... args_) { std::ignore = luaL_error(L_, fmt_.data(), std::forward(args_)...); // doesn't return assert(false); // we should never get here, but i'm paranoid @@ -25,7 +27,8 @@ template // use this instead of Lua's luaL_argerror template -[[noreturn]] static inline void raise_luaL_argerror(lua_State* const L_, StackIndex const arg_, std::string_view const& extramsg_) +[[noreturn]] +static inline void raise_luaL_argerror(lua_State* const L_, StackIndex const arg_, std::string_view const& extramsg_) { std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return assert(false); // we should never get here, but i'm paranoid @@ -36,7 +39,8 @@ template #if LUA_VERSION_NUM >= 504 // use this instead of Lua's luaL_typeerror template -[[noreturn]] static inline void raise_luaL_typeerror(lua_State* const L_, StackIndex const arg_, std::string_view const& tname_) +[[noreturn]] +static inline void raise_luaL_typeerror(lua_State* const L_, StackIndex const arg_, std::string_view const& tname_) { std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return assert(false); // we should never get here, but i'm paranoid diff --git a/src/nameof.cpp b/src/nameof.cpp index 1bf55d1..2ae315a 100644 --- a/src/nameof.cpp +++ b/src/nameof.cpp @@ -32,7 +32,8 @@ THE SOFTWARE. // ################################################################################################# // Return some name helping to identify an object -[[nodiscard]] static int DiscoverObjectNameRecur(lua_State* L_, int shortest_, int depth_) +[[nodiscard]] +static int DiscoverObjectNameRecur(lua_State* L_, int shortest_, int depth_) { static constexpr StackIndex kWhat{ 1 }; // the object to investigate // L_: o "r" {c} {fqn} ... {?} static constexpr StackIndex kResult{ 2 }; // where the result string is stored diff --git a/src/threading.cpp b/src/threading.cpp index 9c0d0fb..bedbcf8 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -204,7 +204,8 @@ void THREAD_SETNAME(std::string_view const& name_) // general its implementation is pretty much trivial, as on Win32 target // just SCHED_OTHER can be supported. #undef pthread_attr_setschedpolicy -[[nodiscard]] static int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy) +[[nodiscard]] +static int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy) { if (policy != SCHED_OTHER) { return ENOTSUP; diff --git a/src/tools.cpp b/src/tools.cpp index e9134f1..827c4a4 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -46,7 +46,8 @@ static constexpr RegistryUniqueKey kLookupCacheRegKey{ 0x9BF75F84E54B691Bull }; // ################################################################################################# static constexpr int kWriterReturnCode{ 666 }; -[[nodiscard]] static int dummy_writer([[maybe_unused]] lua_State* L_, [[maybe_unused]] void const* p_, [[maybe_unused]] size_t sz_, [[maybe_unused]] void* ud_) +[[nodiscard]] +static int dummy_writer([[maybe_unused]] lua_State* L_, [[maybe_unused]] void const* p_, [[maybe_unused]] size_t sz_, [[maybe_unused]] void* ud_) { // always fail with this code return kWriterReturnCode; diff --git a/src/tracker.cpp b/src/tracker.cpp index 69b0ee0..8b06522 100644 --- a/src/tracker.cpp +++ b/src/tracker.cpp @@ -51,7 +51,8 @@ void LaneTracker::tracking_add(Lane* lane_) /* * A free-running lane has ended; remove it from tracking chain */ -[[nodiscard]] bool LaneTracker::tracking_remove(Lane* lane_) +[[nodiscard]] +bool LaneTracker::tracking_remove(Lane* lane_) { if (!isActive()) { return false; @@ -82,7 +83,8 @@ void LaneTracker::tracking_add(Lane* lane_) // ################################################################################################ -[[nodiscard]] int LaneTracker::pushThreadsTable(lua_State* L_) const +[[nodiscard]] +int LaneTracker::pushThreadsTable(lua_State* L_) const { int const _top{ lua_gettop(L_) }; // List _all_ still running threads diff --git a/src/universe.cpp b/src/universe.cpp index 283747f..eab5977 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -119,7 +119,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo // ################################################################################################# // only called from the master state -[[nodiscard]] Universe* Universe::Create(lua_State* const L_) +[[nodiscard]] +Universe* Universe::Create(lua_State* const L_) { LUA_ASSERT(L_, Universe::Get(L_) == nullptr); static constexpr StackIndex kIdxSettings{ 1 }; @@ -194,7 +195,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo // ################################################################################################# // same as PUC-Lua l_alloc -[[nodiscard]] static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_) +[[nodiscard]] +static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_) { if (nsize_ == 0) { free(ptr_); @@ -206,7 +208,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo // ################################################################################################# -[[nodiscard]] static int luaG_provide_protected_allocator(lua_State* const L_) +[[nodiscard]] +static int luaG_provide_protected_allocator(lua_State* const L_) { Universe* const _U{ Universe::Get(L_) }; // push a new full userdata on the stack, giving access to the universe's protected allocator -- cgit v1.2.3-55-g6feb