[BACK]Return to suff.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / make

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/make/suff.c between version 1.164 and 1.165

version 1.164, 2020/09/25 17:14:32 version 1.165, 2020/09/25 17:55:19
Line 599  Suff_AddTransform(char *line)
Line 599  Suff_AddTransform(char *line)
   
 /* Handle the finish of a transformation definition, removing the  /* Handle the finish of a transformation definition, removing the
  * transformation from the graph if it has neither commands nor sources.   * transformation from the graph if it has neither commands nor sources.
  * This is a callback procedure for the Parse module via Lst_ForEachUntil.  
  *   *
  * If the node has no commands or children, the children and parents lists   * If the node has no commands or children, the children and parents lists
  * of the affected suffixes are altered.   * of the affected suffixes are altered.
Line 664  Suff_EndTransform(GNode *gn)
Line 663  Suff_EndTransform(GNode *gn)
  * Input:   * Input:
  *      transformp      Transformation to test   *      transformp      Transformation to test
  *      sp              Suffix to rebuild   *      sp              Suffix to rebuild
  *  
  * Results:  
  *      0, so that Lst_ForEachUntil continues  
  */   */
 static int  static void
 SuffRebuildGraph(void *transformp, void *sp)  SuffRebuildGraph(void *transformp, void *sp)
 {  {
     GNode       *transform = (GNode *)transformp;      GNode       *transform = (GNode *)transformp;
Line 691  SuffRebuildGraph(void *transformp, void 
Line 687  SuffRebuildGraph(void *transformp, void 
             s2 = LstNode_Datum(ln);              s2 = LstNode_Datum(ln);
             SuffInsert(s2->children, s);              SuffInsert(s2->children, s);
             SuffInsert(s->parents, s2);              SuffInsert(s->parents, s2);
             return 0;              return;
         }          }
     }      }
   
Line 722  SuffRebuildGraph(void *transformp, void 
Line 718  SuffRebuildGraph(void *transformp, void 
             SuffInsert(s2->parents, s);              SuffInsert(s2->parents, s);
         }          }
     }      }
     return 0;  
 }  }
   
 /* Called from Suff_AddSuffix via Lst_ForEachUntil to search through the list of  /* Called from Suff_AddSuffix via Lst_ForEachUntil to search through the list of
Line 814  Suff_AddSuffix(const char *name, GNode *
Line 809  Suff_AddSuffix(const char *name, GNode *
          * Look for any existing transformations from or to this suffix.           * Look for any existing transformations from or to this suffix.
          * XXX: Only do this after a Suff_ClearSuffixes?           * XXX: Only do this after a Suff_ClearSuffixes?
          */           */
         Lst_ForEachUntil(transforms, SuffRebuildGraph, s);          Lst_ForEach(transforms, SuffRebuildGraph, s);
     }      }
 }  }
   
Line 926  Suff_AddLib(const char *sname)
Line 921  Suff_AddLib(const char *sname)
           /********** Implicit Source Search Functions *********/            /********** Implicit Source Search Functions *********/
   
 #ifdef DEBUG_SRC  #ifdef DEBUG_SRC
 static int  static void
 PrintAddr(void *a, void *b MAKE_ATTR_UNUSED)  PrintAddr(void *a, void *b MAKE_ATTR_UNUSED)
 {  {
     printf("%lx ", (unsigned long) a);      printf("%lx ", (unsigned long) a);
     return 0;  
 }  }
 #endif  #endif
   
Line 941  PrintAddr(void *a, void *b MAKE_ATTR_UNU
Line 935  PrintAddr(void *a, void *b MAKE_ATTR_UNU
  * Input:   * Input:
  *      sp              suffix for which to create a Src structure   *      sp              suffix for which to create a Src structure
  *      lsp             list and parent for the new Src   *      lsp             list and parent for the new Src
  *  
  * Results:  
  *      0, so that Lst_ForEachUntil continues  
  */   */
 static int  static void
 SuffAddSrc(void *sp, void *lsp)  SuffAddSrc(void *sp, void *lsp)
 {  {
     Suff        *s = (Suff *)sp;      Suff        *s = (Suff *)sp;
Line 975  SuffAddSrc(void *sp, void *lsp)
Line 966  SuffAddSrc(void *sp, void *lsp)
         s2->cp = Lst_Init();          s2->cp = Lst_Init();
         Lst_Append(targ->cp, s2);          Lst_Append(targ->cp, s2);
         fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l);          fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l);
         Lst_ForEachUntil(ls->l, PrintAddr, NULL);          Lst_ForEach(ls->l, PrintAddr, NULL);
         fprintf(debug_file, "\n");          fprintf(debug_file, "\n");
 #endif  #endif
     }      }
