mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fold string literals better by moving them inside
- Partially addresses #1094 - Fix a warning for unreachable code (I still don't like this part of if constexpr) - Update single
This commit is contained in:
parent
b9115623b2
commit
f7d99b05a5
|
@ -105,7 +105,8 @@ static void compat53_call_lua(lua_State* L, char const code[], size_t len, int n
|
|||
}
|
||||
|
||||
|
||||
static const char compat53_arith_code[]
|
||||
COMPAT53_API void lua_arith(lua_State* L, int op) {
|
||||
static const char compat53_arith_code[]
|
||||
= "local op,a,b=...\n"
|
||||
"if op==0 then return a+b\n"
|
||||
"elseif op==1 then return a-b\n"
|
||||
|
@ -116,7 +117,6 @@ static const char compat53_arith_code[]
|
|||
"elseif op==6 then return -a\n"
|
||||
"end\n";
|
||||
|
||||
COMPAT53_API void lua_arith(lua_State* L, int op) {
|
||||
if (op < LUA_OPADD || op > LUA_OPUNM)
|
||||
luaL_error(L, "invalid 'op' argument for lua_arith");
|
||||
luaL_checkstack(L, 5, "not enough stack slots");
|
||||
|
@ -128,11 +128,11 @@ COMPAT53_API void lua_arith(lua_State* L, int op) {
|
|||
}
|
||||
|
||||
|
||||
static const char compat53_compare_code[]
|
||||
COMPAT53_API int lua_compare(lua_State* L, int idx1, int idx2, int op) {
|
||||
static const char compat53_compare_code[]
|
||||
= "local a,b=...\n"
|
||||
"return a<=b\n";
|
||||
|
||||
COMPAT53_API int lua_compare(lua_State* L, int idx1, int idx2, int op) {
|
||||
int result = 0;
|
||||
switch (op) {
|
||||
case LUA_OPEQ:
|
||||
|
|
|
@ -33,11 +33,13 @@
|
|||
|
||||
#if SOL_IS_ON(SOL_COMPILER_GCC_I_)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#if __GNUC__ > 6
|
||||
#pragma GCC diagnostic ignored "-Wnoexcept-type"
|
||||
#endif
|
||||
#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_)
|
||||
#pragma clang diagnostic push
|
||||
// we'll just let this alone for now
|
||||
#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS
|
||||
|
@ -64,8 +66,6 @@
|
|||
|
||||
#if SOL_IS_ON(SOL_COMPILER_GCC_I_)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_)
|
||||
#pragma clang diagnostic pop
|
||||
#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||
#pragma warning(pop)
|
||||
#endif // g++
|
||||
|
|
|
@ -376,10 +376,7 @@ namespace sol { namespace u_detail {
|
|||
"The size of this data pointer is too small to fit the inheritance checking function: Please file "
|
||||
"a bug report.");
|
||||
static_assert(!meta::any_same<T, Bases...>::value, "base classes cannot list the original class as part of the bases");
|
||||
if constexpr (sizeof...(Bases) < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if constexpr (sizeof...(Bases) > 0) {
|
||||
(void)detail::swallow { 0, ((weak_derive<Bases>::value = true), 0)... };
|
||||
|
||||
void* derived_this = static_cast<void*>(static_cast<usertype_storage<T>*>(this));
|
||||
|
@ -397,6 +394,7 @@ namespace sol { namespace u_detail {
|
|||
for_each_fx.p_derived_usb = derived_this;
|
||||
this->for_each_table(L, for_each_fx);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
if (value_index_table.valid()) {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-12-30 02:46:25.191859 UTC
|
||||
// This header was generated with sol v3.2.3 (revision 6a77d5cf)
|
||||
// Generated 2020-12-30 02:56:57.400161 UTC
|
||||
// This header was generated with sol v3.2.3 (revision b9115623)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_CONFIG_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-12-30 02:46:25.077859 UTC
|
||||
// This header was generated with sol v3.2.3 (revision 6a77d5cf)
|
||||
// Generated 2020-12-30 02:56:57.318161 UTC
|
||||
// This header was generated with sol v3.2.3 (revision b9115623)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// This file was generated with a script.
|
||||
// Generated 2020-12-30 02:46:21.039049 UTC
|
||||
// This header was generated with sol v3.2.3 (revision 6a77d5cf)
|
||||
// Generated 2020-12-30 02:56:53.623397 UTC
|
||||
// This header was generated with sol v3.2.3 (revision b9115623)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -681,11 +681,12 @@
|
|||
|
||||
#if SOL_IS_ON(SOL_COMPILER_GCC_I_)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#if __GNUC__ > 6
|
||||
#pragma GCC diagnostic ignored "-Wnoexcept-type"
|
||||
#endif
|
||||
#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_)
|
||||
#pragma clang diagnostic push
|
||||
#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS
|
||||
|
@ -3102,7 +3103,8 @@ static void compat53_call_lua(lua_State* L, char const code[], size_t len, int n
|
|||
lua_call(L, nargs, nret);
|
||||
}
|
||||
|
||||
static const char compat53_arith_code[]
|
||||
COMPAT53_API void lua_arith(lua_State* L, int op) {
|
||||
static const char compat53_arith_code[]
|
||||
= "local op,a,b=...\n"
|
||||
"if op==0 then return a+b\n"
|
||||
"elseif op==1 then return a-b\n"
|
||||
|
@ -3113,7 +3115,6 @@ static const char compat53_arith_code[]
|
|||
"elseif op==6 then return -a\n"
|
||||
"end\n";
|
||||
|
||||
COMPAT53_API void lua_arith(lua_State* L, int op) {
|
||||
if (op < LUA_OPADD || op > LUA_OPUNM)
|
||||
luaL_error(L, "invalid 'op' argument for lua_arith");
|
||||
luaL_checkstack(L, 5, "not enough stack slots");
|
||||
|
@ -3124,11 +3125,11 @@ COMPAT53_API void lua_arith(lua_State* L, int op) {
|
|||
compat53_call_lua(L, compat53_arith_code, sizeof(compat53_arith_code) - 1, 3, 1);
|
||||
}
|
||||
|
||||
static const char compat53_compare_code[]
|
||||
COMPAT53_API int lua_compare(lua_State* L, int idx1, int idx2, int op) {
|
||||
static const char compat53_compare_code[]
|
||||
= "local a,b=...\n"
|
||||
"return a<=b\n";
|
||||
|
||||
COMPAT53_API int lua_compare(lua_State* L, int idx1, int idx2, int op) {
|
||||
int result = 0;
|
||||
switch (op) {
|
||||
case LUA_OPEQ:
|
||||
|
@ -22345,10 +22346,7 @@ namespace sol { namespace u_detail {
|
|||
"The size of this data pointer is too small to fit the inheritance checking function: Please file "
|
||||
"a bug report.");
|
||||
static_assert(!meta::any_same<T, Bases...>::value, "base classes cannot list the original class as part of the bases");
|
||||
if constexpr (sizeof...(Bases) < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if constexpr (sizeof...(Bases) > 0) {
|
||||
(void)detail::swallow { 0, ((weak_derive<Bases>::value = true), 0)... };
|
||||
|
||||
void* derived_this = static_cast<void*>(static_cast<usertype_storage<T>*>(this));
|
||||
|
@ -22366,6 +22364,7 @@ namespace sol { namespace u_detail {
|
|||
for_each_fx.p_derived_usb = derived_this;
|
||||
this->for_each_table(L, for_each_fx);
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
if (value_index_table.valid()) {
|
||||
|
@ -26946,8 +26945,6 @@ namespace sol {
|
|||
|
||||
#if SOL_IS_ON(SOL_COMPILER_GCC_I_)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif SOL_IS_ON(SOL_COMPILER_CLANG_I_)
|
||||
#pragma clang diagnostic pop
|
||||
#elif SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||
#pragma warning(pop)
|
||||
#endif // g++
|
||||
|
|
Loading…
Reference in New Issue
Block a user