diff --git a/.github/workflows/buildAndTest-Linux.yml b/.github/workflows/buildAndTest-Linux.yml index 8969603..4ea031e 100644 --- a/.github/workflows/buildAndTest-Linux.yml +++ b/.github/workflows/buildAndTest-Linux.yml @@ -11,6 +11,7 @@ jobs: lua: [ "luajit libluajit-5.1-dev libluajit-5.1-2", + "liblua5.4-dev lua5.4", "liblua5.3-dev lua5.3", "liblua5.2-dev lua5.2", "liblua5.1-0-dev lua5.1", diff --git a/.github/workflows/buildAndTest-MacOS.yml b/.github/workflows/buildAndTest-MacOS.yml index e780d42..79bbfab 100644 --- a/.github/workflows/buildAndTest-MacOS.yml +++ b/.github/workflows/buildAndTest-MacOS.yml @@ -8,13 +8,24 @@ jobs: strategy: matrix: lua: ["lua", "luajit"] + compiler: ["gcc", "clang"] steps: - uses: "actions/checkout@v4" - name: "Install Dependencies" run: | brew install ${{ matrix.lua }} luarocks + + if [[ "${{ matrix.compiler }}" = "gcc" ]]; then + brew install gcc + luarocks config "variables.CMAKE_C_COMPILER" "$(brew --prefix)/bin/gcc-13" + luarocks config "variables.CMAKE_CXX_COMPILER" "$(brew --prefix)/bin/g++-13" + fi + luarocks install luaunit - name: "Build Project" - run: "luarocks make" + run: | + export CXX_COMPILER="$(brew --prefix)/bin/g++-13" + export C_COMPILER="$(brew --prefix)/bin/gcc-13" + CXX="$CXX_COMPILER" CC="$C_COMPILER" luarocks make - name: "Test Project" run: "lua tests/tests.lua" diff --git a/.gitignore b/.gitignore index bc04c27..2e30dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Brewfile.lock.json .vscode/ .nova/ .vim/ +node_modules # Test files test.lua diff --git a/src/decoding/decoding.cpp b/src/decoding/decoding.cpp index 39fdaa0..f08201e 100644 --- a/src/decoding/decoding.cpp +++ b/src/decoding/decoding.cpp @@ -12,7 +12,9 @@ void insertNodeInTable( auto v = std::string(*node->as_string()); try { luaTable[std::get(keyOrIndex)] = v; - } catch (std::bad_variant_access) { luaTable[std::get(keyOrIndex)] = v; } + } catch (std::bad_variant_access const &) { + luaTable[std::get(keyOrIndex)] = v; + } break; } @@ -24,7 +26,7 @@ void insertNodeInTable( } else { luaTable[std::get(keyOrIndex)] = v.get(); } - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { if (options.formattedIntsAsUserData && v.flags() != toml::value_flags::none) { luaTable[std::get(keyOrIndex)] = TOMLInt(v, v.flags()); } else { @@ -40,7 +42,9 @@ void insertNodeInTable( try { luaTable[std::get(keyOrIndex)] = v; - } catch (std::bad_variant_access) { luaTable[std::get(keyOrIndex)] = v; } + } catch (std::bad_variant_access const &) { + luaTable[std::get(keyOrIndex)] = v; + } break; } @@ -50,7 +54,9 @@ void insertNodeInTable( try { luaTable[std::get(keyOrIndex)] = v; - } catch (std::bad_variant_access) { luaTable[std::get(keyOrIndex)] = v; } + } catch (std::bad_variant_access const &) { + luaTable[std::get(keyOrIndex)] = v; + } break; } @@ -63,7 +69,7 @@ void insertNodeInTable( try { luaTable[std::get(keyOrIndex)] = newLTable; - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { luaTable[std::get(keyOrIndex)] = newLTable; } @@ -78,7 +84,7 @@ void insertNodeInTable( try { luaTable[std::get(keyOrIndex)] = newLTable; - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { luaTable[std::get(keyOrIndex)] = newLTable; } @@ -95,7 +101,7 @@ void insertNodeInTable( v.toTable(t); luaTable[std::get(keyOrIndex)] = t; } - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { if (options.temporalTypesAsUserData) { luaTable[std::get(keyOrIndex)] = v; } else { @@ -118,7 +124,7 @@ void insertNodeInTable( v.toTable(t); luaTable[std::get(keyOrIndex)] = t; } - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { if (options.temporalTypesAsUserData) { luaTable[std::get(keyOrIndex)] = v; } else { @@ -145,7 +151,7 @@ void insertNodeInTable( dt.toTable(t); luaTable[std::get(keyOrIndex)] = t; } - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { if (options.temporalTypesAsUserData) { luaTable[std::get(keyOrIndex)] = dt; } else { diff --git a/src/encoding/encoding.cpp b/src/encoding/encoding.cpp index 7b2cb58..d5c74fb 100644 --- a/src/encoding/encoding.cpp +++ b/src/encoding/encoding.cpp @@ -15,7 +15,7 @@ void unpack( try { auto t = std::get>(tableOrArray); tableFunc(std::get<0>(t), std::get<1>(t)); - } catch (std::bad_variant_access) { + } catch (std::bad_variant_access const &) { auto a = std::get(tableOrArray); arrayFunc(a); } diff --git a/src/toml.cpp b/src/toml.cpp index 9a09740..7d1678e 100644 --- a/src/toml.cpp +++ b/src/toml.cpp @@ -157,7 +157,7 @@ extern "C" { tomlToLuaTable(tomlTable, luaTable, options); return luaTable.push(); - } catch (std::bad_variant_access) { return std::get(res); } + } catch (std::bad_variant_access const &) { return std::get(res); } } catch (std::exception & e) { return luaL_error( L, (std::string("An error occurred during decoding: ") + e.what()).c_str());