diff --git a/include/boost/ut.hpp b/include/boost/ut.hpp index 05a1790e..dd7b655d 100644 --- a/include/boost/ut.hpp +++ b/include/boost/ut.hpp @@ -6,6 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // #if defined(__cpp_modules) && !defined(BOOST_UT_DISABLE_MODULE) +#define BOOST_UT_MODULE_MODE export module boost.ut; export import std; #define BOOST_UT_EXPORT export @@ -14,6 +15,7 @@ export import std; #define BOOST_UT_EXPORT #endif +#if !defined(BOOST_UT_MODULE_MODE) && !defined(_MSC_VER) #if __has_include() #include // and, or, not, ... #endif @@ -25,6 +27,7 @@ export import std; #undef min #undef max #endif +#endif // Before libc++ 17 had experimental support for format and it required a // special build flag. Currently libc++ has not implemented all C++20 chrono // improvements. Therefore doesn't define __cpp_lib_format, instead query the @@ -72,6 +75,7 @@ export import std; #define __has_builtin(...) __has_##__VA_ARGS__ #endif +#if !defined(BOOST_UT_MODULE_MODE) && !defined(_MSC_VER) #include #include #include @@ -97,13 +101,20 @@ export import std; #if defined(__cpp_exceptions) #include #endif - #if __has_include() #include #endif #if __has_include() #include #endif +#endif + +#if defined(BOOST_UT_MODULE_MODE) && defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable : 5244) // '#include ' in the purview of module 'boost.ut' appears erroneous. +#include +#pragma warning(pop) +#endif struct _unique_name_for_auto_detect_prefix_and_suffix_lenght_0123456789_struct { }; @@ -2749,6 +2760,9 @@ namespace terse { #pragma clang diagnostic ignored "-Wunused-comparison" #endif +// error C2294: cannot export symbol 'boost::ext::ut::vx_y_z::operators::terse::_t' because it has internal linkage +// error C2294: cannot export symbol 'boost::ext::ut::vx_y_z::operators::terse::operator %' because it has internal linkage +#if !(defined(BOOST_UT_MODULE_MODE) && defined(_MSC_VER)) [[maybe_unused]] constexpr struct { } _t; @@ -2756,6 +2770,7 @@ template constexpr auto operator%(const T& t, const decltype(_t)&) { return detail::value{t}; } +#endif template inline auto operator>>(const T& t, @@ -3289,7 +3304,7 @@ __attribute__((constructor)) inline void cmd_line_args(int argc, // For MSVC, largc/largv are initialized with __argc/__argv #endif -#if defined(_MSC_VER) +#if !defined(BOOST_UT_MODULE_MODE) && defined(_MSC_VER) #pragma pop_macro("min") #pragma pop_macro("max") #endif