From fa086024d954bae1623c0db02854eb370224b8bd Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Feb 2024 23:32:40 +0900 Subject: [PATCH] Declare `v1::pointer_set` deprecated Signed-off-by: yamacir-kit --- CMakeLists.txt | 9 +++++---- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/pair.hpp | 6 +++++- include/meevax/memory/integer_set.hpp | 24 ++++++++++++------------ include/meevax/memory/pointer_set.hpp | 2 +- src/kernel/pair.cpp | 4 ++++ 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1e3569b2..dcd7e9160 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,13 +200,14 @@ file(GLOB ${PROJECT_NAME}_TEST_CPP ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp) foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP) get_filename_component(FILENAME ${EACH} NAME_WE) - add_executable(assert-${FILENAME} ${EACH}) - target_link_libraries(assert-${FILENAME} PRIVATE basis kernel) + add_executable(test_${FILENAME} ${EACH}) + target_link_libraries(test_${FILENAME} PRIVATE basis kernel) + target_compile_options(test_${FILENAME} PUBLIC -Wno-deprecated-declarations) add_test( - NAME assert-${FILENAME} + NAME test/${FILENAME} COMMAND ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND} ${${PROJECT_NAME}_MEMORY_CHECK_OPTIONS} - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assert-${FILENAME}) + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME}) endforeach() # ---- Additional Targets ------------------------------------------------------ diff --git a/README.md b/README.md index ddc1c6839..775f6851e 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.115_amd64.deb +sudo apt install build/meevax_0.5.116_amd64.deb ``` or @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.115.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.116.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.115_amd64.deb` +| `package` | Generate debian package `meevax_0.5.116_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index 11e4875e9..34076ef25 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.115 +0.5.116 diff --git a/include/meevax/kernel/pair.hpp b/include/meevax/kernel/pair.hpp index 2ea70c124..a5b02366f 100644 --- a/include/meevax/kernel/pair.hpp +++ b/include/meevax/kernel/pair.hpp @@ -136,7 +136,11 @@ inline namespace kernel using const_iterator = forward_iterator; - explicit pair(object const& = unit, object const& = unit); + constexpr pair() = default; + + explicit pair(object const&); + + explicit pair(object const&, object const&); template > explicit pair(object const& a, Ts&&... xs) diff --git a/include/meevax/memory/integer_set.hpp b/include/meevax/memory/integer_set.hpp index da830268f..a380d1909 100644 --- a/include/meevax/memory/integer_set.hpp +++ b/include/meevax/memory/integer_set.hpp @@ -68,13 +68,13 @@ inline namespace memory using subset = integer_set; // Only the outermost implementation knows the original type name T. - using superset = std::array; + using subsets = subset *[N]; - superset data {}; + subsets data = {}; struct const_iterator : public std::iterator { - superset const* data = nullptr; + subset const* const* data = nullptr; std::size_t i = std::numeric_limits::max(); @@ -83,7 +83,7 @@ inline namespace memory constexpr const_iterator() = default; explicit const_iterator(integer_set const* container, std::size_t i, std::uintptr_t j = 0) - : data { std::addressof(container->data) } + : data { container->data } , i { i } { assert(i <= N); @@ -91,7 +91,7 @@ inline namespace memory } explicit const_iterator(integer_set const* container) - : data { std::addressof(container->data) } + : data { container->data } , i { N } { decrement_unless_truthy(); @@ -100,9 +100,11 @@ inline namespace memory auto increment_unless_truthy(std::uintptr_t j = 0) -> void { - for (assert(data); good(); ++i, j = 0) + assert(data); + + for (; good(); ++i, j = 0) { - if (auto datum = (*data)[i]; datum and (iter = datum->lower_bound(j)).good()) + if (data[i] and (iter = data[i]->lower_bound(j)).good()) { return; } @@ -113,13 +115,11 @@ inline namespace memory auto decrement_unless_truthy() -> void { - i = std::min(i, N - 1); - - assert(good()); + assert(data); - for (assert(data); good(); --i) + for (i = std::min(i, N - 1); good(); --i) { - if (auto datum = (*data)[i]; datum and (iter = typename subset::const_iterator(datum)).good()) + if (data[i] and (iter = typename subset::const_iterator(data[i])).good()) { return; } diff --git a/include/meevax/memory/pointer_set.hpp b/include/meevax/memory/pointer_set.hpp index bcffe600a..b0fd052de 100644 --- a/include/meevax/memory/pointer_set.hpp +++ b/include/meevax/memory/pointer_set.hpp @@ -43,7 +43,7 @@ inline namespace v1 template typename OrderedMap = simple_flat_map, template typename Bitset = simple_bitset, std::size_t N = 4096 * 8> // getconf PAGE_SIZE - class pointer_set + class [[deprecated]] pointer_set { static_assert(std::is_pointer_v); diff --git a/src/kernel/pair.cpp b/src/kernel/pair.cpp index bd4604808..3d8ca0305 100644 --- a/src/kernel/pair.cpp +++ b/src/kernel/pair.cpp @@ -22,6 +22,10 @@ inline namespace kernel { let unit { nullptr }; + pair::pair(object const& a) + : std::pair { a, unit } + {} + pair::pair(object const& a, object const& b) : std::pair { a, b } {}