Skip to content
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
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,58 @@ jobs:
- name: run
run: ctest -V -C Release

mingw:
name: MinGW ${{ matrix.sys }} C++${{ matrix.cpp }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
cpp: [11, 14, 17, 20, 23]
sys:
- mingw64
- mingw32
- ucrt64
- clang64
include:
- range_v3: ON
- range_v3: OFF
cpp: 11
- range_v3: OFF
sys: mingw32
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
pacboy: >-
gcc:p
cmake:p
ninja:p
boost:p
fmt:p
${{ matrix.sys != 'mingw32' && 'range-v3:p' || '' }}
- name: setup catch2
run: |
mkdir -p cmake/catch2
curl -L -o cmake/catch2/catch.hpp https://github.com/catchorg/Catch2/releases/download/v2.13.10/catch.hpp
cat > cmake/FindCatch2.cmake << 'EOF'
add_library(Catch2::Catch2 INTERFACE IMPORTED)
set_target_properties(Catch2::Catch2 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}"
)
set(Catch2_FOUND TRUE)
EOF
- name: build
run: |
cmake . -G Ninja -DCMAKE_MODULE_PATH=$(pwd)/cmake -DENABLE_RANGE_V3=${{ matrix.range_v3 }} -DENABLE_FMT=ON -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wconversion -Wshadow -pedantic -Werror -Wno-c2y-extensions' -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: run
run: ctest -V

macos:
name: Xcode C++${{ matrix.cpp }}
runs-on: macos-14
Expand Down
4 changes: 3 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Renato Florentino Garcia <fgarcia.renato@gmail.com>
Renato Garcia <fgarcia.renato@gmail.com>
Dwayne Robinson <fdwr@hotmail.com>
JoyHak <access-restricted@onionmail.org>
30 changes: 25 additions & 5 deletions icecream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
#pragma warning(disable: 4127 4355 4514 4623 4626 4820 4866 4868 5027 5045 4582 4583)
#endif

#if (!defined(__APPLE__) && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 15000))
#if !( \
defined(__APPLE__) /* macOS */ \
|| (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 15000) /* libc++ < 15.0 */ \
|| (defined(__MSVCRT_VERSION__) && !defined( _UCRT)) /* msvcrt */ \
)
#define ICECREAM_UCHAR_HEADER
#include <uchar.h>
#endif
Expand Down Expand Up @@ -4081,6 +4085,25 @@ namespace detail {

// -------------------------------------------------- Range classes

// Check if a value of type From fits in type To. Uses SFINAE to avoid tautological
// comparison warnings when From type have the same size or is shorter than To type.
template<typename To, typename From>
auto fits_in(From v) -> typename std::enable_if<
(sizeof(From) > sizeof(To)), bool
>::type
{
return v >= std::numeric_limits<To>::lowest()
&& v <= std::numeric_limits<To>::max();
}

template<typename To, typename From>
auto fits_in(From) -> typename std::enable_if<
(sizeof(From) <= sizeof(To)), bool
>::type
{
return true;
}

// Direct representation of a slicing string.
struct Slice
{
Expand Down Expand Up @@ -4141,10 +4164,7 @@ namespace detail {
)

// or if there is an overflow to convert from long to ptrdiff
|| (
lnum > std::numeric_limits<ptrdiff_t>::max()
|| lnum < std::numeric_limits<ptrdiff_t>::lowest()
)
|| !fits_in<ptrdiff_t>(lnum)
) {
return {};
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_c++11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ TEST_CASE("pointer_like")

float* v0 = nullptr;
IC(v0);
#if !defined(__APPLE__) && defined(_LIBCPP_VERSION)
#if !defined(__APPLE__) && defined(_LIBCPP_VERSION) && !defined(__MINGW64__)
REQUIRE(str == "ic| v0: (nil)\n");
#else
REQUIRE_THAT(str, Catch::Matches("ic\\| v0: (0x)*0+\n"));
Expand All @@ -800,7 +800,7 @@ TEST_CASE("pointer_like")

auto v0 = std::unique_ptr<double> {};
IC(v0);
#if !defined(__APPLE__) && defined(_LIBCPP_VERSION)
#if !defined(__APPLE__) && defined(_LIBCPP_VERSION) && !defined(__MINGW64__)
REQUIRE(str == "ic| v0: (nil)\n");
#else
REQUIRE_THAT(str, Catch::Matches("ic\\| v0: (0x)*0+\n"));
Expand Down
2 changes: 1 addition & 1 deletion tests/test_clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEST_CASE("dump_string")
{&i0},
};

#if !defined(__APPLE__) && defined(_LIBCPP_VERSION)
#if !defined(__APPLE__) && defined(_LIBCPP_VERSION) && !defined(__MINGW64__)
auto const result = "ic\\| v0: \\{integers: \\[(0x)*[0-9a-fA-F]+, \\(nil\\)\\]\\}\n";
#else
auto const result = "ic\\| v0: \\{integers: \\[(0x)*[0-9a-fA-F]+, (0x)*0\\]\\}\n";
Expand Down
Loading