tech-toolchain archive

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

make: invalid malformed conditional error



The change to the unit test below, shows a valid conditional, that
causes an error:

Malformed conditional (defined(nosuch) && ${nosuch:Mx} != "")

without the modifier it behaves correctly.
The fix is to return varNoError when we have a junk var and told that
missing vars are ok.

Index: var.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/var.c,v
retrieving revision 1.161
diff -u -p -r1.161 var.c
--- var.c       2 Dec 2010 16:46:22 -0000       1.161
+++ var.c       4 Mar 2011 05:04:42 -0000
@@ -3746,7 +3746,7 @@ Var_Parse(const char *str, GNode *ctxt, 
                nstr = bmake_strndup(start, *lengthPtr);
                *freePtr = nstr;
            } else {
-               nstr = var_Error;
+               nstr = errnum ? var_Error : varNoError;
            }
        }
        if (nstr != Buf_GetAll(&v->val, NULL))
Index: unit-tests/cond1
===================================================================
RCS file: /cvsroot/src/usr.bin/make/unit-tests/cond1,v
retrieving revision 1.4
diff -u -p -r1.4 cond1
--- unit-tests/cond1    29 Oct 2008 15:37:08 -0000      1.4
+++ unit-tests/cond1    4 Mar 2011 05:04:42 -0000
@@ -95,6 +95,10 @@ C=clever
 C=dim
 .endif
 
+.if defined(nosuch) && ${nosuch:Mx} != ""
+.info nosuch is x
+.endif
+
 all:
        @echo "$n is $X prime"
        @echo "A='$A' B='$B' C='$C' o='$o,${o2}'"




Home | Main Index | Thread Index | Old Index