Skip to content

Commit 7ac7b31

Browse files
Merge pull request #2 from contour-terminal/overall-improvements
overall improvements
2 parents 583f734 + 6cd1dc9 commit 7ac7b31

File tree

4 files changed

+77
-9
lines changed

4 files changed

+77
-9
lines changed

.github/workflows/main.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and Test
2+
3+
on:
4+
merge_group:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
14+
# FIXME: We're having a linker error wrt. Catch2 on Windows with MSVC
15+
# windows-msvc:
16+
# name: "Windows - MSVC"
17+
# runs-on: windows-latest
18+
# steps:
19+
# - uses: actions/checkout@v4
20+
# - name: Install dependencies
21+
# run: choco install ninja
22+
# - name: configure
23+
# run: cmake --preset windows-cl-release
24+
# - name: build
25+
# run: cmake --build --preset windows-cl-release
26+
# - name: test
27+
# run: ctest --preset windows-cl-release -VV
28+
29+
ubuntu24-clang:
30+
name: "Ubuntu Linux - Clang ${{ matrix.clang_version }}"
31+
runs-on: ubuntu-24.04
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
clang_version: [17, 18]
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Install clang
39+
run: |
40+
wget https://apt.llvm.org/llvm.sh
41+
chmod +x llvm.sh
42+
sudo ./llvm.sh ${{ matrix.clang_version }}
43+
- name: Install ninja
44+
run: sudo apt-get install ninja-build
45+
- name: configure
46+
run: cmake --preset linux-clang-release
47+
- name: build
48+
run: cmake --build --preset linux-clang-release
49+
- name: test
50+
run: ctest --preset linux-clang-release -VV
51+
52+
ubuntu24-gcc:
53+
name: "Ubuntu Linux - GCC ${{ matrix.gcc_version }}"
54+
runs-on: ubuntu-24.04
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
gcc_version: [13, 14]
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Install dependencies
62+
run: sudo apt-get install ninja-build g++-${{ matrix.gcc_version }}
63+
- name: configure
64+
run: cmake --preset linux-gcc-release
65+
- name: build
66+
run: cmake --build --preset linux-gcc-release
67+
- name: test
68+
run: ctest --preset linux-gcc-release -VV

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ if(BOXED_TESTING)
6363
test-reflection-cpp.cpp
6464
)
6565
target_compile_features(test-reflection-cpp INTERFACE cxx_std_20)
66-
target_link_libraries(test-reflection-cpp reflection-cpp Catch2::Catch2WithMain)
66+
target_link_libraries(test-reflection-cpp reflection-cpp Catch2::Catch2 Catch2::Catch2WithMain)
6767
add_test(test-reflection-cpp ./test-reflection-cpp)
6868
endif()
6969
message(STATUS "[reflection-cpp] Compile unit tests: ${BOXED_TESTING}")

CMakePresets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"name": "windows-common",
1717
"hidden": true,
1818
"inherits": ["common"],
19-
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
2019
"condition": {
2120
"type": "equals",
2221
"lhs": "${hostSystemName}",

include/reflection-cpp/Reflection.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace detail
8181
constexpr auto joined_arr = []() {
8282
constexpr size_t len = (Strs.size() + ... + 0);
8383
std::array<char, len + 1> arr {};
84-
auto append = [i = 0, &arr](const auto& s) mutable {
84+
auto append = [i = 0u, &arr](const auto& s) mutable {
8585
for (auto c: s)
8686
arr[i++] = c;
8787
};
@@ -356,13 +356,13 @@ consteval std::string_view GetName()
356356
#if defined(_MSC_VER) && !defined(__clang__)
357357
if constexpr (std::is_member_object_pointer_v<decltype(P)>)
358358
{
359-
using T = remove_member_pointer<std::decay_t<decltype(P)>>::type;
359+
using T = detail::remove_member_pointer<std::decay_t<decltype(P)>>::type;
360360
constexpr auto p = P;
361361
return detail::get_name_msvc<T, &(detail::External<T>.*p)>();
362362
}
363363
else
364364
{
365-
using T = remove_member_pointer<std::decay_t<decltype(P)>>::type;
365+
using T = detail::remove_member_pointer<std::decay_t<decltype(P)>>::type;
366366
return detail::func_name_msvc<T, P>();
367367
}
368368
#else
@@ -384,8 +384,9 @@ consteval auto GetName()
384384
str = str.substr(str.rfind("::") + 2);
385385
return str.substr(0, str.find('>'));
386386
#else
387+
constexpr auto MarkerStart = std::string_view { "E = " };
387388
std::string_view str = REFLECTION_PRETTY_FUNCTION;
388-
str = str.substr(str.rfind("::") + 2 + 15);
389+
str = str.substr(str.rfind(MarkerStart) + MarkerStart.size());
389390
str = str.substr(0, str.find(']'));
390391
return str;
391392
#endif
@@ -396,8 +397,8 @@ std::string Inspect(Object const& object)
396397
{
397398
return [&]<size_t... I>(std::index_sequence<I...>) {
398399
std::string str;
399-
auto onMember = [&str](auto&& name, auto&& value) {
400-
auto onValue = [&str]<typename T>(T&& arg) {
400+
auto const onMember = [&str]<typename Name, typename Value>(Name&& name, Value&& value) {
401+
auto const InspectValue = [&str]<typename T>(T&& arg) {
401402
// clang-format off
402403
if constexpr (std::is_convertible_v<T, std::string>
403404
|| std::is_convertible_v<T, std::string_view>
@@ -410,7 +411,7 @@ std::string Inspect(Object const& object)
410411
str += ' ';
411412
str += name;
412413
str += '=';
413-
onValue(value);
414+
InspectValue(value);
414415
};
415416
(onMember(MemberNameOf<I, Object>, std::get<I>(Reflection::ToTuple(object))), ...);
416417
return str;

0 commit comments

Comments
 (0)