=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/parse.c,v retrieving revision 1.71 retrieving revision 1.72 diff -c -r1.71 -r1.72 *** src/usr.bin/make/parse.c 2007/03/20 03:50:39 1.71 --- src/usr.bin/make/parse.c 2007/07/08 17:44:20 1.72 *************** *** 1,5 **** /* $OpenPackages$ */ ! /* $OpenBSD: parse.c,v 1.71 2007/03/20 03:50:39 tedu Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* --- 1,5 ---- /* $OpenPackages$ */ ! /* $OpenBSD: parse.c,v 1.72 2007/07/08 17:44:20 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* *************** *** 213,218 **** --- 213,219 ---- static void ParseAddCmd(void *, void *); static void ParseHasCommands(void *); static void ParseDoInclude(char *); + static void ParseDoPoison(char *); static void ParseTraditionalInclude(char *); static void ParseConditionalInclude(char *); static void ParseLookupIncludeFile(char *, char *, bool, bool); *************** *** 1337,1344 **** --- 1338,1407 ---- } + static void + ParseDoPoison(char *line) + { + char *p = line; + int type = POISON_NORMAL; + bool not = false; + bool paren_to_match = false; + char *name, *ename; + while (isspace(*p)) + p++; + if (*p == '!') { + not = true; + p++; + } + while (isspace(*p)) + p++; + if (strncmp(p, "defined", 7) == 0) { + type = POISON_DEFINED; + p += 7; + } else if (strncmp(p, "empty", 5) == 0) { + type = POISON_EMPTY; + p += 5; + } + while (isspace(*p)) + p++; + if (*p == '(') { + paren_to_match = true; + p++; + } + while (isspace(*p)) + p++; + name = ename = p; + while (*p != '\0' && !isspace(*p)) { + if (*p == ')' && paren_to_match) { + paren_to_match = false; + p++; + break; + } + p++; + ename = p; + } + while (isspace(*p)) + p++; + switch(type) { + case POISON_NORMAL: + case POISON_EMPTY: + if (not) + type = POISON_INVALID; + break; + case POISON_DEFINED: + if (not) + type = POISON_NOT_DEFINED; + else + type = POISON_INVALID; + break; + } + if ((*p != '\0' && *p != '#') || type == POISON_INVALID) + Parse_Error(PARSE_FATAL, "Invalid syntax for .poison: %s", + line); + Var_MarkPoisoned(name, ename, type); + } + /* Strip comments from the line. May return either a copy of the line, or * the line itself. */ static char * *************** *** 1421,1426 **** --- 1484,1492 ---- case COND_ISINCLUDE: ParseDoInclude(line + 7); return true; + case COND_ISPOISON: + ParseDoPoison(line + 6); + return true; case COND_ISUNDEF: { char *cp; *************** *** 1520,1526 **** if (inDependency) ParseFinishDependency(); ! if (Parse_DoVar(stripped, VAR_GLOBAL)) inDependency = false; else { size_t pos; --- 1586,1592 ---- if (inDependency) ParseFinishDependency(); ! if (Parse_DoVar(stripped)) inDependency = false; else { size_t pos;