fix multiply-declared forward declaration values

transition to CATCH2 (no changes really)
fix diagnostic printout for single.py
update ignores
update CMake to download CATCH single
update single
This commit is contained in:
ThePhD 2017-12-11 12:31:30 -05:00
parent cf81d815a9
commit c0660b454c
12 changed files with 49 additions and 50 deletions

1
.gitignore vendored
View File

@ -89,3 +89,4 @@ main_aux.cpp
main.hpp
tmp_thingy_user.lua
tmp_thingy.lua
external/

View File

@ -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)

View File

@ -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)

View File

@ -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 <typename F, F fx>
inline int c_call(lua_State* L) {
typedef meta::unqualified_t<F> Fu;
return function_detail::c_call_raw<F, fx>(std::integral_constant < bool, std::is_same<Fu, lua_CFunction>::value
typedef std::integral_constant<bool, std::is_same<Fu, lua_CFunction>::value
#ifdef SOL_NOEXCEPT_FUNCTION_TYPE
|| std::is_same<Fu, detail::lua_CFunction_noexcept>::value
#endif
> (),
L);
> is_raw;
return function_detail::c_call_raw<F, fx>(is_raw(), L);
}
template <typename F, F f>

View File

@ -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 {

View File

@ -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

View File

@ -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 {
}

View File

@ -117,12 +117,12 @@ namespace sol {
template <typename F, F fx>
inline int c_call(lua_State* L) {
typedef meta::unqualified_t<F> Fu;
return function_detail::c_call_raw<F, fx>(std::integral_constant < bool, std::is_same<Fu, lua_CFunction>::value
typedef std::integral_constant<bool, std::is_same<Fu, lua_CFunction>::value
#ifdef SOL_NOEXCEPT_FUNCTION_TYPE
|| std::is_same<Fu, detail::lua_CFunction_noexcept>::value
#endif
> (),
L);
> is_raw;
return function_detail::c_call_raw<F, fx>(is_raw(), L);
}
template <typename F, F f>

View File

@ -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

View File

@ -9,6 +9,7 @@
#include <list>
#include <vector>
#include <memory>
#include <set>
TEST_CASE("gc/destructors", "test if destructors are fired properly through gc of unbound usertypes") {
struct test;

View File

@ -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;

View File

@ -1,4 +1,4 @@
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_MAIN 1
#define SOL_CHECK_ARGUMENTS 1
#define SOL_ENABLE_INTEROP 1