summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-10-26 09:41:49 +0000
committerrillig <rillig@pkgsrc.org>2007-10-26 09:41:49 +0000
commit9f649ecff237604ec84c833e228636f23fa674a3 (patch)
tree962554ea2501e6dbe50eb8dc519f30ec50d74c5e
parent8efe8794ae3ee825b50bab1154770c4479590d10 (diff)
downloadpkgsrc-9f649ecff237604ec84c833e228636f23fa674a3.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.
-rw-r--r--devel/bmake/files/cond.c12
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) {