From cbee7f8bedce6f32f42d6eea070a85edad38a814 Mon Sep 17 00:00:00 2001 From: Aleksey Loginov Date: Wed, 16 Oct 2024 19:45:50 +0300 Subject: [PATCH 1/2] debug disposable --- .github/workflows/ci v2.yml | 19 +------------------ .../details/disposable_strategy.hpp | 2 ++ src/rpp/rpp/observers/details/fwd.hpp | 2 ++ src/tests/utils/disposable_observable.hpp | 1 + 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci v2.yml b/.github/workflows/ci v2.yml index 70319bfeb..88b09062a 100644 --- a/.github/workflows/ci v2.yml +++ b/.github/workflows/ci v2.yml @@ -84,14 +84,6 @@ jobs: with: fetch-depth: 0 - # Work around https://github.com/actions/runner-images/issues/8659 - # - name: "Remove GCC 13 from runner image (workaround)" - # shell: bash - # run: | - # sudo apt-get update - # sudo apt-get purge -y g++-13 gcc-13 libstdc++-13-dev - # sudo apt-get install -y --allow-downgrades libstdc++-12-dev libstdc++6=12.* libgcc-s1=12.* - - name: Install Qt uses: jurplel/install-qt-action@v4 with: @@ -146,15 +138,6 @@ jobs: with: fetch-depth: 0 - # Work around https://github.com/actions/runner-images/issues/8659 - # - name: "Remove GCC 13 from runner image (workaround)" - # if: matrix.config.os == 'ubuntu-latest' - # shell: bash - # run: | - # sudo apt-get update - # sudo apt-get purge -y g++-13 gcc-13 libstdc++-13-dev - # sudo apt-get install -y --allow-downgrades libstdc++-12-dev libstdc++6=12.* libgcc-s1=12.* - - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: @@ -194,7 +177,7 @@ jobs: uses: lukka/run-cmake@v10 with: configurePreset: ${{ matrix.config.name }}-${{ matrix.type }} - configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=${{ matrix.build_type.config }}', '-DCMAKE_CONFIGURATION_TYPES=${{ matrix.build_type.config }}']" + configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=${{ matrix.build_type.config }}', '-DCMAKE_CONFIGURATION_TYPES=${{ matrix.build_type.config }}', '-DRPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION=1']" buildPreset: ci-build buildPresetAdditionalArgs: "['--config ${{ matrix.build_type.config }}']" testPreset: ${{matrix.build_type.test_preset}} diff --git a/src/rpp/rpp/observables/details/disposable_strategy.hpp b/src/rpp/rpp/observables/details/disposable_strategy.hpp index dfcb0cdbb..59462c1fa 100644 --- a/src/rpp/rpp/observables/details/disposable_strategy.hpp +++ b/src/rpp/rpp/observables/details/disposable_strategy.hpp @@ -93,9 +93,11 @@ namespace rpp::details::observables template consteval auto* deduce_updated_disposable_strategy() { + #ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION if constexpr (has_updated_disposable_strategy) return static_cast*>(nullptr); else + #endif return static_cast(nullptr); } } // namespace details diff --git a/src/rpp/rpp/observers/details/fwd.hpp b/src/rpp/rpp/observers/details/fwd.hpp index 377b9f295..c92cb1f23 100644 --- a/src/rpp/rpp/observers/details/fwd.hpp +++ b/src/rpp/rpp/observers/details/fwd.hpp @@ -72,9 +72,11 @@ namespace rpp::details::observers template consteval auto* deduce_disposable_strategy() { + #ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION if constexpr (has_disposable_strategy) return static_cast(nullptr); else + #endif return static_cast*>(nullptr); } } // namespace details diff --git a/src/tests/utils/disposable_observable.hpp b/src/tests/utils/disposable_observable.hpp index e5b527b95..023564433 100644 --- a/src/tests/utils/disposable_observable.hpp +++ b/src/tests/utils/disposable_observable.hpp @@ -128,6 +128,7 @@ void test_operator_over_observable_with_disposable(auto&& op) op(rpp::source::create([](auto&& obs) { const auto d = rpp::composite_disposable_wrapper::make(); obs.set_upstream(d); + CHECK(!d.is_disposed()); obs.on_completed(); CHECK(d.is_disposed()); })).subscribe([](const auto&) {}, [](const std::exception_ptr&) {}); From fef90ccd5a29bf8937a5201bca0f7186830a479e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:50:01 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/rpp/rpp/observables/details/disposable_strategy.hpp | 4 ++-- src/rpp/rpp/observers/details/fwd.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpp/rpp/observables/details/disposable_strategy.hpp b/src/rpp/rpp/observables/details/disposable_strategy.hpp index 59462c1fa..589dd396a 100644 --- a/src/rpp/rpp/observables/details/disposable_strategy.hpp +++ b/src/rpp/rpp/observables/details/disposable_strategy.hpp @@ -93,11 +93,11 @@ namespace rpp::details::observables template consteval auto* deduce_updated_disposable_strategy() { - #ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION +#ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION if constexpr (has_updated_disposable_strategy) return static_cast*>(nullptr); else - #endif +#endif return static_cast(nullptr); } } // namespace details diff --git a/src/rpp/rpp/observers/details/fwd.hpp b/src/rpp/rpp/observers/details/fwd.hpp index c92cb1f23..f8fc4ddb9 100644 --- a/src/rpp/rpp/observers/details/fwd.hpp +++ b/src/rpp/rpp/observers/details/fwd.hpp @@ -72,11 +72,11 @@ namespace rpp::details::observers template consteval auto* deduce_disposable_strategy() { - #ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION +#ifndef RPP_DEBUG_DISABLE_DISPOSABLES_OPTIMIZATION if constexpr (has_disposable_strategy) return static_cast(nullptr); else - #endif +#endif return static_cast*>(nullptr); } } // namespace details