From b830006453fcfad38d4728e93e86350096902ffb Mon Sep 17 00:00:00 2001 From: Christian Granzin Date: Tue, 22 Sep 2026 20:04:46 +0200 Subject: [PATCH 1/3] feat(backmp11)!: remove active state switch policies --- doc/modules/ROOT/pages/version-history.adoc | 2 ++ .../msm/backmp11/detail/transition_table.hpp | 31 +++---------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/doc/modules/ROOT/pages/version-history.adoc b/doc/modules/ROOT/pages/version-history.adoc index cabd6338..2ce09d06 100644 --- a/doc/modules/ROOT/pages/version-history.adoc +++ b/doc/modules/ROOT/pages/version-history.adoc @@ -5,6 +5,8 @@ == Boost 1.93 * fix(back11): Dropped transition depending on transition table row order (https://github.com/boostorg/msm/issues/252[#252]) +* **Breaking changes (`backmp11`)**: +** The active state switch policy can no longer be configured; the active state is now always set after source exit, in compliance with the UML specification (https://github.com/boostorg/msm/issues/222[#222]) == Boost 1.92 diff --git a/include/boost/msm/backmp11/detail/transition_table.hpp b/include/boost/msm/backmp11/detail/transition_table.hpp index 5b323541..b78bfbd9 100644 --- a/include/boost/msm/backmp11/detail/transition_table.hpp +++ b/include/boost/msm/backmp11/detail/transition_table.hpp @@ -14,7 +14,6 @@ #include -#include #include #include @@ -160,12 +159,6 @@ struct transition_table_impl using derived_t = typename StateMachine::derived_t; using state_set = typename StateMachine::state_set; - template - using get_active_state_switch_policy = typename T::active_state_switch_policy; - using active_state_switching = - boost::mp11::mp_eval_or; - template static bool call_guard_or_true(StateMachine& sm, const Event& event, @@ -305,36 +298,20 @@ struct transition_table_impl // guard rejected the event, we stay in the current one return process_result::rejected; } - if constexpr (std::is_same_v) - { - state_id = next_state_id; - } // first call the exit method of the current state source.on_exit(event, sm.get_fsm_argument()); - if constexpr (std::is_same_v) - { - state_id = next_state_id; - } + + // set the new active state id after source exit and + // before target entry (UML 14.2.3.4.5 & 14.2.3.4.6) + state_id = next_state_id; // then call the action method process_result res = call_action_or_true(sm, event, source, target); - if constexpr (std::is_same_v) - { - state_id = next_state_id; - } // and finally the entry method of the new state call_entry(sm, event, target); - if constexpr (std::is_same_v) - { - state_id = next_state_id; - } // Give a chance to handle completion transitions. sm.on_state_entry_completed(target, region_id); From 2f8d1b8d9d025d28c1fed3c52e4872ec1cbe699d Mon Sep 17 00:00:00 2001 From: Christian Granzin Date: Tue, 22 Sep 2026 20:05:46 +0200 Subject: [PATCH 2/3] feat(backmp11)!: remove deprecated process_result enum values --- doc/modules/ROOT/pages/version-history.adoc | 1 + include/boost/msm/backmp11/common_types.hpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/modules/ROOT/pages/version-history.adoc b/doc/modules/ROOT/pages/version-history.adoc index 2ce09d06..dae3d755 100644 --- a/doc/modules/ROOT/pages/version-history.adoc +++ b/doc/modules/ROOT/pages/version-history.adoc @@ -7,6 +7,7 @@ * fix(back11): Dropped transition depending on transition table row order (https://github.com/boostorg/msm/issues/252[#252]) * **Breaking changes (`backmp11`)**: ** The active state switch policy can no longer be configured; the active state is now always set after source exit, in compliance with the UML specification (https://github.com/boostorg/msm/issues/222[#222]) +** The deprecated `HANDLED_`-prefixed values are removed from the `process_result` enum, use `discarded`, `consumed`, `rejected` and `deferred` instead (https://github.com/boostorg/msm/issues/242[#242]) == Boost 1.92 diff --git a/include/boost/msm/backmp11/common_types.hpp b/include/boost/msm/backmp11/common_types.hpp index 7c9b9ef5..62a46435 100644 --- a/include/boost/msm/backmp11/common_types.hpp +++ b/include/boost/msm/backmp11/common_types.hpp @@ -45,12 +45,6 @@ enum class process_result : uint8_t rejected = 2, /// The event will be re-evaluated after the next transition. deferred = 4, - - /// Deprecated enum values. - HANDLED_FALSE [[deprecated("Use discarded")]] = 0, - HANDLED_TRUE [[deprecated("Use accepted")]] = 1, - HANDLED_GUARD_REJECT [[deprecated("Use rejected")]] = 2, - HANDLED_DEFERRED [[deprecated("Use deferred")]] = 4 }; constexpr process_result operator|(process_result lhs, process_result rhs) From fcb9e4edd6c3bb088fbf052d35035d4a0148f957 Mon Sep 17 00:00:00 2001 From: Christian Granzin Date: Tue, 22 Sep 2026 20:45:51 +0200 Subject: [PATCH 3/3] doc: remove experimental status from backmp11 --- doc/modules/ROOT/pages/back-back-end.adoc | 6 +++--- doc/modules/ROOT/pages/backmp11-back-end.adoc | 5 ++--- doc/modules/ROOT/pages/version-history.adoc | 3 ++- doc/modules/ROOT/partials/toc.adoc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/modules/ROOT/pages/back-back-end.adoc b/doc/modules/ROOT/pages/back-back-end.adoc index 28258814..cddc9b7b 100644 --- a/doc/modules/ROOT/pages/back-back-end.adoc +++ b/doc/modules/ROOT/pages/back-back-end.adoc @@ -4,9 +4,9 @@ The back-end contains the library engine and defines the performance and functionality trade-offs. There are, at the moment, three back-ends: -- `msm::back` is using {cpp}03 -- `msm::back11` is using {cpp}11 and should be used by default if possible as it removes some pre-{cpp}11 limitations (mpl::vector of limited size) -- `msm::backmp11` is using {cpp}17 (it is still experimental at the moment and further described in a xref:./backmp11-back-end.adoc[separate page]) +- `msm::back` is using {cpp}03 and is kept for backwards compatibility +- `msm::back11` is using {cpp}11 and should be preferred over `msm::back` where possible, as it removes some pre-{cpp}11 limitations (mpl::vector of limited size) +- `msm::backmp11` is using {cpp}17 and should be used by default if possible. It provides additional features and significantly better compile times and runtime performance. It is further described in a xref:./backmp11-back-end.adoc[separate page] The currently available back-ends implement most of the functionality defined by the UML 2.0 standard at very high runtime speed, in exchange diff --git a/doc/modules/ROOT/pages/backmp11-back-end.adoc b/doc/modules/ROOT/pages/backmp11-back-end.adoc index fca6f75a..be1fe7a9 100644 --- a/doc/modules/ROOT/pages/backmp11-back-end.adoc +++ b/doc/modules/ROOT/pages/backmp11-back-end.adoc @@ -1,7 +1,6 @@ -= Backmp11 back-end (C{plus}{plus}17, experimental) += Backmp11 back-end (C{plus}{plus}17) The `backmp11` back-end requires C{plus}{plus}17 and is mostly backwards-compatible with `back`. -It is currently in an **experimental** stage - it is functionally mature, though some details about its API and compatibility to less used functionality might change (feedback welcome!). It is named after the metaprogramming library https://www.boost.org/library/latest/mp11/[Boost.Mp11], the main contributor to the optimizations. Use of MPL is replaced with Mp11 to eliminate the costly C{plus}{plus}03 emulation of variadic templates. @@ -644,7 +643,7 @@ Calls to the old APIs can be replaced as follows: | 1.91 / 1.92 a| The API `process_event` automatically enqueues events when the state machine is already processing. This requires instantiating `enqueue_event` for every event type, even though most instantiations are never invoked. They are only needed when `process_event` is called in actions. -*Change:* The API `process_event` will reject an event and return `HANDLED_FALSE` when called during event processing instead of automatically enqueueing it. +*Change:* The API `process_event` will reject an event and return `discarded` when called during event processing instead of automatically enqueueing it. Calls to `process_event` in actions must be replaced with `enqueue_event`. diff --git a/doc/modules/ROOT/pages/version-history.adoc b/doc/modules/ROOT/pages/version-history.adoc index dae3d755..57ca0537 100644 --- a/doc/modules/ROOT/pages/version-history.adoc +++ b/doc/modules/ROOT/pages/version-history.adoc @@ -4,10 +4,11 @@ == Boost 1.93 -* fix(back11): Dropped transition depending on transition table row order (https://github.com/boostorg/msm/issues/252[#252]) +* The `backmp11` back-end is no longer experimental. Its API is considered stable from this release on, after the cleanup listed below * **Breaking changes (`backmp11`)**: ** The active state switch policy can no longer be configured; the active state is now always set after source exit, in compliance with the UML specification (https://github.com/boostorg/msm/issues/222[#222]) ** The deprecated `HANDLED_`-prefixed values are removed from the `process_result` enum, use `discarded`, `consumed`, `rejected` and `deferred` instead (https://github.com/boostorg/msm/issues/242[#242]) +* fix(back11): Dropped transition depending on transition table row order (https://github.com/boostorg/msm/issues/252[#252]) == Boost 1.92 diff --git a/doc/modules/ROOT/partials/toc.adoc b/doc/modules/ROOT/partials/toc.adoc index 77293764..44d6132e 100644 --- a/doc/modules/ROOT/partials/toc.adoc +++ b/doc/modules/ROOT/partials/toc.adoc @@ -9,7 +9,7 @@ ** xref:back-back-end.adoc[`back` & `back11` back-end] *** xref:back-back-end/examples.adoc[Examples] *** xref:back-back-end/performance-compilers.adoc[Performance / Compilers] -** xref:backmp11-back-end.adoc[`backmp11` back-end (C++17, experimental)] +** xref:backmp11-back-end.adoc[`backmp11` back-end (C++17)] *** xref:backmp11-back-end/examples.adoc[Examples] ** xref:internals.adoc[Internals] ** xref:acknowledgements.adoc[Acknowledgements]