From b5475eb38b8b79a13a0a9e8a6cb68755b84f0c7b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 7 Mar 2023 01:39:42 +1100 Subject: Various updates, mostly around Lua: Compile Lua as C++. When Lua is compiled as C, it uses setjmp/longjmp for error handling, resulting in failure to unwind intermediate stack frames. Trying to ensure no objects with non-trivial destructors are in scope when raising a Lua error is error-prone. In particular, converting an exception to a Lua error becomes convoluted, and raising a Lua error from a constructor is effectively impossible. Updated Lua to 5.4.4 - this includes a brand-new garbage collector implementation with better performance. The main thing removed is the deprecated bitlib. Updated sol2 to version 3.3.0 - this adds support for Lua 5.4 and fixes a number of issues, including not correctly handling errors when Lua is built as C++. Updated LuaFileSystem to version 1.8.0 - this adds support for symbolic links on Windows, as well as Lua 5.4 compatibility. Updated LuaSQLite3 to version 0.9.5 - this fixes issues in multi-threaded environments, as well as Lua 5.4 compatibility. Fixed double-free after attempting to construct a debugger expression from Lua with an invalid string, and exposed expression error to Lua in a better way. Added warning level print function to Lua. Fixed saving cheats with shift operators in expressions, although this code isn't actually used as there's no cheat editor. --- scripts/src/3rdparty.lua | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'scripts/src/3rdparty.lua') diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 3ce8267723c..8e44414ec55 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -843,14 +843,9 @@ project "lua" uuid "d9e2eed1-f1ab-4737-a6ac-863700b1a5a9" kind "StaticLib" - -- uncomment the options below to - -- compile using c++. Do the same - -- in lualibs. - -- In addition comment out the "extern "C"" - -- in lua.hpp and do the same in luaengine.c line 47 - --options { - -- "ForceCPP", - --} + options { + "ForceCPP", + } configuration { "gmake or ninja" } buildoptions_c { @@ -910,7 +905,6 @@ end MAME_DIR .. "3rdparty/lua/src/lzio.c", MAME_DIR .. "3rdparty/lua/src/lauxlib.c", MAME_DIR .. "3rdparty/lua/src/lbaselib.c", - MAME_DIR .. "3rdparty/lua/src/lbitlib.c", MAME_DIR .. "3rdparty/lua/src/lcorolib.c", MAME_DIR .. "3rdparty/lua/src/ldblib.c", MAME_DIR .. "3rdparty/lua/src/liolib.c", @@ -937,6 +931,16 @@ project "lualibs" uuid "1d84edab-94cf-48fb-83ee-b75bc697660e" kind "StaticLib" + options { + "ForceCPP", + } + + configuration { "gmake or ninja" } + buildoptions { -- Lua SQLite3, Lua filesystem and Lua zlib don't cast pointers* explicitly + "-Wno-error", + "-fpermissive", + } + configuration { "vs*" } buildoptions { "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data @@ -1671,6 +1675,16 @@ project "linenoise" addprojectflags() + options { + "ForceCPP", + } + + configuration { "gmake or ninja" } + buildoptions { -- implicit pointer conversions + "-Wno-error", + "-fpermissive", + } + configuration { "vs*" } buildoptions { "/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used -- cgit v1.2.3-70-g09d2