Line 993  SuffAddSrc(void *sp, void *lsp)
Line 984  SuffAddSrc(void *sp, void *lsp)
     s2->cp = Lst_Init();      s2->cp = Lst_Init();
     Lst_Append(targ->cp, s2);      Lst_Append(targ->cp, s2);
     fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l);      fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l);
     Lst_ForEachUntil(ls->l, PrintAddr, NULL);      Lst_ForEach(ls->l, PrintAddr, NULL);
     fprintf(debug_file, "\n");      fprintf(debug_file, "\n");
 #endif  #endif
   
     return 0;  
 }  }
   
 /* Add all the children of targ as Src structures to the given list.  /* Add all the children of targ as Src structures to the given list.
Line 1014  SuffAddLevel(SrcList *l, Src *targ)
Line 1003  SuffAddLevel(SrcList *l, Src *targ)
     ls.s = targ;      ls.s = targ;
     ls.l = l;      ls.l = l;
   
     Lst_ForEachUntil(targ->suff->children, SuffAddSrc, &ls);      Lst_ForEach(targ->suff->children, SuffAddSrc, &ls);
 }  }
   
 /* Free the first Src in the list that doesn't have a reference count.  /* Free the first Src in the list that doesn't have a reference count.
Line 1029  SuffRemoveSrc(SrcList *l)
Line 1018  SuffRemoveSrc(SrcList *l)
   
 #ifdef DEBUG_SRC  #ifdef DEBUG_SRC
     fprintf(debug_file, "cleaning %lx: ", (unsigned long) l);      fprintf(debug_file, "cleaning %lx: ", (unsigned long) l);
     Lst_ForEachUntil(l, PrintAddr, NULL);      Lst_ForEach(l, PrintAddr, NULL);
     fprintf(debug_file, "\n");      fprintf(debug_file, "\n");
 #endif  #endif
   
Line 1059  SuffRemoveSrc(SrcList *l)
Line 1048  SuffRemoveSrc(SrcList *l)
 #ifdef DEBUG_SRC  #ifdef DEBUG_SRC
         else {          else {
             fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children);              fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children);
             Lst_ForEachUntil(s->cp, PrintAddr, NULL);              Lst_ForEach(s->cp, PrintAddr, NULL);
             fprintf(debug_file, "\n");              fprintf(debug_file, "\n");
         }          }
 #endif  #endif
Line 2193  Suff_End(void)
Line 2182  Suff_End(void)
   
 /********************* DEBUGGING FUNCTIONS **********************/  /********************* DEBUGGING FUNCTIONS **********************/
   
 static int SuffPrintName(void *s, void *dummy MAKE_ATTR_UNUSED)  static void
   SuffPrintName(void *s, void *dummy MAKE_ATTR_UNUSED)
 {  {
   
     fprintf(debug_file, "%s ", ((Suff *)s)->name);      fprintf(debug_file, "%s ", ((Suff *)s)->name);
     return 0;  
 }  }
   
 static int  static void
 SuffPrintSuff(void *sp, void *dummy MAKE_ATTR_UNUSED)  SuffPrintSuff(void *sp, void *dummy MAKE_ATTR_UNUSED)
 {  {
     Suff    *s = (Suff *)sp;      Suff    *s = (Suff *)sp;
Line 2216  SuffPrintSuff(void *sp, void *dummy MAKE
Line 2204  SuffPrintSuff(void *sp, void *dummy MAKE
     }      }
     fputc('\n', debug_file);      fputc('\n', debug_file);
     fprintf(debug_file, "#\tTo: ");      fprintf(debug_file, "#\tTo: ");
     Lst_ForEachUntil(s->parents, SuffPrintName, NULL);      Lst_ForEach(s->parents, SuffPrintName, NULL);
     fputc('\n', debug_file);      fputc('\n', debug_file);
     fprintf(debug_file, "#\tFrom: ");      fprintf(debug_file, "#\tFrom: ");
     Lst_ForEachUntil(s->children, SuffPrintName, NULL);      Lst_ForEach(s->children, SuffPrintName, NULL);
     fputc('\n', debug_file);      fputc('\n', debug_file);
     fprintf(debug_file, "#\tSearch Path: ");      fprintf(debug_file, "#\tSearch Path: ");
     Dir_PrintPath(s->searchPath);      Dir_PrintPath(s->searchPath);
     fputc('\n', debug_file);      fputc('\n', debug_file);
     return 0;  
 }  }
   
 static int  static void
 SuffPrintTrans(void *tp, void *dummy MAKE_ATTR_UNUSED)  SuffPrintTrans(void *tp, void *dummy MAKE_ATTR_UNUSED)
 {  {
     GNode   *t = (GNode *)tp;      GNode   *t = (GNode *)tp;
Line 2237  SuffPrintTrans(void *tp, void *dummy MAK
Line 2224  SuffPrintTrans(void *tp, void *dummy MAK
     fputc('\n', debug_file);      fputc('\n', debug_file);
     Targ_PrintCmds(t);      Targ_PrintCmds(t);
     fputc('\n', debug_file);      fputc('\n', debug_file);
     return 0;  
 }  }
   
 void  void
 Suff_PrintAll(void)  Suff_PrintAll(void)
 {  {
     fprintf(debug_file, "#*** Suffixes:\n");      fprintf(debug_file, "#*** Suffixes:\n");
     Lst_ForEachUntil(sufflist, SuffPrintSuff, NULL);      Lst_ForEach(sufflist, SuffPrintSuff, NULL);
   
     fprintf(debug_file, "#*** Transformations:\n");      fprintf(debug_file, "#*** Transformations:\n");
     Lst_ForEachUntil(transforms, SuffPrintTrans, NULL);      Lst_ForEach(transforms, SuffPrintTrans, NULL);
 }  }

Legend:
Removed from v.1.164  
changed lines
  Added in v.1.165

CVSweb <webmaster@jp.NetBSD.org>