Compile fix for std::variant detection on Apple clang 9.1.0 (Xcode 9.3) (#628)

* Compile fix for std::variant detection on Apple clang 9.1.0 (Xcode 9.3)

* Update single

* Consistently check SOL_CXX17_FEATURES, SOL_STD_VARIANT

* Update single
This commit is contained in:
hzwar 2018-04-13 20:46:05 +02:00 committed by The Phantom Derpstorm
parent 6e970f35ac
commit 2de6447e73
7 changed files with 21804 additions and 21778 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2018-04-12 18:01:15.071442 UTC // Generated 2018-04-13 18:36:16.622867 UTC
// This header was generated with sol v2.19.5 (revision 80df3fc) // This header was generated with sol v2.19.5 (revision d9aef04)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -77,9 +77,11 @@
#endif // noexcept is part of a function's type #endif // noexcept is part of a function's type
#endif // compiler-specific checks #endif // compiler-specific checks
#if defined(__clang__) && defined(__APPLE__) #if defined(__clang__) && defined(__APPLE__)
#if __has_include && __has_include(<variant>) #if defined(__has_include)
#if __has_include(<variant>)
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // has include nonsense #endif // has include nonsense
#endif // __has_include
#else #else
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // Clang screws up variant #endif // Clang screws up variant
@ -4522,7 +4524,9 @@ namespace sol {
// end of sol/filters.hpp // end of sol/filters.hpp
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
#include <variant> #include <variant>
#endif
#endif // C++17 #endif // C++17
#ifdef SOL_USE_BOOST #ifdef SOL_USE_BOOST
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
@ -5464,9 +5468,11 @@ namespace sol {
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {}; struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {};
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn> template <typename... Tn>
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {}; struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {};
#endif // C++ 17 (or not) features #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
template <typename T> template <typename T>
struct lua_type_of<nested<T>, std::enable_if_t<::sol::is_container<T>::value>> : std::integral_constant<type, type::table> {}; struct lua_type_of<nested<T>, std::enable_if_t<::sol::is_container<T>::value>> : std::integral_constant<type, type::table> {};
@ -7833,7 +7839,9 @@ namespace sol {
#include <cmath> #include <cmath>
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#endif // C++17 #ifdef SOL_STD_VARIANT
#endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
namespace sol { namespace sol {
namespace stack { namespace stack {
@ -8376,6 +8384,7 @@ namespace stack {
}; };
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn, typename C> template <typename... Tn, typename C>
struct checker<std::variant<Tn...>, type::poly, C> { struct checker<std::variant<Tn...>, type::poly, C> {
typedef std::variant<Tn...> V; typedef std::variant<Tn...> V;
@ -8406,7 +8415,8 @@ namespace stack {
return is_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking); return is_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking);
} }
}; };
#endif // C++17 #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack
@ -9585,8 +9595,8 @@ namespace stack {
return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, tracking); return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, tracking);
} }
}; };
#endif // Apple Clang screwed up #endif // SOL_STD_VARIANT
#endif // C++17-wave #endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack
@ -9708,6 +9718,7 @@ namespace stack {
}; };
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn> template <typename... Tn>
struct check_getter<std::variant<Tn...>> { struct check_getter<std::variant<Tn...>> {
typedef std::variant<Tn...> V; typedef std::variant<Tn...> V;
@ -9747,7 +9758,8 @@ namespace stack {
return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking); return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking);
} }
}; };
#endif // C++17 #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2018-04-12 18:01:15.385481 UTC // Generated 2018-04-13 18:36:16.720493 UTC
// This header was generated with sol v2.19.5 (revision 80df3fc) // This header was generated with sol v2.19.5 (revision d9aef04)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
@ -44,9 +44,11 @@
#endif // noexcept is part of a function's type #endif // noexcept is part of a function's type
#endif // compiler-specific checks #endif // compiler-specific checks
#if defined(__clang__) && defined(__APPLE__) #if defined(__clang__) && defined(__APPLE__)
#if __has_include && __has_include(<variant>) #if defined(__has_include)
#if __has_include(<variant>)
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // has include nonsense #endif // has include nonsense
#endif // __has_include
#else #else
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // Clang screws up variant #endif // Clang screws up variant

View File

@ -41,9 +41,11 @@
#endif // noexcept is part of a function's type #endif // noexcept is part of a function's type
#endif // compiler-specific checks #endif // compiler-specific checks
#if defined(__clang__) && defined(__APPLE__) #if defined(__clang__) && defined(__APPLE__)
#if __has_include && __has_include(<variant>) #if defined(__has_include)
#if __has_include(<variant>)
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // has include nonsense #endif // has include nonsense
#endif // __has_include
#else #else
#define SOL_STD_VARIANT 1 #define SOL_STD_VARIANT 1
#endif // Clang screws up variant #endif // Clang screws up variant

View File

@ -32,8 +32,10 @@
#include <utility> #include <utility>
#include <cmath> #include <cmath>
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
#include <variant> #include <variant>
#endif // C++17 #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
namespace sol { namespace sol {
namespace stack { namespace stack {
@ -576,6 +578,7 @@ namespace stack {
}; };
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn, typename C> template <typename... Tn, typename C>
struct checker<std::variant<Tn...>, type::poly, C> { struct checker<std::variant<Tn...>, type::poly, C> {
typedef std::variant<Tn...> V; typedef std::variant<Tn...> V;
@ -606,7 +609,8 @@ namespace stack {
return is_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking); return is_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking);
} }
}; };
#endif // C++17 #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack

View File

@ -145,6 +145,7 @@ namespace stack {
}; };
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn> template <typename... Tn>
struct check_getter<std::variant<Tn...>> { struct check_getter<std::variant<Tn...>> {
typedef std::variant<Tn...> V; typedef std::variant<Tn...> V;
@ -184,7 +185,8 @@ namespace stack {
return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking); return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, std::forward<Handler>(handler), tracking);
} }
}; };
#endif // C++17 #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack

View File

@ -879,8 +879,8 @@ namespace stack {
return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, tracking); return get_one(std::integral_constant<std::size_t, V_size::value>(), L, index, tracking);
} }
}; };
#endif // Apple Clang screwed up #endif // SOL_STD_VARIANT
#endif // C++17-wave #endif // SOL_CXX17_FEATURES
} }
} // namespace sol::stack } // namespace sol::stack

View File

@ -39,7 +39,9 @@
#include <string> #include <string>
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#include <string_view> #include <string_view>
#ifdef SOL_STD_VARIANT
#include <variant> #include <variant>
#endif
#endif // C++17 #endif // C++17
#ifdef SOL_USE_BOOST #ifdef SOL_USE_BOOST
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
@ -981,9 +983,11 @@ namespace sol {
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {}; struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {};
#ifdef SOL_CXX17_FEATURES #ifdef SOL_CXX17_FEATURES
#ifdef SOL_STD_VARIANT
template <typename... Tn> template <typename... Tn>
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {}; struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {};
#endif // C++ 17 (or not) features #endif // SOL_STD_VARIANT
#endif // SOL_CXX17_FEATURES
template <typename T> template <typename T>
struct lua_type_of<nested<T>, std::enable_if_t<::sol::is_container<T>::value>> : std::integral_constant<type, type::table> {}; struct lua_type_of<nested<T>, std::enable_if_t<::sol::is_container<T>::value>> : std::integral_constant<type, type::table> {};