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: do not treat .USEBEFORE as candidate for ...



details:   https://anonhg.NetBSD.org/src/rev/906f6597f82f
branches:  trunk
changeset: 1029243:906f6597f82f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 14:22:51 2021 +0000

description:
make: do not treat .USEBEFORE as candidate for the main target

A .USE target is not a candidate, so .USEBEFORE shouldn't either.

Since make.h 1.36 from 2001-07-03.  In that commit, OP_USEBEFORE should
have been added to OP_NOTARGET.

diffstat:

 usr.bin/make/make.h                         |  7 +++----
 usr.bin/make/unit-tests/depsrc-use.mk       |  7 ++++++-
 usr.bin/make/unit-tests/depsrc-usebefore.mk |  7 ++++++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 0ba0b2bfa3d1 -r 906f6597f82f usr.bin/make/make.h
--- a/usr.bin/make/make.h       Tue Dec 28 14:06:42 2021 +0000
+++ b/usr.bin/make/make.h       Tue Dec 28 14:22:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.280 2021/12/28 14:06:42 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.281 2021/12/28 14:22:51 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -816,9 +816,8 @@
 MAKE_INLINE bool MAKE_ATTR_USE
 GNode_IsMainCandidate(const GNode *gn)
 {
-       /* XXX: What about OP_USEBEFORE? */
-       return (gn->type & (OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM)) ==
-              0;
+       return (gn->type & (OP_NOTMAIN | OP_USE | OP_USEBEFORE |
+                           OP_EXEC | OP_TRANSFORM)) == 0;
 }
 
 MAKE_INLINE const char * MAKE_ATTR_USE
diff -r 0ba0b2bfa3d1 -r 906f6597f82f usr.bin/make/unit-tests/depsrc-use.mk
--- a/usr.bin/make/unit-tests/depsrc-use.mk     Tue Dec 28 14:06:42 2021 +0000
+++ b/usr.bin/make/unit-tests/depsrc-use.mk     Tue Dec 28 14:22:51 2021 +0000
@@ -1,8 +1,13 @@
-# $NetBSD: depsrc-use.mk,v 1.4 2020/08/22 12:30:57 rillig Exp $
+# $NetBSD: depsrc-use.mk,v 1.5 2021/12/28 14:22:51 rillig Exp $
 #
 # Tests for the special source .USE in dependency declarations,
 # which allows to append common commands to other targets.
 
+# Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
+# regarded as a candidate for the main target.  On the other hand, a .USE
+# target was not.
+not-a-main-candidate: .USE
+
 all: action directly
 
 first: .USE
diff -r 0ba0b2bfa3d1 -r 906f6597f82f usr.bin/make/unit-tests/depsrc-usebefore.mk
--- a/usr.bin/make/unit-tests/depsrc-usebefore.mk       Tue Dec 28 14:06:42 2021 +0000
+++ b/usr.bin/make/unit-tests/depsrc-usebefore.mk       Tue Dec 28 14:22:51 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: depsrc-usebefore.mk,v 1.7 2021/12/28 14:22:51 rillig Exp $
 #
 # Tests for the special source .USEBEFORE in dependency declarations,
 # which allows to prepend common commands to other targets.
@@ -7,6 +7,11 @@
 #      .USE
 #      depsrc-use.mk
 
+# Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
+# regarded as a candidate for the main target.  On the other hand, a .USE
+# target was not.
+not-a-main-candidate: .USEBEFORE
+
 all: action directly
 
 first: .USEBEFORE



Home | Main Index | Thread Index | Old Index