- Better error reporting for local order constraints.

This commit is contained in:
ccremers 2006-02-28 15:33:12 +00:00
parent 4064d8ca65
commit 527bf8baa5
3 changed files with 59 additions and 20 deletions

View File

@ -39,34 +39,70 @@ correctLocalOrder (const System sys)
// t is a term from r2 that occurs in r1
r2 = TermRunid (t);
e1 = firstOccurrence (sys, r1, t, READ);
e1 = firstOccurrence (sys, r1, t, ANYEVENT);
if (e1 >= 0)
{
e2 = firstOccurrence (sys, r2, t, SEND);
if (e2 >= 0)
if (roledef_shift (sys->runs[r1].start, e1)->type == READ)
{
// thus, it should not be the case that e1 occurs before e2
if (isDependEvent (r1, e1, r2, e2))
e2 = firstOccurrence (sys, r2, t, SEND);
if (e2 >= 0)
{
// That's not good!
if (switches.output == PROOF)
// thus, it should not be the case that e1 occurs before e2
if (isDependEvent (r1, e1, r2, e2))
{
indentPrint ();
eprintf ("Pruned because ordering for term ");
termSubstPrint (t);
eprintf
(" cannot be correct: the first send r%ii%i occurs after the read r%ii%i.\n",
r2, e2, r1, e1);
// That's not good!
if (switches.output == PROOF)
{
indentPrint ();
eprintf ("Pruned because ordering for term ");
termSubstPrint (t);
eprintf
(" cannot be correct: the first send r%ii%i occurs after the read r%ii%i.\n",
r2, e2, r1, e1);
}
flag = false;
return false;
}
flag = false;
return false;
}
else
{
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i, but it doesn't.\n",
r2, r2);
globalError--;
error ("Abort");
}
}
else
{
// not a read first?
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i first in a READ event, but it occurs first in another event.\n",
r2, r1);
globalError--;
error ("Abort");
}
}
}
return true;
else
{
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i, but it doesn't.\n", r2,
r1);
globalError--;
error ("Abort");
}
return true;
}
}
return iterateLocalToOther (sys, r1, checkTerm);

View File

@ -9,7 +9,7 @@
#include "states.h"
enum eventtype
{ READ, SEND, CLAIM };
{ READ, SEND, CLAIM, ANYEVENT };
//! The container for the claim info list
/**

View File

@ -1576,13 +1576,16 @@ iterateEvents (const System sys, const int run,
}
// Iterate over event type in a certain run (increasing through role)
/**
* If evtype == ANYEVENT then it does not matter.
*/
int
iterateEventsType (const System sys, const int run, const int evtype,
int (*callback) (Roledef rd, int ev))
{
int selectEvent (Roledef rd, int e)
{
if (rd->type == evtype)
if (evtype == ANYEVENT || rd->type == evtype)
{
return callback (rd, e);
}