diff --git a/.gitignore b/.gitignore index a4f37ddb..2751aa28 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,4 @@ main_aux.cpp main.hpp tmp_thingy_user.lua tmp_thingy.lua +external/ diff --git a/CMakeLists.txt b/CMakeLists.txt index bc946755..d237ad22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,11 +77,16 @@ if (EXAMPLES) endif() if (TESTS) + # Catch now has a single header: pull it in directly using CMake's download + # catch requires C++ files when built out of its tree now, so we cannot 'just get the git repository' anymore + # which sort of sucks, but MEH + # this is easiest for now + file(download https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp ${CMAKE_BINARY_DIR}/Catch/include/catch.hpp) file(GLOB TEST_SRC tests/test*.cpp) source_group(tests FILES ${TEST_SRC}) add_executable(tests ${TEST_SRC} ${HEADER_SRCS}) - target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR}/Catch/include/) + target_include_directories(tests PRIVATE ${CMAKE_BINARY_DIR}/Catch/include/) add_test(Tests tests) find_package(Threads) diff --git a/single.py b/single.py index 56be98bd..0fda4916 100644 --- a/single.py +++ b/single.py @@ -197,5 +197,5 @@ with open(single_file, 'w', encoding='utf-8') as f: with open(forward_single_file, 'w', encoding='utf-8') as f: if not args.quiet: - print('writing {}...'.format(single_file)) + print('writing {}...'.format(forward_single_file)) f.write(forward_result) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index b2db59b3..ba6f7b9f 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.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 2017-12-10 20:56:35.224200 UTC -// This header was generated with sol v2.19.0 (revision c3c7f42) +// Generated 2017-12-11 17:29:42.822392 UTC +// This header was generated with sol v2.19.0 (revision cf81d81) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -72,6 +72,7 @@ #if defined(__cpp_noexcept_function_type) || ((defined(_MSC_VER) && _MSC_VER > 1911) && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))) #ifndef SOL_NOEXCEPT_FUNCTION_TYPE +#define SOL_NOEXCEPT_FUNCTION_TYPE 1 #endif // noexcept is part of a function's type #endif @@ -186,17 +187,6 @@ #endif #endif // avoiding nil defines / keywords -namespace sol { -namespace detail { - const bool default_safe_function_calls = -#ifdef SOL_SAFE_FUNCTION_CALLS - true; -#else - false; -#endif -} -} // namespace sol::detail - // end of sol/feature_test.hpp namespace sol { @@ -4108,6 +4098,15 @@ namespace sol { // beginning of sol/forward_detail.hpp namespace sol { + namespace detail { + const bool default_safe_function_calls = +#ifdef SOL_SAFE_FUNCTION_CALLS + true; +#else + false; +#endif + } // namespace detail + namespace meta { namespace meta_detail { } @@ -4425,6 +4424,8 @@ namespace sol { namespace detail { #ifdef SOL_NOEXCEPT_FUNCTION_TYPE typedef int (*lua_CFunction_noexcept)(lua_State* L) noexcept; +#else + typedef int(*lua_CFunction_noexcept)(lua_State* L); #endif // noexcept function type for lua_CFunction #ifdef SOL_NO_EXCEPTIONS @@ -12540,12 +12541,12 @@ namespace sol { template inline int c_call(lua_State* L) { typedef meta::unqualified_t Fu; - return function_detail::c_call_raw(std::integral_constant < bool, std::is_same::value + typedef std::integral_constant::value #ifdef SOL_NOEXCEPT_FUNCTION_TYPE - || std::is_same::value + || std::is_same::value #endif - > (), - L); + > is_raw; + return function_detail::c_call_raw(is_raw(), L); } template diff --git a/single/sol/sol_forward.hpp b/single/sol/sol_forward.hpp index 31a37724..438d5130 100644 --- a/single/sol/sol_forward.hpp +++ b/single/sol/sol_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 2017-12-10 20:56:35.410742 UTC -// This header was generated with sol v2.19.0 (revision c3c7f42) +// Generated 2017-12-11 17:29:42.995868 UTC +// This header was generated with sol v2.19.0 (revision cf81d81) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP @@ -39,6 +39,7 @@ #if defined(__cpp_noexcept_function_type) || ((defined(_MSC_VER) && _MSC_VER > 1911) && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))) #ifndef SOL_NOEXCEPT_FUNCTION_TYPE +#define SOL_NOEXCEPT_FUNCTION_TYPE 1 #endif // noexcept is part of a function's type #endif @@ -153,17 +154,6 @@ #endif #endif // avoiding nil defines / keywords -namespace sol { -namespace detail { - const bool default_safe_function_calls = -#ifdef SOL_SAFE_FUNCTION_CALLS - true; -#else - false; -#endif -} -} // namespace sol::detail - // end of sol/feature_test.hpp namespace sol { diff --git a/sol/feature_test.hpp b/sol/feature_test.hpp index 78118c74..ca98235f 100644 --- a/sol/feature_test.hpp +++ b/sol/feature_test.hpp @@ -30,7 +30,7 @@ #if defined(__cpp_noexcept_function_type) || ((defined(_MSC_VER) && _MSC_VER > 1911) && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))) #ifndef SOL_NOEXCEPT_FUNCTION_TYPE -//#define SOL_NOEXCEPT_FUNCTION_TYPE 1 +#define SOL_NOEXCEPT_FUNCTION_TYPE 1 #endif // noexcept is part of a function's type #endif @@ -173,15 +173,4 @@ #endif #endif // avoiding nil defines / keywords -namespace sol { -namespace detail { - const bool default_safe_function_calls = -#ifdef SOL_SAFE_FUNCTION_CALLS - true; -#else - false; -#endif -} -} // namespace sol::detail - #endif // SOL_FEATURE_TEST_HPP diff --git a/sol/forward_detail.hpp b/sol/forward_detail.hpp index cbeb1e51..e36c9c35 100644 --- a/sol/forward_detail.hpp +++ b/sol/forward_detail.hpp @@ -27,6 +27,16 @@ #include "traits.hpp" namespace sol { + namespace detail { + const bool default_safe_function_calls = +#ifdef SOL_SAFE_FUNCTION_CALLS + true; +#else + false; +#endif + } // namespace detail + + namespace meta { namespace meta_detail { } diff --git a/sol/function_types_templated.hpp b/sol/function_types_templated.hpp index e86c0c5e..2d348306 100644 --- a/sol/function_types_templated.hpp +++ b/sol/function_types_templated.hpp @@ -117,12 +117,12 @@ namespace sol { template inline int c_call(lua_State* L) { typedef meta::unqualified_t Fu; - return function_detail::c_call_raw(std::integral_constant < bool, std::is_same::value + typedef std::integral_constant::value #ifdef SOL_NOEXCEPT_FUNCTION_TYPE - || std::is_same::value + || std::is_same::value #endif - > (), - L); + > is_raw; + return function_detail::c_call_raw(is_raw(), L); } template diff --git a/sol/types.hpp b/sol/types.hpp index e94ce944..be6acebc 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -44,6 +44,8 @@ namespace sol { namespace detail { #ifdef SOL_NOEXCEPT_FUNCTION_TYPE typedef int (*lua_CFunction_noexcept)(lua_State* L) noexcept; +#else + typedef int(*lua_CFunction_noexcept)(lua_State* L); #endif // noexcept function type for lua_CFunction #ifdef SOL_NO_EXCEPTIONS diff --git a/tests/test_gc.cpp b/tests/test_gc.cpp index a2b3502a..6d1bc063 100644 --- a/tests/test_gc.cpp +++ b/tests/test_gc.cpp @@ -9,6 +9,7 @@ #include #include #include +#include TEST_CASE("gc/destructors", "test if destructors are fired properly through gc of unbound usertypes") { struct test; diff --git a/tests/test_usertypes.cpp b/tests/test_usertypes.cpp index 30230106..83dd3e33 100644 --- a/tests/test_usertypes.cpp +++ b/tests/test_usertypes.cpp @@ -1801,7 +1801,7 @@ TEST_CASE("usertype/meta-key-retrievals", "allow for special meta keys (__index, } } -TEST_CASE("usertype/noexcept-methods", "make sure noexcept functinos and methods can be bound to usertypes without issues") { +TEST_CASE("usertype/noexcept-methods", "make sure noexcept functions and methods can be bound to usertypes without issues") { struct T { static int noexcept_function() noexcept { return 0x61; diff --git a/tests/tests.cpp b/tests/tests.cpp index cd0857c2..b150bdfb 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -1,4 +1,4 @@ -#define CATCH_CONFIG_MAIN +#define CATCH_CONFIG_MAIN 1 #define SOL_CHECK_ARGUMENTS 1 #define SOL_ENABLE_INTEROP 1