pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/bmake/files Emit a warning if the function name ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b5c2bb0a20a6
branches:  trunk
changeset: 534540:b5c2bb0a20a6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Oct 26 09:41:49 2007 +0000

description:
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:

 devel/bmake/files/cond.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 5cde60cd9ac5 -r b5c2bb0a20a6 devel/bmake/files/cond.c
--- a/devel/bmake/files/cond.c  Fri Oct 26 03:54:54 2007 +0000
+++ b/devel/bmake/files/cond.c  Fri Oct 26 09:41:49 2007 +0000
@@ -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 @@
 
                    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) {



Home | Main Index | Thread Index | Old Index