From 80df3fc915a47087d8ae0831768b29c1171e6da2 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Thu, 12 Apr 2018 13:58:25 -0400 Subject: [PATCH] Fix #626 Fix #625 Fix #624 --- .clang-format | 2 +- .travis.yml | 2 +- CMakeLists.txt | 12 ++++++------ appveyor.yml | 2 +- cmake/Modules/Common/Core.cmake | 2 +- cmake/Modules/FindCatch.cmake | 2 +- cmake/Modules/FindKaguyaBuild.cmake | 2 +- cmake/Modules/FindLua/set_version_vars.cmake | 2 +- cmake/Modules/FindLuaBridgeBuild.cmake | 2 +- cmake/Modules/FindLuaBuild.cmake | 2 +- cmake/Modules/FindLuaBuild/LuaJIT.cmake | 2 +- cmake/Modules/FindLuaBuild/LuaVanilla.cmake | 2 +- cmake/Modules/FindLuwraBuild.cmake | 2 +- cmake/Modules/FindToLuappBuild.cmake | 2 +- cmake/sol2-config.cmake.in | 2 +- sol/feature_test.hpp | 7 +++++++ sol/load_result.hpp | 2 +- sol/protected_function.hpp | 1 + sol/proxy.hpp | 2 +- sol/stack_get.hpp | 4 ++++ sol/stack_push.hpp | 4 ++++ tests/CMakeLists.txt | 2 +- 22 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.clang-format b/.clang-format index 07ef55a7..a81f12f2 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/.travis.yml b/.travis.yml index 577ca3f0..cdbb3521 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/CMakeLists.txt b/CMakeLists.txt index 95368996..609889e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -257,11 +257,11 @@ if (DO_TESTS OR DO_EXAMPLES) # Here, we pull in all the necessary libraries for building examples and tests # Find threading library if (NOT MSVC) - if (IS_X86) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32") - set(CMAKE_EXECUTABLE_LINKER_FLAGS "${CMAKE_EXECUTABLE_LINKER_FLAGS} -m32") + if (IS_X86) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32") + set(CMAKE_EXECUTABLE_LINKER_FLAGS "${CMAKE_EXECUTABLE_LINKER_FLAGS} -m32") endif() set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE) diff --git a/appveyor.yml b/appveyor.yml index 0014685c..a4cc9ea6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/Common/Core.cmake b/cmake/Modules/Common/Core.cmake index 49483021..d50f152d 100644 --- a/cmake/Modules/Common/Core.cmake +++ b/cmake/Modules/Common/Core.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindCatch.cmake b/cmake/Modules/FindCatch.cmake index 4feb67ce..3931db11 100644 --- a/cmake/Modules/FindCatch.cmake +++ b/cmake/Modules/FindCatch.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindKaguyaBuild.cmake b/cmake/Modules/FindKaguyaBuild.cmake index d3dd370a..fd8e5e68 100644 --- a/cmake/Modules/FindKaguyaBuild.cmake +++ b/cmake/Modules/FindKaguyaBuild.cmake @@ -2,7 +2,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLua/set_version_vars.cmake b/cmake/Modules/FindLua/set_version_vars.cmake index b6790a0a..fad0fcca 100644 --- a/cmake/Modules/FindLua/set_version_vars.cmake +++ b/cmake/Modules/FindLua/set_version_vars.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLuaBridgeBuild.cmake b/cmake/Modules/FindLuaBridgeBuild.cmake index 74e863ba..75209527 100644 --- a/cmake/Modules/FindLuaBridgeBuild.cmake +++ b/cmake/Modules/FindLuaBridgeBuild.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLuaBuild.cmake b/cmake/Modules/FindLuaBuild.cmake index 201163ca..1ef99653 100644 --- a/cmake/Modules/FindLuaBuild.cmake +++ b/cmake/Modules/FindLuaBuild.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLuaBuild/LuaJIT.cmake b/cmake/Modules/FindLuaBuild/LuaJIT.cmake index f29a3a22..6584acf3 100644 --- a/cmake/Modules/FindLuaBuild/LuaJIT.cmake +++ b/cmake/Modules/FindLuaBuild/LuaJIT.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake index 3da46218..4dcb1185 100644 --- a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake +++ b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindLuwraBuild.cmake b/cmake/Modules/FindLuwraBuild.cmake index e205435c..97e13711 100644 --- a/cmake/Modules/FindLuwraBuild.cmake +++ b/cmake/Modules/FindLuwraBuild.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/Modules/FindToLuappBuild.cmake b/cmake/Modules/FindToLuappBuild.cmake index b10dcf3e..63bd581e 100644 --- a/cmake/Modules/FindToLuappBuild.cmake +++ b/cmake/Modules/FindToLuappBuild.cmake @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/cmake/sol2-config.cmake.in b/cmake/sol2-config.cmake.in index 667629fb..9c69beb4 100644 --- a/cmake/sol2-config.cmake.in +++ b/cmake/sol2-config.cmake.in @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/sol/feature_test.hpp b/sol/feature_test.hpp index 39edf3bb..faa52170 100644 --- a/sol/feature_test.hpp +++ b/sol/feature_test.hpp @@ -40,6 +40,13 @@ #define SOL_NOEXCEPT_FUNCTION_TYPE 1 #endif // noexcept is part of a function's type #endif // compiler-specific checks +#if defined(__clang__) && defined(__APPLE__) +#if __has_include && __has_include() +#define SOL_STD_VARIANT 1 +#endif // has include nonsense +#else +#define SOL_STD_VARIANT 1 +#endif // Clang screws up variant #endif // C++17 only #ifdef _MSC_VER diff --git a/sol/load_result.hpp b/sol/load_result.hpp index 272f8d70..4646c9e2 100644 --- a/sol/load_result.hpp +++ b/sol/load_result.hpp @@ -122,7 +122,7 @@ namespace sol { template decltype(auto) call(Args&&... args) { -#if defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 191326128 && _MSC_FULL_VER >= 191200000 +#if defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 191326131 && _MSC_FULL_VER >= 191200000 // MSVC is ass sometimes return get().call(std::forward(args)...); #else diff --git a/sol/protected_function.hpp b/sol/protected_function.hpp index 66c90d80..8b721db9 100644 --- a/sol/protected_function.hpp +++ b/sol/protected_function.hpp @@ -89,6 +89,7 @@ namespace sol { detail::call_exception_handler(lua_state(), maybe_ex, error); } }; + (void)onexcept; #if !defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || defined(SOL_LUAJIT) try { #endif // Safe Exception Propagation diff --git a/sol/proxy.hpp b/sol/proxy.hpp index fe937942..67ac9521 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -126,7 +126,7 @@ namespace sol { template decltype(auto) call(Args&&... args) { -#if defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 191326128 && _MSC_FULL_VER >= 191200000 +#if defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 191326131 && _MSC_FULL_VER >= 191200000 // MSVC is ass sometimes return get().call(std::forward(args)...); #else diff --git a/sol/stack_get.hpp b/sol/stack_get.hpp index 32566711..cd4b5502 100644 --- a/sol/stack_get.hpp +++ b/sol/stack_get.hpp @@ -38,7 +38,9 @@ #include #ifdef SOL_CXX17_FEATURES #include +#ifdef SOL_STD_VARIANT #include +#endif // Apple clang screwed up #endif // C++17 namespace sol { @@ -841,6 +843,7 @@ namespace stack { }; #ifdef SOL_CXX17_FEATURES +#ifdef SOL_STD_VARIANT template struct getter> { typedef std::variant V; @@ -876,6 +879,7 @@ namespace stack { return get_one(std::integral_constant(), L, index, tracking); } }; +#endif // Apple Clang screwed up #endif // C++17-wave } } // namespace sol::stack diff --git a/sol/stack_push.hpp b/sol/stack_push.hpp index 8d4d16b0..ed14dab0 100644 --- a/sol/stack_push.hpp +++ b/sol/stack_push.hpp @@ -37,7 +37,9 @@ #include #ifdef SOL_CXX17_FEATURES #include +#ifdef SOL_STD_VARIANT #include +#endif // Can use variant #endif // C++17 namespace sol { @@ -987,6 +989,7 @@ namespace stack { }; #ifdef SOL_CXX17_FEATURES +#ifdef SOL_STD_VARIANT namespace stack_detail { struct push_function { @@ -1014,6 +1017,7 @@ namespace stack { return std::visit(stack_detail::push_function(L), std::move(v)); } }; +#endif // Variant because Clang is terrible #endif // C++17 Support } } // namespace sol::stack diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bd498bad..e86426ab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ # # # # sol2 # The MIT License (MIT) # -# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors +# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in