Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for function call ...



details:   https://anonhg.NetBSD.org/src/rev/a3e74a9d69ec
branches:  trunk
changeset: 956876:a3e74a9d69ec
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 22:38:28 2020 +0000

description:
make(1): add test for function call in .ifdef directive

diffstat:

 usr.bin/make/unit-tests/directive-ifdef.exp |   1 +
 usr.bin/make/unit-tests/directive-ifdef.mk  |  12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r a455672adfdc -r a3e74a9d69ec usr.bin/make/unit-tests/directive-ifdef.exp
--- a/usr.bin/make/unit-tests/directive-ifdef.exp       Sun Nov 08 22:37:52 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-ifdef.exp       Sun Nov 08 22:38:28 2020 +0000
@@ -1,1 +1,2 @@
+make: "directive-ifdef.mk" line 12: Function calls in .ifdef are possible.
 exit status 0
diff -r a455672adfdc -r a3e74a9d69ec usr.bin/make/unit-tests/directive-ifdef.mk
--- a/usr.bin/make/unit-tests/directive-ifdef.mk        Sun Nov 08 22:37:52 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-ifdef.mk        Sun Nov 08 22:38:28 2020 +0000
@@ -1,8 +1,18 @@
-# $NetBSD: directive-ifdef.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-ifdef.mk,v 1.3 2020/11/08 22:38:28 rillig Exp $
 #
 # Tests for the .ifdef directive.
 
 # TODO: Implementation
 
+DEFINED=       defined
+
+# It looks redundant to have a call to defined() in an .ifdef, but it's
+# possible.  The .ifdef only affects plain symbols, not function calls.
+.ifdef defined(DEFINED)
+.  info Function calls in .ifdef are possible.
+.else
+.  error
+.endif
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index