CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: rin Date: Mon Nov 23 06:46:38 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm2835_genfb.c Log Message: Sort headers. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm2835_genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: rin Date: Mon Nov 23 06:46:38 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm2835_genfb.c Log Message: Sort headers. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm2835_genfb.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/broadcom/bcm2835_genfb.c diff -u src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.9 src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.10 --- src/sys/arch/arm/broadcom/bcm2835_genfb.c:1.9 Sun Apr 1 04:35:03 2018 +++ src/sys/arch/arm/broadcom/bcm2835_genfb.c Mon Nov 23 06:46:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_genfb.c,v 1.9 2018/04/01 04:35:03 ryo Exp $ */ +/* $NetBSD: bcm2835_genfb.c,v 1.10 2020/11/23 06:46:38 rin Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,15 +31,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_genfb.c,v 1.9 2018/04/01 04:35:03 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_genfb.c,v 1.10 2020/11/23 06:46:38 rin Exp $"); #include #include -#include -#include -#include #include +#include +#include #include +#include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:39:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Add missing __KERNEL_RCSID(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/vcprop_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:39:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Add missing __KERNEL_RCSID(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/vcprop_subr.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/evbarm/rpi/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.8 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 Mon Nov 23 06:29:54 2020 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Mon Nov 23 06:39:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.7 2020/11/23 06:29:54 rin Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.8 2020/11/23 06:39:54 rin Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -28,6 +28,8 @@ /* * Mailbox property interface wrapper functions */ +#include +__KERNEL_RCSID(0, "$NetBSD: vcprop_subr.c,v 1.8 2020/11/23 06:39:54 rin Exp $"); #include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop_subr.c Log Message: Sort headers. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/rpi/vcprop_subr.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/evbarm/rpi/rpi_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.5 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.6 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.5 Sat Dec 8 06:53:11 2018 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Mon Nov 23 06:29:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.6 2020/11/23 06:29:54 rin Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,15 +31,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.6 2020/11/23 06:29:54 rin Exp $"); #include #include -#include -#include -#include #include +#include +#include #include +#include #include #include Index: src/sys/arch/evbarm/rpi/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.6 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.6 Sat Jul 4 15:14:56 2020 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Mon Nov 23 06:29:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.6 2020/07/04 15:14:56 skrll Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.7 2020/11/23 06:29:54 rin Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -30,8 +30,8 @@ */ #include -#include #include +#include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop_subr.c Log Message: Sort headers. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/rpi/vcprop_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:32 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Remove stray white space. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/rpi/vcprop.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/arch/evbarm/rpi/vcprop.h diff -u src/sys/arch/evbarm/rpi/vcprop.h:1.17 src/sys/arch/evbarm/rpi/vcprop.h:1.18 --- src/sys/arch/evbarm/rpi/vcprop.h:1.17 Mon Dec 30 15:58:12 2019 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Nov 23 06:29:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.17 2019/12/30 15:58:12 skrll Exp $ */ +/* $NetBSD: vcprop.h,v 1.18 2020/11/23 06:29:32 rin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -130,12 +130,12 @@ struct vcprop_tag_fwrev { struct vcprop_tag_boardmodel { struct vcprop_tag tag; uint32_t model; -} ; +}; struct vcprop_tag_boardrev { struct vcprop_tag tag; uint32_t rev; -} ; +}; #define VCPROP_REV_PCBREV __BITS(3,0) #define VCPROP_REV_MODEL __BITS(11,4)
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:32 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Remove stray white space. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/rpi/vcprop.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: rin Date: Mon Nov 23 06:24:35 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/evbarm/conf: RPI Log Message: Support EARLYCONS and VERBOSE_INIT_ARM for Raspberry Pi Zero W, for which mini UART should be used instead of PL011 UART. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.93 -r1.94 src/sys/arch/evbarm/conf/RPI 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/broadcom/bcm283x_platform.c diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.42 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.43 --- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.42 Mon Nov 23 06:21:07 2020 +++ src/sys/arch/arm/broadcom/bcm283x_platform.c Mon Nov 23 06:24:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin Exp $ */ +/* $NetBSD: bcm283x_platform.c,v 1.43 2020/11/23 06:24:35 rin Exp $ */ /*- * Copyright (c) 2017 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.43 2020/11/23 06:24:35 rin Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -112,6 +112,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm283x_plat #define RPI_CPU_MAX 4 void bcm2835_platform_early_putchar(char c); +void bcm2835_aux_platform_early_putchar(char c); void bcm2836_platform_early_putchar(char c); void bcm2837_platform_early_putchar(char c); void bcm2711_platform_early_putchar(char c); @@ -1368,6 +1369,15 @@ bcm2835_platform_early_putchar(char c) } void __noasan +bcm2835_aux_platform_early_putchar(char c) +{ + paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE); + vaddr_t va = BCM2835_IOPHYSTOVIRT(pa); + + bcm283x_aux_platform_early_putchar(va, pa, c); +} + +void __noasan bcm2836_platform_early_putchar(char c) { paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_UART0_BASE); Index: src/sys/arch/evbarm/conf/RPI diff -u src/sys/arch/evbarm/conf/RPI:1.93 src/sys/arch/evbarm/conf/RPI:1.94 --- src/sys/arch/evbarm/conf/RPI:1.93 Fri Oct 30 11:02:50 2020 +++ src/sys/arch/evbarm/conf/RPI Mon Nov 23 06:24:35 2020 @@ -1,5 +1,5 @@ # -# $NetBSD: RPI,v 1.93 2020/10/30 11:02:50 rin Exp $ +# $NetBSD: RPI,v 1.94 2020/11/23 06:24:35 rin Exp $ # # RPi -- Raspberry Pi # @@ -19,7 +19,8 @@ makeoptions CPUFLAGS="-march=armv6z -mt # Development and Debugging options #options KGDB,KGDB_PLCOMUNIT=0,KGDB_DEVRATE=115200,KGDB_CONMODE=0xB00 #options VERBOSE_INIT_ARM -#options EARLYCONS=bcm2835,CONSADDR=0x20201000 +#options EARLYCONS=bcm2835,CONSADDR=0x20201000 # RPI1, RPI0 +#options EARLYCONS=bcm2835_aux,CONSADDR=0x20215040 # RPI0W makeoptions DEBUG="-g" # compile full symbol table makeoptions COPY_SYMTAB=1 options PLCONSOLE
CVS commit: src/sys/arch
Module Name:src Committed By: rin Date: Mon Nov 23 06:24:35 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/evbarm/conf: RPI Log Message: Support EARLYCONS and VERBOSE_INIT_ARM for Raspberry Pi Zero W, for which mini UART should be used instead of PL011 UART. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.93 -r1.94 src/sys/arch/evbarm/conf/RPI Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: rin Date: Mon Nov 23 06:21:07 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c Log Message: Factor out bcm283x_aux_platform_early_putchar() from bcm{2837,2711}_platform_early_putchar(), for which output goes to AUX UART (aka mini UART). No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/broadcom/bcm283x_platform.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/broadcom/bcm283x_platform.c diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.41 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.42 --- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.41 Mon Sep 28 11:54:23 2020 +++ src/sys/arch/arm/broadcom/bcm283x_platform.c Mon Nov 23 06:21:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm283x_platform.c,v 1.41 2020/09/28 11:54:23 jmcneill Exp $ */ +/* $NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin Exp $ */ /*- * Copyright (c) 2017 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.41 2020/09/28 11:54:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.42 2020/11/23 06:21:07 rin Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -1344,6 +1344,20 @@ bcm283x_platform_early_putchar(vaddr_t v continue; } +static void __noasan +bcm283x_aux_platform_early_putchar(vaddr_t va, paddr_t pa, char c) +{ + volatile uint32_t *uartaddr = + cpu_earlydevice_va_p() ? + (volatile uint32_t *)va : + (volatile uint32_t *)pa; + + while ((uartaddr[com_lsr] & LSR_TXRDY) == 0) + continue; + + uartaddr[com_data] = c; +} + void __noasan bcm2835_platform_early_putchar(char c) { @@ -1365,37 +1379,19 @@ bcm2836_platform_early_putchar(char c) void __noasan bcm2837_platform_early_putchar(char c) { -#define AUCONSADDR_PA BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE) -#define AUCONSADDR_VA BCM2835_IOPHYSTOVIRT(AUCONSADDR_PA) - volatile uint32_t *uartaddr = - cpu_earlydevice_va_p() ? - (volatile uint32_t *)AUCONSADDR_VA : - (volatile uint32_t *)AUCONSADDR_PA; - - while ((uartaddr[com_lsr] & LSR_TXRDY) == 0) - ; + paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE); + vaddr_t va = BCM2835_IOPHYSTOVIRT(pa); - uartaddr[com_data] = c; -#undef AUCONSADDR_VA -#undef AUCONSADDR_PA + bcm283x_aux_platform_early_putchar(va, pa, c); } void __noasan bcm2711_platform_early_putchar(char c) { -#define AUCONSADDR_PA BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE) -#define AUCONSADDR_VA BCM2711_IOPHYSTOVIRT(AUCONSADDR_PA) - volatile uint32_t *uartaddr = - cpu_earlydevice_va_p() ? - (volatile uint32_t *)AUCONSADDR_VA : - (volatile uint32_t *)AUCONSADDR_PA; + paddr_t pa = BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE); + vaddr_t va = BCM2711_IOPHYSTOVIRT(pa); - while ((uartaddr[com_lsr] & LSR_TXRDY) == 0) - ; - - uartaddr[com_data] = c; -#undef AUCONSADDR_VA -#undef AUCONSADDR_PA + bcm283x_aux_platform_early_putchar(va, pa, c); } #define BCM283x_REF_FREQ 1920
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: rin Date: Mon Nov 23 06:21:07 UTC 2020 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c Log Message: Factor out bcm283x_aux_platform_early_putchar() from bcm{2837,2711}_platform_early_putchar(), for which output goes to AUX UART (aka mini UART). No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/broadcom/bcm283x_platform.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: chs Date: Mon Nov 23 00:52:53 UTC 2020 Modified Files: src/sys/kern: uipc_socket.c src/sys/netinet: tcp_usrreq.c src/sys/sys: socketvar.h Log Message: Restore correct functioning of SIOCATMARK by removing the previous change that was done to fix poll(POLLPRI | POLLRDBAND) and instead add a separate flag to track when poll() should indicate that a MSG_OOB byte is available. Re-fixes PR 54435 properly. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/sys/kern/uipc_socket.c cvs rdiff -u -r1.227 -r1.228 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.162 -r1.163 src/sys/sys/socketvar.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/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.292 src/sys/kern/uipc_socket.c:1.293 --- src/sys/kern/uipc_socket.c:1.292 Sat Oct 17 09:06:15 2020 +++ src/sys/kern/uipc_socket.c Mon Nov 23 00:52:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.292 2020/10/17 09:06:15 mlelstv Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.293 2020/11/23 00:52:53 chs Exp $ */ /* * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.292 2020/10/17 09:06:15 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.293 2020/11/23 00:52:53 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1186,9 +1186,6 @@ soreceive(struct socket *so, struct mbuf MIN(uio->uio_resid, m->m_len), uio); m = m_free(m); } while (uio->uio_resid > 0 && error == 0 && m); - /* We consumed the oob data, no more oobmark. */ - so->so_oobmark = 0; - so->so_state &= ~SS_RCVATMARK; bad: if (m != NULL) m_freem(m); @@ -1565,6 +1562,8 @@ dontblock: if (offset == so->so_oobmark) break; } + } else { + so->so_state &= ~SS_POLLRDBAND; } if (flags & MSG_EOR) break; @@ -2214,6 +2213,7 @@ void sohasoutofband(struct socket *so) { + so->so_state |= SS_POLLRDBAND; fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so); selnotify(>so_rcv.sb_sel, POLLPRI | POLLRDBAND, NOTE_SUBMIT); } @@ -2388,7 +2388,7 @@ sodopoll(struct socket *so, int events) revents |= events & (POLLOUT | POLLWRNORM); if (events & (POLLPRI | POLLRDBAND)) - if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) + if (so->so_state & SS_POLLRDBAND) revents |= events & (POLLPRI | POLLRDBAND); return revents; Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.227 src/sys/netinet/tcp_usrreq.c:1.228 --- src/sys/netinet/tcp_usrreq.c:1.227 Sat Oct 17 08:50:38 2020 +++ src/sys/netinet/tcp_usrreq.c Mon Nov 23 00:52:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.227 2020/10/17 08:50:38 mlelstv Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.227 2020/10/17 08:50:38 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1095,8 +1095,10 @@ tcp_recvoob(struct socket *so, struct mb m->m_len = 1; *mtod(m, char *) = tp->t_iobc; - if ((flags & MSG_PEEK) == 0) + if ((flags & MSG_PEEK) == 0) { tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA); + so->so_state &= ~SS_POLLRDBAND; + } tcp_debug_trace(so, tp, ostate, PRU_RCVOOB); splx(s); Index: src/sys/sys/socketvar.h diff -u src/sys/sys/socketvar.h:1.162 src/sys/sys/socketvar.h:1.163 --- src/sys/sys/socketvar.h:1.162 Tue Nov 17 03:22:33 2020 +++ src/sys/sys/socketvar.h Mon Nov 23 00:52:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: socketvar.h,v 1.162 2020/11/17 03:22:33 chs Exp $ */ +/* $NetBSD: socketvar.h,v 1.163 2020/11/23 00:52:53 chs Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -197,12 +197,12 @@ struct socket { #define SS_RCVATMARK 0x040 /* at mark on input */ #define SS_ISABORTING 0x080 /* aborting fd references - close() */ #define SS_RESTARTSYS 0x100 /* restart blocked system calls */ -#define SS_ISDISCONNECTED 0x800 /* socket disconnected from peer */ - +#define SS_POLLRDBAND 0x200 /* poll should return POLLRDBAND */ #define SS_MORETOCOME 0x400 /* * hint from sosend to lower layer; * more data coming */ +#define SS_ISDISCONNECTED 0x800 /* socket disconnected from peer */ #define SS_ISAPIPE 0x1000 /* socket is implementing a pipe */ #define SS_NBIO 0x2000 /* socket is in non blocking I/O */
CVS commit: src/sys
Module Name:src Committed By: chs Date: Mon Nov 23 00:52:53 UTC 2020 Modified Files: src/sys/kern: uipc_socket.c src/sys/netinet: tcp_usrreq.c src/sys/sys: socketvar.h Log Message: Restore correct functioning of SIOCATMARK by removing the previous change that was done to fix poll(POLLPRI | POLLRDBAND) and instead add a separate flag to track when poll() should indicate that a MSG_OOB byte is available. Re-fixes PR 54435 properly. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/sys/kern/uipc_socket.c cvs rdiff -u -r1.227 -r1.228 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.162 -r1.163 src/sys/sys/socketvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 23:45:20 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: suff-transform-debug.exp suff-transform-debug.mk Log Message: make(1): add test for debug output from transformation rules To generate a diff of this commit: cvs rdiff -u -r1.973 -r1.974 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.218 -r1.219 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-transform-debug.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.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.973 src/distrib/sets/lists/tests/mi:1.974 --- src/distrib/sets/lists/tests/mi:1.973 Sun Nov 22 20:36:17 2020 +++ src/distrib/sets/lists/tests/mi Sun Nov 22 23:45:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.973 2020/11/22 20:36:17 rillig Exp $ +# $NetBSD: mi,v 1.974 2020/11/22 23:45:20 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5293,6 +5293,8 @@ ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-self.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-self.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-transform-debug.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-transform-debug.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-expand.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.218 src/usr.bin/make/unit-tests/Makefile:1.219 --- src/usr.bin/make/unit-tests/Makefile:1.218 Sun Nov 22 20:36:17 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Nov 22 23:45:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.218 2020/11/22 20:36:17 rillig Exp $ +# $NetBSD: Makefile,v 1.219 2020/11/22 23:45:20 rillig Exp $ # # Unit tests for make(1) # @@ -270,6 +270,7 @@ TESTS+= suff-main TESTS+= suff-main-several TESTS+= suff-rebuild TESTS+= suff-self +TESTS+= suff-transform-debug TESTS+= suff-transform-endless TESTS+= suff-transform-expand TESTS+= suff-transform-select @@ -446,7 +447,6 @@ SED_CMDS.job-output-long-lines= \ -e '/^bb*--- job-a ---$$/d' SED_CMDS.objdir-writable= -e 's,${RO_OBJDIR},OBJDIR/roobj,g' SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1} -SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(),' SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid ,' SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process ,' @@ -454,8 +454,10 @@ SED_CMDS.opt-debug-jobs+= -e 's,JobFinis SED_CMDS.opt-debug-jobs+= -e 's,Command: ${.SHELL:T},Command: ,' # The "-q" may be there or not, see jobs.c, variable shells. SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: \) -q,\1,' +SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} +SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} SED_CMDS.var-op-shell+= \ -e 's,^${.SHELL:T}: [ 0-9:]*,,' \ -e '/command/s,No such.*,not found,' @@ -474,7 +476,8 @@ POSTPROC.deptgt-suffixes= awk '/^\#\*\*\ POSTPROC.gnode-submake= awk '/Input graph/, /^$$/' POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p' # The directory cache contains the hard-coded '/usr/share/mk'. -POSTPROC.suff-main-several= awk '/Directory Cache/,/^$$/ { next } { print }' +POSTPROC.suff-main-several= ${STD_POSTPROC.dg1} +POSTPROC.suff-transform-debug= ${STD_POSTPROC.dg1} # Some tests reuse other tests, which makes them unnecessarily fragile. export-all.rawout: export.mk @@ -491,6 +494,7 @@ STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1 ,' +STD_POSTPROC.dg1= awk '/Directory Cache/,/^$$/ { next } { print }' # End of the configuration helpers section. Added files: Index: src/usr.bin/make/unit-tests/suff-transform-debug.exp diff -u /dev/null src/usr.bin/make/unit-tests/suff-transform-debug.exp:1.1 --- /dev/null Sun Nov 22 23:45:20 2020 +++ src/usr.bin/make/unit-tests/suff-transform-debug.exp Sun Nov 22 23:45:20 2020 @@ -0,0 +1,55 @@ +#*** Input graph: +# all, made UNMADE, type OP_DEPENDS, flags none + + +# +# Files that are only sources: +#***
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 23:45:20 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: suff-transform-debug.exp suff-transform-debug.mk Log Message: make(1): add test for debug output from transformation rules To generate a diff of this commit: cvs rdiff -u -r1.973 -r1.974 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.218 -r1.219 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-transform-debug.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 22:58:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add high-level API for CandidateSearcher This avoids passing invisible void pointers around in Lst_Append. It also provides a convenient place to document what it means to "add a candidate to the searcher". To generate a diff of this commit: cvs rdiff -u -r1.302 -r1.303 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.302 src/usr.bin/make/suff.c:1.303 --- src/usr.bin/make/suff.c:1.302 Sun Nov 22 22:27:19 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 22:58:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.302 2020/11/22 22:27:19 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.303 2020/11/22 22:58:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.302 2020/11/22 22:27:19 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.303 2020/11/22 22:58:43 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -898,6 +898,41 @@ Suff_AddLib(const char *suffName) /** Implicit Source Search Functions */ +static void +CandidateSearcher_Init(CandidateSearcher *cs) +{ +cs->list = Lst_New(); +} + +static void +CandidateSearcher_Done(CandidateSearcher *cs) +{ +Lst_Free(cs->list); +} + +static void +CandidateSearcher_Add(CandidateSearcher *cs, Candidate *cand) +{ +/* TODO: filter duplicates */ +Lst_Append(cs->list, cand); +} + +static void +CandidateSearcher_AddIfNew(CandidateSearcher *cs, Candidate *cand) +{ +/* TODO: filter duplicates */ +if (Lst_FindDatum(cs->list, cand) == NULL) + Lst_Append(cs->list, cand); +} + +static void +CandidateSearcher_MoveAll(CandidateSearcher *cs, CandidateList *list) +{ +/* TODO: filter duplicates */ +Lst_MoveAll(cs->list, list); +} + + #ifdef DEBUG_SRC static void CandidateList_PrintAddrs(CandidateList *list) @@ -1061,7 +1096,7 @@ FindThem(CandidateList *srcs, CandidateS SUFF_DEBUG0("not there\n"); CandidateList_AddCandidatesFor(srcs, src); - Lst_Append(cs->list, src); + CandidateSearcher_Add(cs, src); } if (retsrc) { @@ -1137,7 +1172,7 @@ FindCmds(Candidate *targ, CandidateSearc targ, targ->file, ret, ret->file); Lst_Append(targ->childrenList, ret); #endif -Lst_Append(cs->list, ret); +CandidateSearcher_Add(cs, ret); SUFF_DEBUG1("\tusing existing source %s\n", sgn->name); return ret; } @@ -1861,8 +1896,7 @@ sfnd_abort: * up to but not including the parent node. */ while (bottom != NULL && bottom->parent != NULL) { - if (Lst_FindDatum(cs->list, bottom) == NULL) - Lst_Append(cs->list, bottom); + CandidateSearcher_AddIfNew(cs, bottom); bottom = bottom->parent; } bottom = src; @@ -1924,14 +1958,22 @@ sfnd_abort: * two lists. */ sfnd_return: -if (bottom != NULL && Lst_FindDatum(cs->list, bottom) == NULL) - Lst_Append(cs->list, bottom); +if (bottom != NULL) + CandidateSearcher_AddIfNew(cs, bottom); while (RemoveCandidate(srcs) || RemoveCandidate(targs)) continue; -Lst_MoveAll(cs->list, srcs); -Lst_MoveAll(cs->list, targs); +CandidateSearcher_MoveAll(cs, srcs); +CandidateSearcher_MoveAll(cs, targs); +} + +static void +CandidateSearcher_CleanUp(CandidateSearcher *cs) +{ +while (RemoveCandidate(cs->list)) + continue; +assert(Lst_IsEmpty(cs->list)); } @@ -1952,15 +1994,14 @@ sfnd_return: void Suff_FindDeps(GNode *gn) { -CandidateSearcher cs = { Lst_New() }; +CandidateSearcher cs; -FindDeps(gn, ); +CandidateSearcher_Init(); -while (RemoveCandidate(cs.list)) - continue; +FindDeps(gn, ); -assert(Lst_IsEmpty(cs.list)); -Lst_Free(cs.list); +CandidateSearcher_CleanUp(); +CandidateSearcher_Done(); } static void
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 22:58:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add high-level API for CandidateSearcher This avoids passing invisible void pointers around in Lst_Append. It also provides a convenient place to document what it means to "add a candidate to the searcher". To generate a diff of this commit: cvs rdiff -u -r1.302 -r1.303 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 22:27:19 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add CandidateSearcher to resolve transformation rules Having a simple list of candidates is not enough. It is currently possible to construct endless loops with huge memory usage, as demonstrated in suff-transform-endless.mk. To fix this, a straight-forward idea is to remember which candidates have already been searched and to not search them again. This also fixes a small inconsistency in the code. Most parameters had been named slst (the s came from a time when Candidate was named Src), except for Suff_FindDeps, where the variable was named srcs. The confusing thing about this was that the name srcs is used throughout the file for a different purpose. Only in FindThem there were two parameters of the same type, which made this even more confusing. To generate a diff of this commit: cvs rdiff -u -r1.301 -r1.302 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.301 src/usr.bin/make/suff.c:1.302 --- src/usr.bin/make/suff.c:1.301 Sun Nov 22 21:34:34 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 22:27:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.302 2020/11/22 22:27:19 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.302 2020/11/22 22:27:19 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -209,6 +209,17 @@ typedef struct Candidate { #endif } Candidate; +typedef struct CandidateSearcher { + +CandidateList *list; + +/* + * TODO: Add HashSet for seen entries, to avoid endless loops such as + * in suff-transform-endless.mk. + */ + +} CandidateSearcher; + /* TODO: Document the difference between nullSuff and emptySuff. */ /* The NULL suffix for this run */ @@ -1011,9 +1022,8 @@ RemoveCandidate(CandidateList *srcs) } /* Find the first existing file/target in srcs. */ -/* XXX: The parameter names are too similar. */ static Candidate * -FindThem(CandidateList *srcs, CandidateList *slst) +FindThem(CandidateList *srcs, CandidateSearcher *cs) { Candidate *retsrc = NULL; @@ -1051,7 +1061,7 @@ FindThem(CandidateList *srcs, CandidateL SUFF_DEBUG0("not there\n"); CandidateList_AddCandidatesFor(srcs, src); - Lst_Append(slst, src); + Lst_Append(cs->list, src); } if (retsrc) { @@ -1066,7 +1076,7 @@ FindThem(CandidateList *srcs, CandidateL * for it and returned. */ static Candidate * -FindCmds(Candidate *targ, CandidateList *slst) +FindCmds(Candidate *targ, CandidateSearcher *cs) { GNodeListNode *gln; GNode *tgn; /* Target GNode */ @@ -1127,7 +1137,7 @@ FindCmds(Candidate *targ, CandidateList targ, targ->file, ret, ret->file); Lst_Append(targ->childrenList, ret); #endif -Lst_Append(slst, ret); +Lst_Append(cs->list, ret); SUFF_DEBUG1("\tusing existing source %s\n", sgn->name); return ret; } @@ -1471,7 +1481,7 @@ ExpandMember(GNode *gn, const char *eoar } } -static void FindDeps(GNode *, CandidateList *); +static void FindDeps(GNode *, CandidateSearcher *); /* Locate dependencies for an OP_ARCHV node. * @@ -1482,7 +1492,7 @@ static void FindDeps(GNode *, CandidateL * Same as Suff_FindDeps */ static void -FindDepsArchive(GNode *gn, CandidateList *slst) +FindDepsArchive(GNode *gn, CandidateSearcher *cs) { char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ @@ -1517,7 +1527,7 @@ FindDepsArchive(GNode *gn, CandidateList * suffix list, backtracking for each one... */ mem = Targ_GetNode(name); -FindDeps(mem, slst); +FindDeps(mem, cs); /* * Create the link between the two nodes right off @@ -1733,7 +1743,7 @@ FindDepsRegularPath(GNode *gn, Candidate * Same as Suff_FindDeps */ static void -FindDepsRegular(GNode *gn, CandidateList *slst) +FindDepsRegular(GNode *gn, CandidateSearcher *cs) { CandidateList *srcs; /* List of sources at which to look */ CandidateList *targs; /* List of targets to which things can be @@ -1788,7 +1798,7 @@ FindDepsRegular(GNode *gn, CandidateList * Using the list of possible sources built up from the target * suffix(es), try and find an existing file/target that matches. */ - bottom = FindThem(srcs, slst); + bottom = FindThem(srcs, cs); if (bottom == NULL) { /* @@ -1843,7 +1853,7 @@ sfnd_abort: * Check for overriding transformation rule implied by sources */ if
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 22:27:19 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add CandidateSearcher to resolve transformation rules Having a simple list of candidates is not enough. It is currently possible to construct endless loops with huge memory usage, as demonstrated in suff-transform-endless.mk. To fix this, a straight-forward idea is to remember which candidates have already been searched and to not search them again. This also fixes a small inconsistency in the code. Most parameters had been named slst (the s came from a time when Candidate was named Src), except for Suff_FindDeps, where the variable was named srcs. The confusing thing about this was that the name srcs is used throughout the file for a different purpose. Only in FindThem there were two parameters of the same type, which made this even more confusing. To generate a diff of this commit: cvs rdiff -u -r1.301 -r1.302 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 21:37:09 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: suff-transform-endless.mk Log Message: make(1): fix confusing command output in test suff-transform-endless To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/usr.bin/make/unit-tests/suff-transform-endless.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 21:37:09 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: suff-transform-endless.mk Log Message: make(1): fix confusing command output in test suff-transform-endless To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/usr.bin/make/unit-tests/suff-transform-endless.mk 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/suff-transform-endless.mk diff -u src/usr.bin/make/unit-tests/suff-transform-endless.mk:1.1 src/usr.bin/make/unit-tests/suff-transform-endless.mk:1.2 --- src/usr.bin/make/unit-tests/suff-transform-endless.mk:1.1 Tue Oct 20 20:36:53 2020 +++ src/usr.bin/make/unit-tests/suff-transform-endless.mk Sun Nov 22 21:37:09 2020 @@ -1,4 +1,4 @@ -# $NetBSD: suff-transform-endless.mk,v 1.1 2020/10/20 20:36:53 rillig Exp $ +# $NetBSD: suff-transform-endless.mk,v 1.2 2020/11/22 21:37:09 rillig Exp $ # https://gnats.netbsd.org/49086, issue 6: # Transformation search can end up in an infinite loop. @@ -16,7 +16,7 @@ all: issue6.f .SUFFIXES: .c .d .e .f .e .e.f .f.e: - : 'Making ${.TARGET} out of nothing.' + : 'Making ${.TARGET} from ${.IMPSRC}.' # XXX: As of 2020-10-20, the result is unexpected. # XXX: .d.c is not a transformation rule.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 21:34:34 UTC 2020 Modified Files: src/usr.bin/make: make.h suff.c src/usr.bin/make/unit-tests: suff-incomplete.exp suff-lookup.exp suff-rebuild.exp Log Message: make(1): add more debugging for searching transformation rules To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/usr.bin/make/make.h cvs rdiff -u -r1.300 -r1.301 src/usr.bin/make/suff.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/suff-incomplete.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/suff-lookup.exp \ src/usr.bin/make/unit-tests/suff-rebuild.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/make.h diff -u src/usr.bin/make/make.h:1.213 src/usr.bin/make/make.h:1.214 --- src/usr.bin/make/make.h:1.213 Sun Nov 22 10:48:11 2020 +++ src/usr.bin/make/make.h Sun Nov 22 21:34:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.213 2020/11/22 10:48:11 rillig Exp $ */ +/* $NetBSD: make.h,v 1.214 2020/11/22 21:34:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -279,7 +279,8 @@ typedef enum GNodeType { * this node will be saved on the .END node instead, to be executed at * the very end. */ OP_SAVE_CMDS = 1 << 25, -/* Already processed by Suff_FindDeps */ +/* Already processed by Suff_FindDeps, to find dependencies from suffix + * transformation rules. */ OP_DEPS_FOUND = 1 << 24, /* Node found while expanding .ALLSRC */ OP_MARK = 1 << 23, Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.300 src/usr.bin/make/suff.c:1.301 --- src/usr.bin/make/suff.c:1.300 Sun Nov 22 20:29:53 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 21:34:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.301 2020/11/22 21:34:34 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -893,8 +893,10 @@ CandidateList_PrintAddrs(CandidateList * { CandidateListNode *ln; -for (ln = list->first; ln != NULL; ln = ln->next) - debug_printf(" %p", ln->datum); +for (ln = list->first; ln != NULL; ln = ln->next) { + Candidate *cand = ln->datum; + debug_printf(" %p:%s", cand, cand->file); +} debug_printf("\n"); } #endif @@ -929,8 +931,8 @@ CandidateList_Add(CandidateList *list, c #ifdef DEBUG_SRC Lst_Append(targ->childrenList, cand); -debug_printf("%s add suff %p candidate %p to list %p:", - debug_tag, targ, cand, list); +debug_printf("%s add suff %p:%s candidate %p:%s to list %p:", + debug_tag, targ, targ->file, cand, cand->file, list); CandidateList_PrintAddrs(list); #endif } @@ -988,8 +990,8 @@ RemoveCandidate(CandidateList *srcs) src->parent->numChildren--; } #ifdef DEBUG_SRC - debug_printf("free: list %p src %p children %d\n", - srcs, src, src->numChildren); + debug_printf("free: list %p src %p:%s children %d\n", + srcs, src, src->file, src->numChildren); Lst_Free(src->childrenList); #endif Lst_Remove(srcs, ln); @@ -998,8 +1000,8 @@ RemoveCandidate(CandidateList *srcs) } #ifdef DEBUG_SRC else { - debug_printf("keep: list %p src %p children %d:", - srcs, src, src->numChildren); + debug_printf("keep: list %p src %p:%s children %d:", + srcs, src, src->file, src->numChildren); CandidateList_PrintAddrs(src->childrenList); } #endif @@ -1026,7 +1028,8 @@ FindThem(CandidateList *srcs, CandidateL */ if (Targ_FindNode(src->file) != NULL) { #ifdef DEBUG_SRC - debug_printf("remove from list %p src %p\n", srcs, src); + debug_printf("remove from list %p src %p:%s\n", + srcs, src, src->file); #endif retsrc = src; break; @@ -1037,7 +1040,8 @@ FindThem(CandidateList *srcs, CandidateL if (file != NULL) { retsrc = src; #ifdef DEBUG_SRC - debug_printf("remove from list %p src %p\n", srcs, src); + debug_printf("remove from list %p src %p:%s\n", + srcs, src, src->file); #endif free(file); break; @@ -1119,7 +1123,8 @@ FindCmds(Candidate *targ, CandidateList ret = Candidate_New(bmake_strdup(sgn->name), targ->prefix, suff, targ, sgn); targ->numChildren++; #ifdef DEBUG_SRC -debug_printf("3 add targ %p ret %p\n", targ, ret); +debug_printf("3 add targ %p:%s ret %p:%s\n", + targ, targ->file, ret, ret->file); Lst_Append(targ->childrenList, ret); #endif Lst_Append(slst, ret); @@ -1741,6 +1746,10 @@ FindDepsRegular(GNode *gn, CandidateList const char *name = gn->name; size_t nameLen =
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 21:34:34 UTC 2020 Modified Files: src/usr.bin/make: make.h suff.c src/usr.bin/make/unit-tests: suff-incomplete.exp suff-lookup.exp suff-rebuild.exp Log Message: make(1): add more debugging for searching transformation rules To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/usr.bin/make/make.h cvs rdiff -u -r1.300 -r1.301 src/usr.bin/make/suff.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/suff-incomplete.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/suff-lookup.exp \ src/usr.bin/make/unit-tests/suff-rebuild.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 20:36:17 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: suff-main-several.exp suff-main-several.mk Log Message: make(1): add another unit test for suffix handling To generate a diff of this commit: cvs rdiff -u -r1.972 -r1.973 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.447 -r1.448 src/usr.bin/make/parse.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-main-several.exp \ src/usr.bin/make/unit-tests/suff-main-several.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.972 src/distrib/sets/lists/tests/mi:1.973 --- src/distrib/sets/lists/tests/mi:1.972 Sun Nov 22 19:37:27 2020 +++ src/distrib/sets/lists/tests/mi Sun Nov 22 20:36:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.972 2020/11/22 19:37:27 rillig Exp $ +# $NetBSD: mi,v 1.973 2020/11/22 20:36:17 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5285,6 +5285,8 @@ ./usr/tests/usr.bin/make/unit-tests/suff-incomplete.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-lookup.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-lookup.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-main-several.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-main-several.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-main.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-main.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.447 src/usr.bin/make/parse.c:1.448 --- src/usr.bin/make/parse.c:1.447 Sun Nov 22 20:29:53 2020 +++ src/usr.bin/make/parse.c Sun Nov 22 20:36:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.448 2020/11/22 20:36:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.448 2020/11/22 20:36:17 rillig Exp $"); /* types and constants */ @@ -902,9 +902,10 @@ ParseDoSrcMain(const char *src) * the sources of said target to the list of things to create. * * Note that this will only be invoked if the user didn't specify a - * target on the command line. This is to allow .ifmake to succeed. + * target on the command line and the .MAIN occurs for the first time. * - * XXX: Double-check all of the above comment. + * See ParseDoDependencyTargetSpecial, branch SP_MAIN. + * See unit-tests/cond-func-make-main.mk. */ Lst_Append(opts.create, bmake_strdup(src)); /* Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.217 src/usr.bin/make/unit-tests/Makefile:1.218 --- src/usr.bin/make/unit-tests/Makefile:1.217 Sun Nov 22 19:37:27 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Nov 22 20:36:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.217 2020/11/22 19:37:27 rillig Exp $ +# $NetBSD: Makefile,v 1.218 2020/11/22 20:36:17 rillig Exp $ # # Unit tests for make(1) # @@ -267,6 +267,7 @@ TESTS+= suff-clear-single TESTS+= suff-incomplete TESTS+= suff-lookup TESTS+= suff-main +TESTS+= suff-main-several TESTS+= suff-rebuild TESTS+= suff-self TESTS+= suff-transform-endless @@ -454,6 +455,7 @@ SED_CMDS.opt-debug-jobs+= -e 's,Command: # The "-q" may be there or not, see jobs.c, variable shells. SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: \) -q,\1,' SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} +SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} SED_CMDS.var-op-shell+= \ -e 's,^${.SHELL:T}: [ 0-9:]*,,' \ -e '/command/s,No such.*,not found,' @@ -471,6 +473,8 @@ SED_CMDS.varname-dot-shell+= -e 's,\[/[^ POSTPROC.deptgt-suffixes= awk '/^\#\*\*\* Suffixes/,/^never-stop/' POSTPROC.gnode-submake= awk '/Input graph/, /^$$/' POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p' +# The directory cache contains the hard-coded '/usr/share/mk'. +POSTPROC.suff-main-several= awk '/Directory Cache/,/^$$/ { next } { print }' # Some tests reuse other tests, which makes them unnecessarily fragile. export-all.rawout: export.mk Added files: Index: src/usr.bin/make/unit-tests/suff-main-several.exp diff -u
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 20:36:17 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: suff-main-several.exp suff-main-several.mk Log Message: make(1): add another unit test for suffix handling To generate a diff of this commit: cvs rdiff -u -r1.972 -r1.973 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.447 -r1.448 src/usr.bin/make/parse.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-main-several.exp \ src/usr.bin/make/unit-tests/suff-main-several.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 20:29:54 UTC 2020 Modified Files: src/usr.bin/make: parse.c suff.c Log Message: make(1): add debug logging for setting and resetting the main target The suffix code still doesn't behave as expected. Make sure that at least setting the main target works as expected. It does, and the added debug logging provides further hints for debugging the suffix handling code. To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/parse.c cvs rdiff -u -r1.299 -r1.300 src/usr.bin/make/suff.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/parse.c diff -u src/usr.bin/make/parse.c:1.446 src/usr.bin/make/parse.c:1.447 --- src/usr.bin/make/parse.c:1.446 Sun Nov 22 19:14:24 2020 +++ src/usr.bin/make/parse.c Sun Nov 22 20:29:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $"); /* types and constants */ @@ -1006,6 +1006,7 @@ FindMainTarget(void) for (ln = targets->first; ln != NULL; ln = ln->next) { GNode *gn = ln->datum; if (!(gn->type & OP_NOTARGET)) { + DEBUG1(MAKE, "Setting main node to \"%s\"\n", gn->name); mainNode = gn; Targ_SetMain(gn); return; Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.299 src/usr.bin/make/suff.c:1.300 --- src/usr.bin/make/suff.c:1.299 Sun Nov 22 18:13:52 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 20:29:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -686,6 +686,7 @@ UpdateTarget(GNode *target, GNode **inou if (*inout_main == NULL && *inout_removedMain && !(target->type & OP_NOTARGET)) { + DEBUG1(MAKE, "Setting main node to \"%s\"\n", target->name); *inout_main = target; Targ_SetMain(target); /* @@ -726,6 +727,8 @@ UpdateTarget(GNode *target, GNode **inou if (ParseTransform(target->name, , )) { if (*inout_main == target) { + DEBUG1(MAKE, "Setting main node from \"%s\" back to null\n", + target->name); *inout_removedMain = TRUE; *inout_main = NULL; Targ_SetMain(NULL);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 20:29:54 UTC 2020 Modified Files: src/usr.bin/make: parse.c suff.c Log Message: make(1): add debug logging for setting and resetting the main target The suffix code still doesn't behave as expected. Make sure that at least setting the main target works as expected. It does, and the added debug logging provides further hints for debugging the suffix handling code. To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/parse.c cvs rdiff -u -r1.299 -r1.300 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: jmcneill Date: Sun Nov 22 20:17:39 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gicv3.c Log Message: Fix interrupt priorities on N1 SDP. The GICv3 architecture specification is not clear on the NS view of priority registers, and there doesn't seem to be any consistency in how these are implemented in both real and emulated environments. The previous fix for this issue was meant to detect what we thought at the time was a bug on the Rockchip RK3399. At that time the theory was somehow EL1 has a secure view of the hardware, and this is causing us to have the wrong view of IPRIORITYRn based on IHI0069F section 4.8.6 "Software accesses of interrupt priority". But it turns out that this is not the full picture. While I was able to confirm that yes, we do have secure access to the GIC on RK3399 from EL1, the view of IPRIORITYRn differs depending on whether you are using the Rockchip TF-A as included with https://github.com/ayufan-rock64/linux-u-boot (shifted view), or mainline TF-A from pkgsrc (unshifted view). So to detect this quirk, we need three things: A method to detect if we have S access to GIC registers, a method to see how many PMR bits are implemented, and a method to see how many IPRIORITYRn bits are implemented. To detect S access, we can try to toggle GICD_CTRL.EnableGrp1S. This bit is either RES0 (security extensions not implemented), RAZ/WI (non-secure access in two security state systems) or RW (secure access in two security state systems). To read the number of PMR and IPRIORITYRn bits supported, we can write all 1s to the register fields and read them back. For the RK3399 (Rockchip TF-A) quirk, we assume a shifted view of IPRIORITYRn if we have detected S accesses, and the PMR and IPRIORITYRn values differ. The S access test is required because some real hardware implementations (Ampere eMAG) were observed to report different PMR and IPRIORITYRn masks, but present an unshifted view of IPRIORITYRn. During testing, I also discovered that QEMU 5.1 requires this shifted view workaround as well -- as far as I can tell, this is a QEMU bug. We can't detect it the same way as RK3399 because security is disabled in the emulated GIC, and the PMR and IPRIORITYRn tests both return 0xff! So now if the GICv3 driver sees this configuration, it assumes that the shifted view is required. Honestly, this feature is so poorly documented that maybe it is better to give up on HW priorities and preemption and use a single flat model like Linux and FreeBSD does. Tested on Arm N1 SDP, ROCKpro64 (RK3399) with Rockchip and pkgsrc TF-A, Pinebook Pro (RK3399), Lenovo HR330A (Ampere eMAG), QEMU 5.1 (gic-version=3), AWS EC2 a1.medium (Graviton). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/cortex/gicv3.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.33 src/sys/arch/arm/cortex/gicv3.c:1.34 --- src/sys/arch/arm/cortex/gicv3.c:1.33 Sat Nov 21 11:44:00 2020 +++ src/sys/arch/arm/cortex/gicv3.c Sun Nov 22 20:17:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $ */ +/* $NetBSD: gicv3.c,v 1.34 2020/11/22 20:17:39 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -31,7 +31,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.33 2020/11/21 11:44:00 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.34 2020/11/22 20:17:39 jmcneill Exp $"); #include #include @@ -755,26 +755,37 @@ gicv3_irq_handler(void *frame) pic_do_pending_ints(I32_bit, oldipl, frame); } -static int -gicv3_detect_pmr_bits(struct gicv3_softc *sc) +static bool +gicv3_access_is_secure(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); + + return nctlr != octlr; +} + +static uint8_t +gicv3_get_pmr_bits(struct gicv3_softc *sc) { const uint32_t opmr = icc_pmr_read(); - icc_pmr_write(0xbf); + icc_pmr_write(0xff); const uint32_t npmr = icc_pmr_read(); icc_pmr_write(opmr); - return NBBY - (ffs(npmr) - 1); + return npmr; } -static int -gicv3_detect_ipriority_bits(struct gicv3_softc *sc) +static uint8_t +gicv3_get_ipriority_bits(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); - return NBBY - (ffs(nipriorityr & 0xff) - 1); + return nipriorityr & 0xff; } int @@ -782,6 +793,7 @@ gicv3_init(struct gicv3_softc *sc) { const uint32_t gicd_typer = gicd_read_4(sc, GICD_TYPER); const uint32_t
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: jmcneill Date: Sun Nov 22 20:17:39 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gicv3.c Log Message: Fix interrupt priorities on N1 SDP. The GICv3 architecture specification is not clear on the NS view of priority registers, and there doesn't seem to be any consistency in how these are implemented in both real and emulated environments. The previous fix for this issue was meant to detect what we thought at the time was a bug on the Rockchip RK3399. At that time the theory was somehow EL1 has a secure view of the hardware, and this is causing us to have the wrong view of IPRIORITYRn based on IHI0069F section 4.8.6 "Software accesses of interrupt priority". But it turns out that this is not the full picture. While I was able to confirm that yes, we do have secure access to the GIC on RK3399 from EL1, the view of IPRIORITYRn differs depending on whether you are using the Rockchip TF-A as included with https://github.com/ayufan-rock64/linux-u-boot (shifted view), or mainline TF-A from pkgsrc (unshifted view). So to detect this quirk, we need three things: A method to detect if we have S access to GIC registers, a method to see how many PMR bits are implemented, and a method to see how many IPRIORITYRn bits are implemented. To detect S access, we can try to toggle GICD_CTRL.EnableGrp1S. This bit is either RES0 (security extensions not implemented), RAZ/WI (non-secure access in two security state systems) or RW (secure access in two security state systems). To read the number of PMR and IPRIORITYRn bits supported, we can write all 1s to the register fields and read them back. For the RK3399 (Rockchip TF-A) quirk, we assume a shifted view of IPRIORITYRn if we have detected S accesses, and the PMR and IPRIORITYRn values differ. The S access test is required because some real hardware implementations (Ampere eMAG) were observed to report different PMR and IPRIORITYRn masks, but present an unshifted view of IPRIORITYRn. During testing, I also discovered that QEMU 5.1 requires this shifted view workaround as well -- as far as I can tell, this is a QEMU bug. We can't detect it the same way as RK3399 because security is disabled in the emulated GIC, and the PMR and IPRIORITYRn tests both return 0xff! So now if the GICv3 driver sees this configuration, it assumes that the shifted view is required. Honestly, this feature is so poorly documented that maybe it is better to give up on HW priorities and preemption and use a single flat model like Linux and FreeBSD does. Tested on Arm N1 SDP, ROCKpro64 (RK3399) with Rockchip and pkgsrc TF-A, Pinebook Pro (RK3399), Lenovo HR330A (Ampere eMAG), QEMU 5.1 (gic-version=3), AWS EC2 a1.medium (Graviton). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/cortex/gicv3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 20:01:46 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): add remark to add a "reasonable way" to format time_t 0 To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.139 src/usr.bin/make/targ.c:1.140 --- src/usr.bin/make/targ.c:1.139 Sat Nov 21 18:41:57 2020 +++ src/usr.bin/make/targ.c Sun Nov 22 20:01:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.139 2020/11/21 18:41:57 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.140 2020/11/22 20:01:46 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -119,7 +119,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.139 2020/11/21 18:41:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.140 2020/11/22 20:01:46 rillig Exp $"); /* * All target nodes that appeared on the left-hand side of one of the @@ -398,6 +398,8 @@ Targ_FmtTime(time_t tm) struct tm *parts; static char buf[128]; +/* TODO: Add special case for 0, which often means ENOENT, to make it + * independent from time zones. */ parts = localtime(); (void)strftime(buf, sizeof buf, "%k:%M:%S %b %d, %Y", parts); return buf;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 20:01:46 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): add remark to add a "reasonable way" to format time_t 0 To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/usr.bin/make/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: jmcneill Date: Sun Nov 22 19:53:48 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gic_reg.h Log Message: Add GICD_CTRL_EnableGrp1S definition. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/cortex/gic_reg.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/arch/arm/cortex/gic_reg.h diff -u src/sys/arch/arm/cortex/gic_reg.h:1.11 src/sys/arch/arm/cortex/gic_reg.h:1.12 --- src/sys/arch/arm/cortex/gic_reg.h:1.11 Thu May 2 23:07:40 2019 +++ src/sys/arch/arm/cortex/gic_reg.h Sun Nov 22 19:53:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gic_reg.h,v 1.11 2019/05/02 23:07:40 jmcneill Exp $ */ +/* $NetBSD: gic_reg.h,v 1.12 2020/11/22 19:53:47 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -144,6 +144,7 @@ #define GICD_CTRL_E1NWF __BIT(7) // GICv3 #define GICD_CTRL_DS __BIT(6) // GICv3 #define GICD_CTRL_ARE_NS __BIT(4) // GICv3 +#define GICD_CTRL_EnableGrp1S __BIT(2) // Secure only #define GICD_CTRL_EnableGrp1A __BIT(1) // GICv3 #define GICD_CTRL_Enable __BIT(0)
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: jmcneill Date: Sun Nov 22 19:53:48 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gic_reg.h Log Message: Add GICD_CTRL_EnableGrp1S definition. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/cortex/gic_reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 19:37:28 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: cond-func-make-main.exp cond-func-make-main.mk Log Message: make(1): document the selection of the main target To generate a diff of this commit: cvs rdiff -u -r1.971 -r1.972 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-func-make-main.exp \ src/usr.bin/make/unit-tests/cond-func-make-main.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.971 src/distrib/sets/lists/tests/mi:1.972 --- src/distrib/sets/lists/tests/mi:1.971 Sat Nov 21 10:32:42 2020 +++ src/distrib/sets/lists/tests/mi Sun Nov 22 19:37:27 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.971 2020/11/21 10:32:42 rillig Exp $ +# $NetBSD: mi,v 1.972 2020/11/22 19:37:27 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4851,6 +4851,8 @@ ./usr/tests/usr.bin/make/unit-tests/cond-func-empty.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/cond-func-exists.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/cond-func-exists.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/cond-func-make-main.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/cond-func-make-main.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/cond-func-make.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/cond-func-make.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/cond-func-target.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.216 src/usr.bin/make/unit-tests/Makefile:1.217 --- src/usr.bin/make/unit-tests/Makefile:1.216 Sun Nov 22 18:44:10 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Nov 22 19:37:27 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.216 2020/11/22 18:44:10 rillig Exp $ +# $NetBSD: Makefile,v 1.217 2020/11/22 19:37:27 rillig Exp $ # # Unit tests for make(1) # @@ -58,6 +58,7 @@ TESTS+= cond-func-defined TESTS+= cond-func-empty TESTS+= cond-func-exists TESTS+= cond-func-make +TESTS+= cond-func-make-main TESTS+= cond-func-target TESTS+= cond-late TESTS+= cond-op Added files: Index: src/usr.bin/make/unit-tests/cond-func-make-main.exp diff -u /dev/null src/usr.bin/make/unit-tests/cond-func-make-main.exp:1.1 --- /dev/null Sun Nov 22 19:37:28 2020 +++ src/usr.bin/make/unit-tests/cond-func-make-main.exp Sun Nov 22 19:37:27 2020 @@ -0,0 +1,3 @@ +: Making dot-main-target-1a. +: Making dot-main-target-1b. +exit status 0 Index: src/usr.bin/make/unit-tests/cond-func-make-main.mk diff -u /dev/null src/usr.bin/make/unit-tests/cond-func-make-main.mk:1.1 --- /dev/null Sun Nov 22 19:37:28 2020 +++ src/usr.bin/make/unit-tests/cond-func-make-main.mk Sun Nov 22 19:37:27 2020 @@ -0,0 +1,62 @@ +# $NetBSD: cond-func-make-main.mk,v 1.1 2020/11/22 19:37:27 rillig Exp $ +# +# Test how accurately the make() function in .if conditions reflects +# what is actually made. +# +# There are several ways to specify what is being made: +# +# 1. The default main target is the first target in the given makefiles that +#is not one of the special targets. For example, .PHONY is special when +#it appears on the left-hand side of the ':'. It is not special on the +#right-hand side though. +# +# 2. Command line arguments that are neither options (-ds or -k) nor variable +#assignments (VAR=value) are interpreted as targets to be made. These +#override the default main target from above. +# +# 3. All sources of the first '.MAIN: sources' line. Any further .MAIN line +#is treated as if .MAIN were a regular name. +# +# This test only covers items 1 and 3. For item 2, see cond-func-make.mk. + +first-main-target: + : Making ${.TARGET}. + +# Even though the main-target would actually be made at this point, it is +# ignored by the make() function. +.if make(first-main-target) +. error +.endif + +# Declaring a target via the .MAIN dependency adds it to the targets to be +# created (opts.create), but only that list was empty at the beginning of +# the line. This implies that several main targets can be set at the name +# time, but they have to be in the same dependency group. +# +# See ParseDoDependencyTargetSpecial, branch SP_MAIN. +.MAIN: dot-main-target-1a dot-main-target-1b + +.if !make(dot-main-target-1a) +. error +.endif +.if !make(dot-main-target-1b) +. error +.endif +
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Nov 22 19:37:28 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: cond-func-make-main.exp cond-func-make-main.mk Log Message: make(1): document the selection of the main target To generate a diff of this commit: cvs rdiff -u -r1.971 -r1.972 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-func-make-main.exp \ src/usr.bin/make/unit-tests/cond-func-make-main.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 19:14:25 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): use canonical character comparison in ParseDoDependencyTargets To generate a diff of this commit: cvs rdiff -u -r1.445 -r1.446 src/usr.bin/make/parse.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/parse.c diff -u src/usr.bin/make/parse.c:1.445 src/usr.bin/make/parse.c:1.446 --- src/usr.bin/make/parse.c:1.445 Fri Nov 20 20:01:16 2020 +++ src/usr.bin/make/parse.c Sun Nov 22 19:14:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.445 2020/11/20 20:01:16 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.445 2020/11/20 20:01:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $"); /* types and constants */ @@ -1462,7 +1462,7 @@ ParseDoDependencyTargets(char **inout_cp continue; } - if (!*cp) { + if (*cp == '\0') { ParseErrorNoDependency(lstart); return FALSE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 19:14:25 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): use canonical character comparison in ParseDoDependencyTargets To generate a diff of this commit: cvs rdiff -u -r1.445 -r1.446 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 18:44:10 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: make(1): make configuration of export tests simpler The configuration section of unit-tests/Makefile is already complicated enough to read, due to the excessive use of regular expressions. Therefore, to keep the structuring elements at a minimum, inline the .for loop. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 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.215 src/usr.bin/make/unit-tests/Makefile:1.216 --- src/usr.bin/make/unit-tests/Makefile:1.215 Sun Nov 22 18:25:43 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Nov 22 18:44:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.215 2020/11/22 18:25:43 rillig Exp $ +# $NetBSD: Makefile,v 1.216 2020/11/22 18:44:10 rillig Exp $ # # Unit tests for make(1) # @@ -428,12 +428,9 @@ FLAGS.doterror= # none, especially not FLAGS.varname-empty= -dv '$${:U}=cmdline-u' '=cmdline-plain' # Some tests need extra postprocessing. -SED_CMDS.export= \ - -e '/^[^=_A-Za-z0-9]*=/d' -# these all share the same requirement -.for t in export-all export-env -SED_CMDS.$t= ${SED_CMDS.export} -.endfor +SED_CMDS.export= -e '/^[^=_A-Za-z0-9]*=/d' +SED_CMDS.export-all= ${SED_CMDS.export} +SED_CMDS.export-env= ${SED_CMDS.export} SED_CMDS.job-output-long-lines= \ ${:D Job separators on their own line are ok. } \ -e '/^--- job-[ab] ---$$/d' \
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 18:44:10 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: make(1): make configuration of export tests simpler The configuration section of unit-tests/Makefile is already complicated enough to read, due to the excessive use of regular expressions. Therefore, to keep the structuring elements at a minimum, inline the .for loop. To generate a diff of this commit: cvs rdiff -u -r1.215 -r1.216 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.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 18:25:44 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp Log Message: make(1): add more output to test for -dg1 Previously, the variables section had been omitted. This was because the variables had been output in hashcode order until 2020-10-18, and because some of the variable values are specific to the test environment or the individual run (MACHINE_ARCH, MAKE.PPID). To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-debug-graph1.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/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.214 src/usr.bin/make/unit-tests/Makefile:1.215 --- src/usr.bin/make/unit-tests/Makefile:1.214 Sat Nov 21 21:41:27 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Nov 22 18:25:43 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.214 2020/11/21 21:41:27 rillig Exp $ +# $NetBSD: Makefile,v 1.215 2020/11/22 18:25:43 rillig Exp $ # # Unit tests for make(1) # @@ -445,12 +445,9 @@ SED_CMDS.job-output-long-lines= \ ${:D marker should always be at the beginning of the line. } \ -e '/^aa*--- job-b ---$$/d' \ -e '/^bb*--- job-a ---$$/d' -SED_CMDS.objdir-writable= -e 's,${RO_OBJDIR},OBJDIR/roobj,g' -SED_CMDS.opt-debug-graph1= \ - -e 's,${.CURDIR},CURDIR,' -SED_CMDS.opt-debug-graph1+= \ - -e '/Global Variables:/,/Suffixes:/d' -SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' +SED_CMDS.objdir-writable= -e 's,${RO_OBJDIR},OBJDIR/roobj,g' +SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1} +SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' SED_CMDS.opt-debug-jobs= -e 's,([0-9][0-9]*),(),' SED_CMDS.opt-debug-jobs+= -e 's,pid [0-9][0-9]*,pid ,' SED_CMDS.opt-debug-jobs+= -e 's,Process [0-9][0-9]*,Process ,' @@ -458,6 +455,7 @@ SED_CMDS.opt-debug-jobs+= -e 's,JobFinis SED_CMDS.opt-debug-jobs+= -e 's,Command: ${.SHELL:T},Command: ,' # The "-q" may be there or not, see jobs.c, variable shells. SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: \) -q,\1,' +SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.var-op-shell+= \ -e 's,^${.SHELL:T}: [ 0-9:]*,,' \ -e '/command/s,No such.*,not found,' @@ -483,6 +481,17 @@ unexport-env.rawout: export.mk # End of the configuration section. +# Some standard sed commands, to be used in the SED_CMDS above. + +# Omit details from the output of the -dg1 option such as process IDs. +STD_SED_CMDS.dg1= -e 's,${.CURDIR},,' +STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1 ,' +STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 ,' +STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 ,' +STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1 ,' + +# End of the configuration helpers section. + .MAIN: all UNIT_TESTS:= ${.PARSEDIR} Index: src/usr.bin/make/unit-tests/opt-debug-graph1.exp diff -u src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.4 src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.5 --- src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.4 Fri Sep 25 23:30:16 2020 +++ src/usr.bin/make/unit-tests/opt-debug-graph1.exp Sun Nov 22 18:25:43 2020 @@ -13,5 +13,41 @@ # Files that are only sources: # unmade-sources [unmade-sources] # unmade-silent-source [unmade-silent-source] .SILENT +#*** Global Variables: +.ALLTARGETS = all made-target made-target-no-sources made-source unmade-target unmade-sources unmade-silent-source unmade-target-no-sources +.CURDIR = +.INCLUDES= +.LIBS= +.MAKE= +.MAKE.DEPENDFILE = +.MAKE.LEVEL = +.MAKE.MAKEFILES = +.MAKE.MAKEFILE_PREFERENCE = +.MAKE.OS = +.MAKE.PATH_FILEMON = +.MAKE.PID= +.MAKE.PPID = +.MAKEFLAGS = -r -k -d g1 +.MAKEOVERRIDES = +.OBJDIR = +.PATH= . +.TARGETS = +.newline = + +MACHINE = +MACHINE_ARCH = +MAKE = +MFLAGS = -r -k -d g1 +#*** Command-line Variables: +.MAKE.LEVEL.ENV = MAKELEVEL + +#*** Directory Cache: +# Stats: 0 hits 2 misses 0 near misses 0 losers (0%) +# directoryreferenced hits +# 2 0 +# . 2 0 +# /usr/share/mk 1 0 + +#*** Suffixes: #*** Transformations: exit status 0
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 18:25:44 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp Log Message: make(1): add more output to test for -dg1 Previously, the variables section had been omitted. This was because the variables had been output in hashcode order until 2020-10-18, and because some of the variable values are specific to the test environment or the individual run (MACHINE_ARCH, MAKE.PPID). To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-debug-graph1.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 18:13:52 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename local variable in UpdateTargets To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.298 src/usr.bin/make/suff.c:1.299 --- src/usr.bin/make/suff.c:1.298 Sun Nov 22 17:20:15 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 18:13:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.298 2020/11/22 17:20:15 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.298 2020/11/22 17:20:15 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -751,11 +751,12 @@ UpdateTarget(GNode *target, GNode **inou static void UpdateTargets(GNode **inout_main, Suffix *suff) { -Boolean r = FALSE; +Boolean removedMain = FALSE; GNodeListNode *ln; + for (ln = Targ_List()->first; ln != NULL; ln = ln->next) { GNode *gn = ln->datum; - if (UpdateTarget(gn, inout_main, suff, )) + if (UpdateTarget(gn, inout_main, suff, )) break; } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 18:13:52 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename local variable in UpdateTargets To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 17:20:15 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract FindDepsLib from FindDepsRegularKnown To generate a diff of this commit: cvs rdiff -u -r1.297 -r1.298 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.297 src/usr.bin/make/suff.c:1.298 --- src/usr.bin/make/suff.c:1.297 Sun Nov 22 12:05:20 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 17:20:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.297 2020/11/22 12:05:20 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.298 2020/11/22 17:20:15 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.297 2020/11/22 12:05:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.298 2020/11/22 17:20:15 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1573,6 +1573,34 @@ FindDepsArchive(GNode *gn, CandidateList mem->type |= OP_MEMBER | OP_JOIN | OP_MADE; } +/* + * If the node is a library, it is the arch module's job to find it + * and set the TARGET variable accordingly. We merely provide the + * search path, assuming all libraries end in ".a" (if the suffix + * hasn't been defined, there's nothing we can do for it, so we just + * set the TARGET variable to the node's name in order to give it a + * value). + */ +static void +FindDepsLib(GNode *gn) +{ +Suffix *suff = FindSuffixByName(LIBSUFF); +if (suff != NULL) { + Suffix_Reassign(>suffix, suff); + Arch_FindLib(gn, suff->searchPath); +} else { + Suffix_Unassign(>suffix); + Var_Set(TARGET, gn->name, gn); +} + +/* + * Because a library (-lfoo) target doesn't follow the standard + * filesystem conventions, we don't set the regular variables for + * the thing. .PREFIX is simply made empty. + */ +Var_Set(PREFIX, "", gn); +} + static void FindDepsRegularKnown(const char *name, size_t nameLen, GNode *gn, CandidateList *srcs, CandidateList *targs) @@ -1927,34 +1955,12 @@ FindDeps(GNode *gn, CandidateList *slst) SUFF_DEBUG1("SuffFindDeps (%s)\n", gn->name); -if (gn->type & OP_ARCHV) { +if (gn->type & OP_ARCHV) FindDepsArchive(gn, slst); -} else if (gn->type & OP_LIB) { - /* - * If the node is a library, it is the arch module's job to find it - * and set the TARGET variable accordingly. We merely provide the - * search path, assuming all libraries end in ".a" (if the suffix - * hasn't been defined, there's nothing we can do for it, so we just - * set the TARGET variable to the node's name in order to give it a - * value). - */ - Suffix *suff = FindSuffixByName(LIBSUFF); - if (suff != NULL) { - Suffix_Reassign(>suffix, suff); - Arch_FindLib(gn, suff->searchPath); - } else { - Suffix_Unassign(>suffix); - Var_Set(TARGET, gn->name, gn); - } - /* - * Because a library (-lfoo) target doesn't follow the standard - * filesystem conventions, we don't set the regular variables for - * the thing. .PREFIX is simply made empty... - */ - Var_Set(PREFIX, "", gn); -} else { +else if (gn->type & OP_LIB) + FindDepsLib(gn); +else FindDepsRegular(gn, slst); -} } /* Define which suffix is the null suffix.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 17:20:15 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract FindDepsLib from FindDepsRegularKnown To generate a diff of this commit: cvs rdiff -u -r1.297 -r1.298 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 12:05:20 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename Candidate.pref to prefix The new name nicely matches the .PREFIX variable. To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.296 src/usr.bin/make/suff.c:1.297 --- src/usr.bin/make/suff.c:1.296 Sun Nov 22 12:00:27 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 12:05:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.296 2020/11/22 12:00:27 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.297 2020/11/22 12:05:20 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.296 2020/11/22 12:00:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.297 2020/11/22 12:05:20 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -191,8 +191,7 @@ typedef struct Candidate { char *file; /* The prefix from which file was formed. * Its memory is shared among all candidates. */ -/* XXX: rename to prefix */ -char *pref; +char *prefix; /* The suffix on the file. */ Suffix *suff; @@ -897,13 +896,13 @@ CandidateList_PrintAddrs(CandidateList * #endif static Candidate * -Candidate_New(char *name, char *pref, Suffix *suff, Candidate *parent, +Candidate_New(char *name, char *prefix, Suffix *suff, Candidate *parent, GNode *gn) { Candidate *cand = bmake_malloc(sizeof *cand); cand->file = name; -cand->pref = pref; +cand->prefix = prefix; cand->suff = Suffix_Ref(suff); cand->parent = parent; cand->node = gn; @@ -920,7 +919,7 @@ static void CandidateList_Add(CandidateList *list, char *srcName, Candidate *targ, Suffix *suff, const char *debug_tag) { -Candidate *cand = Candidate_New(srcName, targ->pref, suff, targ, NULL); +Candidate *cand = Candidate_New(srcName, targ->prefix, suff, targ, NULL); targ->numChildren++; Lst_Append(list, cand); @@ -946,11 +945,11 @@ CandidateList_AddCandidatesFor(Candidate * If the suffix has been marked as the NULL suffix, also * create a candidate for a file with no suffix attached. */ - CandidateList_Add(list, bmake_strdup(cand->pref), + CandidateList_Add(list, bmake_strdup(cand->prefix), cand, suff, "1"); } - CandidateList_Add(list, str_concat2(cand->pref, suff->name), + CandidateList_Add(list, str_concat2(cand->prefix, suff->name), cand, suff, "2"); } } @@ -973,7 +972,7 @@ RemoveCandidate(CandidateList *srcs) if (src->numChildren == 0) { free(src->file); if (src->parent == NULL) - free(src->pref); + free(src->prefix); else { #ifdef DEBUG_SRC /* XXX: Lst_RemoveDatum */ @@ -1070,7 +1069,7 @@ FindCmds(Candidate *targ, CandidateList char *cp; tgn = targ->node; -prefLen = strlen(targ->pref); +prefLen = strlen(targ->prefix); for (gln = tgn->children->first; gln != NULL; gln = gln->next) { sgn = gln->datum; @@ -1092,7 +1091,7 @@ FindCmds(Candidate *targ, CandidateList } else { cp++; } - if (strncmp(cp, targ->pref, prefLen) != 0) + if (strncmp(cp, targ->prefix, prefLen) != 0) continue; /* The node matches the prefix ok, see if it has a known suffix. */ suff = FindSuffixByName(cp + prefLen); @@ -1113,7 +1112,7 @@ FindCmds(Candidate *targ, CandidateList if (gln == NULL) return NULL; -ret = Candidate_New(bmake_strdup(sgn->name), targ->pref, suff, targ, sgn); +ret = Candidate_New(bmake_strdup(sgn->name), targ->prefix, suff, targ, sgn); targ->numChildren++; #ifdef DEBUG_SRC debug_printf("3 add targ %p ret %p\n", targ, ret); @@ -1702,10 +1701,9 @@ FindDepsRegular(GNode *gn, CandidateList CandidateList *srcs; /* List of sources at which to look */ CandidateList *targs; /* List of targets to which things can be * transformed. They all have the same file, - * but different suff and pref fields */ + * but different suff and prefix fields */ Candidate *bottom; /* Start of found transformation path */ Candidate *src; -char *pref; /* Prefix to use */ Candidate *targ; const char *name = gn->name; @@ -1771,9 +1769,7 @@ FindDepsRegular(GNode *gn, CandidateList } Var_Set(TARGET, GNode_Path(gn), gn); - -pref = targ != NULL ? targ->pref : gn->name; -Var_Set(PREFIX, pref, gn); +Var_Set(PREFIX, targ != NULL ? targ->prefix : gn->name, gn); /* * Now we've got the important local variables set, expand any sources @@ -1865,7 +1861,7 @@ sfnd_abort: * node, so all we need to do is set the standard
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 12:05:20 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename Candidate.pref to prefix The new name nicely matches the .PREFIX variable. To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 12:00:27 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): improve documentation of Candidate fields To generate a diff of this commit: cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.295 src/usr.bin/make/suff.c:1.296 --- src/usr.bin/make/suff.c:1.295 Sun Nov 22 11:50:31 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 12:00:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.295 2020/11/22 11:50:31 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.296 2020/11/22 12:00:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.295 2020/11/22 11:50:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.296 2020/11/22 12:00:27 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -187,13 +187,24 @@ typedef struct Suffix { * node is finally chosen to be made. */ typedef struct Candidate { -char *file; /* The file to look for */ -char *pref; /* Prefix from which file was formed */ -Suffix *suff; /* The suffix on the file */ -struct Candidate *parent; /* The candidate for which this is a source */ -GNode *node; /* The node describing the file */ -int numChildren; /* Count of existing children (so we don't free - * this thing too early or never nuke it) */ +/* The file or node to look for. */ +char *file; +/* The prefix from which file was formed. + * Its memory is shared among all candidates. */ +/* XXX: rename to prefix */ +char *pref; +/* The suffix on the file. */ +Suffix *suff; + +/* The candidate that can be made from this, + * or NULL for the top-level candidate. */ +struct Candidate *parent; +/* The node describing the file. */ +GNode *node; + +/* Count of existing children, only used for memory management, so we + * don't free this candidate too early or too late. */ +int numChildren; #ifdef DEBUG_SRC CandidateList *childrenList; #endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 12:00:27 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): improve documentation of Candidate fields To generate a diff of this commit: cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:50:31 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract ExpandMember from FindDepsArchive To generate a diff of this commit: cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:50:31 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract ExpandMember from FindDepsArchive To generate a diff of this commit: cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.294 src/usr.bin/make/suff.c:1.295 --- src/usr.bin/make/suff.c:1.294 Sun Nov 22 11:46:49 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:50:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.295 2020/11/22 11:50:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.295 2020/11/22 11:50:31 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1424,6 +1424,33 @@ ApplyTransform(GNode *tgn, GNode *sgn, S return TRUE; } +/* + * Member has a known suffix, so look for a transformation rule from + * it to a possible suffix of the archive. + * + * Rather than searching through the entire list, we just look at + * suffixes to which the member's suffix may be transformed. + */ +static void +ExpandMember(GNode *gn, const char *eoarch, GNode *mem, Suffix *memSuff) +{ +GNodeListNode *ln; +size_t nameLen = (size_t)(eoarch - gn->name); + +/* Use first matching suffix... */ +for (ln = memSuff->parents->first; ln != NULL; ln = ln->next) + if (Suffix_IsSuffix(ln->datum, nameLen, eoarch)) + break; + +if (ln != NULL) { + /* Got one -- apply it */ + Suffix *suff = ln->datum; + if (!ApplyTransform(gn, mem, suff, memSuff)) { + SUFF_DEBUG2("\tNo transformation from %s -> %s\n", + memSuff->name, suff->name); + } +} +} static void FindDeps(GNode *, CandidateList *); @@ -1441,8 +1468,8 @@ FindDepsArchive(GNode *gn, CandidateList char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ GNode *mem; /* Node for member */ -Suffix *ms; /* Suffix descriptor for member */ -char *name; /* Start of member's name */ +Suffix *memSuff; +const char *name; /* Start of member's name */ /* * The node is an archive(member) pair. so we must find a @@ -1486,10 +1513,10 @@ FindDepsArchive(GNode *gn, CandidateList Var_Set(PREFIX, GNode_VarPrefix(mem), gn); Var_Set(TARGET, GNode_VarTarget(mem), gn); -ms = mem->suffix; -if (ms == NULL) { /* Didn't know what it was. */ +memSuff = mem->suffix; +if (memSuff == NULL) { /* Didn't know what it was. */ SUFF_DEBUG0("using null suffix\n"); - ms = nullSuff; + memSuff = nullSuff; } @@ -1510,32 +1537,8 @@ FindDepsArchive(GNode *gn, CandidateList */ ExpandAllChildren(gn); -if (ms != NULL) { - /* - * Member has a known suffix, so look for a transformation rule from - * it to a possible suffix of the archive. Rather than searching - * through the entire list, we just look at suffixes to which the - * member's suffix may be transformed... - */ - size_t nameLen = (size_t)(eoarch - gn->name); - SuffixListNode *ln; - - /* Use first matching suffix... */ - for (ln = ms->parents->first; ln != NULL; ln = ln->next) - if (Suffix_IsSuffix(ln->datum, nameLen, eoarch)) - break; - - if (ln != NULL) { - /* - * Got one -- apply it - */ - Suffix *suff = ln->datum; - if (!ApplyTransform(gn, mem, suff, ms)) { - SUFF_DEBUG2("\tNo transformation from %s -> %s\n", - ms->name, suff->name); - } - } -} +if (memSuff != NULL) + ExpandMember(gn, eoarch, mem, memSuff); /* * Replace the opening and closing parens now we've no need of the separate
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:46:50 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract ExpandAllChildren from FindDepsArchive To generate a diff of this commit: cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.293 src/usr.bin/make/suff.c:1.294 --- src/usr.bin/make/suff.c:1.293 Sun Nov 22 11:30:02 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:46:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.294 2020/11/22 11:46:49 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1312,6 +1312,17 @@ ExpandChildren(GNodeListNode *cln, GNode Lst_Remove(cgn->parents, Lst_FindDatum(cgn->parents, pgn)); } +static void +ExpandAllChildren(GNode *gn) +{ +GNodeListNode *ln, *nln; + +for (ln = gn->children->first; ln != NULL; ln = nln) { + nln = ln->next; + ExpandChildren(ln, gn); +} +} + /* Find a path along which to expand the node. * * If the node has a known suffix, use that path. @@ -1430,7 +1441,6 @@ FindDepsArchive(GNode *gn, CandidateList char *eoarch; /* End of archive portion */ char *eoname; /* End of member portion */ GNode *mem; /* Node for member */ -SuffixListNode *ln, *nln; /* Next suffix node to check */ Suffix *ms; /* Suffix descriptor for member */ char *name; /* Start of member's name */ @@ -1498,10 +1508,7 @@ FindDepsArchive(GNode *gn, CandidateList * Now we've got the important local variables set, expand any sources * that still contain variables or wildcards in their names. */ -for (ln = gn->children->first; ln != NULL; ln = nln) { - nln = ln->next; - ExpandChildren(ln, gn); -} +ExpandAllChildren(gn); if (ms != NULL) { /* @@ -1511,6 +1518,7 @@ FindDepsArchive(GNode *gn, CandidateList * member's suffix may be transformed... */ size_t nameLen = (size_t)(eoarch - gn->name); + SuffixListNode *ln; /* Use first matching suffix... */ for (ln = ms->parents->first; ln != NULL; ln = ln->next)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:46:50 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract ExpandAllChildren from FindDepsArchive To generate a diff of this commit: cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:30:02 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract string handling from Suffix_GetSuffix Finding a suffix of a string is not the job of the Suffix type. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.292 src/usr.bin/make/suff.c:1.293 --- src/usr.bin/make/suff.c:1.292 Sun Nov 22 11:26:50 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:30:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.292 2020/11/22 11:26:50 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.292 2020/11/22 11:26:50 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.293 2020/11/22 11:30:02 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -249,31 +249,40 @@ StrTrimPrefix(const char *pref, const ch } /* - * See if suff is a suffix of name, and if so, return a pointer to the suffix - * in the given name, thereby marking the point where the prefix ends. + * See if suff is a suffix of str, and if so, return the pointer to the suffix + * in str, which at the same time marks the end of the prefix. */ static const char * -Suffix_GetSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd) +StrTrimSuffix(const char *str, size_t strLen, const char *suff, size_t suffLen) { -size_t suffLen = suff->nameLen; -const char *suffInName; +const char *suffInStr; size_t i; -if (nameLen < suffLen) +if (strLen < suffLen) return NULL; -suffInName = nameEnd - suffLen; -for (i = 0; i < suffLen; i++) { - if (suff->name[i] != suffInName[i]) +suffInStr = str + strLen - suffLen; +for (i = 0; i < suffLen; i++) + if (suff[i] != suffInStr[i]) return NULL; -} -return suffInName; + +return suffInStr; +} + +/* + * See if suff is a suffix of name, and if so, return the end of the prefix + * in name. + */ +static const char * +Suffix_TrimSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd) +{ +return StrTrimSuffix(nameEnd - nameLen, nameLen, suff->name, suff->nameLen); } static Boolean Suffix_IsSuffix(const Suffix *suff, size_t nameLen, const char *nameEnd) { -return Suffix_GetSuffix(suff, nameLen, nameEnd) != NULL; +return Suffix_TrimSuffix(suff, nameLen, nameEnd) != NULL; } static Suffix * @@ -640,7 +649,7 @@ RebuildGraph(GNode *transform, Suffix *s /* * Not from, maybe to? */ -toName = Suffix_GetSuffix(suff, nameLen, name + nameLen); +toName = Suffix_TrimSuffix(suff, nameLen, name + nameLen); if (toName != NULL) { Suffix *from = FindSuffixByNameLen(name, (size_t)(toName - name)); if (from != NULL)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:30:02 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): extract string handling from Suffix_GetSuffix Finding a suffix of a string is not the job of the Suffix type. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:26:50 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename StrIsPrefix to StrTrimPrefix Only functions returning Boolean should have the word Is in their name. To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.291 src/usr.bin/make/suff.c:1.292 --- src/usr.bin/make/suff.c:1.291 Sun Nov 22 11:15:43 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:26:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.291 2020/11/22 11:15:43 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.292 2020/11/22 11:26:50 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.291 2020/11/22 11:15:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.292 2020/11/22 11:26:50 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -238,7 +238,7 @@ Suffix_Unassign(Suffix **var) * Return NULL if it ain't, pointer to character in str after prefix if so. */ static const char * -StrIsPrefix(const char *pref, const char *str) +StrTrimPrefix(const char *pref, const char *str) { while (*str && *pref == *str) { pref++; @@ -462,7 +462,7 @@ ParseTransform(const char *str, Suffix * for (ln = sufflist->first; ln != NULL; ln = ln->next) { Suffix *src = ln->datum; - if (StrIsPrefix(src->name, str) == NULL) + if (StrTrimPrefix(src->name, str) == NULL) continue; if (str[src->nameLen] == '\0') { @@ -627,7 +627,7 @@ RebuildGraph(GNode *transform, Suffix *s /* * First see if it is a transformation from this suffix. */ -toName = StrIsPrefix(suff->name, name); +toName = StrTrimPrefix(suff->name, name); if (toName != NULL) { Suffix *to = FindSuffixByName(toName); if (to != NULL) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:26:50 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename StrIsPrefix to StrTrimPrefix Only functions returning Boolean should have the word Is in their name. To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:15:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): fix C99-ism in Suffix_GetSuffix To generate a diff of this commit: cvs rdiff -u -r1.290 -r1.291 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:15:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): fix C99-ism in Suffix_GetSuffix To generate a diff of this commit: cvs rdiff -u -r1.290 -r1.291 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.290 src/usr.bin/make/suff.c:1.291 --- src/usr.bin/make/suff.c:1.290 Sun Nov 22 11:11:43 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:15:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.290 2020/11/22 11:11:43 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.291 2020/11/22 11:15:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.290 2020/11/22 11:11:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.291 2020/11/22 11:15:43 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -257,12 +257,13 @@ Suffix_GetSuffix(const Suffix *suff, siz { size_t suffLen = suff->nameLen; const char *suffInName; +size_t i; if (nameLen < suffLen) return NULL; suffInName = nameEnd - suffLen; -for (size_t i = 0; i < suffLen; i++) { +for (i = 0; i < suffLen; i++) { if (suff->name[i] != suffInName[i]) return NULL; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:11:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): fix type of local variable in FindDepsRegular The compiler cannot check these since all lists and list nodes are aliases to each other. Maybe it's time to add type-generic lists to the code, to delegate these checks to the compiler. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.289 src/usr.bin/make/suff.c:1.290 --- src/usr.bin/make/suff.c:1.289 Sun Nov 22 10:27:56 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 11:11:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.289 2020/11/22 10:27:56 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.290 2020/11/22 11:11:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.289 2020/11/22 10:27:56 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.290 2020/11/22 11:11:43 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1748,7 +1748,7 @@ FindDepsRegular(GNode *gn, CandidateList * that still contain variables or wildcards in their names. */ { - SuffixListNode *ln, *nln; + GNodeListNode *ln, *nln; for (ln = gn->children->first; ln != NULL; ln = nln) { nln = ln->next; ExpandChildren(ln, gn);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 11:11:43 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): fix type of local variable in FindDepsRegular The compiler cannot check these since all lists and list nodes are aliases to each other. Maybe it's time to add type-generic lists to the code, to delegate these checks to the compiler. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 11:05:49 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: suff-incomplete.mk Log Message: make(1): document the type of the .DEFAULT node It is marked intentionally as a transformation node, even though this seems counterintuitive at first. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-incomplete.mk 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/suff-incomplete.mk diff -u src/usr.bin/make/unit-tests/suff-incomplete.mk:1.1 src/usr.bin/make/unit-tests/suff-incomplete.mk:1.2 --- src/usr.bin/make/unit-tests/suff-incomplete.mk:1.1 Sat Nov 21 10:32:42 2020 +++ src/usr.bin/make/unit-tests/suff-incomplete.mk Sun Nov 22 11:05:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: suff-incomplete.mk,v 1.1 2020/11/21 10:32:42 rillig Exp $ +# $NetBSD: suff-incomplete.mk,v 1.2 2020/11/22 11:05:49 rillig Exp $ # # Tests incomplete transformation rules, which are ignored. @@ -23,8 +23,9 @@ all: suff-incomplete.c .DEFAULT: : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default. -# XXX: The debug log says "transformation .DEFAULT complete", which is wrong. -# .DEFAULT is not a transformation. +# The debug log says "transformation .DEFAULT complete", which seems wrong +# on the first sight. It is intentionally done though, in the call to +# GNode_New(".DEFAULT"). # XXX: The output of this test says "Making suff-incomplete.c from # suff-incomplete.c". It doesn't make sense to make something out of itself.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Nov 22 11:05:49 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: suff-incomplete.mk Log Message: make(1): document the type of the .DEFAULT node It is marked intentionally as a transformation node, even though this seems counterintuitive at first. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-incomplete.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:48:11 UTC 2020 Modified Files: src/usr.bin/make: make.h Log Message: make(1): renumber the flags in GNodeType In plain C, bit 31 of an enum is not guaranteed to play well with binary operators. Bit 23 was unused until now, so shift them all down. The order of the bits is only used in Targ_PrintType. To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 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.212 src/usr.bin/make/make.h:1.213 --- src/usr.bin/make/make.h:1.212 Sat Nov 21 19:15:06 2020 +++ src/usr.bin/make/make.h Sun Nov 22 10:48:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.212 2020/11/21 19:15:06 rillig Exp $ */ +/* $NetBSD: make.h,v 1.213 2020/11/22 10:48:11 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -260,29 +260,29 @@ typedef enum GNodeType { /* Attributes applied by PMake */ /* The node is a transformation rule, such as ".c.o". */ -OP_TRANSFORM = 1 << 31, +OP_TRANSFORM = 1 << 30, /* Target is a member of an archive */ /* XXX: How does this differ from OP_ARCHV? */ -OP_MEMBER = 1 << 30, +OP_MEMBER = 1 << 29, /* The node is a library, * its name has the form "-l" */ -OP_LIB = 1 << 29, +OP_LIB = 1 << 28, /* The node is an archive member, * its name has the form "archive(member)" */ /* XXX: How does this differ from OP_MEMBER? */ -OP_ARCHV = 1 << 28, +OP_ARCHV = 1 << 27, /* Target has all the commands it should. Used when parsing to catch * multiple command groups for a target. Only applies to the dependency * operators ':' and '!', but not to '::'. */ -OP_HAS_COMMANDS = 1 << 27, +OP_HAS_COMMANDS = 1 << 26, /* The special command "..." has been seen. All further commands from * this node will be saved on the .END node instead, to be executed at * the very end. */ -OP_SAVE_CMDS = 1 << 26, +OP_SAVE_CMDS = 1 << 25, /* Already processed by Suff_FindDeps */ -OP_DEPS_FOUND = 1 << 25, +OP_DEPS_FOUND = 1 << 24, /* Node found while expanding .ALLSRC */ -OP_MARK = 1 << 24, +OP_MARK = 1 << 23, OP_NOTARGET = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM } GNodeType;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:48:11 UTC 2020 Modified Files: src/usr.bin/make: make.h Log Message: make(1): renumber the flags in GNodeType In plain C, bit 31 of an enum is not guaranteed to play well with binary operators. Bit 23 was unused until now, so shift them all down. The order of the bits is only used in Targ_PrintType. To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 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.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:27:56 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add comment about missing unit test for .MAIN in suffixes To generate a diff of this commit: cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:27:56 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): add comment about missing unit test for .MAIN in suffixes To generate a diff of this commit: cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.288 src/usr.bin/make/suff.c:1.289 --- src/usr.bin/make/suff.c:1.288 Sun Nov 22 10:24:52 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 10:27:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.288 2020/11/22 10:24:52 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.289 2020/11/22 10:27:56 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.288 2020/11/22 10:24:52 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.289 2020/11/22 10:27:56 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -674,6 +674,10 @@ UpdateTarget(GNode *target, GNode **inou * transformations, no matter whether or not a new .MAIN node * has been found. */ + /* + * XXX: Even when changing this to FALSE, none of the existing unit + * tests fails. + */ return TRUE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:24:52 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): remove last occurrences of Src To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:24:52 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): remove last occurrences of Src To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.287 src/usr.bin/make/suff.c:1.288 --- src/usr.bin/make/suff.c:1.287 Sun Nov 22 10:22:23 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 10:24:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.287 2020/11/22 10:22:23 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.288 2020/11/22 10:24:52 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.287 2020/11/22 10:22:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.288 2020/11/22 10:24:52 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -450,7 +450,7 @@ static Boolean ParseTransform(const char *str, Suffix **out_src, Suffix **out_targ) { SuffixListNode *ln; -Suffix *singleSrc = NULL; +Suffix *single = NULL; /* * Loop looking first for a suffix that matches the start of the @@ -465,7 +465,7 @@ ParseTransform(const char *str, Suffix * continue; if (str[src->nameLen] == '\0') { - singleSrc = src; + single = src; } else { Suffix *targ = FindSuffixByName(str + src->nameLen); if (targ != NULL) { @@ -476,7 +476,7 @@ ParseTransform(const char *str, Suffix * } } -if (singleSrc != NULL) { +if (single != NULL) { /* * There was a suffix that encompassed the entire string, so we * assume it was a transformation to the null suffix (thank you @@ -487,7 +487,7 @@ ParseTransform(const char *str, Suffix * * * XXX: Use emptySuff over nullSuff? */ - *out_src = singleSrc; + *out_src = single; *out_targ = nullSuff; return TRUE; } @@ -933,7 +933,7 @@ CandidateList_AddCandidatesFor(Candidate /* Free the first candidate in the list that is not referenced anymore. * Return whether a candidate was removed. */ static Boolean -RemoveSrc(CandidateList *srcs) +RemoveCandidate(CandidateList *srcs) { CandidateListNode *ln; @@ -1844,7 +1844,7 @@ sfnd_return: if (bottom != NULL && Lst_FindDatum(slst, bottom) == NULL) Lst_Append(slst, bottom); -while (RemoveSrc(srcs) || RemoveSrc(targs)) +while (RemoveCandidate(srcs) || RemoveCandidate(targs)) continue; Lst_MoveAll(slst, srcs); @@ -1873,7 +1873,7 @@ Suff_FindDeps(GNode *gn) FindDeps(gn, srcs); -while (RemoveSrc(srcs)) +while (RemoveCandidate(srcs)) continue; assert(Lst_IsEmpty(srcs));
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:22:23 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up comment about single-suffix inference rules To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.286 src/usr.bin/make/suff.c:1.287 --- src/usr.bin/make/suff.c:1.286 Sun Nov 22 10:11:23 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 10:22:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.286 2020/11/22 10:11:23 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.287 2020/11/22 10:22:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.286 2020/11/22 10:11:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.287 2020/11/22 10:22:23 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -478,11 +478,12 @@ ParseTransform(const char *str, Suffix * if (singleSrc != NULL) { /* - * Not so fast Mr. Smith! There was a suffix that encompassed - * the entire string, so we assume it was a transformation - * to the null suffix (thank you POSIX). We still prefer to - * find a double rule over a singleton, hence we leave this - * check until the end. + * There was a suffix that encompassed the entire string, so we + * assume it was a transformation to the null suffix (thank you + * POSIX; search for "single suffix" or "single-suffix"). + * + * We still prefer to find a double rule over a singleton, + * hence we leave this check until the end. * * XXX: Use emptySuff over nullSuff? */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:22:23 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up comment about single-suffix inference rules To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:11:23 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): merge functions for suffix handling The names of the functions AddSources and AddLevel were not as precise and guiding as possible. Merging them into a single function makes the code indented a little more, but on the other hand provides a function with an easy to grasp purpose. To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.285 src/usr.bin/make/suff.c:1.286 --- src/usr.bin/make/suff.c:1.285 Sun Nov 22 09:56:01 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 10:11:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.285 2020/11/22 09:56:01 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.286 2020/11/22 10:11:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.285 2020/11/22 09:56:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.286 2020/11/22 10:11:23 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -906,32 +906,26 @@ CandidateList_Add(CandidateList *list, c #endif } -/* - * Add a new candidate to the list, formed from the candidate's prefix and - * the suffix. - */ -/* XXX: reorder parameters */ +/* Add all candidates to the list that can be formed by applying a suffix to + * the candidate. */ static void -AddSources(Suffix *suff, CandidateList *list, Candidate *targ) +CandidateList_AddCandidatesFor(CandidateList *list, Candidate *cand) { -if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { - /* - * If the suffix has been marked as the NULL suffix, also create a - * candidate for a file with no suffix attached. - */ - CandidateList_Add(list, bmake_strdup(targ->pref), targ, suff, "1"); -} -CandidateList_Add(list, str_concat2(targ->pref, suff->name), targ, suff, "2"); -} +SuffixListNode *ln; +for (ln = cand->suff->children->first; ln != NULL; ln = ln->next) { + Suffix *suff = ln->datum; -/* Add all the children of targ to the list. */ -static void -AddLevel(CandidateList *srcs, Candidate *targ) -{ -CandidateListNode *ln; -for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { - Suffix *childSuff = ln->datum; - AddSources(childSuff, srcs, targ); + if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { + /* + * If the suffix has been marked as the NULL suffix, also + * create a candidate for a file with no suffix attached. + */ + CandidateList_Add(list, bmake_strdup(cand->pref), + cand, suff, "1"); + } + + CandidateList_Add(list, str_concat2(cand->pref, suff->name), + cand, suff, "2"); } } @@ -1023,7 +1017,7 @@ FindThem(CandidateList *srcs, CandidateL SUFF_DEBUG0("not there\n"); - AddLevel(srcs, src); + CandidateList_AddCandidatesFor(srcs, src); Lst_Append(slst, src); } @@ -1559,10 +1553,7 @@ FindDepsRegularKnown(const char *name, s pref = bmake_strldup(name, (size_t)(nameLen - suff->nameLen)); targ = Candidate_New(bmake_strdup(gn->name), pref, suff, NULL, gn); - /* - * Add nodes from which the target can be made - */ - AddLevel(srcs, targ); + CandidateList_AddCandidatesFor(srcs, targ); /* * Record the target so we can nuke it @@ -1592,7 +1583,7 @@ FindDepsRegularUnknown(GNode *gn, const * don't do this anymore. */ if (Lst_IsEmpty(gn->commands)) - AddLevel(srcs, targ); + CandidateList_AddCandidatesFor(srcs, targ); else { SUFF_DEBUG0("not "); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 10:11:23 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): merge functions for suffix handling The names of the functions AddSources and AddLevel were not as precise and guiding as possible. Merging them into a single function makes the code indented a little more, but on the other hand provides a function with an easy to grasp purpose. To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:56:01 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up comments for Suff_AddInclude and Suff_AddLib To generate a diff of this commit: cvs rdiff -u -r1.284 -r1.285 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.284 src/usr.bin/make/suff.c:1.285 --- src/usr.bin/make/suff.c:1.284 Sun Nov 22 09:48:58 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 09:56:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.284 2020/11/22 09:48:58 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.285 2020/11/22 09:56:01 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.284 2020/11/22 09:48:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.285 2020/11/22 09:56:01 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -828,34 +828,30 @@ Suff_DoPaths(void) Lst_Destroy(inLibs, Dir_Destroy); } -/* Add the given suffix as a type of file which gets included. - * Called from the parse module when a .INCLUDES line is parsed. - * The suffix must have already been defined. - * The SUFF_INCLUDE bit is set in the suffix's flags field. - * - * Input: - * sname Name of the suffix to mark +/* + * Add the given suffix as a type of file which gets included. + * Called when a '.INCLUDES: .h' line is parsed. + * To have an effect, the suffix must already exist. + * This affects the magic variable '.INCLUDES'. */ void -Suff_AddInclude(const char *sname) +Suff_AddInclude(const char *suffName) { -Suffix *suff = FindSuffixByName(sname); +Suffix *suff = FindSuffixByName(suffName); if (suff != NULL) suff->flags |= SUFF_INCLUDE; } -/* Add the given suffix as a type of file which is a library. - * Called from the parse module when parsing a .LIBS line. - * The suffix must have been defined via .SUFFIXES before this is called. - * The SUFF_LIBRARY bit is set in the suffix's flags field. - * - * Input: - * sname Name of the suffix to mark +/* + * Add the given suffix as a type of file which is a library. + * Called when a '.LIBS: .a' line is parsed. + * To have an effect, the suffix must already exist. + * This affects the magic variable '.LIBS'. */ void -Suff_AddLib(const char *sname) +Suff_AddLib(const char *suffName) { -Suffix *suff = FindSuffixByName(sname); +Suffix *suff = FindSuffixByName(suffName); if (suff != NULL) suff->flags |= SUFF_LIBRARY; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:56:01 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up comments for Suff_AddInclude and Suff_AddLib To generate a diff of this commit: cvs rdiff -u -r1.284 -r1.285 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:48:58 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): document possible bug in UpdateTarget in suffix handling To generate a diff of this commit: cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.283 src/usr.bin/make/suff.c:1.284 --- src/usr.bin/make/suff.c:1.283 Sun Nov 22 09:46:37 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 09:48:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.283 2020/11/22 09:46:37 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.284 2020/11/22 09:48:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.283 2020/11/22 09:46:37 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.284 2020/11/22 09:48:58 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -667,6 +667,12 @@ UpdateTarget(GNode *target, GNode **inou !(target->type & OP_NOTARGET)) { *inout_main = target; Targ_SetMain(target); + /* + * XXX: Why could it be a good idea to return TRUE here? + * The main task of this function is to turn ordinary nodes into + * transformations, no matter whether or not a new .MAIN node + * has been found. + */ return TRUE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:48:58 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): document possible bug in UpdateTarget in suffix handling To generate a diff of this commit: cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:46:37 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename type SrcList to CandidateList The variable names will be renamed in a follow-up commit, as necessary. To generate a diff of this commit: cvs rdiff -u -r1.282 -r1.283 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.282 src/usr.bin/make/suff.c:1.283 --- src/usr.bin/make/suff.c:1.282 Sun Nov 22 09:30:22 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 09:46:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.282 2020/11/22 09:30:22 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.283 2020/11/22 09:46:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.282 2020/11/22 09:30:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.283 2020/11/22 09:46:37 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -123,8 +123,8 @@ MAKE_RCSID("$NetBSD: suff.c,v 1.282 2020 typedef List SuffixList; typedef ListNode SuffixListNode; -typedef List SrcList; /* XXX: rename to CandidateList */ -typedef ListNode SrcListNode; /* XXX: rename to CandidateListNode */ +typedef List CandidateList; +typedef ListNode CandidateListNode; static SuffixList *sufflist; /* List of suffixes */ #ifdef CLEANUP @@ -195,7 +195,7 @@ typedef struct Candidate { int numChildren; /* Count of existing children (so we don't free * this thing too early or never nuke it) */ #ifdef DEBUG_SRC -SrcList *childrenList; +CandidateList *childrenList; #endif } Candidate; @@ -858,10 +858,11 @@ Suff_AddLib(const char *sname) #ifdef DEBUG_SRC static void -SrcList_PrintAddrs(SrcList *srcList) +CandidateList_PrintAddrs(CandidateList *list) { -SrcListNode *ln; -for (ln = srcList->first; ln != NULL; ln = ln->next) +CandidateListNode *ln; + +for (ln = list->first; ln != NULL; ln = ln->next) debug_printf(" %p", ln->datum); debug_printf("\n"); } @@ -886,18 +887,20 @@ Candidate_New(char *name, char *pref, Su return cand; } +/* Add a new candidate to the list. */ static void -SrcList_Add(SrcList *srcList, char *srcName, Candidate *targ, Suffix *suff, - const char *debug_tag) +CandidateList_Add(CandidateList *list, char *srcName, Candidate *targ, + Suffix *suff, const char *debug_tag) { -Candidate *src = Candidate_New(srcName, targ->pref, suff, targ, NULL); +Candidate *cand = Candidate_New(srcName, targ->pref, suff, targ, NULL); targ->numChildren++; -Lst_Append(srcList, src); +Lst_Append(list, cand); + #ifdef DEBUG_SRC -Lst_Append(targ->childrenList, src); -debug_printf("%s add suff %p src %p to list %p:", - debug_tag, targ, src, srcList); -SrcList_PrintAddrs(srcList); +Lst_Append(targ->childrenList, cand); +debug_printf("%s add suff %p candidate %p to list %p:", + debug_tag, targ, cand, list); +CandidateList_PrintAddrs(list); #endif } @@ -905,24 +908,25 @@ SrcList_Add(SrcList *srcList, char *srcN * Add a new candidate to the list, formed from the candidate's prefix and * the suffix. */ +/* XXX: reorder parameters */ static void -AddSources(Suffix *suff, SrcList *srcList, Candidate *targ) +AddSources(Suffix *suff, CandidateList *list, Candidate *targ) { if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { /* * If the suffix has been marked as the NULL suffix, also create a * candidate for a file with no suffix attached. */ - SrcList_Add(srcList, bmake_strdup(targ->pref), targ, suff, "1"); + CandidateList_Add(list, bmake_strdup(targ->pref), targ, suff, "1"); } -SrcList_Add(srcList, str_concat2(targ->pref, suff->name), targ, suff, "2"); +CandidateList_Add(list, str_concat2(targ->pref, suff->name), targ, suff, "2"); } /* Add all the children of targ to the list. */ static void -AddLevel(SrcList *srcs, Candidate *targ) +AddLevel(CandidateList *srcs, Candidate *targ) { -SrcListNode *ln; +CandidateListNode *ln; for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { Suffix *childSuff = ln->datum; AddSources(childSuff, srcs, targ); @@ -932,13 +936,13 @@ AddLevel(SrcList *srcs, Candidate *targ) /* Free the first candidate in the list that is not referenced anymore. * Return whether a candidate was removed. */ static Boolean -RemoveSrc(SrcList *srcs) +RemoveSrc(CandidateList *srcs) { -SrcListNode *ln; +CandidateListNode *ln; #ifdef DEBUG_SRC debug_printf("cleaning list %p:", srcs); -SrcList_PrintAddrs(srcs); +CandidateList_PrintAddrs(srcs); #endif for (ln = srcs->first; ln != NULL; ln = ln->next) { @@ -950,7 +954,9 @@
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:46:37 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename type SrcList to CandidateList The variable names will be renamed in a follow-up commit, as necessary. To generate a diff of this commit: cvs rdiff -u -r1.282 -r1.283 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:30:22 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename type Src to Candidate In all this code about sources, targets, parents and children, it's been way too difficult to decide whether each word 'src' meant a source as opposed to target, or just a possible source on its own. To generate a diff of this commit: cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.281 src/usr.bin/make/suff.c:1.282 --- src/usr.bin/make/suff.c:1.281 Sat Nov 21 23:51:28 2020 +++ src/usr.bin/make/suff.c Sun Nov 22 09:30:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.281 2020/11/21 23:51:28 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.282 2020/11/22 09:30:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.281 2020/11/21 23:51:28 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.282 2020/11/22 09:30:22 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -123,8 +123,8 @@ MAKE_RCSID("$NetBSD: suff.c,v 1.281 2020 typedef List SuffixList; typedef ListNode SuffixListNode; -typedef List SrcList; -typedef ListNode SrcListNode; +typedef List SrcList; /* XXX: rename to CandidateList */ +typedef ListNode SrcListNode; /* XXX: rename to CandidateListNode */ static SuffixList *sufflist; /* List of suffixes */ #ifdef CLEANUP @@ -184,20 +184,20 @@ typedef struct Suffix { * via the transformation rule ".c.o". If that doesn't exist, maybe there is * another transformation rule ".pas.c" that would make "src.pas" an indirect * candidate as well. The first such chain that leads to an existing file or - * node is finally made. + * node is finally chosen to be made. */ -typedef struct Src { +typedef struct Candidate { char *file; /* The file to look for */ char *pref; /* Prefix from which file was formed */ Suffix *suff; /* The suffix on the file */ -struct Src *parent; /* The Src for which this is a source */ +struct Candidate *parent; /* The candidate for which this is a source */ GNode *node; /* The node describing the file */ int numChildren; /* Count of existing children (so we don't free * this thing too early or never nuke it) */ #ifdef DEBUG_SRC SrcList *childrenList; #endif -} Src; +} Candidate; /* TODO: Document the difference between nullSuff and emptySuff. */ @@ -867,29 +867,30 @@ SrcList_PrintAddrs(SrcList *srcList) } #endif -static Src * -SrcNew(char *name, char *pref, Suffix *suff, Src *parent, GNode *gn) -{ -Src *src = bmake_malloc(sizeof *src); - -src->file = name; -src->pref = pref; -src->suff = Suffix_Ref(suff); -src->parent = parent; -src->node = gn; -src->numChildren = 0; +static Candidate * +Candidate_New(char *name, char *pref, Suffix *suff, Candidate *parent, + GNode *gn) +{ +Candidate *cand = bmake_malloc(sizeof *cand); + +cand->file = name; +cand->pref = pref; +cand->suff = Suffix_Ref(suff); +cand->parent = parent; +cand->node = gn; +cand->numChildren = 0; #ifdef DEBUG_SRC -src->childrenList = Lst_New(); +cand->childrenList = Lst_New(); #endif -return src; +return cand; } static void -SrcList_Add(SrcList *srcList, char *srcName, Src *targ, Suffix *suff, +SrcList_Add(SrcList *srcList, char *srcName, Candidate *targ, Suffix *suff, const char *debug_tag) { -Src *src = SrcNew(srcName, targ->pref, suff, targ, NULL); +Candidate *src = Candidate_New(srcName, targ->pref, suff, targ, NULL); targ->numChildren++; Lst_Append(srcList, src); #ifdef DEBUG_SRC @@ -900,23 +901,17 @@ SrcList_Add(SrcList *srcList, char *srcN #endif } -/* Add a suffix as a Src structure to the given list with its parent - * being the given Src structure. If the suffix is the null suffix, - * the prefix is used unaltered as the filename in the Src structure. - * - * Input: - * suff suffix for which to create a Src structure - * srcList list for the new Src - * targ parent for the new Src +/* + * Add a new candidate to the list, formed from the candidate's prefix and + * the suffix. */ static void -AddSources(Suffix *suff, SrcList *srcList, Src *targ) +AddSources(Suffix *suff, SrcList *srcList, Candidate *targ) { if ((suff->flags & SUFF_NULL) && suff->name[0] != '\0') { /* - * If the suffix has been marked as the NULL suffix, also create a Src - * structure for a file with no suffix attached. Two birds, and all - * that... + * If the suffix has been marked as the NULL suffix, also create a + * candidate for a file with no suffix attached. */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Nov 22 09:30:22 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename type Src to Candidate In all this code about sources, targets, parents and children, it's been way too difficult to decide whether each word 'src' meant a source as opposed to target, or just a possible source on its own. To generate a diff of this commit: cvs rdiff -u -r1.281 -r1.282 src/usr.bin/make/suff.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.