From 53236cf0472b5093195bcc128dec6b45a6fe1446 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 28 Oct 2024 17:38:36 +0100 Subject: Renamed luaerrors.h → luaerrors.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/debug.h | 2 +- src/luaerrors.h | 44 -------------------------------------------- src/luaerrors.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/macros_and_utils.h | 2 +- 4 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 src/luaerrors.h create mode 100644 src/luaerrors.hpp (limited to 'src') diff --git a/src/debug.h b/src/debug.h index 9b7137b..7c7f497 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,7 +1,7 @@ #pragma once #include "lanesconf.h" -#include "luaerrors.h" +#include "luaerrors.hpp" #include "unique.hpp" // ################################################################################################# diff --git a/src/luaerrors.h b/src/luaerrors.h deleted file mode 100644 index ef32c60..0000000 --- a/src/luaerrors.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include "stackindex.hpp" - -// ################################################################################################# - -// use this instead of Lua's lua_error -[[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 -} - -// ################################################################################################# - -// 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_) -{ - std::ignore = luaL_error(L_, fmt_.data(), std::forward(args_)...); // doesn't return - assert(false); // we should never get here, but i'm paranoid -} - -// ################################################################################################# - -// 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_) -{ - std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return - assert(false); // we should never get here, but i'm paranoid -} - -// ################################################################################################# - -#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_) -{ - std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return - assert(false); // we should never get here, but i'm paranoid -} -#endif // LUA_VERSION_NUM diff --git a/src/luaerrors.hpp b/src/luaerrors.hpp new file mode 100644 index 0000000..ef32c60 --- /dev/null +++ b/src/luaerrors.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include "stackindex.hpp" + +// ################################################################################################# + +// use this instead of Lua's lua_error +[[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 +} + +// ################################################################################################# + +// 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_) +{ + std::ignore = luaL_error(L_, fmt_.data(), std::forward(args_)...); // doesn't return + assert(false); // we should never get here, but i'm paranoid +} + +// ################################################################################################# + +// 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_) +{ + std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return + assert(false); // we should never get here, but i'm paranoid +} + +// ################################################################################################# + +#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_) +{ + std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return + assert(false); // we should never get here, but i'm paranoid +} +#endif // LUA_VERSION_NUM diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h index f22d124..4a84483 100644 --- a/src/macros_and_utils.h +++ b/src/macros_and_utils.h @@ -1,7 +1,7 @@ #pragma once #include "debug.h" -#include "luaerrors.h" +#include "luaerrors.hpp" #include "unique.hpp" using namespace std::chrono_literals; -- cgit v1.2.3-55-g6feb