From 6822fd7bf472c9edc27c0e851f3efd67c2a99952 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Jul 2003 20:33:29 +0000 Subject: [PATCH] * Bug fix: slices are transitive, so if we detect that an input path is referenced in an output paths, we also have to add all ids referenced by that input path. * Better debug assertions to catch these sorts of errors. --- src/fstate.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fstate.cc b/src/fstate.cc index 11a91cffcb..31dd175825 100644 --- a/src/fstate.cc +++ b/src/fstate.cc @@ -217,6 +217,9 @@ static void parseIds(ATermList ids, FSIds & out) } +static void checkSlice(const Slice & slice); + + /* Parse a slice. */ static Slice parseSlice(FState fs) { @@ -242,6 +245,8 @@ static Slice parseSlice(FState fs) elems = ATgetNext(elems); } + checkSlice(slice); + return slice; } @@ -414,6 +419,9 @@ static Slice normaliseFState2(FSId id, StringSet & usedPaths) if ((k = inMap.find(*j)) != inMap.end()) { elem.refs.push_back(k->second.id); used.insert(k->second.id); + for (FSIds::iterator m = k->second.refs.begin(); + m != k->second.refs.end(); m++) + used.insert(*m); } else if ((l = outPaths.find(*j)) != outPaths.end()) { elem.refs.push_back(l->second); used.insert(l->second); @@ -441,6 +449,8 @@ static Slice normaliseFState2(FSId id, StringSet & usedPaths) storeSuccessor(id, nf, &fsPath); usedPaths.insert(fsPath); + parseSlice(nf); /* check */ + return slice; } @@ -460,10 +470,7 @@ static void checkSlice(const Slice & slice) FSIdSet decl; for (SliceElems::const_iterator i = slice.elems.begin(); i != slice.elems.end(); i++) - { - debug((string) i->id); decl.insert(i->id); - } for (FSIds::const_iterator i = slice.roots.begin(); i != slice.roots.end(); i++) @@ -484,8 +491,6 @@ void realiseSlice(const Slice & slice) debug(format("realising slice")); Nest nest(true); - checkSlice(slice); - /* Perhaps all paths already contain the right id? */ bool missing = false;