[BACK]Return to parse.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/parse.c between version 1.104 and 1.105

version 1.104, 2012/04/20 13:28:11 version 1.105, 2012/09/21 07:55:20
Line 547 
Line 547 
                 gn->type &= ~OP_DUMMY;                  gn->type &= ~OP_DUMMY;
         }          }
   
         if (gn != NULL)          /* try to find a proper location for a target in a file, by
                 Array_AtEnd(&gtargets, gn);           * filling it repeatedly until the target has commands..
            * This is not perfect for .USE targets...
            */
           if ((gn->type & OP_HAS_COMMANDS) == 0)
                   Parse_FillLocation(&gn->origin);
   
           Array_AtEnd(&gtargets, gn);
 }  }
   
 static void  static void
Line 1040 
Line 1046 
 {  {
         GNode *gn = (GNode *)gnp;          GNode *gn = (GNode *)gnp;
         /* if target already supplied, ignore commands */          /* if target already supplied, ignore commands */
         if (!(gn->type & OP_HAS_COMMANDS)) {          if (!(gn->type & OP_HAS_COMMANDS))
                 Lst_AtEnd(&gn->commands, cmd);                  Lst_AtEnd(&gn->commands, cmd);
                 if (!gn->origin.lineno)  
                         Parse_FillLocation(&gn->origin);  
         }  
 }  }
   
 /*-  /*-
Line 1441 
Line 1444 
 {  {
         /* add the command to the list of          /* add the command to the list of
          * commands of all targets in the dependency spec */           * commands of all targets in the dependency spec */
         char *cmd = estrdup(line);  
   
           struct command *cmd;
           size_t len = strlen(line);
   
           cmd = emalloc(sizeof(struct command) + len);
           memcpy(&cmd->string, line, len+1);
           Parse_FillLocation(&cmd->location);
   
   
         Array_ForEach(targets, ParseAddCmd, cmd);          Array_ForEach(targets, ParseAddCmd, cmd);
 #ifdef CLEANUP  #ifdef CLEANUP
         Lst_AtEnd(&targCmds, cmd);          Lst_AtEnd(&targCmds, cmd);
Line 1486 
Line 1496 
         size_t pos;          size_t pos;
         char *end;          char *end;
         char *cp;          char *cp;
         char *dep;          char *cmd;
   
         /* let's start a new set of commands */          /* let's start a new set of commands */
         Array_Reset(targets);          Array_Reset(targets);
   
         /* XXX this is a dirty heuristic to handle target: dep ; commands */          /* XXX this is a dirty heuristic to handle target: dep ; commands */
         dep = NULL;          cmd = NULL;
         /* First we need to find eventual dependencies */          /* First we need to find eventual dependencies */
         pos = strcspn(stripped, ":!");          pos = strcspn(stripped, ":!");
         /* go over :!, and find ;  */          /* go over :!, and find ;  */
Line 1501 
Line 1511 
                 if (line != stripped)                  if (line != stripped)
                         /* find matching ; in original... The                          /* find matching ; in original... The
                          * original might be slightly longer.  */                           * original might be slightly longer.  */
                         dep = strchr(line+(end-stripped), ';');                          cmd = strchr(line+(end-stripped), ';');
                 else                  else
                         dep = end;                          cmd = end;
                 /* kill end of line. */                  /* kill end of line. */
                 *end = '\0';                  *end = '\0';
         }          }
Line 1514 
Line 1524 
         ParseDoDependency(cp);          ParseDoDependency(cp);
         free(cp);          free(cp);
   
         /* Parse dependency if it's not empty. */          /* Parse command if it's not empty. */
         if (dep != NULL) {          if (cmd != NULL) {
                 do {                  do {
                         dep++;                          cmd++;
                 } while (isspace(*dep));                  } while (isspace(*cmd));
                 if (*dep != '\0')                  if (*cmd != '\0')
                         parse_commands(targets, dep);                          parse_commands(targets, cmd);
         }          }
 }  }
   

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.105