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 13:41:42 -0400

Alas, I just discovered that the patch I sent you is correct for Make
3.78.1 but not for 3.79.1.  Here's an equivalent patch for 3.79.1.

diff -ru make-3.79.1-4/filedef.h /u/jik/cygwin-cvs/src/make-3.79.1-4/filedef.h
--- make-3.79.1-4/filedef.h     Tue Jun 26 15:16:34 2001
+++ /u/jik/cygwin-cvs/src/make-3.79.1-4/filedef.h       Fri Aug 31 13:32:31 2001
@@ -48,10 +48,6 @@
     /* List of variable sets used for this file.  */
     struct variable_set_list *variables;
 
-    /* Pattern-specific variable reference for this target, or null if there
-       isn't one.  Also see the pat_searched flag, below.  */
-    struct variable_set_list *pat_variables;
-
     /* Immediate dependent that caused this target to be remade,
        or nil if there isn't one.  */
     struct file *parent;
diff -ru make-3.79.1-4/rule.c /u/jik/cygwin-cvs/src/make-3.79.1-4/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/rule.c  Fri Aug 31 13:10:23 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;
diff -ru make-3.79.1-4/rule.h /u/jik/cygwin-cvs/src/make-3.79.1-4/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/rule.h  Fri Aug 31 13:10:23 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/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/variable.c      Fri Aug 31 13:33:52 2001
@@ -312,25 +312,18 @@
 
   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 = l->next;
+          l->next = pat_variables;
         }
-    }
-
-  /* If we have a pattern variable match, set it up.  */
 
-  if (file->pat_variables != 0)
-    {
-      file->pat_variables->next = l->next;
-      l->next = file->pat_variables;
+      file->pat_searched = 1;
     }
 }
 



reply via email to

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