Module Name: src Committed By: rillig Date: Wed Dec 29 08:23:40 UTC 2021
Modified Files: src/usr.bin/make: cond.c Log Message: make: in irrelevant function calls in conditions, return false When a condition contains an irrelevant function call, it doesn't matter whether the function call evaluates to true or to false, it will be discarded anyway by either CondParser_And or CondParser_Or. Returning false instead of true makes the code simpler, plus it is more common to return false for irrelevant results. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/cond.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.315 src/usr.bin/make/cond.c:1.316 --- src/usr.bin/make/cond.c:1.315 Wed Dec 29 08:15:45 2021 +++ src/usr.bin/make/cond.c Wed Dec 29 08:23:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.315 2021/12/29 08:15:45 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.316 2021/12/29 08:23:40 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.315 2021/12/29 08:15:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.316 2021/12/29 08:23:40 rillig Exp $"); /* * The parsing of conditional expressions is based on this grammar: @@ -762,7 +762,7 @@ CondParser_FuncCall(CondParser *par, boo return false; ok = ParseWord(par, &p, doEval, fn_name, &arg); - *out_token = ToToken(ok && (!doEval || fn(arg))); + *out_token = ToToken(ok && doEval && fn(arg)); free(arg); par->p = p;