Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang 18 fixes #188

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
7 changes: 0 additions & 7 deletions module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,3 @@ target_sources(flux-mod PUBLIC
target_link_libraries(flux-mod PRIVATE flux)
target_compile_features(flux-mod PUBLIC $<IF:$<CXX_COMPILER_ID:MSVC>,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 <flux.hpp>' in the purview of module 'flux' appears erroneous
)
endif()
22 changes: 22 additions & 0 deletions module/flux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flux.hpp>

#ifdef __clang__
#pragma clang diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
7 changes: 0 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <flux.hpp>' in the purview of module 'flux' appears erroneous
)
endif()
endif()
endif()

Expand Down
Loading