From c8bc46c4bca2c0c56dd91359ca5de8a30a157511 Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 6 Feb 2008 18:26:37 +0000 Subject: [PATCH] Warn for constructs like .if empty xxx(foo) which are interpreted as .if empty(foo) or .if empty (foo) This is based on rillig's commit to pkgsrc/devel/bmake, but doesn't warn for the third case. Discussed with sjg. --- usr.bin/make/cond.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index 34b9dd596a2a..059348705b67 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.37 2007/02/04 19:23:49 dsl Exp $ */ +/* $NetBSD: cond.c,v 1.38 2008/02/06 18:26:37 joerg 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.37 2007/02/04 19:23:49 dsl Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.38 2008/02/06 18:26:37 joerg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.37 2007/02/04 19:23:49 dsl Exp $"); +__RCSID("$NetBSD: cond.c,v 1.38 2008/02/06 18:26:37 joerg Exp $"); #endif #endif /* not lint */ #endif @@ -909,10 +909,13 @@ error: condExpr += 5; - for (arglen = 0; - condExpr[arglen] != '(' && condExpr[arglen] != '\0'; - arglen += 1) - continue; + for (arglen = 0; condExpr[arglen] != '\0'; arglen += 1) { + if (condExpr[arglen] == '(') + break; + if (!isspace((unsigned char)condExpr[arglen])) + Parse_Error(PARSE_WARNING, + "Extra characters after \"empty\""); + } if (condExpr[arglen] != '\0') { val = Var_Parse(&condExpr[arglen - 1], VAR_CMD,