Skip to content

Commit

Permalink
CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Oct 25, 2024
1 parent c2b00c4 commit d25812f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,10 @@ jobs:
restore-keys: |
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-install${{ matrix.external_deps }}-${{ github.ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-install${{ matrix.external_deps }}-${{ github.base_ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-install${{ matrix.external_deps }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.sha }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.base_ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-install${{ matrix.external_deps }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}
- name: Setup ccache
Expand Down Expand Up @@ -552,7 +552,7 @@ jobs:
- "-DSCN_DISABLE_FAST_FLOAT=ON"

env:
CXX: g++-11
CXX: g++-13
CMAKE_CXX_STANDARD: 17
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
Expand All @@ -578,10 +578,10 @@ jobs:
restore-keys: |
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-flags${{ hashfiles('$GITHUB_WORKSPACE/flags.txt') }}-${{ github.ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-flags${{ hashfiles('$GITHUB_WORKSPACE/flags.txt') }}-${{ github.base_ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-flags${{ hashfiles('$GITHUB_WORKSPACE/flags.txt') }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.sha }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-${{ github.base_ref }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}-flags${{ hashfiles('$GITHUB_WORKSPACE/flags.txt') }}
ccache-${{ github.workflow }}-ubuntu22.04-${{ env.CXX }}-std${{ env.CMAKE_CXX_STANDARD }}
- name: Setup ccache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
fail-fast: false
matrix:
os: [ 14, 12 ]
cxx: [ brew-clang++, clang++, g++-13, g++-12, g++-11 ]
cxx: [ brew-clang++, clang++, g++-14, g++-13, g++-12 ]
std: [ 17 ]

include:
Expand Down
21 changes: 18 additions & 3 deletions include/scn/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,22 @@ struct year_month_day {
namespace detail {
template <typename T>
using has_tm_gmtoff_predicate = decltype(T::tm_gmtoff);

template <typename T>
void assign_gmtoff(T& tm, std::chrono::seconds val)
{
static_assert(std::is_same_v<T, std::tm>);
if constexpr (mp_valid<has_tm_gmtoff_predicate, T>::value) {
tm.tm_gmtoff = val.count();
}
else {
SCN_UNUSED(tm);
SCN_UNUSED(val);
SCN_EXPECT(false);
SCN_UNREACHABLE;
}
}
} // namespace detail

/**
* An alternative to `std::tm`,
Expand Down Expand Up @@ -303,9 +318,9 @@ struct datetime_components {
};
if constexpr (detail::mp_valid<detail::has_tm_gmtoff_predicate,
std::tm>::value) {
t.tm_gmtoff = std::chrono::duration_cast<std::chrono::seconds>(
tz_offset.value_or(std::chrono::minutes{0}))
.count();
detail::assign_gmtoff(
t, std::chrono::duration_cast<std::chrono::seconds>(
tz_offset.value_or(std::chrono::minutes{0})));
}
return t;
}
Expand Down
2 changes: 1 addition & 1 deletion include/scn/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ SCN_GCC_POP
static_cast< \
typename ::scn::detail::remove_reference<decltype(x)>::type&&>(x)
#define SCN_FWD(x) static_cast<decltype(x)&&>(x)
#define SCN_DECLVAL(T) static_cast<T (*)()>(nullptr)()
#define SCN_DECLVAL(...) static_cast<__VA_ARGS__ (*)()>(nullptr)()

#define SCN_BEGIN_NAMESPACE inline namespace v4 {
#define SCN_END_NAMESPACE }
Expand Down
9 changes: 5 additions & 4 deletions include/scn/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,11 @@ struct SCN_TRIVIAL_ABI expected_operations_base<
private:
template <typename Other>
void construct_common(Other&& other) noexcept(
noexcept(expected_storage_base<T, E>::construct(
std::forward<Other>(other).get_value())) &&
noexcept(expected_storage_base<T, E>::construct_unexpected(
std::forward<Other>(other).get_unexpected())))
noexcept(SCN_DECLVAL(expected_storage_base<T, E>)
.construct(std::forward<Other>(other).get_value())) &&
noexcept(SCN_DECLVAL(expected_storage_base<T, E>)
.construct_unexpected(
std::forward<Other>(other).get_unexpected())))
{
if (other.has_value()) {
this->construct(std::forward<Other>(other).get_value());
Expand Down
7 changes: 3 additions & 4 deletions src/scn/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,9 +2622,8 @@ struct datetime_setter<std::tm> {
std::chrono::minutes o)
{
if constexpr (mp_valid<has_tm_gmtoff_predicate, std::tm>::value) {
t.tm_gmtoff =
std::chrono::duration_cast<std::chrono::seconds>(o).count();
return st.set_tzoff(h);
assign_gmtoff(t,
std::chrono::duration_cast<std::chrono::seconds>(o));
}
else {
return h.set_error(
Expand Down Expand Up @@ -3836,7 +3835,7 @@ class tm_reader {
loc),
&std::use_facet<
typename localized_read_state::numpunct_facet_type>(loc),
{}};
std::basic_stringstream<CharT>{}};

m_loc_state->dummy_stream.imbue(m_loc_state->locale);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/localized_tests/localized_chrono_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ auto const en_locale = []() {
return std::locale("en_US.UTF-8");
}
catch (...) {
std::fputs("en_US.UTF-8 local required for scn_localized_tests",
std::fputs("en_US.UTF-8 locale required for scn_localized_tests",
stderr);
std::abort();
}
Expand All @@ -40,7 +40,7 @@ auto const fi_locale = []() {
return std::locale("fi_FI.UTF-8");
}
catch (...) {
std::fputs("fi_FI.UTF-8 local required for scn_localized_tests",
std::fputs("fi_FI.UTF-8 locale required for scn_localized_tests",
stderr);
std::abort();
}
Expand Down

0 comments on commit d25812f

Please sign in to comment.