Skip to content

Commit

Permalink
Global: Remove support for Lua 5.2
Browse files Browse the repository at this point in the history
It took far too much effort to keep compatible with it.  Since every distro
out there provides either Lua 5.1 or 5.3, it makes sense to give up on 5.2.
  • Loading branch information
Josef 'Jeff' Sipek committed Mar 15, 2021
1 parent 62a94d2 commit 508a7f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
4 changes: 2 additions & 2 deletions m4/want_lua.m4
Expand Up @@ -16,8 +16,8 @@ AC_DEFUN([DOVECOT_WANT_LUA],[
AS_IF([test -n "$LUA_CFLAGS" -o -n "$LUA_LIBS"], [
with_lua=yes
], [
for LUAPC in lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51 lua; do
PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1 , [
for LUAPC in lua5.3 lua-5.3 lua53 lua5.1 lua-5.1 lua51 lua; do
PKG_CHECK_MODULES([LUA], [$LUAPC >= 5.1 $LUAPC != 5.2] , [
with_lua=yes
], [LUAPC=""]) # otherwise pkg_check will fail
if test "x$LUA_LIBS" != "x"; then break; fi
Expand Down
45 changes: 0 additions & 45 deletions src/lib-lua/test-lua.c
Expand Up @@ -214,11 +214,7 @@ static void test_lua(void)
check_table_get_luainteger_ok(script, -1, -5, "small-negative-int", 0);
check_table_get_luainteger_ok(script, -1, 1ll<<48, "large-positive-int", 1);
check_table_get_luainteger_ok(script, -1, -(1ll<<48), "large-negative-int", 2);
#if LUA_VERSION_NUM != 502
check_table_get_luainteger_err(script, -1, -1, "small-float", 3);
#else
check_table_get_uintmax_ok(script, -1, 1, "small-float", 3);
#endif
check_table_get_luainteger_err(script, -1, -1, "bool-true", 4);
check_table_get_luainteger_err(script, -1, -1, "bool-false", 5);
check_table_get_luainteger_err(script, -1, -1, "str", 6);
Expand All @@ -229,11 +225,7 @@ static void test_lua(void)
check_table_get_int_ok(script, -1, -5, "small-negative-int", 0);
check_table_get_int_err(script, -1, -1, "large-positive-int", 1);
check_table_get_int_err(script, -1, -1, "large-negative-int", 2);
#if LUA_VERSION_NUM != 502
check_table_get_int_err(script, -1, -1, "small-float", 3);
#else
check_table_get_uintmax_ok(script, -1, 1, "small-float", 3);
#endif
check_table_get_int_err(script, -1, -1, "bool-true", 4);
check_table_get_int_err(script, -1, -1, "bool-false", 5);
check_table_get_int_err(script, -1, -1, "str", 6);
Expand All @@ -244,11 +236,7 @@ static void test_lua(void)
check_table_get_intmax_ok(script, -1, -5, "small-negative-int", 0);
check_table_get_intmax_ok(script, -1, 1ll<<48, "large-positive-int", 1);
check_table_get_intmax_ok(script, -1, -(1ll<<48), "large-negative-int", 2);
#if LUA_VERSION_NUM != 502
check_table_get_intmax_err(script, -1, -1, "small-float", 3);
#else
check_table_get_uintmax_ok(script, -1, 1, "small-float", 3);
#endif
check_table_get_intmax_err(script, -1, -1, "bool-true", 4);
check_table_get_intmax_err(script, -1, -1, "bool-false", 5);
check_table_get_intmax_err(script, -1, -1, "str", 6);
Expand All @@ -259,11 +247,7 @@ static void test_lua(void)
check_table_get_uint_err(script, -1, -1, "small-negative-int", 0);
check_table_get_uint_err(script, -1, -1, "large-positive-int", 1);
check_table_get_uint_err(script, -1, -1, "large-negative-int", 2);
#if LUA_VERSION_NUM != 502
check_table_get_uint_err(script, -1, -1, "small-float", 3);
#else
check_table_get_uintmax_ok(script, -1, 1, "small-float", 3);
#endif
check_table_get_uint_err(script, -1, -1, "bool-true", 4);
check_table_get_uint_err(script, -1, -1, "bool-false", 5);
check_table_get_uint_err(script, -1, -1, "str", 6);
Expand All @@ -274,11 +258,7 @@ static void test_lua(void)
check_table_get_uintmax_err(script, -1, -1, "small-negative-int", 0);
check_table_get_uintmax_ok(script, -1, 1ll<<48, "large-positive-int", 1);
check_table_get_uintmax_err(script, -1, -1, "large-negative-int", 2);
#if LUA_VERSION_NUM != 502
check_table_get_uintmax_err(script, -1, -1, "small-float", 3);
#else
check_table_get_uintmax_ok(script, -1, 1, "small-float", 3);
#endif
check_table_get_uintmax_err(script, -1, -1, "bool-true", 4);
check_table_get_uintmax_err(script, -1, -1, "bool-false", 5);
check_table_get_uintmax_err(script, -1, -1, "str", 6);
Expand Down Expand Up @@ -361,20 +341,8 @@ static void test_compat_tointegerx_and_isinteger(void)
{ "0xabcdef", 0xabcdef, 1 },
{ "0xabcdefg", 0, 0 },
{ "abc", 0, 0 },

/*
* The following tests fail with Lua 5.2, but work on 5.1 &
* 5.3. (See lua_tointegerx() comment in dlua-compat.h.)
*
* We just hack around it and provide a different set of
* expected test results for 5.2.
*/
#if LUA_VERSION_NUM != 502
{ "1.525", 0, 0 },
{ "52.51", 0, 0 },
#else
{ "52.51", 52, 1 },
#endif
};
static const struct {
lua_Number input;
Expand All @@ -386,24 +354,11 @@ static void test_compat_tointegerx_and_isinteger(void)
{ 1, 1, 1 },
{ INT_MIN, INT_MIN, 1 },
{ INT_MAX, INT_MAX, 1 },

/*
* The following tests fail with Lua 5.2, but work on 5.1 &
* 5.3. (See lua_tointegerx() comment in dlua-compat.h.)
*
* We just hack around it and provide a different set of
* expected test results for 5.2.
*/
#if LUA_VERSION_NUM != 502
{ 1.525, 0, 0 },
{ 52.51, 0, 0 },
{ NAN, 0, 0 },
{ +INFINITY, 0, 0},
{ -INFINITY, 0, 0},
#else
{ 1.525, 1, 1 },
{ 52.51, 52, 1 },
#endif
};
static const struct {
lua_Integer input;
Expand Down

0 comments on commit 508a7f7

Please sign in to comment.