commit 1543141
shrub
·
2026-07-23 16:00:11 +0000 UTC
parent d112c98
rebuild target hash index after scoping sh paths
6 files changed,
+46,
-0
+1,
-0
1@@ -337,6 +337,7 @@ scopegraph(struct Graph *graph, const char *prefix)
2 scopelist(&graph->v[i].order_only, prefix);
3 scoperecipes(&graph->v[i].recipes, prefix);
4 }
5+ reindexgraph(graph);
6 }
7
8 static int
+1,
-0
1@@ -76,6 +76,7 @@ void envdelvar(struct Env *env, const char *name);
2 struct Target *findtarget(struct Graph *graph, const char *name);
3 const struct Target *findctarget(const struct Graph *graph, const char *name);
4 struct Target *gettarget(struct Graph *graph, const char *name, int *added);
5+void reindexgraph(struct Graph *graph);
6 const char *firstprereq(const struct Target *t);
7 char *joinallprereqs(const struct Target *t, const char *sep);
8 size_t totalprereqs(const struct Target *t);
+13,
-0
1@@ -713,6 +713,19 @@ graphindexput(struct Graph *graph, const char *name, size_t idx)
2 graph->ntargetindex++;
3 }
4
5+void
6+reindexgraph(struct Graph *graph)
7+{
8+ size_t i;
9+
10+ free(graph->targetindex);
11+ graph->targetindex = 0;
12+ graph->ntargetindex = 0;
13+ graph->cap_targetindex = 0;
14+ for (i = 0; i < graph->n; i++)
15+ graphindexput(graph, graph->v[i].name, i);
16+}
17+
18 static void
19 envindexgrow(struct Env *env)
20 {
+6,
-0
1@@ -0,0 +1,6 @@
2+all: sub/lib.a
3+
4+sub/lib.a: input
5+ @$(MAKE) -C sub
6+
7+input:
+1,
-0
1@@ -0,0 +1 @@
2+building lib.a
+24,
-0
1@@ -0,0 +1,24 @@
2+{
3+ "case": "t004",
4+ "category": "recursion",
5+ "compare_output": true,
6+ "description": "recursive targets remain reachable after subgraph path scoping",
7+ "details": "",
8+ "env": {},
9+ "expected_exit": 0,
10+ "options": "",
11+ "options_mode": "argv",
12+ "output_mode": "exact",
13+ "setup": [
14+ {
15+ "kind": "file",
16+ "mode": "0644",
17+ "mtime": 0,
18+ "path": "sub/Makefile",
19+ "content": "all: lib.a\n\nlib.a:\n\t@echo building lib.a\n\t@touch lib.a\n"
20+ }
21+ ],
22+ "stdin": "",
23+ "suite": "shin",
24+ "timeout_seconds": 60
25+}