aboutsummaryrefslogtreecommitdiffstats
path: root/main/make/double-colon-targets.patch
blob: 744cd05b231442cc6f5ba0434d3f7e414d09f95d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
diff -upr make-4.2.orig/filedef.h make-4.2/filedef.h
--- make-4.2.orig/filedef.h	2016-06-01 10:55:27.566366858 +0200
+++ make-4.2/filedef.h	2016-06-01 10:55:48.086259674 +0200
@@ -58,6 +58,8 @@ struct file
     FILE_TIMESTAMP last_mtime;  /* File's modtime, if already known.  */
     FILE_TIMESTAMP mtime_before_update; /* File's modtime before any updating
                                            has been performed.  */
+    unsigned int considered;    /* equal to 'considered' if file has been
+                                   considered on current scan of goal chain */
     int command_flags;          /* Flags OR'd in for cmds; see commands.h.  */
     enum update_status          /* Status of the last attempt to update.  */
       {
@@ -96,8 +98,6 @@ struct file
     unsigned int ignore_vpath:1;/* Nonzero if we threw out VPATH name.  */
     unsigned int pat_searched:1;/* Nonzero if we already searched for
                                    pattern-specific variables.  */
-    unsigned int considered:1;  /* equal to 'considered' if file has been
-                                   considered on current scan of goal chain */
     unsigned int no_diag:1;     /* True if the file failed to update and no
                                    diagnostics has been issued (dontcare). */
   };
diff -upr make-4.2.orig/main.c make-4.2/main.c
--- make-4.2.orig/main.c	2016-06-01 10:55:27.579700121 +0200
+++ make-4.2/main.c	2016-06-01 10:55:48.086259674 +0200
@@ -2262,10 +2262,6 @@ main (int argc, char **argv, char **envp
 
             for (i = 0, d = read_files; d != 0; ++i, d = d->next)
               {
-                /* Reset the considered flag; we may need to look at the file
-                   again to print an error.  */
-                d->file->considered = 0;
-
                 if (d->file->updated)
                   {
                     /* This makefile was updated.  */
diff -upr make-4.2.orig/remake.c make-4.2/remake.c
--- make-4.2.orig/remake.c	2016-06-01 10:55:27.563033542 +0200
+++ make-4.2/remake.c	2016-06-01 10:55:48.086259674 +0200
@@ -57,8 +57,9 @@ unsigned int commands_started = 0;
 static struct goaldep *goal_list;
 static struct dep *goal_dep;
 
-/* Current value for pruning the scan of the goal chain (toggle 0/1).  */
-static unsigned int considered;
+/* Current value for pruning the scan of the goal chain.
+   All files start with considered == 0.  */
+static unsigned int considered = 0;
 
 static enum update_status update_file (struct file *file, unsigned int depth);
 static enum update_status update_file_1 (struct file *file, unsigned int depth);
@@ -90,12 +91,12 @@ update_goal_chain (struct goaldep *goald
 
   goal_list = rebuilding_makefiles ? goaldeps : NULL;
 
-  /* All files start with the considered bit 0, so the global value is 1.  */
-  considered = 1;
-
 #define MTIME(file) (rebuilding_makefiles ? file_mtime_no_search (file) \
                      : file_mtime (file))
 
+  /* Start a fresh batch of consideration.  */
+  ++considered;
+
   /* Update all the goals until they are all finished.  */
 
   while (goals != 0)
@@ -247,10 +248,10 @@ update_goal_chain (struct goaldep *goald
             }
         }
 
-      /* If we reached the end of the dependency graph toggle the considered
-         flag for the next pass.  */
+      /* If we reached the end of the dependency graph update CONSIDERED
+         for the next pass.  */
       if (g == 0)
-        considered = !considered;
+        ++considered;
     }
 
   if (rebuilding_makefiles)
@@ -615,8 +616,8 @@ update_file_1 (struct file *file, unsign
             break;
 
           if (!running)
-            /* The prereq is considered changed if the timestamp has changed while
-               it was built, OR it doesn't exist.  */
+            /* The prereq is considered changed if the timestamp has changed
+               while it was built, OR it doesn't exist.  */
             d->changed = ((file_mtime (d->file) != mtime)
                           || (mtime == NONEXISTENT_MTIME));
 
@@ -650,7 +651,7 @@ update_file_1 (struct file *file, unsign
             /* We may have already considered this file, when we didn't know
                we'd need to update it.  Force update_file() to consider it and
                not prune it.  */
-            d->file->considered = !considered;
+            d->file->considered = 0;
 
             new = update_file (d->file, depth);
             if (new > dep_status)
@@ -1087,7 +1088,7 @@ check_dep (struct file *file, unsigned i
               /* If the target was waiting for a dependency it has to be
                  reconsidered, as that dependency might have finished.  */
               if (file->command_state == cs_deps_running)
-                file->considered = !considered;
+                file->considered = 0;
 
               set_command_state (file, cs_not_started);
             }
diff -upr make-4.2.orig/tests/scripts/features/double_colon make-4.2/tests/scripts/features/double_colon
--- make-4.2.orig/tests/scripts/features/double_colon	2016-06-01 10:55:27.576366805 +0200
+++ make-4.2/tests/scripts/features/double_colon	2016-06-01 10:55:48.086259674 +0200
@@ -197,6 +197,21 @@ all:: 3
 ',
               '-rs -j2 1 2 root', "all_one\nall_two\nroot\n");
 
+# SV 47995 : Parallel double-colon rules with FORCE
+
+run_make_test('
+all:: ; @echo one
+
+all:: joe ; @echo four
+
+joe: FORCE ; touch joe-is-forced
+
+FORCE:
+',
+              '-j5', "one\ntouch joe-is-forced\nfour\n");
+
+unlink('joe-is-forced');
+
 # This tells the test driver that the perl test script executed properly.
 1;