about summary refs log tree commit diff
path: root/src/fstate.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-16T20·33+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-16T20·33+0000
commit6822fd7bf472c9edc27c0e851f3efd67c2a99952 (patch)
treecd60fb2b9a26eb0e8f2e5ef7704b1f7304c44d6b /src/fstate.cc
parent9d56ca219fb7af1c209458f81a8ce35a1b6afd28 (diff)
* 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.

Diffstat (limited to 'src/fstate.cc')
-rw-r--r--src/fstate.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/fstate.cc b/src/fstate.cc
index 11a91cffcb87..31dd17582584 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;