Skip to content

Commit

Permalink
Merge pull request #188 from tcbrindle/pr/clang18_fixes
Browse files Browse the repository at this point in the history
Clang 18 fixes
  • Loading branch information
tcbrindle authored Jun 3, 2024
2 parents 75f72ba + 18d2234 commit b1297e5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
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

0 comments on commit b1297e5

Please sign in to comment.