make(1): fix test for .ifndef when compiled with -DUSE_UCHAR_BOOLEAN

In that compilation variant, TRUE is defined to 255, to see whether all
boolean expressions evaluate to either 1 or 0.  The field If.doNot in
cond.c doesn't do this since it uses the actual value of TRUE.
Therefore, change the evaluation slightly to also handle this case.
This commit is contained in:
rillig 2020-10-05 18:29:20 +00:00
parent d1e081ff69
commit 1c039f5ce4
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.157 2020/10/03 21:19:54 rillig Exp $ */
/* $NetBSD: cond.c,v 1.158 2020/10/05 18:29:20 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -93,7 +93,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
MAKE_RCSID("$NetBSD: cond.c,v 1.157 2020/10/03 21:19:54 rillig Exp $");
MAKE_RCSID("$NetBSD: cond.c,v 1.158 2020/10/05 18:29:20 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@ -537,7 +537,7 @@ EvalNotEmpty(CondParser *par, const char *lhs, Boolean lhsQuoted)
return lhs[0] != 0;
/* Otherwise action default test ... */
return par->if_info->defProc(strlen(lhs), lhs) != par->if_info->doNot;
return par->if_info->defProc(strlen(lhs), lhs) == !par->if_info->doNot;
}
/* Evaluate a numerical comparison, such as in ".if ${VAR} >= 9". */
@ -785,7 +785,7 @@ CondParser_Func(CondParser *par, Boolean doEval)
* after .if must have been taken literally, so the argument cannot
* be empty - even if it contained a variable expansion.
*/
t = !doEval || par->if_info->defProc(arglen, arg) != par->if_info->doNot;
t = !doEval || par->if_info->defProc(arglen, arg) == !par->if_info->doNot;
free(arg);
return t;
}