diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-11-20 18:03:33 +0100 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-11-20 18:03:33 +0100 |
| commit | 0f6f3c207c46fa28059403e5f16af774d20c7ea2 (patch) | |
| tree | 8031145bb2534c33ca0f2c65b9de85696c8a8ee0 /src | |
| parent | 304e4dfabe4555dff4aa72e75b677405fd30d1b3 (diff) | |
| download | lanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.tar.gz lanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.tar.bz2 lanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.zip | |
More [[nodiscard]] boyscouting
Diffstat (limited to 'src')
| -rw-r--r-- | src/cancel.cpp | 6 | ||||
| -rw-r--r-- | src/deep.cpp | 3 | ||||
| -rw-r--r-- | src/intercopycontext.cpp | 69 | ||||
| -rw-r--r-- | src/keeper.cpp | 27 | ||||
| -rw-r--r-- | src/lane.cpp | 21 | ||||
| -rw-r--r-- | src/lanes.cpp | 3 | ||||
| -rw-r--r-- | src/linda.cpp | 6 | ||||
| -rw-r--r-- | src/luaerrors.hpp | 12 | ||||
| -rw-r--r-- | src/nameof.cpp | 3 | ||||
| -rw-r--r-- | src/threading.cpp | 3 | ||||
| -rw-r--r-- | src/tools.cpp | 3 | ||||
| -rw-r--r-- | src/tracker.cpp | 6 | ||||
| -rw-r--r-- | src/universe.cpp | 9 |
13 files changed, 114 insertions, 57 deletions
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. | |||
| 50 | * Returns CANCEL_SOFT/HARD if any locks are to be exited, and 'raise_cancel_error()' called, | 50 | * Returns CANCEL_SOFT/HARD if any locks are to be exited, and 'raise_cancel_error()' called, |
| 51 | * to make execution of the lane end. | 51 | * to make execution of the lane end. |
| 52 | */ | 52 | */ |
| 53 | [[nodiscard]] CancelRequest CheckCancelRequest(lua_State* const L_) | 53 | [[nodiscard]] |
| 54 | CancelRequest CheckCancelRequest(lua_State* const L_) | ||
| 54 | { | 55 | { |
| 55 | auto const* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) }; | 56 | auto const* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) }; |
| 56 | // 'lane' is nullptr for the original main state (and no-one can cancel that) | 57 | // '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_) | |||
| 103 | 104 | ||
| 104 | // ################################################################################################# | 105 | // ################################################################################################# |
| 105 | 106 | ||
| 106 | [[nodiscard]] static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) | 107 | [[nodiscard]] |
| 108 | static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) | ||
| 107 | { | 109 | { |
| 108 | if (luaG_type(L_, idx_) == LuaType::STRING) { | 110 | if (luaG_type(L_, idx_) == LuaType::STRING) { |
| 109 | std::string_view const _str{ luaG_tostring(L_, idx_) }; | 111 | 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 { | |||
| 68 | * End of life for a proxy object; reduce the deep reference count and clean it up if reaches 0. | 68 | * End of life for a proxy object; reduce the deep reference count and clean it up if reaches 0. |
| 69 | * | 69 | * |
| 70 | */ | 70 | */ |
| 71 | [[nodiscard]] static int DeepGC(lua_State* const L_) | 71 | [[nodiscard]] |
| 72 | static int DeepGC(lua_State* const L_) | ||
| 72 | { | 73 | { |
| 73 | DeepPrelude* const* const _proxy{ luaG_tofulluserdata<DeepPrelude*>(L_, StackIndex{ 1 }) }; | 74 | DeepPrelude* const* const _proxy{ luaG_tofulluserdata<DeepPrelude*>(L_, StackIndex{ 1 }) }; |
| 74 | DeepPrelude* const _p{ *_proxy }; | 75 | 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. | |||
| 40 | // we have to do it that way because we can't unbalance the stack between buffer operations | 40 | // we have to do it that way because we can't unbalance the stack between buffer operations |
| 41 | // namely, this means we can't push a function on top of the stack *after* we initialize the buffer! | 41 | // namely, this means we can't push a function on top of the stack *after* we initialize the buffer! |
| 42 | // luckily, this also works with earlier Lua versions | 42 | // luckily, this also works with earlier Lua versions |
| 43 | [[nodiscard]] static int buf_writer(lua_State* L_, void const* b_, size_t size_, void* ud_) | 43 | [[nodiscard]] |
| 44 | static int buf_writer(lua_State* L_, void const* b_, size_t size_, void* ud_) | ||
| 44 | { | 45 | { |
| 45 | luaL_Buffer* const _B{ static_cast<luaL_Buffer*>(ud_) }; | 46 | luaL_Buffer* const _B{ static_cast<luaL_Buffer*>(ud_) }; |
| 46 | if (!_B->L) { | 47 | if (!_B->L) { |
| @@ -53,7 +54,8 @@ THE SOFTWARE. | |||
| 53 | // ################################################################################################# | 54 | // ################################################################################################# |
| 54 | 55 | ||
| 55 | // function sentinel used to transfer native functions from/to keeper states | 56 | // function sentinel used to transfer native functions from/to keeper states |
| 56 | [[nodiscard]] static int func_lookup_sentinel(lua_State* L_) | 57 | [[nodiscard]] |
| 58 | static int func_lookup_sentinel(lua_State* L_) | ||
| 57 | { | 59 | { |
| 58 | raise_luaL_error(L_, "function lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); | 60 | raise_luaL_error(L_, "function lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); |
| 59 | } | 61 | } |
| @@ -61,7 +63,8 @@ THE SOFTWARE. | |||
| 61 | // ################################################################################################# | 63 | // ################################################################################################# |
| 62 | 64 | ||
| 63 | // function sentinel used to transfer native table from/to keeper states | 65 | // function sentinel used to transfer native table from/to keeper states |
| 64 | [[nodiscard]] static int table_lookup_sentinel(lua_State* L_) | 66 | [[nodiscard]] |
| 67 | static int table_lookup_sentinel(lua_State* L_) | ||
| 65 | { | 68 | { |
| 66 | raise_luaL_error(L_, "table lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); | 69 | raise_luaL_error(L_, "table lookup sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); |
| 67 | } | 70 | } |
| @@ -69,7 +72,8 @@ THE SOFTWARE. | |||
| 69 | // ################################################################################################# | 72 | // ################################################################################################# |
| 70 | 73 | ||
| 71 | // function sentinel used to transfer cloned full userdata from/to keeper states | 74 | // function sentinel used to transfer cloned full userdata from/to keeper states |
| 72 | [[nodiscard]] static int userdata_clone_sentinel(lua_State* L_) | 75 | [[nodiscard]] |
| 76 | static int userdata_clone_sentinel(lua_State* L_) | ||
| 73 | { | 77 | { |
| 74 | raise_luaL_error(L_, "userdata clone sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); | 78 | raise_luaL_error(L_, "userdata clone sentinel for %s, should never be called", lua_tostring(L_, lua_upvalueindex(1))); |
| 75 | } | 79 | } |
| @@ -77,7 +81,8 @@ THE SOFTWARE. | |||
| 77 | // ################################################################################################# | 81 | // ################################################################################################# |
| 78 | 82 | ||
| 79 | // retrieve the name of a function/table in the lookup database | 83 | // retrieve the name of a function/table in the lookup database |
| 80 | [[nodiscard]] std::string_view InterCopyContext::findLookupName() const | 84 | [[nodiscard]] |
| 85 | std::string_view InterCopyContext::findLookupName() const | ||
| 81 | { | 86 | { |
| 82 | LUA_ASSERT(L1, lua_isfunction(L1, L1_i) || lua_istable(L1, L1_i)); // L1: ... v ... | 87 | LUA_ASSERT(L1, lua_isfunction(L1, L1_i) || lua_istable(L1, L1_i)); // L1: ... v ... |
| 83 | STACK_CHECK_START_REL(L1, 0); | 88 | STACK_CHECK_START_REL(L1, 0); |
| @@ -141,7 +146,8 @@ THE SOFTWARE. | |||
| 141 | static constexpr RegistryUniqueKey kMtIdRegKey{ 0xA8895DCF4EC3FE3Cull }; | 146 | static constexpr RegistryUniqueKey kMtIdRegKey{ 0xA8895DCF4EC3FE3Cull }; |
| 142 | 147 | ||
| 143 | // get a unique ID for metatable at [i]. | 148 | // get a unique ID for metatable at [i]. |
| 144 | [[nodiscard]] static lua_Integer get_mt_id(Universe* U_, lua_State* L_, StackIndex const idx_) | 149 | [[nodiscard]] |
| 150 | static lua_Integer get_mt_id(Universe* U_, lua_State* L_, StackIndex const idx_) | ||
| 145 | { | 151 | { |
| 146 | StackIndex const _absidx{ luaG_absindex(L_, idx_) }; | 152 | StackIndex const _absidx{ luaG_absindex(L_, idx_) }; |
| 147 | 153 | ||
| @@ -399,7 +405,8 @@ void InterCopyContext::copyCachedFunction() const | |||
| 399 | // ################################################################################################# | 405 | // ################################################################################################# |
| 400 | 406 | ||
| 401 | // Push a looked-up table, or nothing if we found nothing | 407 | // Push a looked-up table, or nothing if we found nothing |
| 402 | [[nodiscard]] bool InterCopyContext::lookupTable() const | 408 | [[nodiscard]] |
| 409 | bool InterCopyContext::lookupTable() const | ||
| 403 | { | 410 | { |
| 404 | // get the name of the table we want to send | 411 | // get the name of the table we want to send |
| 405 | std::string_view const _fqn{ findLookupName() }; | 412 | std::string_view const _fqn{ findLookupName() }; |
| @@ -585,7 +592,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 585 | 592 | ||
| 586 | // ################################################################################################# | 593 | // ################################################################################################# |
| 587 | 594 | ||
| 588 | [[nodiscard]] bool InterCopyContext::pushCachedMetatable() const | 595 | [[nodiscard]] |
| 596 | bool InterCopyContext::pushCachedMetatable() const | ||
| 589 | { | 597 | { |
| 590 | STACK_CHECK_START_REL(L1, 0); | 598 | STACK_CHECK_START_REL(L1, 0); |
| 591 | if (!lua_getmetatable(L1, L1_i)) { // L1: ... mt | 599 | if (!lua_getmetatable(L1, L1_i)) { // L1: ... mt |
| @@ -637,7 +645,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 637 | // local functions to point to the same table, also in the target. | 645 | // local functions to point to the same table, also in the target. |
| 638 | // Always pushes a table to 'L2'. | 646 | // Always pushes a table to 'L2'. |
| 639 | // Returns true if the table was cached (no need to fill it!); false if it's a virgin. | 647 | // Returns true if the table was cached (no need to fill it!); false if it's a virgin. |
| 640 | [[nodiscard]] bool InterCopyContext::pushCachedTable() const | 648 | [[nodiscard]] |
| 649 | bool InterCopyContext::pushCachedTable() const | ||
| 641 | { | 650 | { |
| 642 | void const* const _p{ lua_topointer(L1, L1_i) }; | 651 | void const* const _p{ lua_topointer(L1, L1_i) }; |
| 643 | 652 | ||
| @@ -669,7 +678,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 669 | 678 | ||
| 670 | // ################################################################################################# | 679 | // ################################################################################################# |
| 671 | 680 | ||
| 672 | [[nodiscard]] bool InterCopyContext::tryCopyClonable() const | 681 | [[nodiscard]] |
| 682 | bool InterCopyContext::tryCopyClonable() const | ||
| 673 | { | 683 | { |
| 674 | SourceIndex const _L1_i{ luaG_absindex(L1, L1_i).value() }; | 684 | SourceIndex const _L1_i{ luaG_absindex(L1, L1_i).value() }; |
| 675 | void* const _source{ lua_touserdata(L1, _L1_i) }; | 685 | void* const _source{ lua_touserdata(L1, _L1_i) }; |
| @@ -773,7 +783,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 773 | 783 | ||
| 774 | // Copy deep userdata between two separate Lua states (from L1 to L2) | 784 | // Copy deep userdata between two separate Lua states (from L1 to L2) |
| 775 | // Returns false if not a deep userdata, else true (unless an error occured) | 785 | // Returns false if not a deep userdata, else true (unless an error occured) |
| 776 | [[nodiscard]] bool InterCopyContext::tryCopyDeep() const | 786 | [[nodiscard]] |
| 787 | bool InterCopyContext::tryCopyDeep() const | ||
| 777 | { | 788 | { |
| 778 | DeepFactory* const _factory{ DeepFactory::LookupFactory(L1, L1_i, mode) }; // L1: ... deep ... | 789 | DeepFactory* const _factory{ DeepFactory::LookupFactory(L1, L1_i, mode) }; // L1: ... deep ... |
| 779 | if (_factory == nullptr) { | 790 | if (_factory == nullptr) { |
| @@ -817,7 +828,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 817 | 828 | ||
| 818 | // ################################################################################################# | 829 | // ################################################################################################# |
| 819 | 830 | ||
| 820 | [[nodiscard]] bool InterCopyContext::interCopyBoolean() const | 831 | [[nodiscard]] |
| 832 | bool InterCopyContext::interCopyBoolean() const | ||
| 821 | { | 833 | { |
| 822 | int const _v{ lua_toboolean(L1, L1_i) }; | 834 | int const _v{ lua_toboolean(L1, L1_i) }; |
| 823 | DEBUGSPEW_CODE(DebugSpew(nullptr) << (_v ? "true" : "false") << std::endl); | 835 | DEBUGSPEW_CODE(DebugSpew(nullptr) << (_v ? "true" : "false") << std::endl); |
| @@ -827,7 +839,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 827 | 839 | ||
| 828 | // ################################################################################################# | 840 | // ################################################################################################# |
| 829 | 841 | ||
| 830 | [[nodiscard]] bool InterCopyContext::interCopyFunction() const | 842 | [[nodiscard]] |
| 843 | bool InterCopyContext::interCopyFunction() const | ||
| 831 | { | 844 | { |
| 832 | if (vt == VT::KEY) { | 845 | if (vt == VT::KEY) { |
| 833 | return false; | 846 | return false; |
| @@ -921,7 +934,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 921 | 934 | ||
| 922 | // ################################################################################################# | 935 | // ################################################################################################# |
| 923 | 936 | ||
| 924 | [[nodiscard]] bool InterCopyContext::interCopyLightuserdata() const | 937 | [[nodiscard]] |
| 938 | bool InterCopyContext::interCopyLightuserdata() const | ||
| 925 | { | 939 | { |
| 926 | void* const _p{ lua_touserdata(L1, L1_i) }; | 940 | void* const _p{ lua_touserdata(L1, L1_i) }; |
| 927 | // recognize and print known UniqueKey names here | 941 | // recognize and print known UniqueKey names here |
| @@ -952,7 +966,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 952 | 966 | ||
| 953 | // ################################################################################################# | 967 | // ################################################################################################# |
| 954 | 968 | ||
| 955 | [[nodiscard]] bool InterCopyContext::interCopyNil() const | 969 | [[nodiscard]] |
| 970 | bool InterCopyContext::interCopyNil() const | ||
| 956 | { | 971 | { |
| 957 | if (vt == VT::KEY) { | 972 | if (vt == VT::KEY) { |
| 958 | return false; | 973 | return false; |
| @@ -968,7 +983,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 968 | 983 | ||
| 969 | // ################################################################################################# | 984 | // ################################################################################################# |
| 970 | 985 | ||
| 971 | [[nodiscard]] bool InterCopyContext::interCopyNumber() const | 986 | [[nodiscard]] |
| 987 | bool InterCopyContext::interCopyNumber() const | ||
| 972 | { | 988 | { |
| 973 | // LNUM patch support (keeping integer accuracy) | 989 | // LNUM patch support (keeping integer accuracy) |
| 974 | #if defined LUA_LNUM || LUA_VERSION_NUM >= 503 | 990 | #if defined LUA_LNUM || LUA_VERSION_NUM >= 503 |
| @@ -988,7 +1004,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 988 | 1004 | ||
| 989 | // ################################################################################################# | 1005 | // ################################################################################################# |
| 990 | 1006 | ||
| 991 | [[nodiscard]] bool InterCopyContext::interCopyString() const | 1007 | [[nodiscard]] |
| 1008 | bool InterCopyContext::interCopyString() const | ||
| 992 | { | 1009 | { |
| 993 | std::string_view const _s{ luaG_tostring(L1, L1_i) }; | 1010 | std::string_view const _s{ luaG_tostring(L1, L1_i) }; |
| 994 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "'" << _s << "'" << std::endl); | 1011 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "'" << _s << "'" << std::endl); |
| @@ -998,7 +1015,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 998 | 1015 | ||
| 999 | // ################################################################################################# | 1016 | // ################################################################################################# |
| 1000 | 1017 | ||
| 1001 | [[nodiscard]] bool InterCopyContext::interCopyTable() const | 1018 | [[nodiscard]] |
| 1019 | bool InterCopyContext::interCopyTable() const | ||
| 1002 | { | 1020 | { |
| 1003 | if (vt == VT::KEY) { | 1021 | if (vt == VT::KEY) { |
| 1004 | return false; | 1022 | return false; |
| @@ -1055,7 +1073,8 @@ LuaType InterCopyContext::processConversion() const | |||
| 1055 | 1073 | ||
| 1056 | // ################################################################################################# | 1074 | // ################################################################################################# |
| 1057 | 1075 | ||
| 1058 | [[nodiscard]] bool InterCopyContext::interCopyUserdata() const | 1076 | [[nodiscard]] |
| 1077 | bool InterCopyContext::interCopyUserdata() const | ||
| 1059 | { | 1078 | { |
| 1060 | STACK_CHECK_START_REL(L1, 0); | 1079 | STACK_CHECK_START_REL(L1, 0); |
| 1061 | STACK_CHECK_START_REL(L2, 0); | 1080 | STACK_CHECK_START_REL(L2, 0); |
| @@ -1120,7 +1139,8 @@ namespace { | |||
| 1120 | * | 1139 | * |
| 1121 | * Returns true if value was pushed, false if its type is non-supported. | 1140 | * Returns true if value was pushed, false if its type is non-supported. |
| 1122 | */ | 1141 | */ |
| 1123 | [[nodiscard]] InterCopyResult InterCopyContext::interCopyOne() const | 1142 | [[nodiscard]] |
| 1143 | InterCopyResult InterCopyContext::interCopyOne() const | ||
| 1124 | { | 1144 | { |
| 1125 | STACK_GROW(L2, 1); | 1145 | STACK_GROW(L2, 1); |
| 1126 | STACK_CHECK_START_REL(L1, 0); | 1146 | STACK_CHECK_START_REL(L1, 0); |
| @@ -1185,7 +1205,8 @@ namespace { | |||
| 1185 | // returns InterCopyResult::Success if everything is fine | 1205 | // returns InterCopyResult::Success if everything is fine |
| 1186 | // returns InterCopyResult::Error if pushed an error message in L1 | 1206 | // returns InterCopyResult::Error if pushed an error message in L1 |
| 1187 | // else raise an error in whichever state is not a keeper | 1207 | // else raise an error in whichever state is not a keeper |
| 1188 | [[nodiscard]] InterCopyResult InterCopyContext::interCopyPackage() const | 1208 | [[nodiscard]] |
| 1209 | InterCopyResult InterCopyContext::interCopyPackage() const | ||
| 1189 | { | 1210 | { |
| 1190 | DEBUGSPEW_CODE(DebugSpew(U) << "InterCopyContext::interCopyPackage()" << std::endl); | 1211 | DEBUGSPEW_CODE(DebugSpew(U) << "InterCopyContext::interCopyPackage()" << std::endl); |
| 1191 | 1212 | ||
| @@ -1268,7 +1289,8 @@ namespace { | |||
| 1268 | 1289 | ||
| 1269 | // Akin to 'lua_xmove' but copies values between _any_ Lua states. | 1290 | // Akin to 'lua_xmove' but copies values between _any_ Lua states. |
| 1270 | // NOTE: Both the states must be solely in the current OS thread's possession. | 1291 | // NOTE: Both the states must be solely in the current OS thread's possession. |
| 1271 | [[nodiscard]] InterCopyResult InterCopyContext::interCopy(int const n_) const | 1292 | [[nodiscard]] |
| 1293 | InterCopyResult InterCopyContext::interCopy(int const n_) const | ||
| 1272 | { | 1294 | { |
| 1273 | LUA_ASSERT(L1, vt == VT::NORMAL); | 1295 | LUA_ASSERT(L1, vt == VT::NORMAL); |
| 1274 | 1296 | ||
| @@ -1328,7 +1350,8 @@ namespace { | |||
| 1328 | 1350 | ||
| 1329 | // ################################################################################################# | 1351 | // ################################################################################################# |
| 1330 | 1352 | ||
| 1331 | [[nodiscard]] InterCopyResult InterCopyContext::interMove(int const n_) const | 1353 | [[nodiscard]] |
| 1354 | InterCopyResult InterCopyContext::interMove(int const n_) const | ||
| 1332 | { | 1355 | { |
| 1333 | assert(L1_i == 0); // we can only move stuff off the top of the stack | 1356 | assert(L1_i == 0); // we can only move stuff off the top of the stack |
| 1334 | InterCopyResult const _ret{ interCopy(n_) }; | 1357 | 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 | |||
| 75 | LindaLimit limit{ -1 }; | 75 | LindaLimit limit{ -1 }; |
| 76 | 76 | ||
| 77 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents | 77 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents |
| 78 | [[nodiscard]] static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv<KeyUD>(L_, UserValueCount{ 1 }); } | 78 | [[nodiscard]] |
| 79 | static void* operator new([[maybe_unused]] size_t size_, KeeperState L_) noexcept { return luaG_newuserdatauv<KeyUD>(L_, UserValueCount{ 1 }); } | ||
| 79 | // always embedded somewhere else or "in-place constructed" as a full userdata | 80 | // always embedded somewhere else or "in-place constructed" as a full userdata |
| 80 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception | 81 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception |
| 81 | static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] KeeperState L_) { LUA_ASSERT(L_, !"should never be called"); } | 82 | static void operator delete([[maybe_unused]] void* p_, [[maybe_unused]] KeeperState L_) { LUA_ASSERT(L_, !"should never be called"); } |
| 82 | 83 | ||
| 83 | [[nodiscard]] bool changeLimit(LindaLimit limit_); | 84 | [[nodiscard]] |
| 84 | [[nodiscard]] static KeyUD* Create(KeeperState K_); | 85 | bool changeLimit(LindaLimit limit_); |
| 85 | [[nodiscard]] static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); | 86 | [[nodiscard]] |
| 87 | static KeyUD* Create(KeeperState K_); | ||
| 88 | [[nodiscard]] | ||
| 89 | static KeyUD* GetPtr(KeeperState K_, StackIndex idx_); | ||
| 86 | void peek(KeeperState K_, int count_) const; // keepercall_get | 90 | void peek(KeeperState K_, int count_) const; // keepercall_get |
| 87 | [[nodiscard]] int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] | 91 | [[nodiscard]] |
| 92 | int pop(KeeperState K_, int minCount_, int maxCount_); // keepercall_receive[_batched] | ||
| 88 | void prepareAccess(KeeperState K_, StackIndex idx_) const; | 93 | void prepareAccess(KeeperState K_, StackIndex idx_) const; |
| 89 | [[nodiscard]] bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set | 94 | [[nodiscard]] |
| 95 | bool push(KeeperState K_, int count_, bool enforceLimit_); // keepercall_send and keepercall_set | ||
| 90 | void pushFillStatus(KeeperState K_) const; | 96 | void pushFillStatus(KeeperState K_) const; |
| 91 | static void PushFillStatus(KeeperState K_, KeyUD const* key_); | 97 | static void PushFillStatus(KeeperState K_, KeyUD const* key_); |
| 92 | [[nodiscard]] bool reset(KeeperState K_); | 98 | [[nodiscard]] |
| 99 | bool reset(KeeperState K_); | ||
| 93 | }; | 100 | }; |
| 94 | 101 | ||
| 95 | // ################################################################################################# | 102 | // ################################################################################################# |
| @@ -840,7 +847,8 @@ void Keepers::close() | |||
| 840 | 847 | ||
| 841 | // ################################################################################################# | 848 | // ################################################################################################# |
| 842 | 849 | ||
| 843 | [[nodiscard]] Keeper* Keepers::getKeeper(KeeperIndex const idx_) | 850 | [[nodiscard]] |
| 851 | Keeper* Keepers::getKeeper(KeeperIndex const idx_) | ||
| 844 | { | 852 | { |
| 845 | if (isClosing.test(std::memory_order_acquire)) { | 853 | if (isClosing.test(std::memory_order_acquire)) { |
| 846 | return nullptr; | 854 | return nullptr; |
| @@ -859,7 +867,8 @@ void Keepers::close() | |||
| 859 | 867 | ||
| 860 | // ################################################################################################# | 868 | // ################################################################################################# |
| 861 | 869 | ||
| 862 | [[nodiscard]] int Keepers::getNbKeepers() const | 870 | [[nodiscard]] |
| 871 | int Keepers::getNbKeepers() const | ||
| 863 | { | 872 | { |
| 864 | if (isClosing.test(std::memory_order_acquire)) { | 873 | if (isClosing.test(std::memory_order_acquire)) { |
| 865 | return 0; | 874 | 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_) | |||
| 484 | // ########################################## Finalizer ############################################ | 484 | // ########################################## Finalizer ############################################ |
| 485 | // ################################################################################################# | 485 | // ################################################################################################# |
| 486 | 486 | ||
| 487 | [[nodiscard]] static int PushStackTrace(lua_State* const L_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const rc_, [[maybe_unused]] StackIndex const stk_base_) | 487 | [[nodiscard]] |
| 488 | static int PushStackTrace(lua_State* const L_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const rc_, [[maybe_unused]] StackIndex const stk_base_) | ||
| 488 | { | 489 | { |
| 489 | // Lua 5.1 error handler is limited to one return value; it stored the stack trace in the registry | 490 | // Lua 5.1 error handler is limited to one return value; it stored the stack trace in the registry |
| 490 | StackIndex const _top{ lua_gettop(L_) }; | 491 | StackIndex const _top{ lua_gettop(L_) }; |
| @@ -536,7 +537,8 @@ int Lane::LuaErrorHandler(lua_State* L_) | |||
| 536 | // TBD: should we add stack trace on failing finalizer, wouldn't be hard.. | 537 | // TBD: should we add stack trace on failing finalizer, wouldn't be hard.. |
| 537 | // | 538 | // |
| 538 | 539 | ||
| 539 | [[nodiscard]] static LuaError run_finalizers(Lane* const lane_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const lua_rc_) | 540 | [[nodiscard]] |
| 541 | static LuaError run_finalizers(Lane* const lane_, Lane::ErrorTraceLevel const errorTraceLevel_, LuaError const lua_rc_) | ||
| 540 | { | 542 | { |
| 541 | // if we are a coroutine, we can't run the finalizers in the coroutine state! | 543 | // if we are a coroutine, we can't run the finalizers in the coroutine state! |
| 542 | lua_State* const _L{ lane_->S }; | 544 | lua_State* const _L{ lane_->S }; |
| @@ -641,7 +643,8 @@ void Lane::selfdestructAdd() | |||
| 641 | // ################################################################################################# | 643 | // ################################################################################################# |
| 642 | 644 | ||
| 643 | // A free-running lane has ended; remove it from selfdestruct chain | 645 | // A free-running lane has ended; remove it from selfdestruct chain |
| 644 | [[nodiscard]] bool Lane::selfdestructRemove() | 646 | [[nodiscard]] |
| 647 | bool Lane::selfdestructRemove() | ||
| 645 | { | 648 | { |
| 646 | bool _found{ false }; | 649 | bool _found{ false }; |
| 647 | std::lock_guard<std::mutex> _guard{ U->selfdestructMutex }; | 650 | std::lock_guard<std::mutex> _guard{ U->selfdestructMutex }; |
| @@ -938,7 +941,8 @@ CancelResult Lane::cancel(CancelOp const op_, std::chrono::time_point<std::chron | |||
| 938 | 941 | ||
| 939 | // ################################################################################################# | 942 | // ################################################################################################# |
| 940 | 943 | ||
| 941 | [[nodiscard]] CancelResult Lane::internalCancel(CancelRequest const rq_, std::chrono::time_point<std::chrono::steady_clock> const until_, WakeLane const wakeLane_) | 944 | [[nodiscard]] |
| 945 | CancelResult Lane::internalCancel(CancelRequest const rq_, std::chrono::time_point<std::chrono::steady_clock> const until_, WakeLane const wakeLane_) | ||
| 942 | { | 946 | { |
| 943 | cancelRequest.store(rq_, std::memory_order_relaxed); // it's now signaled to stop | 947 | cancelRequest.store(rq_, std::memory_order_relaxed); // it's now signaled to stop |
| 944 | if (rq_ == CancelRequest::Hard) { | 948 | if (rq_ == CancelRequest::Hard) { |
| @@ -992,7 +996,8 @@ void Lane::changeDebugName(StackIndex const nameIdx_) | |||
| 992 | // / "error" finished at an error, error value is there | 996 | // / "error" finished at an error, error value is there |
| 993 | // / "cancelled" execution cancelled by M (state gone) | 997 | // / "cancelled" execution cancelled by M (state gone) |
| 994 | // | 998 | // |
| 995 | [[nodiscard]] std::string_view Lane::errorTraceLevelString() const | 999 | [[nodiscard]] |
| 1000 | std::string_view Lane::errorTraceLevelString() const | ||
| 996 | { | 1001 | { |
| 997 | std::string_view const _str{ | 1002 | std::string_view const _str{ |
| 998 | (errorTraceLevel == ErrorTraceLevel::Minimal) ? "minimal" : | 1003 | (errorTraceLevel == ErrorTraceLevel::Minimal) ? "minimal" : |
| @@ -1107,7 +1112,8 @@ void Lane::pushIndexedResult(lua_State* const L_, int const key_) const | |||
| 1107 | 1112 | ||
| 1108 | // ################################################################################################# | 1113 | // ################################################################################################# |
| 1109 | 1114 | ||
| 1110 | [[nodiscard]] std::string_view Lane::pushErrorTraceLevel(lua_State* L_) const | 1115 | [[nodiscard]] |
| 1116 | std::string_view Lane::pushErrorTraceLevel(lua_State* L_) const | ||
| 1111 | { | 1117 | { |
| 1112 | std::string_view const _str{ errorTraceLevelString() }; | 1118 | std::string_view const _str{ errorTraceLevelString() }; |
| 1113 | LUA_ASSERT(L_, !_str.empty()); | 1119 | LUA_ASSERT(L_, !_str.empty()); |
| @@ -1287,7 +1293,8 @@ int Lane::storeResults(lua_State* const L_) | |||
| 1287 | // "error" finished at an error, error value is there | 1293 | // "error" finished at an error, error value is there |
| 1288 | // "cancelled" execution cancelled (state gone) | 1294 | // "cancelled" execution cancelled (state gone) |
| 1289 | // | 1295 | // |
| 1290 | [[nodiscard]] std::string_view Lane::threadStatusString() const | 1296 | [[nodiscard]] |
| 1297 | std::string_view Lane::threadStatusString() const | ||
| 1291 | { | 1298 | { |
| 1292 | static constexpr std::string_view kStrs[] = { | 1299 | static constexpr std::string_view kStrs[] = { |
| 1293 | "pending", | 1300 | "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_) | |||
| 881 | 881 | ||
| 882 | // ################################################################################################# | 882 | // ################################################################################################# |
| 883 | 883 | ||
| 884 | [[nodiscard]] static int default_luaopen_lanes(lua_State* const L_) | 884 | [[nodiscard]] |
| 885 | static int default_luaopen_lanes(lua_State* const L_) | ||
| 885 | { | 886 | { |
| 886 | LuaError const _rc{ luaL_loadfile(L_, "lanes.lua") || lua_pcall(L_, 0, 1, 0) }; | 887 | LuaError const _rc{ luaL_loadfile(L_, "lanes.lua") || lua_pcall(L_, 0, 1, 0) }; |
| 887 | if (_rc != LuaError::OK) { | 888 | 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 { | |||
| 83 | // ############################################################################################# | 83 | // ############################################################################################# |
| 84 | 84 | ||
| 85 | template <bool OPT> | 85 | template <bool OPT> |
| 86 | [[nodiscard]] static inline Linda* ToLinda(lua_State* const L_, StackIndex const idx_) | 86 | [[nodiscard]] |
| 87 | static inline Linda* ToLinda(lua_State* const L_, StackIndex const idx_) | ||
| 87 | { | 88 | { |
| 88 | Linda* const _linda{ static_cast<Linda*>(LindaFactory::Instance.toDeep(L_, idx_)) }; | 89 | Linda* const _linda{ static_cast<Linda*>(LindaFactory::Instance.toDeep(L_, idx_)) }; |
| 89 | if constexpr (!OPT) { | 90 | if constexpr (!OPT) { |
| @@ -104,7 +105,8 @@ namespace { | |||
| 104 | */ | 105 | */ |
| 105 | 106 | ||
| 106 | template <bool OPT> | 107 | template <bool OPT> |
| 107 | [[nodiscard]] static int LindaToString(lua_State* const L_, StackIndex const idx_) | 108 | [[nodiscard]] |
| 109 | static int LindaToString(lua_State* const L_, StackIndex const idx_) | ||
| 108 | { | 110 | { |
| 109 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; | 111 | Linda* const _linda{ ToLinda<OPT>(L_, idx_) }; |
| 110 | if (_linda != nullptr) { | 112 | 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 @@ | |||
| 5 | // ################################################################################################# | 5 | // ################################################################################################# |
| 6 | 6 | ||
| 7 | // use this instead of Lua's lua_error | 7 | // use this instead of Lua's lua_error |
| 8 | [[noreturn]] static inline void raise_lua_error(lua_State* const L_) | 8 | [[noreturn]] |
| 9 | static inline void raise_lua_error(lua_State* const L_) | ||
| 9 | { | 10 | { |
| 10 | std::ignore = lua_error(L_); // doesn't return | 11 | std::ignore = lua_error(L_); // doesn't return |
| 11 | assert(false); // we should never get here, but i'm paranoid | 12 | assert(false); // we should never get here, but i'm paranoid |
| @@ -15,7 +16,8 @@ | |||
| 15 | 16 | ||
| 16 | // use this instead of Lua's luaL_error | 17 | // use this instead of Lua's luaL_error |
| 17 | template <typename... ARGS> | 18 | template <typename... ARGS> |
| 18 | [[noreturn]] static inline void raise_luaL_error(lua_State* const L_, std::string_view const& fmt_, ARGS... args_) | 19 | [[noreturn]] |
| 20 | static inline void raise_luaL_error(lua_State* const L_, std::string_view const& fmt_, ARGS... args_) | ||
| 19 | { | 21 | { |
| 20 | std::ignore = luaL_error(L_, fmt_.data(), std::forward<ARGS>(args_)...); // doesn't return | 22 | std::ignore = luaL_error(L_, fmt_.data(), std::forward<ARGS>(args_)...); // doesn't return |
| 21 | assert(false); // we should never get here, but i'm paranoid | 23 | assert(false); // we should never get here, but i'm paranoid |
| @@ -25,7 +27,8 @@ template <typename... ARGS> | |||
| 25 | 27 | ||
| 26 | // use this instead of Lua's luaL_argerror | 28 | // use this instead of Lua's luaL_argerror |
| 27 | template <typename... ARGS> | 29 | template <typename... ARGS> |
| 28 | [[noreturn]] static inline void raise_luaL_argerror(lua_State* const L_, StackIndex const arg_, std::string_view const& extramsg_) | 30 | [[noreturn]] |
| 31 | static inline void raise_luaL_argerror(lua_State* const L_, StackIndex const arg_, std::string_view const& extramsg_) | ||
| 29 | { | 32 | { |
| 30 | std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return | 33 | std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return |
| 31 | assert(false); // we should never get here, but i'm paranoid | 34 | assert(false); // we should never get here, but i'm paranoid |
| @@ -36,7 +39,8 @@ template <typename... ARGS> | |||
| 36 | #if LUA_VERSION_NUM >= 504 | 39 | #if LUA_VERSION_NUM >= 504 |
| 37 | // use this instead of Lua's luaL_typeerror | 40 | // use this instead of Lua's luaL_typeerror |
| 38 | template <typename... ARGS> | 41 | template <typename... ARGS> |
| 39 | [[noreturn]] static inline void raise_luaL_typeerror(lua_State* const L_, StackIndex const arg_, std::string_view const& tname_) | 42 | [[noreturn]] |
| 43 | static inline void raise_luaL_typeerror(lua_State* const L_, StackIndex const arg_, std::string_view const& tname_) | ||
| 40 | { | 44 | { |
| 41 | std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return | 45 | std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return |
| 42 | assert(false); // we should never get here, but i'm paranoid | 46 | 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. | |||
| 32 | // ################################################################################################# | 32 | // ################################################################################################# |
| 33 | 33 | ||
| 34 | // Return some name helping to identify an object | 34 | // Return some name helping to identify an object |
| 35 | [[nodiscard]] static int DiscoverObjectNameRecur(lua_State* L_, int shortest_, int depth_) | 35 | [[nodiscard]] |
| 36 | static int DiscoverObjectNameRecur(lua_State* L_, int shortest_, int depth_) | ||
| 36 | { | 37 | { |
| 37 | static constexpr StackIndex kWhat{ 1 }; // the object to investigate // L_: o "r" {c} {fqn} ... {?} | 38 | static constexpr StackIndex kWhat{ 1 }; // the object to investigate // L_: o "r" {c} {fqn} ... {?} |
| 38 | static constexpr StackIndex kResult{ 2 }; // where the result string is stored | 39 | 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_) | |||
| 204 | // general its implementation is pretty much trivial, as on Win32 target | 204 | // general its implementation is pretty much trivial, as on Win32 target |
| 205 | // just SCHED_OTHER can be supported. | 205 | // just SCHED_OTHER can be supported. |
| 206 | #undef pthread_attr_setschedpolicy | 206 | #undef pthread_attr_setschedpolicy |
| 207 | [[nodiscard]] static int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy) | 207 | [[nodiscard]] |
| 208 | static int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy) | ||
| 208 | { | 209 | { |
| 209 | if (policy != SCHED_OTHER) { | 210 | if (policy != SCHED_OTHER) { |
| 210 | return ENOTSUP; | 211 | 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 }; | |||
| 46 | // ################################################################################################# | 46 | // ################################################################################################# |
| 47 | 47 | ||
| 48 | static constexpr int kWriterReturnCode{ 666 }; | 48 | static constexpr int kWriterReturnCode{ 666 }; |
| 49 | [[nodiscard]] static int dummy_writer([[maybe_unused]] lua_State* L_, [[maybe_unused]] void const* p_, [[maybe_unused]] size_t sz_, [[maybe_unused]] void* ud_) | 49 | [[nodiscard]] |
| 50 | static int dummy_writer([[maybe_unused]] lua_State* L_, [[maybe_unused]] void const* p_, [[maybe_unused]] size_t sz_, [[maybe_unused]] void* ud_) | ||
| 50 | { | 51 | { |
| 51 | // always fail with this code | 52 | // always fail with this code |
| 52 | return kWriterReturnCode; | 53 | 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_) | |||
| 51 | /* | 51 | /* |
| 52 | * A free-running lane has ended; remove it from tracking chain | 52 | * A free-running lane has ended; remove it from tracking chain |
| 53 | */ | 53 | */ |
| 54 | [[nodiscard]] bool LaneTracker::tracking_remove(Lane* lane_) | 54 | [[nodiscard]] |
| 55 | bool LaneTracker::tracking_remove(Lane* lane_) | ||
| 55 | { | 56 | { |
| 56 | if (!isActive()) { | 57 | if (!isActive()) { |
| 57 | return false; | 58 | return false; |
| @@ -82,7 +83,8 @@ void LaneTracker::tracking_add(Lane* lane_) | |||
| 82 | 83 | ||
| 83 | // ################################################################################################ | 84 | // ################################################################################################ |
| 84 | 85 | ||
| 85 | [[nodiscard]] int LaneTracker::pushThreadsTable(lua_State* L_) const | 86 | [[nodiscard]] |
| 87 | int LaneTracker::pushThreadsTable(lua_State* L_) const | ||
| 86 | { | 88 | { |
| 87 | int const _top{ lua_gettop(L_) }; | 89 | int const _top{ lua_gettop(L_) }; |
| 88 | // List _all_ still running threads | 90 | // 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 | |||
| 119 | // ################################################################################################# | 119 | // ################################################################################################# |
| 120 | 120 | ||
| 121 | // only called from the master state | 121 | // only called from the master state |
| 122 | [[nodiscard]] Universe* Universe::Create(lua_State* const L_) | 122 | [[nodiscard]] |
| 123 | Universe* Universe::Create(lua_State* const L_) | ||
| 123 | { | 124 | { |
| 124 | LUA_ASSERT(L_, Universe::Get(L_) == nullptr); | 125 | LUA_ASSERT(L_, Universe::Get(L_) == nullptr); |
| 125 | static constexpr StackIndex kIdxSettings{ 1 }; | 126 | static constexpr StackIndex kIdxSettings{ 1 }; |
| @@ -194,7 +195,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo | |||
| 194 | // ################################################################################################# | 195 | // ################################################################################################# |
| 195 | 196 | ||
| 196 | // same as PUC-Lua l_alloc | 197 | // same as PUC-Lua l_alloc |
| 197 | [[nodiscard]] static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_) | 198 | [[nodiscard]] |
| 199 | static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_) | ||
| 198 | { | 200 | { |
| 199 | if (nsize_ == 0) { | 201 | if (nsize_ == 0) { |
| 200 | free(ptr_); | 202 | free(ptr_); |
| @@ -206,7 +208,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo | |||
| 206 | 208 | ||
| 207 | // ################################################################################################# | 209 | // ################################################################################################# |
| 208 | 210 | ||
| 209 | [[nodiscard]] static int luaG_provide_protected_allocator(lua_State* const L_) | 211 | [[nodiscard]] |
| 212 | static int luaG_provide_protected_allocator(lua_State* const L_) | ||
| 210 | { | 213 | { |
| 211 | Universe* const _U{ Universe::Get(L_) }; | 214 | Universe* const _U{ Universe::Get(L_) }; |
| 212 | // push a new full userdata on the stack, giving access to the universe's protected allocator | 215 | // push a new full userdata on the stack, giving access to the universe's protected allocator |
