From: Arnaud Giersch Date: Mon, 16 Oct 2017 19:30:05 +0000 (+0200) Subject: Sonar asked to end this switch cases with an unconditional statement. X-Git-Tag: v3.18~440 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/319c975f24002b72eefd252b4c701b2da425304b Sonar asked to end this switch cases with an unconditional statement. --- diff --git a/src/mc/checker/LivenessChecker.cpp b/src/mc/checker/LivenessChecker.cpp index e74980ea7e..902246d338 100644 --- a/src/mc/checker/LivenessChecker.cpp +++ b/src/mc/checker/LivenessChecker.cpp @@ -76,6 +76,7 @@ static bool evaluate_label(xbt_automaton_exp_label_t l, std::vector const& return values[cursor] != 0; } xbt_die("Missing predicate"); + break; } case xbt_automaton_exp_label::AUT_ONE: return true; diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index dbafa01632..429a995061 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -111,8 +111,7 @@ bool actor_is_enabled(smx_actor_t actor) if (mutex->owner == nullptr) return true; - else - return mutex->owner->pid == req->issuer->pid; + return mutex->owner->pid == req->issuer->pid; } case SIMCALL_SEM_ACQUIRE: { diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index e4fbdf6892..b2afcbcac1 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -160,16 +160,11 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2) if (synchro1->src_buff == synchro2->src_buff && synchro1->dst_buff == synchro2->dst_buff) return false; - else if (synchro1->src_buff != nullptr - && synchro1->dst_buff != nullptr - && synchro2->src_buff != nullptr - && synchro2->dst_buff != nullptr - && synchro1->dst_buff != synchro2->src_buff - && synchro1->dst_buff != synchro2->dst_buff - && synchro2->dst_buff != synchro1->src_buff) + if (synchro1->src_buff != nullptr && synchro1->dst_buff != nullptr && synchro2->src_buff != nullptr && + synchro2->dst_buff != nullptr && synchro1->dst_buff != synchro2->src_buff && + synchro1->dst_buff != synchro2->dst_buff && synchro2->dst_buff != synchro1->src_buff) return false; - else - return true; + return true; default: return true; } diff --git a/src/mc/mc_snapshot.hpp b/src/mc/mc_snapshot.hpp index 6eab44490c..12325d10d2 100644 --- a/src/mc/mc_snapshot.hpp +++ b/src/mc/mc_snapshot.hpp @@ -199,10 +199,9 @@ static XBT_ALWAYS_INLINE const void* MC_region_read(mc_mem_region_t region, void if (simgrid::mc::mmu::sameChunk((std::uintptr_t)addr, (std::uintptr_t)end)) { // The memory is contained in a single page: return mc_translate_address_region_chunked((uintptr_t)addr, region); - } else { - // The memory spans several pages: - return MC_region_read_fragmented(region, target, addr, size); } + // Otherwise, the memory spans several pages: + return MC_region_read_fragmented(region, target, addr, size); } default: