bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Only one pattern-specific variable assignment per target?


From: Jonathan Kamens
Subject: Re: Only one pattern-specific variable assignment per target?
Date: Fri, 31 Aug 2001 15:35:05 -0400

Sigh.  The patch I submitted for 3.79.1 was wrong.  I *think* this is
a correct patch.

diff -ru make-3.79.1-4/rule.c /u/jik/cygwin-cvs/src/make-3.79.1-4.clean/rule.c
--- make-3.79.1-4/rule.c        Tue Jun 26 15:16:38 2001
+++ /u/jik/cygwin-cvs/src/make-3.79.1-4.clean/rule.c    Fri Aug 31 15:31:35 2001
@@ -579,16 +579,17 @@
   return p;
 }
 
-/* Look up a target in the pattern-specific variable list.  */
+/* Look up a target in the pattern-specific variable list, optionally
+   starting after the last target we looked at. */
 
 struct pattern_var *
-lookup_pattern_var (target)
+lookup_pattern_var (target, p)
      char *target;
+     struct pattern_var *p;
 {
-  struct pattern_var *p;
   unsigned int targlen = strlen(target);
 
-  for (p = pattern_vars; p != 0; p = p->next)
+  for (p = p ? p->next : pattern_vars; p != 0; p = p->next)
     {
       char *stem;
       unsigned int stemlen;
Only in /u/jik/cygwin-cvs/src/make-3.79.1-4.clean: rule.c~
diff -ru make-3.79.1-4/rule.h /u/jik/cygwin-cvs/src/make-3.79.1-4.clean/rule.h
--- make-3.79.1-4/rule.h        Tue Jun 26 15:16:38 2001
+++ /u/jik/cygwin-cvs/src/make-3.79.1-4.clean/rule.h    Fri Aug 31 14:36:14 2001
@@ -62,7 +62,8 @@
 extern void install_pattern_rule PARAMS ((struct pspec *p, int terminal));
 extern int new_pattern_rule PARAMS ((struct rule *rule, int override));
 extern struct pattern_var *create_pattern_var PARAMS ((char *target, char 
*suffix));
-extern struct pattern_var *lookup_pattern_var PARAMS ((char *target));
+extern struct pattern_var *lookup_pattern_var PARAMS ((char *target,
+                                                       struct pattern_var *p));
 extern void count_implicit_rule_limits PARAMS ((void));
 extern void convert_to_pattern PARAMS ((void));
 extern void create_pattern_rule PARAMS ((char **targets,
diff -ru make-3.79.1-4/variable.c 
/u/jik/cygwin-cvs/src/make-3.79.1-4.clean/variable.c
--- make-3.79.1-4/variable.c    Tue Jun 26 15:16:38 2001
+++ /u/jik/cygwin-cvs/src/make-3.79.1-4.clean/variable.c        Fri Aug 31 
15:28:15 2001
@@ -284,7 +284,7 @@
      struct file *file;
      int reading;
 {
-  register struct variable_set_list *l = file->variables;
+  register struct variable_set_list *l = file->variables, *v;
 
   if (l == 0)
     {
@@ -312,25 +312,29 @@
 
   if (!reading && !file->pat_searched)
     {
-      struct pattern_var *p = lookup_pattern_var (file->name);
+      struct pattern_var *p = NULL;
 
-      file->pat_searched = 1;
-      if (p != 0)
+      while ((p = lookup_pattern_var (file->name, p)))
         {
-          /* If we found one, insert it between the current target's
-             variables and the next set, whatever it is.  */
-          file->pat_variables = (struct variable_set_list *)
+          struct variable_set_list *pat_variables = (struct variable_set_list 
*)
             xmalloc (sizeof (struct variable_set_list));
-          file->pat_variables->set = p->vars->set;
+          pat_variables->set = p->vars->set;
+          pat_variables->next = file->pat_variables;
+          file->pat_variables = pat_variables;
         }
+
+      file->pat_searched = 1;
     }
 
   /* If we have a pattern variable match, set it up.  */
 
-  if (file->pat_variables != 0)
+  for (v = file->pat_variables; v; v = v->next)
     {
-      file->pat_variables->next = l->next;
-      l->next = file->pat_variables;
+      struct variable_set_list *vt = (struct variable_set_list *)
+        xmalloc (sizeof (struct variable_set_list));
+      vt->set = v->set;
+      vt->next = l->next;
+      l->next = vt;
     }
 }
 
Only in /u/jik/cygwin-cvs/src/make-3.79.1-4.clean: variable.c~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]