Changeset 2591 for trunk/src/kmk/rule.c


Ignore:
Timestamp:
Jun 17, 2012, 10:45:31 PM (13 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 3.82. Previous GNU make base version was gnumake-2008-10-28-CVS.

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

    • Property svn:ignore
      •  

        old new  
        1313stamp-*
        1414makebook*
         15
        1516.*gdbinit
         17.gdb_history
         18
        1619*.dep
        1720*.dvi
         
        3134*.pg
        3235*.pgs
         36
        3337README
        3438README.DOS
        3539README.W32
         40README.OS2
        3641aclocal.m4
        3742autom4te.cache
         
        5257config.h.W32
        5358config.h-vms
         59
        5460loadavg
        5561loadavg.c
        5662make
         63
        5764.deps
        5865.dep_segment
         66ID
         67TAGS
         68
        5969_*
        6070sun4
         
        7282sol2
        7383i486-linux
         84
        7485customs
         86
        7587install-sh
        7688mkinstalldirs
         89
         90.directive.asc
  • trunk/src/kmk/rule.c

    r2137 r2591  
    11/* Pattern and suffix rule internals for GNU Make.
    22Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    4 Foundation, Inc.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    9797      for (dep = rule->deps; dep != 0; dep = dep->next)
    9898        {
    99           unsigned int len = strlen (dep->name);
     99          const char *dname = dep_name (dep);
     100          unsigned int len = strlen (dname);
    100101
    101102#ifdef VMS
    102           const char *p = strrchr (dep->name, ']');
     103          const char *p = strrchr (dname, ']');
    103104          const char *p2;
    104105          if (p == 0)
    105             p = strrchr (dep->name, ':');
    106           p2 = p != 0 ? strchr (dep->name, '%') : 0;
     106            p = strrchr (dname, ':');
     107          p2 = p != 0 ? strchr (dname, '%') : 0;
    107108#else
    108           const char *p = strrchr (dep->name, '/');
    109           const char *p2 = p != 0 ? strchr (dep->name, '%') : 0;
     109          const char *p = strrchr (dname, '/');
     110          const char *p2 = p != 0 ? strchr (dname, '%') : 0;
    110111#endif
    111           ndeps++;
     112          ndeps++;
    112113
    113114          if (len > max_pattern_dep_length)
     
    118119              /* There is a slash before the % in the dep name.
    119120                 Extract the directory name.  */
    120               if (p == dep->name)
     121              if (p == dname)
    121122                ++p;
    122               if (p - dep->name > namelen)
     123              if (p - dname > namelen)
    123124                {
    124                   namelen = p - dep->name;
     125                  namelen = p - dname;
    125126                  name = xrealloc (name, namelen + 1);
    126127                }
    127               memcpy (name, dep->name, p - dep->name);
    128               name[p - dep->name] = '\0';
     128              memcpy (name, dname, p - dname);
     129              name[p - dname] = '\0';
    129130
    130131              /* In the deps of an implicit rule the `changed' flag
     
    380381
    381382  ptr = p->dep;
    382 #ifndef CONFIG_WITH_ALLOC_CACHES
    383   r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0',
    384                                                        sizeof (struct dep), 1),
    385                                        sizeof (struct dep));
    386 #else
    387   r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0',
    388                                                        &dep_cache, 1),
    389                                        &dep_cache);
    390 #endif
     383  r->deps = PARSE_FILE_SEQ (&ptr, struct dep, '\0', NULL, 0);
    391384
    392385  if (new_pattern_rule (r, 0))
     
    419412{
    420413  struct rule *next = rule->next;
    421   struct dep *dep;
    422 
    423   dep = rule->deps;
    424   while (dep)
    425     {
    426       struct dep *t = dep->next;
    427       free_dep (dep);
    428       dep = t;
    429     }
    430 
    431   free (rule->targets);
    432   free (rule->suffixes);
     414
     415  free_dep_chain (rule->deps);
     416
     417  /* MSVC erroneously warns without a cast here.  */
     418  free ((void *)rule->targets);
     419  free ((void *)rule->suffixes);
    433420  free (rule->lens);
    434421
     
    505492{
    506493  unsigned int i;
    507   struct dep *d;
    508494
    509495  for (i = 0; i < r->num; ++i)
     
    515501    putchar (':');
    516502
    517   for (d = r->deps; d != 0; d = d->next)
    518     printf (" %s", dep_name (d));
    519   putchar ('\n');
     503  print_prereqs (r->deps);
    520504
    521505  if (r->cmds != 0)
     
    564548         makefiles and thus count_implicit_rule_limits wasn't called yet.  */
    565549      if (num_pattern_rules != 0)
    566         fatal (NILF, _("BUG: num_pattern_rules wrong!  %u != %u"),
     550        fatal (NILF, _("BUG: num_pattern_rules is wrong!  %u != %u"),
    567551               num_pattern_rules, rules);
    568552    }
Note: See TracChangeset for help on using the changeset viewer.