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

Diff for /src/usr.bin/make/var.c between version 1.94 and 1.95

version 1.94, 2013/04/23 14:32:53 version 1.95, 2014/01/06 12:08:18
Line 93 
Line 93 
  */   */
 char    var_Error[] = "";  char    var_Error[] = "";
   
   GNode *current_node = NULL;
 /*  /*
  * Similar to var_Error, but returned when the 'err' flag for Var_Parse is   * Similar to var_Error, but returned when the 'err' flag for Var_Parse is
  * set false. Why not just use a constant? Well, gcc likes to condense   * set false. Why not just use a constant? Well, gcc likes to condense
Line 927 
Line 928 
         return val;          return val;
 }  }
   
   #define ERRMSG1 "Using $< in a non-suffix rule context is a GNUmake idiom "
   #define ERRMSG2  "Using undefined dynamic variable $%s "
   static void
   bad_dynamic_variable(int idx)
   {
           Location origin;
   
           Parse_FillLocation(&origin);
           if (idx >= LOCAL_SIZE)
                   idx = EXTENDED2SIMPLE(idx);
           switch(idx) {
           case IMPSRC_INDEX:
                   if (origin.fname)
                           Fatal(ERRMSG1  "(%s:%lu)",
                               origin.lineno, origin.fname);
                   else if (current_node)
                           Fatal(ERRMSG1 "(prereq of %s)", current_node->name);
                   else
                           Fatal(ERRMSG1 "(?)");
                   break;
           default:
                   if (origin.fname)
                           Error(ERRMSG2 "(%s:%lu)", varnames[idx],
                               origin.lineno, origin.fname);
                   else if (current_node)
                           Error(ERRMSG2 "(prereq of %s)", varnames[idx],
                               current_node->name);
                   else
                           Error(ERRMSG2 "(?)", varnames[idx]);
                   break;
           }
   }
   
 char *  char *
 Var_Parse(const char *str,      /* The string to parse */  Var_Parse(const char *str,      /* The string to parse */
     SymTable *ctxt,             /* The context for the variable */      SymTable *ctxt,             /* The context for the variable */
Line 968 
Line 1002 
                                 *freePtr = true;                                  *freePtr = true;
                                 val = Str_dupi(str, tstr);                                  val = Str_dupi(str, tstr);
                         } else {                          } else {
                                 Location origin;                                  bad_dynamic_variable(idx);
   
                                 Parse_FillLocation(&origin);  
                                 if (idx >= LOCAL_SIZE)  
                                         idx = EXTENDED2SIMPLE(idx);  
                                 switch(idx) {  
                                 case IMPSRC_INDEX:  
                                         Fatal(  
 "Using $< in a non-suffix rule context is a GNUmake idiom (line %lu of %s)",  
                                             origin.lineno, origin.fname);  
                                         break;  
                                 default:  
                                         Error(  
 "Using undefined dynamic variable $%s (line %lu of %s)",  
                                             varnames[idx], origin.lineno,  
                                             origin.fname);  
                                         break;  
                                 }  
                         }                          }
                 }                  }
         }          }

Legend:
Removed from v.1.94  
changed lines
  Added in v.1.95