From: Brian Norris Date: Wed, 12 Dec 2012 02:05:51 +0000 (-0800) Subject: action: refactor ATOMIC_READ printing X-Git-Tag: oopsla2013~437 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=cb9bcfa58847b8261c41890d517918260d409bdd action: refactor ATOMIC_READ printing For ATOMIC_READ, we don't need a special case to print VALUE_NONE, because any action where the value isn't explicitly set (e.g., all ATOMIC_READ actions) default to VALUE_NONE. And if this 'default' changes in the future, we would want to print it. (Right now it's confusing, for instance, when we have a failed promise execution, since the model-checker trace gives no indication of what the promised value actually *was*. This should be fixed sometime.) --- diff --git a/action.cc b/action.cc index e88fcee..a114675 100644 --- a/action.cc +++ b/action.cc @@ -470,7 +470,11 @@ void ModelAction::print() const type_str = "unknown type"; } - uint64_t valuetoprint=type==ATOMIC_READ?(reads_from!=NULL?reads_from->value:VALUE_NONE):value; + uint64_t valuetoprint; + if (type == ATOMIC_READ && reads_from != NULL) + valuetoprint = reads_from->value; + else + valuetoprint = value; switch (this->order) { case std::memory_order_relaxed: