diff options
author | rillig <rillig> | 2007-10-26 09:41:49 +0000 |
---|---|---|
committer | rillig <rillig> | 2007-10-26 09:41:49 +0000 |
commit | 43b0df42da6ff88de0ad0b9148b9d293278e7b5b (patch) | |
tree | 962554ea2501e6dbe50eb8dc519f30ec50d74c5e /devel | |
parent | f184b6ba7f83fbf2bd26784c13bd4788ee6cd343 (diff) | |
download | pkgsrc-43b0df42da6ff88de0ad0b9148b9d293278e7b5b.tar.gz |
Emit a warning if the function name "empty" is followed by anything
other than an open parenthesis. Currently, the following lines are all
valid and equivalent:
.if empty(foo)
.if empty or nonempty or whatever(foo)
.if empty?????????????(foo)
.if empty ${foo} (bar)
All except the first line are probably mistakes.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/bmake/files/cond.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/devel/bmake/files/cond.c b/devel/bmake/files/cond.c index 504d907d188..e9dae8dba84 100644 --- a/devel/bmake/files/cond.c +++ b/devel/bmake/files/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.1.1.1 2005/12/02 00:02:59 sjg Exp $ */ +/* $NetBSD: cond.c,v 1.2 2007/10/26 09:41:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.1.1.1 2005/12/02 00:02:59 sjg Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.2 2007/10/26 09:41:49 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.1.1.1 2005/12/02 00:02:59 sjg Exp $"); +__RCSID("$NetBSD: cond.c,v 1.2 2007/10/26 09:41:49 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -898,12 +898,18 @@ error: condExpr += 5; + if (condExpr[0] != '(') + Parse_Error(PARSE_WARNING, "Extra characters after \"empty\""); for (arglen = 0; condExpr[arglen] != '(' && condExpr[arglen] != '\0'; arglen += 1) continue; if (condExpr[arglen] != '\0') { + /* Var_Parse usually gets a string like "$(varname)". + * It doesn't care about the first character, so + * we can pass anything here, even the 'y' of "empty". + */ val = Var_Parse(&condExpr[arglen - 1], VAR_CMD, FALSE, &length, &doFree); if (val == var_Error) { |