Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make: generate more specific error message on m...



details:   https://anonhg.NetBSD.org/src/rev/564c55d28d16
branches:  trunk
changeset: 1027568:564c55d28d16
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 12 08:36:21 2021 +0000

description:
make: generate more specific error message on malformed conditional

diffstat:

 usr.bin/make/cond.c                   |  12 ++++--------
 usr.bin/make/unit-tests/cond-func.exp |   2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r cb7a02598632 -r 564c55d28d16 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sat Dec 11 23:47:53 2021 +0000
+++ b/usr.bin/make/cond.c       Sun Dec 12 08:36:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.298 2021/12/11 11:13:30 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.299 2021/12/12 08:36:21 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.298 2021/12/11 11:13:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.299 2021/12/12 08:36:21 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -230,11 +230,6 @@
        if (func != NULL)
                p++;            /* Skip opening '(' - verified by caller */
 
-       if (*p == '\0') {
-               *out_arg = NULL; /* Missing closing parenthesis: */
-               return 0;       /* .if defined( */
-       }
-
        cpp_skip_hspace(&p);
 
        Buf_InitSize(&argBuf, 16);
@@ -778,8 +773,9 @@
 
        arglen = ParseFuncArg(par, &cp, doEval, fn->fn_name, &arg);
        if (arglen == 0) {
+               *out_token = TOK_FALSE;
+               free(arg);
                par->p = cp;
-               *out_token = TOK_FALSE;
                return true;
        }
 
diff -r cb7a02598632 -r 564c55d28d16 usr.bin/make/unit-tests/cond-func.exp
--- a/usr.bin/make/unit-tests/cond-func.exp     Sat Dec 11 23:47:53 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-func.exp     Sun Dec 12 08:36:21 2021 +0000
@@ -6,7 +6,7 @@
 make: "cond-func.mk" line 109: A plain function name is parsed as !empty(...).
 make: "cond-func.mk" line 119: Symbols may start with a function name.
 make: "cond-func.mk" line 124: Symbols may start with a function name.
-make: "cond-func.mk" line 130: Malformed conditional (defined()
+make: "cond-func.mk" line 130: Missing closing parenthesis for defined()
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1



Home | Main Index | Thread Index | Old Index