CVS commit: src/sys/arch/arm/imx/fdt
Module Name:src Committed By: ryo Date: Wed Nov 25 05:18:39 UTC 2020 Modified Files: src/sys/arch/arm/imx/fdt: imx_ccm_div.c Log Message: `best_diff' should be kept to a positive number To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx_ccm_div.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/imx/fdt/imx_ccm_div.c diff -u src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.1 src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.2 --- src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.1 Wed Jun 10 17:57:50 2020 +++ src/sys/arch/arm/imx/fdt/imx_ccm_div.c Wed Nov 25 05:18:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: imx_ccm_div.c,v 1.1 2020/06/10 17:57:50 jmcneill Exp $ */ +/* $NetBSD: imx_ccm_div.c,v 1.2 2020/11/25 05:18:39 ryo Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx_ccm_div.c,v 1.1 2020/06/10 17:57:50 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx_ccm_div.c,v 1.2 2020/11/25 05:18:39 ryo Exp $"); #include #include @@ -97,7 +97,7 @@ imx_ccm_div_set_rate(struct imx_ccm_soft } else { if (abs(diff) < abs(best_diff)) { best_n = n; -best_diff = diff; +best_diff = abs(diff); } } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Nov 25 00:50:44 UTC 2020 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp suff-main-several.exp suff-transform-debug.exp Log Message: Add .MAKE.UID and .MAKE.GID To generate a diff of this commit: cvs rdiff -u -r1.479 -r1.480 src/usr.bin/make/main.c cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/make.1 cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-main-several.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp 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/main.c diff -u src/usr.bin/make/main.c:1.479 src/usr.bin/make/main.c:1.480 --- src/usr.bin/make/main.c:1.479 Tue Nov 24 19:52:06 2020 +++ src/usr.bin/make/main.c Wed Nov 25 00:50:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $ */ +/* $NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1442,6 +1442,10 @@ main_Init(int argc, char **argv) Var_Set(".MAKE.PID", tmp, VAR_GLOBAL); snprintf(tmp, sizeof tmp, "%u", getppid()); Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL); + snprintf(tmp, sizeof tmp, "%u", getuid()); + Var_Set(".MAKE.UID", tmp, VAR_GLOBAL); + snprintf(tmp, sizeof tmp, "%u", getgid()); + Var_Set(".MAKE.GID", tmp, VAR_GLOBAL); } if (makelevel > 0) { char pn[1024]; Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.292 src/usr.bin/make/make.1:1.293 --- src/usr.bin/make/make.1:1.292 Sat Nov 14 22:19:13 2020 +++ src/usr.bin/make/make.1 Wed Nov 25 00:50:44 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.292 2020/11/14 22:19:13 rillig Exp $ +.\" $NetBSD: make.1,v 1.293 2020/11/25 00:50:44 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd November 14, 2020 +.Dd November 24, 2020 .Dt MAKE 1 .Os .Sh NAME @@ -1018,6 +1018,12 @@ If set to false, becomes .Ql $ per normal evaluation rules. +.It Va .MAKE.UID +The user-id running +.Nm . +.It Va .MAKE.GID +The group-id running +.Nm . .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.225 src/usr.bin/make/unit-tests/Makefile:1.226 --- src/usr.bin/make/unit-tests/Makefile:1.225 Wed Nov 25 00:32:18 2020 +++ src/usr.bin/make/unit-tests/Makefile Wed Nov 25 00:50:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.225 2020/11/25 00:32:18 sjg Exp $ +# $NetBSD: Makefile,v 1.226 2020/11/25 00:50:44 sjg Exp $ # # Unit tests for make(1) # @@ -193,7 +193,7 @@ TESTS+= modmatch TESTS+= modmisc TESTS+= modts TESTS+= modword -.if ${id -u:L:sh} > 0 +.if ${.MAKE.UID:U0} > 0 TESTS+= objdir-writable .endif TESTS+= opt Index: src/usr.bin/make/unit-tests/opt-debug-graph1.exp diff -u src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.6 src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.7 --- src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.6 Mon Nov 23 16:01:59 2020 +++ src/usr.bin/make/unit-tests/opt-debug-graph1.exp Wed Nov 25 00:50:44 2020 @@ -20,6 +20,7 @@ .LIBS= .MAKE= .MAKE.DEPENDFILE = +.MAKE.GID= .MAKE.LEVEL = .MAKE.MAKEFILES = .MAKE.MAKEFILE_PREFERENCE = @@ -27,6 +28,7 @@ .MAKE.PATH_FILEMON = .MAKE.PID= .MAKE.PPID = +.MAKE.UID= .MAKEFLAGS = -r -k -d g1 .MAKEOVERRIDES = .OBJDIR = Index: src/usr.bin/make/unit-tests/suff-main-several.exp diff -u src/usr.bin/make/unit-tests/suff-main-several.exp:1.1 src/usr.bin/make/unit-tests/suff-main-several.exp:1.2 --- src/usr.bin/make/unit-tests/suff-main-several.exp:1.1 Sun Nov 22 20:36:17 2020 +++ src/usr.bin/make/unit-tests/suff-main-several.exp Wed Nov 25 00:50:44 2020 @@ -85,6 +85,7 @@ ParseDoDependency(.MAKEFLAGS: -d0 -dg1) .LIBS= .MAKE= .MAKE.DEPENDFILE = +.MAKE.GID= .MAKE.LEVEL = .MAKE.MAKEFILES = .MAKE.MAKEFILE_PREFERENCE = @@ -92,6 +93,7 @@ ParseDoDependency(.MAKEFLAGS: -d0 -dg1) .MAKE.PATH_FILEMON = .MAKE.PID= .MAKE.PPID = +.MAKE.UID= .MAKEFLAGS = -r -k -d mps -d 0 -d g1 .MAKEOVERRIDES = .OBJDIR = Index:
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Wed Nov 25 00:32:18 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: access(2) does not work for root, so skip objdir-writable To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/usr.bin/make/unit-tests/Makefile 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/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.224 src/usr.bin/make/unit-tests/Makefile:1.225 --- src/usr.bin/make/unit-tests/Makefile:1.224 Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/Makefile Wed Nov 25 00:32:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.224 2020/11/24 19:02:59 rillig Exp $ +# $NetBSD: Makefile,v 1.225 2020/11/25 00:32:18 sjg Exp $ # # Unit tests for make(1) # @@ -193,7 +193,9 @@ TESTS+= modmatch TESTS+= modmisc TESTS+= modts TESTS+= modword +.if ${id -u:L:sh} > 0 TESTS+= objdir-writable +.endif TESTS+= opt TESTS+= opt-backwards TESTS+= opt-chdir
CVS commit: src/sys/arch/arm
Module Name:src Committed By: jmcneill Date: Tue Nov 24 23:31:56 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gicv3.c gicv3.h src/sys/arch/arm/fdt: gicv3_fdt.c Log Message: Improve detection of NS vs S views of priorities. For PMR, write a 0 to bit7 and see if it sticks. This is only possible from NS EL1 if we have a non-secure view of ICC_PMR_EL1. For int priorities (GICD/GICR interfaces and LPIs), assume that the GICD_CTLR.DS bit is telling us the truth. RK3399 is special here when using the vendor bootloader, so keep the auto-detection from the previous commit but limit the scope to only run on RK3399 SOCs. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/cortex/gicv3.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/cortex/gicv3.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/fdt/gicv3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/cortex/gicv3.c diff -u src/sys/arch/arm/cortex/gicv3.c:1.34 src/sys/arch/arm/cortex/gicv3.c:1.35 --- src/sys/arch/arm/cortex/gicv3.c:1.34 Sun Nov 22 20:17:39 2020 +++ src/sys/arch/arm/cortex/gicv3.c Tue Nov 24 23:31:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3.c,v 1.34 2020/11/22 20:17:39 jmcneill Exp $ */ +/* $NetBSD: gicv3.c,v 1.35 2020/11/24 23:31:56 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -31,7 +31,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.34 2020/11/22 20:17:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.35 2020/11/24 23:31:56 jmcneill Exp $"); #include #include @@ -58,7 +58,9 @@ __KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1. #define IPL_TO_PRIORITY(sc, ipl) (((0xff - (ipl)) << (sc)->sc_priority_shift) & 0xff) #define IPL_TO_PMR(sc, ipl) (((0xff - (ipl)) << (sc)->sc_pmr_shift) & 0xff) -#define IPL_TO_LPIPRIO(sc, ipl) (((0xff - (ipl)) << 4) & 0xff) + +#define GIC_PRIO_SHIFT_NS 4 +#define GIC_PRIO_SHIFT_S 3 static struct gicv3_softc *gicv3_softc; @@ -224,7 +226,9 @@ gicv3_dist_enable(struct gicv3_softc *sc u_int n; /* Disable the distributor */ - gicd_write_4(sc, GICD_CTRL, 0); + gicd_ctrl = gicd_read_4(sc, GICD_CTRL); + gicd_ctrl &= ~(GICD_CTRL_EnableGrp1A | GICD_CTRL_ARE_NS); + gicd_write_4(sc, GICD_CTRL, gicd_ctrl); /* Wait for register write to complete */ while (gicd_read_4(sc, GICD_CTRL) & GICD_CTRL_RWP) @@ -543,7 +547,7 @@ gicv3_lpi_establish_irq(struct pic_softc { struct gicv3_softc * const sc = LPITOSOFTC(pic); - sc->sc_lpiconf.base[is->is_irq] = IPL_TO_LPIPRIO(sc, is->is_ipl) | GIC_LPICONF_Res1; + sc->sc_lpiconf.base[is->is_irq] = IPL_TO_PRIORITY(sc, is->is_ipl) | GIC_LPICONF_Res1; if (sc->sc_lpiconf_flush) cpu_dcache_wb_range((vaddr_t)>sc_lpiconf.base[is->is_irq], 1); @@ -756,44 +760,67 @@ gicv3_irq_handler(void *frame) } static bool -gicv3_access_is_secure(struct gicv3_softc *sc) +gicv3_cpuif_is_nonsecure(struct gicv3_softc *sc) { - const uint32_t octlr = gicd_read_4(sc, GICD_CTRL); - gicd_write_4(sc, GICD_CTRL, octlr ^ GICD_CTRL_EnableGrp1S); - const uint32_t nctlr = gicd_read_4(sc, GICD_CTRL); - gicd_write_4(sc, GICD_CTRL, octlr); + /* + * Write 0 to bit7 and see if it sticks. This is only possible if + * we have a non-secure view of the PMR register. + */ + const uint32_t opmr = icc_pmr_read(); + icc_pmr_write(0); + const uint32_t npmr = icc_pmr_read(); + icc_pmr_write(opmr); - return nctlr != octlr; + return (npmr & GICC_PMR_NONSECURE) == 0; } -static uint8_t -gicv3_get_pmr_bits(struct gicv3_softc *sc) +static bool +gicv3_dist_is_nonsecure(struct gicv3_softc *sc) { - const uint32_t opmr = icc_pmr_read(); - icc_pmr_write(0xff); - const uint32_t npmr = icc_pmr_read(); - icc_pmr_write(opmr); + const uint32_t gicd_ctrl = gicd_read_4(sc, GICD_CTRL); - return npmr; + /* + * If security is enabled, we have a non-secure view of the IPRIORITYRn + * registers and LPI configuration priority fields. + */ + return (gicd_ctrl & GICD_CTRL_DS) == 0; } -static uint8_t -gicv3_get_ipriority_bits(struct gicv3_softc *sc) +/* + * Rockchip RK3399 provides a different view of int priority registers + * depending on which firmware is in use. This is hard to detect in + * a way that could possibly break other boards, so only do this + * detection if we know we are on a RK3399 SoC. + */ +static void +gicv3_quirk_rockchip_rk3399(struct gicv3_softc *sc) { - const uint32_t oipriorityr = gicd_read_4(sc, GICD_IPRIORITYRn(8)); - gicd_write_4(sc, GICD_IPRIORITYRn(8), oipriorityr | 0xff); - const uint32_t nipriorityr = gicd_read_4(sc, GICD_IPRIORITYRn(8)); - gicd_write_4(sc, GICD_IPRIORITYRn(8), oipriorityr); + /* Detect the number of supported PMR bits */ + icc_pmr_write(0xff); + const uint8_t pmrbits = icc_pmr_read(); - return nipriorityr & 0xff; + /* Detect the number of supported IPRIORITYRn bits */ + const uint32_t oiprio = gicd_read_4(sc, GICD_IPRIORITYRn(8)); +
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 23:13:09 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): indent some functions in make.c with tabs instead of spaces To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.216 src/usr.bin/make/make.c:1.217 --- src/usr.bin/make/make.c:1.216 Tue Nov 24 22:58:54 2020 +++ src/usr.bin/make/make.c Tue Nov 24 23:13:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.216 2020/11/24 22:58:54 rillig Exp $ */ +/* $NetBSD: make.c,v 1.217 2020/11/24 23:13:09 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.216 2020/11/24 22:58:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.217 2020/11/24 23:13:09 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -116,21 +116,22 @@ static GNodeList *toBeMade; void debug_printf(const char *fmt, ...) { -va_list args; + va_list args; -va_start(args, fmt); -vfprintf(opts.debug_file, fmt, args); -va_end(args); + va_start(args, fmt); + vfprintf(opts.debug_file, fmt, args); + va_end(args); } MAKE_ATTR_DEAD static void make_abort(GNode *gn, int line) { -debug_printf("make_abort from line %d\n", line); -Targ_PrintNode(gn, 2); -Targ_PrintNodes(toBeMade, 2); -Targ_PrintGraph(3); -abort(); + + debug_printf("make_abort from line %d\n", line); + Targ_PrintNode(gn, 2); + Targ_PrintNodes(toBeMade, 2); + Targ_PrintGraph(3); + abort(); } ENUM_VALUE_RTTI_8(GNodeMade, @@ -173,42 +174,44 @@ GNode_FprintDetails(FILE *f, const char Boolean GNode_ShouldExecute(GNode *gn) { -return !((gn->type & OP_MAKE) ? opts.noRecursiveExecute : opts.noExecute); + return !((gn->type & OP_MAKE) + ? opts.noRecursiveExecute + : opts.noExecute); } /* Update the youngest child of the node, according to the given child. */ void GNode_UpdateYoungestChild(GNode *gn, GNode *cgn) { -if (gn->youngestChild == NULL || cgn->mtime > gn->youngestChild->mtime) - gn->youngestChild = cgn; + if (gn->youngestChild == NULL || cgn->mtime > gn->youngestChild->mtime) + gn->youngestChild = cgn; } static Boolean IsOODateRegular(GNode *gn) { -/* These rules are inherited from the original Make. */ + /* These rules are inherited from the original Make. */ -if (gn->youngestChild != NULL) { - if (gn->mtime < gn->youngestChild->mtime) { - DEBUG1(MAKE, "modified before source \"%s\"...", - GNode_Path(gn->youngestChild)); - return TRUE; + if (gn->youngestChild != NULL) { + if (gn->mtime < gn->youngestChild->mtime) { + DEBUG1(MAKE, "modified before source \"%s\"...", + GNode_Path(gn->youngestChild)); + return TRUE; + } + return FALSE; } - return FALSE; -} -if (gn->mtime == 0 && !(gn->type & OP_OPTIONAL)) { - DEBUG0(MAKE, "non-existent and no sources..."); - return TRUE; -} + if (gn->mtime == 0 && !(gn->type & OP_OPTIONAL)) { + DEBUG0(MAKE, "non-existent and no sources..."); + return TRUE; + } -if (gn->type & OP_DOUBLEDEP) { - DEBUG0(MAKE, ":: operator and no sources..."); - return TRUE; -} + if (gn->type & OP_DOUBLEDEP) { + DEBUG0(MAKE, ":: operator and no sources..."); + return TRUE; + } -return FALSE; + return FALSE; } /* See if the node is out of date with respect to its sources. @@ -336,15 +339,16 @@ GNode_IsOODate(GNode *gn) static void PretendAllChildrenAreMade(GNode *pgn) { -GNodeListNode *ln; + GNodeListNode *ln; -for (ln = pgn->children->first; ln != NULL; ln = ln->next) { - GNode *cgn = ln->datum; + for (ln = pgn->children->first; ln != NULL; ln = ln->next) { + GNode *cgn = ln->datum; - Dir_UpdateMTime(cgn, FALSE); /* cgn->path may get updated as well */ - GNode_UpdateYoungestChild(pgn, cgn); - pgn->unmade--; -} + /* This may also update cgn->path. */ + Dir_UpdateMTime(cgn, FALSE); + GNode_UpdateYoungestChild(pgn, cgn); + pgn->unmade--; + } } /* Called by Make_Run and SuffApplyTransform on the downward pass to handle @@ -452,11 +456,11 @@ MakeHandleUse(GNode *cgn, GNode *pgn, GN static void HandleUseNodes(GNode *gn) { -GNodeListNode *ln, *nln; -for (ln = gn->children->first; ln != NULL; ln = nln) { - nln = ln->next; - MakeHandleUse(ln->datum, gn, ln); -} + GNodeListNode *ln, *nln; + for (ln = gn->children->first; ln != NULL; ln = nln) { + nln = ln->next; + MakeHandleUse(ln->datum, gn, ln); + } } @@ -543,36 +547,37 @@ Make_Recheck(GNode *gn) static void UpdateImplicitParentsVars(GNode *cgn, const char *cname) { -GNodeListNode *ln; -const char *cpref = GNode_VarPrefix(cgn); + GNodeListNode *ln; + const char *cpref =
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 22:58:54 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): remove void pointers from MakeBuildParent To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.215 src/usr.bin/make/make.c:1.216 --- src/usr.bin/make/make.c:1.215 Tue Nov 24 22:55:24 2020 +++ src/usr.bin/make/make.c Tue Nov 24 22:58:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.215 2020/11/24 22:55:24 rillig Exp $ */ +/* $NetBSD: make.c,v 1.216 2020/11/24 22:58:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.215 2020/11/24 22:55:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.216 2020/11/24 22:58:54 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -112,7 +112,6 @@ static unsigned int checked_seqno = 1; * It is added to by Make_Update and subtracted from by MakeStartJobs */ static GNodeList *toBeMade; -static int MakeBuildParent(void *, void *); void debug_printf(const char *fmt, ...) @@ -576,6 +575,8 @@ IsWaitingForOrder(GNode *gn) return FALSE; } +static int MakeBuildParent(GNode *, GNodeListNode *); + static void ScheduleOrderSuccessors(GNode *gn) { @@ -853,7 +854,6 @@ Make_DoAllVar(GNode *gn) gn->flags |= DONE_ALLSRC; } -/* XXX: Replace void pointers in parameters with proper types. */ static int MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext) { @@ -898,10 +898,8 @@ MakeBuildChild(GNode *cn, GNodeListNode /* When a .ORDER LHS node completes, we do this on each RHS. */ static int -MakeBuildParent(void *v_pn, void *toBeMadeNext) +MakeBuildParent(GNode *pn, GNodeListNode *toBeMadeNext) { -GNode *pn = v_pn; - if (pn->made != DEFERRED) return 0;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 22:55:24 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): inline Lst_ForEachUntil in Make_Update To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.214 src/usr.bin/make/make.c:1.215 --- src/usr.bin/make/make.c:1.214 Tue Nov 24 22:50:38 2020 +++ src/usr.bin/make/make.c Tue Nov 24 22:55:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.214 2020/11/24 22:50:38 rillig Exp $ */ +/* $NetBSD: make.c,v 1.215 2020/11/24 22:55:24 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.214 2020/11/24 22:50:38 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.215 2020/11/24 22:55:24 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -576,6 +576,17 @@ IsWaitingForOrder(GNode *gn) return FALSE; } +static void +ScheduleOrderSuccessors(GNode *gn) +{ + GNodeListNode *toBeMadeNext = toBeMade->first; + GNodeListNode *ln; + + for (ln = gn->order_succ->first; ln != NULL; ln = ln->next) + if (MakeBuildParent(ln->datum, toBeMadeNext) != 0) + break; +} + /* Perform update on the parents of a node. Used by JobFinish once * a node has been dealt with and by MakeStartJobs if it finds an * up-to-date node. @@ -636,7 +647,7 @@ Make_Update(GNode *cgn) parents = centurion->parents; /* If this was a .ORDER node, schedule the RHS */ -Lst_ForEachUntil(centurion->order_succ, MakeBuildParent, toBeMade->first); +ScheduleOrderSuccessors(centurion); /* Now mark all the parents as having one less unmade child */ for (ln = parents->first; ln != NULL; ln = ln->next) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 22:50:38 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): remove void pointers from MakeBuildChild To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.213 src/usr.bin/make/make.c:1.214 --- src/usr.bin/make/make.c:1.213 Tue Nov 24 22:45:24 2020 +++ src/usr.bin/make/make.c Tue Nov 24 22:50:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.213 2020/11/24 22:45:24 rillig Exp $ */ +/* $NetBSD: make.c,v 1.214 2020/11/24 22:50:38 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.213 2020/11/24 22:45:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.214 2020/11/24 22:50:38 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -844,9 +844,8 @@ Make_DoAllVar(GNode *gn) /* XXX: Replace void pointers in parameters with proper types. */ static int -MakeBuildChild(void *v_cn, void *toBeMade_next) +MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext) { -GNode *cn = v_cn; if (DEBUG(MAKE)) { debug_printf("MakeBuildChild: inspect %s%s, ", @@ -866,16 +865,16 @@ MakeBuildChild(void *v_cn, void *toBeMad DEBUG2(MAKE, "MakeBuildChild: schedule %s%s\n", cn->name, cn->cohort_num); cn->made = REQUESTED; -if (toBeMade_next == NULL) +if (toBeMadeNext == NULL) Lst_Append(toBeMade, cn); else - Lst_InsertBefore(toBeMade, toBeMade_next, cn); + Lst_InsertBefore(toBeMade, toBeMadeNext, cn); if (cn->unmade_cohorts != 0) { ListNode *ln; for (ln = cn->cohorts->first; ln != NULL; ln = ln->next) - if (MakeBuildChild(ln->datum, toBeMade_next) != 0) + if (MakeBuildChild(ln->datum, toBeMadeNext) != 0) break; } @@ -888,14 +887,14 @@ MakeBuildChild(void *v_cn, void *toBeMad /* When a .ORDER LHS node completes, we do this on each RHS. */ static int -MakeBuildParent(void *v_pn, void *toBeMade_next) +MakeBuildParent(void *v_pn, void *toBeMadeNext) { GNode *pn = v_pn; if (pn->made != DEFERRED) return 0; -if (MakeBuildChild(pn, toBeMade_next) == 0) { +if (MakeBuildChild(pn, toBeMadeNext) == 0) { /* Mark so that when this node is built we reschedule its parents */ pn->flags |= DONE_ORDER; } @@ -947,11 +946,11 @@ MakeStartJobs(void) gn->made = DEFERRED; { - GNodeListNode *firstToBeMade = toBeMade->first; + GNodeListNode *toBeMadeNext = toBeMade->first; GNodeListNode *ln; for (ln = gn->children->first; ln != NULL; ln = ln->next) - if (MakeBuildChild(ln->datum, firstToBeMade) != 0) + if (MakeBuildChild(ln->datum, toBeMadeNext) != 0) break; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 22:45:24 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): inline Lst_ForEachUntil in MakeStartJobs To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.212 src/usr.bin/make/make.c:1.213 --- src/usr.bin/make/make.c:1.212 Tue Nov 24 22:32:18 2020 +++ src/usr.bin/make/make.c Tue Nov 24 22:45:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.212 2020/11/24 22:32:18 rillig Exp $ */ +/* $NetBSD: make.c,v 1.213 2020/11/24 22:45:24 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.212 2020/11/24 22:32:18 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.213 2020/11/24 22:45:24 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -945,7 +945,16 @@ MakeStartJobs(void) * just before the current first element. */ gn->made = DEFERRED; - Lst_ForEachUntil(gn->children, MakeBuildChild, toBeMade->first); + + { + GNodeListNode *firstToBeMade = toBeMade->first; + GNodeListNode *ln; + + for (ln = gn->children->first; ln != NULL; ln = ln->next) + if (MakeBuildChild(ln->datum, firstToBeMade) != 0) + break; + } + /* and drop this node on the floor */ DEBUG2(MAKE, "dropped %s%s\n", gn->name, gn->cohort_num); continue;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 22:32:18 UTC 2020 Modified Files: src/usr.bin/make: make.c Log Message: make(1): inline Lst_ForEachUntil in MakeBuildChild This prepares for removing the void pointers from the function signature. To generate a diff of this commit: cvs rdiff -u -r1.211 -r1.212 src/usr.bin/make/make.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/make.c diff -u src/usr.bin/make/make.c:1.211 src/usr.bin/make/make.c:1.212 --- src/usr.bin/make/make.c:1.211 Tue Nov 24 19:33:13 2020 +++ src/usr.bin/make/make.c Tue Nov 24 22:32:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.211 2020/11/24 19:33:13 rillig Exp $ */ +/* $NetBSD: make.c,v 1.212 2020/11/24 22:32:18 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.211 2020/11/24 19:33:13 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.212 2020/11/24 22:32:18 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -871,8 +871,13 @@ MakeBuildChild(void *v_cn, void *toBeMad else Lst_InsertBefore(toBeMade, toBeMade_next, cn); -if (cn->unmade_cohorts != 0) - Lst_ForEachUntil(cn->cohorts, MakeBuildChild, toBeMade_next); +if (cn->unmade_cohorts != 0) { + ListNode *ln; + + for (ln = cn->cohorts->first; ln != NULL; ln = ln->next) + if (MakeBuildChild(ln->datum, toBeMade_next) != 0) + break; +} /* * If this node is a .WAIT node with unmade children
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 21:42:28 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): rename local variable in ApplyModifier_Assign To generate a diff of this commit: cvs rdiff -u -r1.695 -r1.696 src/usr.bin/make/var.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/var.c diff -u src/usr.bin/make/var.c:1.695 src/usr.bin/make/var.c:1.696 --- src/usr.bin/make/var.c:1.695 Mon Nov 23 23:41:11 2020 +++ src/usr.bin/make/var.c Tue Nov 24 21:42:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.695 2020/11/23 23:41:11 rillig Exp $ */ +/* $NetBSD: var.c,v 1.696 2020/11/24 21:42:28 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.695 2020/11/23 23:41:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.696 2020/11/24 21:42:28 rillig Exp $"); #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) @@ -2952,7 +2952,7 @@ ApplyModifier_IfElse(const char **pp, Ap static ApplyModifierResult ApplyModifier_Assign(const char **pp, ApplyModifiersState *st) { -GNode *v_ctxt; +GNode *ctxt; char delim; char *val; VarParseResult res; @@ -2972,11 +2972,11 @@ ok: return AMR_BAD; } -v_ctxt = st->ctxt; /* context where v belongs */ + ctxt = st->ctxt; /* context where v belongs */ if (!(st->exprFlags & VEF_UNDEF) && st->ctxt != VAR_GLOBAL) { Var *gv = VarFind(st->var->name, st->ctxt, FALSE); if (gv == NULL) - v_ctxt = VAR_GLOBAL; + ctxt = VAR_GLOBAL; else VarFreeEnv(gv, TRUE); } @@ -3002,7 +3002,7 @@ ok: if (st->eflags & VARE_WANTRES) { switch (op[0]) { case '+': - Var_Append(st->var->name, val, v_ctxt); + Var_Append(st->var->name, val, ctxt); break; case '!': { const char *errfmt; @@ -3010,7 +3010,7 @@ ok: if (errfmt != NULL) Error(errfmt, val); else - Var_Set(st->var->name, cmd_output, v_ctxt); + Var_Set(st->var->name, cmd_output, ctxt); free(cmd_output); break; } @@ -3019,7 +3019,7 @@ ok: break; /* FALLTHROUGH */ default: - Var_Set(st->var->name, val, v_ctxt); + Var_Set(st->var->name, val, ctxt); break; } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 20:17:17 UTC 2020 Modified Files: src/usr.bin/make: make.h Log Message: make(1): indent make.h with tabs instead of spaces To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/usr.bin/make/make.h 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/make.h diff -u src/usr.bin/make/make.h:1.218 src/usr.bin/make/make.h:1.219 --- src/usr.bin/make/make.h:1.218 Tue Nov 24 19:33:13 2020 +++ src/usr.bin/make/make.h Tue Nov 24 20:17:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.218 2020/11/24 19:33:13 rillig Exp $ */ +/* $NetBSD: make.h,v 1.219 2020/11/24 20:17:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -192,27 +192,29 @@ typedef int Boolean; * UNMADE -> BEINGMADE -> UPTODATE. */ typedef enum GNodeMade { -/* Not examined yet. */ -UNMADE, -/* The node has been examined but is not yet ready since its - * dependencies have to be made first. */ -DEFERRED, - -/* The node is on the toBeMade list. */ -REQUESTED, - -/* The node is already being made. - * Trying to build a node in this state indicates a cycle in the graph. */ -BEINGMADE, - -/* Was out-of-date and has been made. */ -MADE, -/* Was already up-to-date, does not need to be made. */ -UPTODATE, -/* An error occurred while it was being made (used only in compat mode). */ -ERROR, -/* The target was aborted due to an error making a dependency (compat). */ -ABORTED + /* Not examined yet. */ + UNMADE, + /* The node has been examined but is not yet ready since its + * dependencies have to be made first. */ + DEFERRED, + + /* The node is on the toBeMade list. */ + REQUESTED, + + /* The node is already being made. Trying to build a node in this + * state indicates a cycle in the graph. */ + BEINGMADE, + + /* Was out-of-date and has been made. */ + MADE, + /* Was already up-to-date, does not need to be made. */ + UPTODATE, + /* An error occurred while it was being made. + * Used only in compat mode. */ + ERROR, + /* The target was aborted due to an error making a dependency. + * Used only in compat mode. */ + ABORTED } GNodeMade; /* The OP_ constants are used when parsing a dependency line as a way of @@ -221,112 +223,125 @@ typedef enum GNodeMade { * * Some of the OP_ constants can be combined, others cannot. */ typedef enum GNodeType { -OP_NONE = 0, + OP_NONE = 0, -/* The dependency operator ':' is the most common one. The commands of - * this node are executed if any child is out-of-date. */ -OP_DEPENDS = 1 << 0, -/* The dependency operator '!' always executes its commands, even if - * its children are up-to-date. */ -OP_FORCE = 1 << 1, -/* The dependency operator '::' behaves like ':', except that it allows - * multiple dependency groups to be defined. Each of these groups is - * executed on its own, independently from the others. Each individual - * dependency group is called a cohort. */ -OP_DOUBLEDEP = 1 << 2, - -/* Matches the dependency operators ':', '!' and '::'. */ -OP_OPMASK = OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP, - -/* Don't care if the target doesn't exist and can't be created */ -OP_OPTIONAL = 1 << 3, -/* Use associated commands for parents */ -OP_USE = 1 << 4, -/* Target is never out of date, but always execute commands anyway. - * Its time doesn't matter, so it has none...sort of */ -OP_EXEC = 1 << 5, -/* Ignore non-zero exit status from shell commands when creating the node */ -OP_IGNORE = 1 << 6, -/* Don't remove the target when interrupted */ -OP_PRECIOUS = 1 << 7, -/* Don't echo commands when executed */ -OP_SILENT = 1 << 8, -/* Target is a recursive make so its commands should always be executed - * when it is out of date, regardless of the state of the -n or -t flags */ -OP_MAKE = 1 << 9, -/* Target is out-of-date only if any of its children was out-of-date */ -OP_JOIN = 1 << 10, -/* Assume the children of the node have been already made */ -OP_MADE = 1 << 11, -/* Special .BEGIN, .END, .INTERRUPT */ -OP_SPECIAL = 1 << 12, -/* Like .USE, only prepend commands */ -OP_USEBEFORE = 1 << 13, -/* The node is invisible to its parents. I.e. it doesn't show up in the - * parents' local variables (.IMPSRC, .ALLSRC). */ -OP_INVISIBLE = 1 << 14, -/* The node is exempt from normal 'main target' processing in parse.c */ -OP_NOTMAIN = 1 << 15, -/* Not a file target; run always */ -OP_PHONY = 1 << 16, -/* Don't search for file in the path */ -OP_NOPATH = 1 << 17, -/* In a dependency line "target: source1 .WAIT source2", source1 is made - * first, including its children. Once that is finished, source2 is made, - * including its children.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 19:52:06 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): fix indentation for short expressions in main.c To generate a diff of this commit: cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/main.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/main.c diff -u src/usr.bin/make/main.c:1.478 src/usr.bin/make/main.c:1.479 --- src/usr.bin/make/main.c:1.478 Mon Nov 23 23:41:11 2020 +++ src/usr.bin/make/main.c Tue Nov 24 19:52:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.478 2020/11/23 23:41:11 rillig Exp $ */ +/* $NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.478 2020/11/23 23:41:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1821,8 +1821,7 @@ Cmd_Exec(const char *cmd, const char **e if (bytes_read == -1) savederr = errno; - (void)close( - fds[0]); /* Close the input side of the pipe. */ + (void)close(fds[0]); /* Close the input side of the pipe. */ /* Wait for the process to exit. */ while ((pid = waitpid(cpid, , 0)) != cpid && pid >= 0) @@ -2217,8 +2216,7 @@ mkTempFile(const char *pattern, char **o if (out_fname != NULL) { *out_fname = bmake_strdup(tfile); } else { - unlink( - tfile); /* we just want the descriptor */ + unlink(tfile); /* we just want the descriptor */ } return fd; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 19:46:29 UTC 2020 Modified Files: src/usr.bin/make: lst.c lst.h Log Message: make(1): indent list functions with tabs instead of spaces To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/usr.bin/make/lst.c cvs rdiff -u -r1.85 -r1.86 src/usr.bin/make/lst.h 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/lst.c diff -u src/usr.bin/make/lst.c:1.92 src/usr.bin/make/lst.c:1.93 --- src/usr.bin/make/lst.c:1.92 Sun Nov 8 01:29:26 2020 +++ src/usr.bin/make/lst.c Tue Nov 24 19:46:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $ */ +/* $NetBSD: lst.c,v 1.93 2020/11/24 19:46:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -34,42 +34,44 @@ #include "make.h" -MAKE_RCSID("$NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: lst.c,v 1.93 2020/11/24 19:46:29 rillig Exp $"); static ListNode * LstNodeNew(ListNode *prev, ListNode *next, void *datum) { -ListNode *ln = bmake_malloc(sizeof *ln); -ln->prev = prev; -ln->next = next; -ln->datum = datum; -return ln; + ListNode *ln = bmake_malloc(sizeof *ln); + + ln->prev = prev; + ln->next = next; + ln->datum = datum; + + return ln; } /* Create and initialize a new, empty list. */ List * Lst_New(void) { -List *list = bmake_malloc(sizeof *list); + List *list = bmake_malloc(sizeof *list); -list->first = NULL; -list->last = NULL; + list->first = NULL; + list->last = NULL; -return list; + return list; } /* Free a list and all its nodes. The node data are not freed though. */ void Lst_Free(List *list) { -ListNode *ln, *next; + ListNode *ln, *next; -for (ln = list->first; ln != NULL; ln = next) { - next = ln->next; - free(ln); -} + for (ln = list->first; ln != NULL; ln = next) { + next = ln->next; + free(ln); + } -free(list); + free(list); } /* Destroy a list and free all its resources. The freeProc is called with the @@ -77,71 +79,71 @@ Lst_Free(List *list) void Lst_Destroy(List *list, LstFreeProc freeProc) { -ListNode *ln, *next; + ListNode *ln, *next; -for (ln = list->first; ln != NULL; ln = next) { - next = ln->next; - freeProc(ln->datum); - free(ln); -} + for (ln = list->first; ln != NULL; ln = next) { + next = ln->next; + freeProc(ln->datum); + free(ln); + } -free(list); + free(list); } /* Insert a new node with the datum before the given node. */ void Lst_InsertBefore(List *list, ListNode *ln, void *datum) { -ListNode *newNode; + ListNode *newNode; -assert(datum != NULL); + assert(datum != NULL); -newNode = LstNodeNew(ln->prev, ln, datum); + newNode = LstNodeNew(ln->prev, ln, datum); -if (ln->prev != NULL) - ln->prev->next = newNode; -ln->prev = newNode; + if (ln->prev != NULL) + ln->prev->next = newNode; + ln->prev = newNode; -if (ln == list->first) - list->first = newNode; + if (ln == list->first) + list->first = newNode; } /* Add a piece of data at the start of the given list. */ void Lst_Prepend(List *list, void *datum) { -ListNode *ln; + ListNode *ln; -assert(datum != NULL); + assert(datum != NULL); -ln = LstNodeNew(NULL, list->first, datum); + ln = LstNodeNew(NULL, list->first, datum); -if (list->first == NULL) { - list->first = ln; - list->last = ln; -} else { - list->first->prev = ln; - list->first = ln; -} + if (list->first == NULL) { + list->first = ln; + list->last = ln; + } else { + list->first->prev = ln; + list->first = ln; + } } /* Add a piece of data at the end of the given list. */ void Lst_Append(List *list, void *datum) { -ListNode *ln; + ListNode *ln; -assert(datum != NULL); + assert(datum != NULL); -ln = LstNodeNew(list->last, NULL, datum); + ln = LstNodeNew(list->last, NULL, datum); -if (list->last == NULL) { - list->first = ln; - list->last = ln; -} else { - list->last->next = ln; - list->last = ln; -} + if (list->last == NULL) { + list->first = ln; + list->last = ln; + } else { + list->last->next = ln; + list->last = ln; + } } /* Remove the given node from the given list. @@ -149,26 +151,26 @@ Lst_Append(List *list, void *datum) void Lst_Remove(List *list, ListNode *ln) { -/* unlink it from its neighbors */ -if (ln->next != NULL) - ln->next->prev = ln->prev; -if (ln->prev != NULL) - ln->prev->next = ln->next; - -/* unlink it from the list */ -if (list->first == ln) - list->first = ln->next; -if (list->last == ln) - list->last = ln->prev; + /* unlink it from its neighbors */ + if (ln->next != NULL) + ln->next->prev = ln->prev; + if (ln->prev != NULL) + ln->prev->next = ln->next; + + /* unlink it from the list */ + if (list->first == ln) + list->first = ln->next; + if (list->last == ln) + list->last = ln->prev;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 19:33:13 UTC 2020 Modified Files: src/usr.bin/make: make.c make.h Log Message: make(1): add high-level API for GNode.made Having an enum whose constants must be ordered in a certain way may be unexpected to casual readers. Hide this implementation detail in separate functions. To generate a diff of this commit: cvs rdiff -u -r1.210 -r1.211 src/usr.bin/make/make.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/make.h 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/make.c diff -u src/usr.bin/make/make.c:1.210 src/usr.bin/make/make.c:1.211 --- src/usr.bin/make/make.c:1.210 Sat Nov 21 10:51:26 2020 +++ src/usr.bin/make/make.c Tue Nov 24 19:33:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.210 2020/11/21 10:51:26 rillig Exp $ */ +/* $NetBSD: make.c,v 1.211 2020/11/24 19:33:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.210 2020/11/21 10:51:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.211 2020/11/24 19:33:13 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -566,7 +566,7 @@ IsWaitingForOrder(GNode *gn) for (ln = gn->order_pred->first; ln != NULL; ln = ln->next) { GNode *ogn = ln->datum; - if (ogn->made >= MADE || !(ogn->flags & REMAKE)) + if (GNode_IsDone(ogn) || !(ogn->flags & REMAKE)) continue; DEBUG2(MAKE, "IsWaitingForOrder: Waiting for .ORDER node \"%s%s\"\n", @@ -679,7 +679,7 @@ Make_Update(GNode *cgn) * A parent must wait for the completion of all instances * of a `::' dependency. */ - if (centurion->unmade_cohorts != 0 || centurion->made < MADE) { + if (centurion->unmade_cohorts != 0 || !GNode_IsDone(centurion)) { DEBUG2(MAKE, "- centurion made %d, %d unmade cohorts\n", centurion->made, centurion->unmade_cohorts); continue; @@ -842,6 +842,7 @@ Make_DoAllVar(GNode *gn) gn->flags |= DONE_ALLSRC; } +/* XXX: Replace void pointers in parameters with proper types. */ static int MakeBuildChild(void *v_cn, void *toBeMade_next) { @@ -852,7 +853,7 @@ MakeBuildChild(void *v_cn, void *toBeMad cn->name, cn->cohort_num); GNode_FprintDetails(opts.debug_file, "", cn, "\n"); } -if (cn->made > DEFERRED) +if (GNode_IsReady(cn)) return 0; /* If this node is on the RHS of a .ORDER, check LHSs. */ @@ -919,6 +920,7 @@ MakeStartJobs(void) DEBUG2(MAKE, "Examining %s%s...\n", gn->name, gn->cohort_num); if (gn->made != REQUESTED) { + /* XXX: Replace %d with string representation; see made_name. */ DEBUG1(MAKE, "state %d\n", gn->made); make_abort(gn, __LINE__); @@ -978,8 +980,7 @@ MakeStartJobs(void) static void MakePrintStatusOrderNode(GNode *ogn, GNode *gn) { -if (!(ogn->flags & REMAKE) || ogn->made > REQUESTED) - /* not waiting for this one */ +if (!GNode_IsWaitingFor(ogn)) return; printf("`%s%s' has .ORDER dependency against %s%s ", Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.217 src/usr.bin/make/make.h:1.218 --- src/usr.bin/make/make.h:1.217 Tue Nov 24 18:17:45 2020 +++ src/usr.bin/make/make.h Tue Nov 24 19:33:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.217 2020/11/24 18:17:45 rillig Exp $ */ +/* $NetBSD: make.h,v 1.218 2020/11/24 19:33:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -197,11 +197,14 @@ typedef enum GNodeMade { /* The node has been examined but is not yet ready since its * dependencies have to be made first. */ DEFERRED, + /* The node is on the toBeMade list. */ REQUESTED, + /* The node is already being made. * Trying to build a node in this state indicates a cycle in the graph. */ BEINGMADE, + /* Was out-of-date and has been made. */ MADE, /* Was already up-to-date, does not need to be made. */ @@ -702,6 +705,24 @@ GNode_Path(const GNode *gn) } MAKE_INLINE Boolean +GNode_IsWaitingFor(const GNode *gn) +{ + return (gn->flags & REMAKE) && gn->made <= REQUESTED; +} + +MAKE_INLINE Boolean +GNode_IsReady(const GNode *gn) +{ + return gn->made > DEFERRED; +} + +MAKE_INLINE Boolean +GNode_IsDone(const GNode *gn) +{ + return gn->made >= MADE; +} + +MAKE_INLINE Boolean GNode_IsError(const GNode *gn) { return gn->made == ERROR || gn->made == ABORTED;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 19:04:42 UTC 2020 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: deptgt-begin-fail-indirect.exp Log Message: make(1): fix error handling for .BEGIN dependency in -k mode To generate a diff of this commit: cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/compat.c cvs rdiff -u -r1.1 -r1.2 \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp 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/compat.c diff -u src/usr.bin/make/compat.c:1.191 src/usr.bin/make/compat.c:1.192 --- src/usr.bin/make/compat.c:1.191 Tue Nov 24 18:17:45 2020 +++ src/usr.bin/make/compat.c Tue Nov 24 19:04:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.192 2020/11/24 19:04:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.192 2020/11/24 19:04:42 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -691,8 +691,7 @@ Compat_Run(GNodeList *targs) gn = Targ_FindNode(".BEGIN"); if (gn != NULL) { Compat_Make(gn, gn); - /* XXX: Replace with GNode_IsError(gn) */ - if (gn->made == ERROR) { + if (GNode_IsError(gn)) { PrintOnError(gn, "\nStop."); exit(1); } Index: src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp diff -u src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp:1.1 src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp:1.2 --- src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp:1.1 Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp Tue Nov 24 19:04:42 2020 @@ -1,4 +1,6 @@ false *** Error code 1 (continuing) -: This is not made. -exit status 0 + +Stop. +make: stopped in unit-tests +exit status 1
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Nov 24 19:02:59 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: deptgt-begin-fail-indirect.exp deptgt-begin-fail-indirect.mk deptgt-begin-fail.exp deptgt-begin-fail.mk Log Message: make(1): add test for bug in error handling of .BEGIN in -k mode To generate a diff of this commit: cvs rdiff -u -r1.977 -r1.978 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.223 -r1.224 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.mk \ src/usr.bin/make/unit-tests/deptgt-begin-fail.exp \ src/usr.bin/make/unit-tests/deptgt-begin-fail.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.977 src/distrib/sets/lists/tests/mi:1.978 --- src/distrib/sets/lists/tests/mi:1.977 Tue Nov 24 17:59:42 2020 +++ src/distrib/sets/lists/tests/mi Tue Nov 24 19:02:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.977 2020/11/24 17:59:42 rillig Exp $ +# $NetBSD: mi,v 1.978 2020/11/24 19:02:59 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4955,6 +4955,10 @@ ./usr/tests/usr.bin/make/unit-tests/depsrc-wait.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/depsrc.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/depsrc.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-begin-fail.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-begin-fail.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-begin.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-begin.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-default.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.223 src/usr.bin/make/unit-tests/Makefile:1.224 --- src/usr.bin/make/unit-tests/Makefile:1.223 Tue Nov 24 17:59:42 2020 +++ src/usr.bin/make/unit-tests/Makefile Tue Nov 24 19:02:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.223 2020/11/24 17:59:42 rillig Exp $ +# $NetBSD: Makefile,v 1.224 2020/11/24 19:02:59 rillig Exp $ # # Unit tests for make(1) # @@ -109,6 +109,8 @@ TESTS+= depsrc-usebefore-double-colon TESTS+= depsrc-wait TESTS+= deptgt TESTS+= deptgt-begin +TESTS+= deptgt-begin-fail +TESTS+= deptgt-begin-fail-indirect TESTS+= deptgt-default TESTS+= deptgt-delete_on_error TESTS+= deptgt-end Added files: Index: src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp:1.1 --- /dev/null Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.exp Tue Nov 24 19:02:59 2020 @@ -0,0 +1,4 @@ +false +*** Error code 1 (continuing) +: This is not made. +exit status 0 Index: src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.mk diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.mk:1.1 --- /dev/null Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/deptgt-begin-fail-indirect.mk Tue Nov 24 19:02:59 2020 @@ -0,0 +1,16 @@ +# $NetBSD: deptgt-begin-fail-indirect.mk,v 1.1 2020/11/24 19:02:59 rillig Exp $ +# +# Test for a .BEGIN target whose dependency results in an error. +# This stops make immediately and does not build the main targets. +# +# Between 2005-05-08 and 2020-11-24, a failing dependency of the .BEGIN node +# would not stop make from running the main targets. In the end, the exit +# status was even 0. + +.BEGIN: failing + +failing: .PHONY .NOTMAIN + false + +all: + : This is not made. Index: src/usr.bin/make/unit-tests/deptgt-begin-fail.exp diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-begin-fail.exp:1.1 --- /dev/null Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/deptgt-begin-fail.exp Tue Nov 24 19:02:59 2020 @@ -0,0 +1,6 @@ +false +*** Error code 1 (continuing) + +Stop. +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/deptgt-begin-fail.mk diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-begin-fail.mk:1.1 --- /dev/null Tue Nov 24 19:02:59 2020 +++ src/usr.bin/make/unit-tests/deptgt-begin-fail.mk Tue Nov 24 19:02:59 2020 @@ -0,0 +1,10 @@ +# $NetBSD: deptgt-begin-fail.mk,v 1.1 2020/11/24
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 18:17:45 UTC 2020 Modified Files: src/usr.bin/make: compat.c job.c make.h src/usr.bin/make/unit-tests: deptgt-end-fail-indirect.exp Log Message: make(1): fix error handling for dependency of .END in -k mode Fix one bug, find 4 new ones. All these bugs have been around since 2005-05-08, when dependencies on the .BEGIN, .END and .INTERRUPT nodes were implemented. Before that, checking gn->made == ERROR was appropriate, but adding the dependencies made ABORTED a new possible error value from Compat_Make. To generate a diff of this commit: cvs rdiff -u -r1.190 -r1.191 src/usr.bin/make/compat.c cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/job.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/make.h cvs rdiff -u -r1.1 -r1.2 \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp 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/compat.c diff -u src/usr.bin/make/compat.c:1.190 src/usr.bin/make/compat.c:1.191 --- src/usr.bin/make/compat.c:1.190 Tue Nov 24 17:42:31 2020 +++ src/usr.bin/make/compat.c Tue Nov 24 18:17:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.190 2020/11/24 17:42:31 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.190 2020/11/24 17:42:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -639,6 +639,8 @@ Compat_Make(GNode *gn, GNode *pgn) if (gn->made == UNMADE && (gn == pgn || !(pgn->type & OP_MADE))) { if (!MakeUnmade(gn, pgn)) goto cohorts; + + /* XXX: Replace with GNode_IsError(gn) */ } else if (gn->made == ERROR) { /* * Already had an error when making this. @@ -689,6 +691,7 @@ Compat_Run(GNodeList *targs) gn = Targ_FindNode(".BEGIN"); if (gn != NULL) { Compat_Make(gn, gn); + /* XXX: Replace with GNode_IsError(gn) */ if (gn->made == ERROR) { PrintOnError(gn, "\nStop."); exit(1); @@ -722,7 +725,7 @@ Compat_Run(GNodeList *targs) if (indirectErrors == 0) { GNode *endNode = Targ_GetEndNode(); Compat_Make(endNode, endNode); - if (gn->made == ERROR || endNode->made == ERROR) { + if (GNode_IsError(gn) || GNode_IsError(endNode)) { PrintOnError(gn, "\nStop."); exit(1); } Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.328 src/usr.bin/make/job.c:1.329 --- src/usr.bin/make/job.c:1.328 Mon Nov 23 23:41:11 2020 +++ src/usr.bin/make/job.c Tue Nov 24 18:17:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $ */ +/* $NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1843,6 +1843,7 @@ JobRun(GNode *targ) } #else Compat_Make(targ, targ); +/* XXX: Replace with GNode_IsError(gn) */ if (targ->made == ERROR) { PrintOnError(targ, "\n\nStop."); exit(1); @@ -2739,6 +2740,7 @@ Job_RunTarget(const char *target, const Var_Set(ALLSRC, fname, gn); JobRun(gn); +/* XXX: Replace with GNode_IsError(gn) */ if (gn->made == ERROR) { PrintOnError(gn, "\n\nStop."); exit(1); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.216 src/usr.bin/make/make.h:1.217 --- src/usr.bin/make/make.h:1.216 Tue Nov 24 17:42:31 2020 +++ src/usr.bin/make/make.h Tue Nov 24 18:17:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.216 2020/11/24 17:42:31 rillig Exp $ */ +/* $NetBSD: make.h,v 1.217 2020/11/24 18:17:45 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -701,6 +701,12 @@ GNode_Path(const GNode *gn) return gn->path != NULL ? gn->path : gn->name; } +MAKE_INLINE Boolean +GNode_IsError(const GNode *gn) +{ + return gn->made == ERROR || gn->made == ABORTED; +} + MAKE_INLINE const char * GNode_VarTarget(GNode *gn) { return Var_ValueDirect(TARGET, gn); } MAKE_INLINE const char * Index: src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp diff -u src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp:1.1 src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp:1.2 --- src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp:1.1 Tue Nov 24 17:59:42 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp Tue Nov 24
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Nov 24 17:59:42 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile deptgt-end-fail.mk Added Files: src/usr.bin/make/unit-tests: deptgt-end-fail-indirect.exp deptgt-end-fail-indirect.mk Log Message: make(1): add test for error in dependency of .END node in -k mode To generate a diff of this commit: cvs rdiff -u -r1.976 -r1.977 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.222 -r1.223 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.mk cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-end-fail.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.976 src/distrib/sets/lists/tests/mi:1.977 --- src/distrib/sets/lists/tests/mi:1.976 Tue Nov 24 15:36:51 2020 +++ src/distrib/sets/lists/tests/mi Tue Nov 24 17:59:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.976 2020/11/24 15:36:51 rillig Exp $ +# $NetBSD: mi,v 1.977 2020/11/24 17:59:42 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4961,6 +4961,8 @@ ./usr/tests/usr.bin/make/unit-tests/deptgt-default.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail-indirect.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end-jobs.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.222 src/usr.bin/make/unit-tests/Makefile:1.223 --- src/usr.bin/make/unit-tests/Makefile:1.222 Tue Nov 24 15:36:51 2020 +++ src/usr.bin/make/unit-tests/Makefile Tue Nov 24 17:59:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.222 2020/11/24 15:36:51 rillig Exp $ +# $NetBSD: Makefile,v 1.223 2020/11/24 17:59:42 rillig Exp $ # # Unit tests for make(1) # @@ -113,6 +113,7 @@ TESTS+= deptgt-default TESTS+= deptgt-delete_on_error TESTS+= deptgt-end TESTS+= deptgt-end-fail +TESTS+= deptgt-end-fail-indirect TESTS+= deptgt-end-jobs TESTS+= deptgt-error TESTS+= deptgt-ignore Index: src/usr.bin/make/unit-tests/deptgt-end-fail.mk diff -u src/usr.bin/make/unit-tests/deptgt-end-fail.mk:1.1 src/usr.bin/make/unit-tests/deptgt-end-fail.mk:1.2 --- src/usr.bin/make/unit-tests/deptgt-end-fail.mk:1.1 Tue Nov 24 15:36:51 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail.mk Tue Nov 24 17:59:42 2020 @@ -1,10 +1,10 @@ -# $NetBSD: deptgt-end-fail.mk,v 1.1 2020/11/24 15:36:51 rillig Exp $ +# $NetBSD: deptgt-end-fail.mk,v 1.2 2020/11/24 17:59:42 rillig Exp $ # # Tests for an error in the .END node. # # Before 2020-11-25, an error in the .END target did not print the "Stop.", -# even though this was intended. The cause for this was a simple typo in -# a variable name. +# even though this was intended. The cause for this was a missing condition +# in Compat_Run, in the code handling the .END node. all: : $@ Added files: Index: src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp:1.1 --- /dev/null Tue Nov 24 17:59:42 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp Tue Nov 24 17:59:42 2020 @@ -0,0 +1,4 @@ +: all +false +*** Error code 1 (continuing) +exit status 0 Index: src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.mk diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.mk:1.1 --- /dev/null Tue Nov 24 17:59:42 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail-indirect.mk Tue Nov 24 17:59:42 2020 @@ -0,0 +1,15 @@ +# $NetBSD: deptgt-end-fail-indirect.mk,v 1.1 2020/11/24 17:59:42 rillig Exp $ +# +# Tests for an error in a dependency of the .END node. +# +# Before 2020-11-25, an error in the .END target did not print the "Stop." +# and exited with status 0. The cause for this was a missing condition in +# Compat_Run in the handling of the .END node. + +all: + : $@ + +.END: failing + +failing: .PHONY + false
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 17:42:31 UTC 2020 Modified Files: src/usr.bin/make: compat.c make.h Log Message: make(1): document the enum GNodeMade Given only the state names and their individual documentation, it is hard to see the full picture. To make this easier, provide typical examples of the ways that a GNode takes through these states. To generate a diff of this commit: cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/compat.c cvs rdiff -u -r1.215 -r1.216 src/usr.bin/make/make.h 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/compat.c diff -u src/usr.bin/make/compat.c:1.189 src/usr.bin/make/compat.c:1.190 --- src/usr.bin/make/compat.c:1.189 Tue Nov 24 16:28:44 2020 +++ src/usr.bin/make/compat.c Tue Nov 24 17:42:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.189 2020/11/24 16:28:44 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.190 2020/11/24 17:42:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.189 2020/11/24 16:28:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.190 2020/11/24 17:42:31 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -470,6 +470,9 @@ MakeNodes(GNodeList *gnodes, GNode *pgn) static Boolean MakeUnmade(GNode *const gn, GNode *const pgn) { + + assert(gn->made == UNMADE); + /* * First mark ourselves to be made, then apply whatever transformations * the suffix module thinks are necessary. Once that's done, we can @@ -480,9 +483,12 @@ MakeUnmade(GNode *const gn, GNode *const */ gn->flags |= REMAKE; gn->made = BEINGMADE; + if (!(gn->type & OP_MADE)) Suff_FindDeps(gn); + MakeNodes(gn->children, gn); + if (!(gn->flags & REMAKE)) { gn->made = ABORTED; pgn->flags &= ~(unsigned)REMAKE; @@ -503,20 +509,19 @@ MakeUnmade(GNode *const gn, GNode *const gn->made = UPTODATE; DEBUG0(MAKE, "up-to-date.\n"); return FALSE; - } else - DEBUG0(MAKE, "out-of-date.\n"); + } /* * If the user is just seeing if something is out-of-date, exit now * to tell him/her "yes". */ + DEBUG0(MAKE, "out-of-date.\n"); if (opts.queryFlag) exit(1); /* - * We need to be re-made. We also have to make sure we've got a $? - * variable. To be nice, we also define the $> variable using - * Make_DoAllVar(). + * We need to be re-made. + * Ensure that $? (.OODATE) and $> (.ALLSRC) are both set. */ Make_DoAllVar(gn); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.215 src/usr.bin/make/make.h:1.216 --- src/usr.bin/make/make.h:1.215 Mon Nov 23 20:41:20 2020 +++ src/usr.bin/make/make.h Tue Nov 24 17:42:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.215 2020/11/23 20:41:20 rillig Exp $ */ +/* $NetBSD: make.h,v 1.216 2020/11/24 17:42:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -173,18 +173,43 @@ typedef int Boolean; #include "buf.h" #include "make_malloc.h" +/* + * The typical flow of states is: + * + * The direct successful path: + * UNMADE -> BEINGMADE -> MADE. + * + * The direct error path: + * UNMADE -> BEINGMADE -> ERROR. + * + * The successful path when dependencies need to be made first: + * UNMADE -> DEFERRED -> REQUESTED -> BEINGMADE -> MADE. + * + * A node that has dependencies, and one of the dependencies cannot be made: + * UNMADE -> DEFERRED -> ABORTED. + * + * A node that turns out to be up-to-date: + * UNMADE -> BEINGMADE -> UPTODATE. + */ typedef enum GNodeMade { -UNMADE, /* Not examined yet */ -DEFERRED, /* Examined once (building child) */ -REQUESTED, /* on toBeMade list */ -BEINGMADE, /* Target is already being made. - * Indicates a cycle in the graph. */ -MADE, /* Was out-of-date and has been made */ -UPTODATE, /* Was already up-to-date */ -ERROR, /* An error occurred while it was being - * made (used only in compat mode) */ -ABORTED /* The target was aborted due to an error - * making an inferior (compat). */ +/* Not examined yet. */ +UNMADE, +/* The node has been examined but is not yet ready since its + * dependencies have to be made first. */ +DEFERRED, +/* The node is on the toBeMade list. */ +REQUESTED, +/* The node is already being made. + * Trying to build a node in this state indicates a cycle in the graph. */ +BEINGMADE, +/* Was out-of-date and has been made. */ +MADE, +/* Was already up-to-date, does not need to be made. */ +UPTODATE, +/* An error occurred while it was being made (used only in compat mode). */ +ERROR, +/* The target was aborted due to an error making a dependency (compat). */ +ABORTED } GNodeMade; /* The OP_ constants are used when parsing a dependency line as a way of
CVS commit: src/sys/fs/ptyfs
Module Name:src Committed By: christos Date: Tue Nov 24 16:38:31 UTC 2020 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c Log Message: PR/55821: tar can not extract base.tgz anymore (./dev/pts and mounted ptyfs) Allow chown/chmod at the root of ptyfs. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/fs/ptyfs/ptyfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/ptyfs/ptyfs_vnops.c diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.60 src/sys/fs/ptyfs/ptyfs_vnops.c:1.61 --- src/sys/fs/ptyfs/ptyfs_vnops.c:1.60 Sat Jun 27 13:29:18 2020 +++ src/sys/fs/ptyfs/ptyfs_vnops.c Tue Nov 24 11:38:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vnops.c,v 1.60 2020/06/27 17:29:18 christos Exp $ */ +/* $NetBSD: ptyfs_vnops.c,v 1.61 2020/11/24 16:38:31 christos Exp $ */ /* * Copyright (c) 1993, 1995 @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.60 2020/06/27 17:29:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.61 2020/11/24 16:38:31 christos Exp $"); #include #include @@ -456,8 +456,6 @@ ptyfs_setattr(void *v) if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return EROFS; - if (ptyfs->ptyfs_type == PTYFSroot) - return EPERM; error = ptyfs_chown(vp, vap->va_uid, vap->va_gid, cred, l); if (error) return error; @@ -492,8 +490,6 @@ ptyfs_setattr(void *v) if (vap->va_mode != (mode_t)VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return EROFS; - if (ptyfs->ptyfs_type == PTYFSroot) - return EPERM; if ((ptyfs->ptyfs_flags & SF_SNAPSHOT) != 0 && (vap->va_mode & (S_IXUSR|S_IWUSR|S_IXGRP|S_IWGRP|S_IXOTH|S_IWOTH)))
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 16:28:44 UTC 2020 Modified Files: src/usr.bin/make: compat.c Log Message: make(1): move documentation about the result of Compat_Make To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/compat.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/compat.c diff -u src/usr.bin/make/compat.c:1.188 src/usr.bin/make/compat.c:1.189 --- src/usr.bin/make/compat.c:1.188 Tue Nov 24 15:59:18 2020 +++ src/usr.bin/make/compat.c Tue Nov 24 16:28:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.188 2020/11/24 15:59:18 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.189 2020/11/24 16:28:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.188 2020/11/24 15:59:18 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.189 2020/11/24 16:28:44 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -615,6 +615,15 @@ MakeOther(GNode *gn, GNode *pgn) * Input: * gn The node to make * pgn Parent to abort if necessary + * + * Output: + * gn->made + * UPTODATE gn was already up-to-date. + * MADE gn was recreated successfully. + * ERROR An error occurred while gn was being created, + *either due to missing commands or in -k mode. + * ABORTED gn was not remade because one of its + *dependencies could not be made due to errors. */ void Compat_Make(GNode *gn, GNode *pgn) @@ -648,7 +657,7 @@ void Compat_Run(GNodeList *targs) { GNode *gn = NULL; /* Current root target */ - int errors; /* Number of targets not remade due to errors */ + int indirectErrors; /* Number of targets not remade due to errors */ if (!shellName) Shell_Init(); @@ -688,17 +697,7 @@ Compat_Run(GNodeList *targs) */ Make_ExpandUse(targs); - /* - * For each entry in the list of targets to create, call Compat_Make - * on it to create the thing. Compat_Make will leave the 'made' field - * of gn in one of several states: - * UPTODATE gn was already up-to-date - * MADE gn was recreated successfully - * ERROR An error occurred while gn was being created - * ABORTED gn was not remade because one of its inferiors - * could not be made due to errors. - */ - errors = 0; + indirectErrors = 0; while (!Lst_IsEmpty(targs)) { gn = Lst_Dequeue(targs); Compat_Make(gn, gn); @@ -708,14 +707,14 @@ Compat_Run(GNodeList *targs) } else if (gn->made == ABORTED) { printf("`%s' not remade because of errors.\n", gn->name); - errors++; + indirectErrors++; } } /* * If the user has defined a .END target, run its commands. */ - if (errors == 0) { + if (indirectErrors == 0) { GNode *endNode = Targ_GetEndNode(); Compat_Make(endNode, endNode); if (gn->made == ERROR || endNode->made == ERROR) {
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Tue Nov 24 16:17:04 UTC 2020 Modified Files: src/sys/sys: device.h param.h Log Message: PR/55816: Martin Husemann: widen cfunit to 24 bits so that it fits the largest minor number which is 20 bits. Welcome to 2x2x19. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/sys/sys/device.h cvs rdiff -u -r1.679 -r1.680 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/device.h diff -u src/sys/sys/device.h:1.158 src/sys/sys/device.h:1.159 --- src/sys/sys/device.h:1.158 Sat Oct 3 18:32:50 2020 +++ src/sys/sys/device.h Tue Nov 24 11:17:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.158 2020/10/03 22:32:50 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.159 2020/11/24 16:17:04 christos Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -279,8 +279,8 @@ struct cfparent { struct cfdata { const char *cf_name; /* driver name */ const char *cf_atname; /* attachment name */ - short cf_unit; /* unit number */ - short cf_fstate; /* finding state (below) */ + unsigned int cf_unit:24; /* unit number */ + unsigned char cf_fstate; /* finding state (below) */ int *cf_loc; /* locators (machine dependent) */ int cf_flags; /* flags from config */ const struct cfparent *cf_pspec;/* parent specification */ Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.679 src/sys/sys/param.h:1.680 --- src/sys/sys/param.h:1.679 Thu Nov 12 02:44:01 2020 +++ src/sys/sys/param.h Tue Nov 24 11:17:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.679 2020/11/12 07:44:01 simonb Exp $ */ +/* $NetBSD: param.h,v 1.680 2020/11/24 16:17:04 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999007500 /* NetBSD 9.99.75 */ +#define __NetBSD_Version__ 999007600 /* NetBSD 9.99.76 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Tue Nov 24 15:59:18 UTC 2020 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: deptgt-end-fail.exp Log Message: make(1): fix missing "Stop." after failed .END node in -k mode To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/compat.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-end-fail.exp 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/compat.c diff -u src/usr.bin/make/compat.c:1.187 src/usr.bin/make/compat.c:1.188 --- src/usr.bin/make/compat.c:1.187 Mon Nov 23 23:41:11 2020 +++ src/usr.bin/make/compat.c Tue Nov 24 15:59:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.187 2020/11/23 23:41:11 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.188 2020/11/24 15:59:18 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.187 2020/11/23 23:41:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.188 2020/11/24 15:59:18 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -718,8 +718,7 @@ Compat_Run(GNodeList *targs) if (errors == 0) { GNode *endNode = Targ_GetEndNode(); Compat_Make(endNode, endNode); - /* XXX: Did you mean endNode->made instead of gn->made? */ - if (gn->made == ERROR) { + if (gn->made == ERROR || endNode->made == ERROR) { PrintOnError(gn, "\nStop."); exit(1); } Index: src/usr.bin/make/unit-tests/deptgt-end-fail.exp diff -u src/usr.bin/make/unit-tests/deptgt-end-fail.exp:1.1 src/usr.bin/make/unit-tests/deptgt-end-fail.exp:1.2 --- src/usr.bin/make/unit-tests/deptgt-end-fail.exp:1.1 Tue Nov 24 15:36:51 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail.exp Tue Nov 24 15:59:18 2020 @@ -1,4 +1,7 @@ : all false *** Error code 1 (continuing) -exit status 0 + +Stop. +make: stopped in unit-tests +exit status 1
CVS commit: src
Module Name:src Committed By: rillig Date: Tue Nov 24 15:36:51 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: deptgt-end-fail.exp deptgt-end-fail.mk Log Message: make(1): add test for missing "Stop" after error in .END To generate a diff of this commit: cvs rdiff -u -r1.975 -r1.976 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.221 -r1.222 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/deptgt-end-fail.exp \ src/usr.bin/make/unit-tests/deptgt-end-fail.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.975 src/distrib/sets/lists/tests/mi:1.976 --- src/distrib/sets/lists/tests/mi:1.975 Mon Nov 23 15:00:32 2020 +++ src/distrib/sets/lists/tests/mi Tue Nov 24 15:36:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.975 2020/11/23 15:00:32 rillig Exp $ +# $NetBSD: mi,v 1.976 2020/11/24 15:36:51 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4961,6 +4961,8 @@ ./usr/tests/usr.bin/make/unit-tests/deptgt-default.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-delete_on_error.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/deptgt-end-fail.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end-jobs.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end-jobs.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/deptgt-end.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.221 src/usr.bin/make/unit-tests/Makefile:1.222 --- src/usr.bin/make/unit-tests/Makefile:1.221 Mon Nov 23 16:01:59 2020 +++ src/usr.bin/make/unit-tests/Makefile Tue Nov 24 15:36:51 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.221 2020/11/23 16:01:59 rillig Exp $ +# $NetBSD: Makefile,v 1.222 2020/11/24 15:36:51 rillig Exp $ # # Unit tests for make(1) # @@ -112,6 +112,7 @@ TESTS+= deptgt-begin TESTS+= deptgt-default TESTS+= deptgt-delete_on_error TESTS+= deptgt-end +TESTS+= deptgt-end-fail TESTS+= deptgt-end-jobs TESTS+= deptgt-error TESTS+= deptgt-ignore Added files: Index: src/usr.bin/make/unit-tests/deptgt-end-fail.exp diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-end-fail.exp:1.1 --- /dev/null Tue Nov 24 15:36:51 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail.exp Tue Nov 24 15:36:51 2020 @@ -0,0 +1,4 @@ +: all +false +*** Error code 1 (continuing) +exit status 0 Index: src/usr.bin/make/unit-tests/deptgt-end-fail.mk diff -u /dev/null src/usr.bin/make/unit-tests/deptgt-end-fail.mk:1.1 --- /dev/null Tue Nov 24 15:36:51 2020 +++ src/usr.bin/make/unit-tests/deptgt-end-fail.mk Tue Nov 24 15:36:51 2020 @@ -0,0 +1,13 @@ +# $NetBSD: deptgt-end-fail.mk,v 1.1 2020/11/24 15:36:51 rillig Exp $ +# +# Tests for an error in the .END node. +# +# Before 2020-11-25, an error in the .END target did not print the "Stop.", +# even though this was intended. The cause for this was a simple typo in +# a variable name. + +all: + : $@ + +.END: + false