X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cef6554994ae17d8f56c9245ad2c10c7cf39af8c..3f9b311ec56db95ec539001a860ae3c838c48312:/src/mc/transition/TransitionComm.cpp diff --git a/src/mc/transition/TransitionComm.cpp b/src/mc/transition/TransitionComm.cpp index 19d8ebfde9..d23cd86fb8 100644 --- a/src/mc/transition/TransitionComm.cpp +++ b/src/mc/transition/TransitionComm.cpp @@ -59,13 +59,10 @@ bool CommWaitTransition::depends(const Transition* other) const bool CommWaitTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_WAIT: - // If the other event is a communication event, then we are not reversible; otherwise we are reversible. - return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_WAIT, "Unexpected transition type %s", to_c_str(type_)); + + // If the other event is a communication event, then we are not reversible; otherwise we are reversible. + return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; } CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_, @@ -114,12 +111,8 @@ bool CommTestTransition::depends(const Transition* other) const bool CommTestTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_TEST: - return true; // CommTest is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_TEST, "Unexpected transition type %s", to_c_str(type_)); + return true; // CommTest is always enabled } CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) @@ -189,12 +182,9 @@ bool CommRecvTransition::depends(const Transition* other) const bool CommRecvTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_ASYNC_RECV: - return true; // CommRecv is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_ASYNC_RECV, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommRecv is always enabled } CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) @@ -265,12 +255,9 @@ bool CommSendTransition::depends(const Transition* other) const bool CommSendTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_ASYNC_SEND: - return true; // CommSend is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_ASYNC_SEND, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommSend is always enabled } } // namespace simgrid::mc