Skip to content

Commit

Permalink
Fix ClangCL and MinGW builds in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Jan 7, 2024
1 parent c83764c commit b5bb60f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ jobs:
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \
-DSCN_DISABLE_TOP_PROJECT=ON -DSCN_PEDANTIC=ON -DSCN_WERROR=OFF -DSCN_TESTS=ON ..
-DSCN_DISABLE_TOP_PROJECT=ON -DSCN_PEDANTIC=ON -DSCN_TESTS=ON -DSCN_EXAMPLES=ON ..
cmake --build . --parallel -- -k 0
ctest --output-on-failure
2 changes: 1 addition & 1 deletion include/scn/detail/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ namespace scn {
SCN_EXPECT(arg && pctx && ctx);

using context_type = Context;
using char_type = typename context_type::char_type;
using parse_context_type =
typename context_type::parse_context_type;
using scanner_type =
Expand All @@ -210,6 +209,7 @@ namespace scn {
auto& ctx_ref = *static_cast<context_type*>(ctx);

SCN_TRY_ERR(_, s.parse(pctx_ref));
SCN_UNUSED(_);
SCN_TRY_ERR(it, s.scan(arg_ref, ctx_ref));
ctx_ref.advance_to(SCN_MOVE(it));

Expand Down
1 change: 1 addition & 0 deletions include/scn/detail/scanner_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ namespace scn {
SCN_TRY(it, detail::scan_str(ctx.range(), this->m_opening_bracket));
ctx.advance_to(it);
SCN_TRY(_, scan_for_each(value, ctx));
SCN_UNUSED(_);
return detail::scan_str(ctx.range(), this->m_closing_bracket);
}

Expand Down
10 changes: 7 additions & 3 deletions src/scn/impl/reader/regex_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace scn {
return result;
}
#elif SCN_REGEX_BACKEND == SCN_REGEX_BACKEND_RE2
auto make_regex_flags(detail::regex_flags flags)
inline auto make_regex_flags(detail::regex_flags flags)
-> std::pair<RE2::Options, std::string_view>
{
RE2::Options opt{RE2::Quiet};
Expand Down Expand Up @@ -235,7 +235,9 @@ namespace scn {
"Failed to parse regular expression");
}

auto new_input = input;
auto new_input = detail::make_string_view_from_pointers(
detail::to_address(input.begin()),
detail::to_address(input.end()));
bool found = re2::RE2::Consume(&new_input, re);
if (!found) {
return unexpected_scan_error(scan_error::invalid_scanned_value,
Expand Down Expand Up @@ -419,7 +421,9 @@ namespace scn {
[](auto& val) { return re2::RE2::Arg{&val}; });
ranges::transform(match_args, match_argptrs.begin(),
[](auto& arg) { return &arg; });
auto new_input = input;
auto new_input = detail::make_string_view_from_pointers(
detail::to_address(input.begin()),
detail::to_address(input.end()));
bool found = re2::RE2::ConsumeN(
&new_input, re, match_argptrs.data(), match_argptrs.size());
if (!found) {
Expand Down
6 changes: 5 additions & 1 deletion tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ add_custom_target(scn_examples_test_prepare ALL
find_package(Python3 COMPONENTS Interpreter)
if (Python3_FOUND)
add_test(NAME scn_stdin_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_BINARY_DIR}/tests/unittests/stdin_test_runner.py")
add_test(NAME scn_examples_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_BINARY_DIR}/examples_test_runner.py")
if (SCN_EXAMPLES)
add_test(NAME scn_examples_test COMMAND ${Python3_EXECUTABLE} "${CMAKE_BINARY_DIR}/examples_test_runner.py")
else()
message(STATUS "scn_examples_test disabled, because SCN_EXAMPLES is OFF")
endif()
else ()
message(WARNING "python3 not found, scn_stdin_test and scn_examples_test not added to CTest")
endif ()
2 changes: 1 addition & 1 deletion tests/unittests/examples_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def find_file(pattern, path):
for name in files:
if fnmatch.fnmatch(name, pattern):
return os.path.join(root, name)
return None
raise RuntimeError(f"Couldn't find pattern '{pattern}' in {path}")


script_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down

0 comments on commit b5bb60f

Please sign in to comment.