diff --git a/example/calendar.cpp b/example/calendar.cpp index e91c5828..522506d8 100644 --- a/example/calendar.cpp +++ b/example/calendar.cpp @@ -29,8 +29,8 @@ constexpr auto max_weeks_in_month = 6; constexpr auto col_sep = " "; constexpr auto row_sep = ' '; -// Workaround: libc++17 does not support C++20 chrono::time_point::operator++ -#if defined _LIBCPP_VERSION and _LIBCPP_VERSION < 180000 +// Workaround: libc++18 does not support C++20 chrono::time_point::operator++ +#if defined _LIBCPP_VERSION and _LIBCPP_VERSION < 190000 namespace std::chrono { sys_days& operator++(sys_days& d) { return d += days{1}; diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 0203601b..c7b12142 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -17,10 +17,3 @@ target_sources(flux-mod PUBLIC target_link_libraries(flux-mod PRIVATE flux) target_compile_features(flux-mod PUBLIC $,cxx_std_23,cxx_std_20>) set_target_properties(flux-mod PROPERTIES CXX_EXTENSIONS Off) - -# Squish MSVC warning when building the module, hopefully we're not actually doing anything wrong -if(MSVC) - target_compile_options(flux-mod PRIVATE - /wd5244 # '#include ' in the purview of module 'flux' appears erroneous - ) -endif() \ No newline at end of file diff --git a/module/flux.cpp b/module/flux.cpp index f63737a0..0c22215c 100644 --- a/module/flux.cpp +++ b/module/flux.cpp @@ -33,4 +33,26 @@ export module flux; #define FLUX_MODULE_INTERFACE +// Silence Clang and MSVC warnings about #include inside a module's purview + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 5244) +#endif + +#ifdef __clang__ +#pragma clang diagnostic push +#if __has_warning("-Winclude-angled-in-module-purview") +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif +#endif + #include + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#ifdef _MSC_VER +#pragma warning(pop) +#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 960cabd5..7f7e58b0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -112,13 +112,6 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0") target_compile_definitions(test-flux PRIVATE -DUSE_MODULES) set_target_properties(test-flux PROPERTIES CXX_SCAN_FOR_MODULES On) - - # Squish MSVC warning when building the module, hopefully we're not actually doing anything wrong - if(MSVC) - target_compile_options(test-flux PRIVATE - /wd5244 # '#include ' in the purview of module 'flux' appears erroneous - ) - endif() endif() endif()