CVS commit: src/share/misc
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:36:46 UTC 2020 Modified Files: src/share/misc: style Log Message: Remove confusing advice about macros that might expand to nothing. Such macros should not exist; as advised earlier in the file, they should expand to `__nothing' (literally) from which itself expands to ((void)0) precisely so that the problem this advice sought to avoid does not arise. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/style diff -u src/share/misc/style:1.58 src/share/misc/style:1.59 --- src/share/misc/style:1.58 Sun Aug 2 01:35:07 2020 +++ src/share/misc/style Sun Aug 2 01:36:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: style,v 1.58 2020/08/02 01:35:07 riastradh Exp $ */ +/* $NetBSD: style,v 1.59 2020/08/02 01:36:46 riastradh Exp $ */ /* * The revision control tag appears first, with a blank line after it. @@ -30,7 +30,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: style,v 1.58 2020/08/02 01:35:07 riastradh Exp $"); +__RCSID("$NetBSD: style,v 1.59 2020/08/02 01:36:46 riastradh Exp $"); /* * VERY important single-line comments look like this. @@ -267,19 +267,6 @@ main(int argc, char *argv[]) stmt; /* - * Braces are required for control statements with a single statement - * that may expand to nothing. - */ -#ifdef DEBUG_FOO -#define DPRINTF(a) printf a -#else -#define DPRINTF(a) -#endif - if (broken) { - DPRINTF(("broken is %d\n", broken)); - } - - /* * Parts of a for loop may be left empty. Don't put declarations * inside blocks unless the routine is unusually complicated. */
CVS commit: src/share/misc
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:36:46 UTC 2020 Modified Files: src/share/misc: style Log Message: Remove confusing advice about macros that might expand to nothing. Such macros should not exist; as advised earlier in the file, they should expand to `__nothing' (literally) from which itself expands to ((void)0) precisely so that the problem this advice sought to avoid does not arise. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/misc
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:35:07 UTC 2020 Modified Files: src/share/misc: style Log Message: Update style around single-line braces according to discussion. https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html https://mail-index.netbsd.org/tech-kern/2020/07/12/msg026594.html Retain some examples of technically unnecessary braces that likely aid legibility from the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/style diff -u src/share/misc/style:1.57 src/share/misc/style:1.58 --- src/share/misc/style:1.57 Sun Aug 2 00:20:21 2020 +++ src/share/misc/style Sun Aug 2 01:35:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: style,v 1.57 2020/08/02 00:20:21 lukem Exp $ */ +/* $NetBSD: style,v 1.58 2020/08/02 01:35:07 riastradh Exp $ */ /* * The revision control tag appears first, with a blank line after it. @@ -30,7 +30,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: style,v 1.57 2020/08/02 00:20:21 lukem Exp $"); +__RCSID("$NetBSD: style,v 1.58 2020/08/02 01:35:07 riastradh Exp $"); /* * VERY important single-line comments look like this. @@ -241,8 +241,9 @@ main(int argc, char *argv[]) errno = 0; num = strtol(optarg, , 10); if (num <= 0 || *ep != '\0' || (errno == ERANGE && - (num == LONG_MAX || num == LONG_MIN)) ) + (num == LONG_MAX || num == LONG_MIN)) ) { errx(1, "illegal number -- %s", optarg); + } break; case '?': default: @@ -254,9 +255,9 @@ main(int argc, char *argv[]) argv += optind; /* - * Space after keywords (while, for, return, switch). No braces are - * required for control statements with only a single statement, - * unless it's a long statement. + * Space after keywords (while, for, return, switch). + * + * Braces around single-line bodies are optional; use discretion. * * Forever loops are done with for's, not while's. */ @@ -288,15 +289,14 @@ main(int argc, char *argv[]) } /* Second level indents are four spaces. */ - while (cnt < 20) + while (cnt < 20) { z = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; + } /* * Closing and opening braces go on the same line as the else. - * Don't add braces that aren't necessary except in cases where - * there are ambiguity or readability issues. */ if (test) { /* @@ -310,8 +310,9 @@ main(int argc, char *argv[]) } else if (bar) { stmt; stmt; - } else + } else { stmt; + } /* No spaces after function names. */ if ((result = function(a1, a2, a3, a4)) == NULL)
CVS commit: src/share/misc
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:35:07 UTC 2020 Modified Files: src/share/misc: style Log Message: Update style around single-line braces according to discussion. https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html https://mail-index.netbsd.org/tech-kern/2020/07/12/msg026594.html Retain some examples of technically unnecessary braces that likely aid legibility from the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:17:57 UTC 2020 Modified Files: src/sys/dev: ld.c ldvar.h src/sys/dev/sdmmc: ld_sdmmc.c Log Message: Remove unnecessary wait in ldbegindetach. Like disk_begindetach, ldbegindetach only commits to detaching but doesn't wait for existing xfers to drain; it is up to the driver to abort them, once we are committed, and then ldenddetach to wait for them to drain. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ld.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ldvar.h cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sdmmc/ld_sdmmc.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/dev/ld.c diff -u src/sys/dev/ld.c:1.110 src/sys/dev/ld.c:1.111 --- src/sys/dev/ld.c:1.110 Mon Apr 13 08:05:02 2020 +++ src/sys/dev/ld.c Sun Aug 2 01:17:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ld.c,v 1.110 2020/04/13 08:05:02 maxv Exp $ */ +/* $NetBSD: ld.c,v 1.111 2020/08/02 01:17:56 riastradh Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.110 2020/04/13 08:05:02 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.111 2020/08/02 01:17:56 riastradh Exp $"); #include #include @@ -189,26 +189,25 @@ int ldbegindetach(struct ld_softc *sc, int flags) { struct dk_softc *dksc = >sc_dksc; - int rv = 0; + int error; + /* If we never attached properly, no problem with detaching. */ if ((sc->sc_flags & LDF_ENABLED) == 0) - return (0); - - rv = disk_begindetach(>sc_dkdev, ld_lastclose, dksc->sc_dev, flags); - - if (rv != 0) - return rv; + return 0; - mutex_enter(>sc_mutex); - sc->sc_maxqueuecnt = 0; + /* + * If the disk is still open, back out before we commit to + * detaching. + */ + error = disk_begindetach(>sc_dkdev, ld_lastclose, dksc->sc_dev, + flags); + if (error) + return error; - while (sc->sc_queuecnt > 0) { - sc->sc_flags |= LDF_DRAIN; - cv_wait(>sc_drain, >sc_mutex); - } - mutex_exit(>sc_mutex); + /* We are now committed to detaching. Prevent new xfers. */ + ldadjqparam(sc, 0); - return (rv); + return 0; } void @@ -220,12 +219,17 @@ ldenddetach(struct ld_softc *sc) if ((sc->sc_flags & LDF_ENABLED) == 0) return; - mutex_enter(>sc_mutex); - /* Wait for commands queued with the hardware to complete. */ - if (sc->sc_queuecnt != 0) { - if (cv_timedwait(>sc_drain, >sc_mutex, 30 * hz)) + mutex_enter(>sc_mutex); + while (sc->sc_queuecnt > 0) { + if (cv_timedwait(>sc_drain, >sc_mutex, 30 * hz)) { + /* + * XXX This seems like a recipe for crashing on + * use after free... + */ printf("%s: not drained\n", dksc->sc_xname); + break; + } } mutex_exit(>sc_mutex); @@ -467,10 +471,7 @@ lddone(struct ld_softc *sc, struct buf * mutex_enter(>sc_mutex); if (--sc->sc_queuecnt <= sc->sc_maxqueuecnt) { - if ((sc->sc_flags & LDF_DRAIN) != 0) { - sc->sc_flags &= ~LDF_DRAIN; - cv_broadcast(>sc_drain); - } + cv_broadcast(>sc_drain); mutex_exit(>sc_mutex); dk_start(dksc, NULL); } else Index: src/sys/dev/ldvar.h diff -u src/sys/dev/ldvar.h:1.33 src/sys/dev/ldvar.h:1.34 --- src/sys/dev/ldvar.h:1.33 Tue Mar 19 07:01:14 2019 +++ src/sys/dev/ldvar.h Sun Aug 2 01:17:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ldvar.h,v 1.33 2019/03/19 07:01:14 mlelstv Exp $ */ +/* $NetBSD: ldvar.h,v 1.34 2020/08/02 01:17:56 riastradh Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ struct ld_softc { /* sc_flags */ #define LDF_ENABLED 0x001 /* device enabled */ -#define LDF_DRAIN 0x020 /* maxqueuecnt has changed; drain */ +#define LDF_UNUSED0 0x020 /* was LDF_DRAIN */ #define LDF_NO_RND 0x040 /* do not attach rnd source */ #define LDF_MPSAFE 0x080 /* backend is MPSAFE */ Index: src/sys/dev/sdmmc/ld_sdmmc.c diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.40 src/sys/dev/sdmmc/ld_sdmmc.c:1.41 --- src/sys/dev/sdmmc/ld_sdmmc.c:1.40 Wed Jul 22 17:18:10 2020 +++ src/sys/dev/sdmmc/ld_sdmmc.c Sun Aug 2 01:17:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_sdmmc.c,v 1.40 2020/07/22 17:18:10 riastradh Exp $ */ +/* $NetBSD: ld_sdmmc.c,v 1.41 2020/08/02 01:17:56 riastradh Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.40 2020/07/22 17:18:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.41 2020/08/02 01:17:56 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -344,11 +344,20 @@ ld_sdmmc_detach(device_t dev, int flags) struct ld_sdmmc_softc *sc = device_private(dev); struct ld_softc *ld = >sc_ld; struct ld_sdmmc_task *task; - int rv, i; + int error, i; /* - * Block new xfers, abort all pending tasks, and wait for all - * pending waiters to notice that we're gone. + * Block new xfers, or fail if the disk is still open and the + * detach isn't forced.
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Sun Aug 2 01:17:57 UTC 2020 Modified Files: src/sys/dev: ld.c ldvar.h src/sys/dev/sdmmc: ld_sdmmc.c Log Message: Remove unnecessary wait in ldbegindetach. Like disk_begindetach, ldbegindetach only commits to detaching but doesn't wait for existing xfers to drain; it is up to the driver to abort them, once we are committed, and then ldenddetach to wait for them to drain. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ld.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ldvar.h cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sdmmc/ld_sdmmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/x86
> Module Name:src > Committed By: jdolecek > Date: Sat Aug 1 12:36:36 UTC 2020 > > Modified Files: > src/sys/arch/x86/pci: pci_intr_machdep.c > src/sys/arch/x86/x86: mainbus.c > > Log Message: > reorder includes to pull __HAVE_PCI_MSI_MSIX properly via > If requires a file to be included ("opt_pci.h"?) in order for its definition of __HAVE_PCI_MSI_MSIX to work, why doesn't include that file directly? Or, if I didn't follow exactly what's going on here, why is it necessary to reorder the includes? I think we should generally treat it as a bug if including two header files in different orders gives different outcomes, and fix it by fixing the header files rather than by adjusting the ordering of includes in every file where they're used.
Re: CVS commit: src/share/misc
On 20-08-01 23:07, Taylor R Campbell wrote: | Index: share/misc/style | === | RCS file: /cvsroot/src/share/misc/style,v | retrieving revision 1.56 | diff -p -p -u -r1.56 style | --- share/misc/style1 Aug 2020 02:45:35 - 1.56 | +++ share/misc/style1 Aug 2020 22:54:53 - | @@ -241,9 +241,8 @@ main(int argc, char *argv[]) | errno = 0; | num = strtol(optarg, , 10); | if (num <= 0 || *ep != '\0' || (errno == ERANGE && | - (num == LONG_MAX || num == LONG_MIN)) ) { | + (num == LONG_MAX || num == LONG_MIN)) ) | errx(1, "illegal number -- %s", optarg); | - } | break; IMO, that example is a case in where if the style is "minimal braces" that's still a good case to retain it. The if condition is across multiple lines, and the brakes make it clearer (to me) where the statement is. This all comes down to a matter of style, where some people prefer "purple" and some prefer "orange", yet the arguments are often claimed to be (by all concerned) as "technical reasons". Anyway, I haven't got the motivation to bikeshed like this in NetBSD anymore. Luke.
CVS commit: src/share/misc
Module Name:src Committed By: lukem Date: Sun Aug 2 00:20:22 UTC 2020 Modified Files: src/share/misc: style Log Message: style: revert previous I misintepreted the consensus. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/style diff -u src/share/misc/style:1.56 src/share/misc/style:1.57 --- src/share/misc/style:1.56 Sat Aug 1 02:45:35 2020 +++ src/share/misc/style Sun Aug 2 00:20:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: style,v 1.56 2020/08/01 02:45:35 lukem Exp $ */ +/* $NetBSD: style,v 1.57 2020/08/02 00:20:21 lukem Exp $ */ /* * The revision control tag appears first, with a blank line after it. @@ -30,7 +30,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: style,v 1.56 2020/08/01 02:45:35 lukem Exp $"); +__RCSID("$NetBSD: style,v 1.57 2020/08/02 00:20:21 lukem Exp $"); /* * VERY important single-line comments look like this. @@ -241,9 +241,8 @@ main(int argc, char *argv[]) errno = 0; num = strtol(optarg, , 10); if (num <= 0 || *ep != '\0' || (errno == ERANGE && - (num == LONG_MAX || num == LONG_MIN)) ) { + (num == LONG_MAX || num == LONG_MIN)) ) errx(1, "illegal number -- %s", optarg); - } break; case '?': default: @@ -255,18 +254,16 @@ main(int argc, char *argv[]) argv += optind; /* - * Space after keywords (while, for, return, switch). - * Braces are preferred for control statements - * with only a single statement. + * Space after keywords (while, for, return, switch). No braces are + * required for control statements with only a single statement, + * unless it's a long statement. * * Forever loops are done with for's, not while's. */ - for (p = buf; *p != '\0'; ++p) { + for (p = buf; *p != '\0'; ++p) continue; /* Explicit no-op */ - } - for (;;) { + for (;;) stmt; - } /* * Braces are required for control statements with a single statement @@ -291,14 +288,15 @@ main(int argc, char *argv[]) } /* Second level indents are four spaces. */ - while (cnt < 20) { + while (cnt < 20) z = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; - } /* * Closing and opening braces go on the same line as the else. + * Don't add braces that aren't necessary except in cases where + * there are ambiguity or readability issues. */ if (test) { /* @@ -312,14 +310,12 @@ main(int argc, char *argv[]) } else if (bar) { stmt; stmt; - } else { + } else stmt; - } /* No spaces after function names. */ - if ((result = function(a1, a2, a3, a4)) == NULL) { + if ((result = function(a1, a2, a3, a4)) == NULL) exit(1); - } /* * Unary operators don't require spaces, binary operators do. @@ -397,12 +393,10 @@ function(int a1, int a2, float fl, int a * * Use err/warn(3), don't roll your own! */ - if ((four = malloc(sizeof(*four))) == NULL) { + if ((four = malloc(sizeof(*four))) == NULL) err(1, NULL); - } - if ((six = (int *)overflow()) == NULL) { + if ((six = (int *)overflow()) == NULL) errx(1, "Number overflowed."); - } /* No parentheses are needed around the return value. */ return eight; @@ -426,9 +420,8 @@ dirinfo(const char *p, struct stat *sb, _DIAGASSERT(p != NULL); _DIAGASSERT(filedesc != -1); - if (stat(p, sb) < 0) { + if (stat(p, sb) < 0) err(1, "Unable to stat %s", p); - } /* * To printf quantities that might be larger than "long", include
Re: CVS commit: src/share/misc
On 20-08-01 23:07, Taylor R Campbell wrote: | > Module Name:src | > Committed By: lukem | > Date: Sat Aug 1 02:45:36 UTC 2020 | > | > Modified Files: | > src/share/misc: style | > | > Log Message: | > style: prefer braces for single statement control statements | > | > Prefer to use { braces } around single statements after | > control statements, instead of discouraging them. | > | > Per discussion on tech-userlevel & tech-kern, where the significant | > majority of developers who responded (including current and former | > core members) prefer this new style. | | Hmm...that's not the conclusion I got from the thread. What you proposed | (https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html), | and got consensus on, was: | | - discourage braces around single statements | + permit braces around single statements | | What you committed was: | | - discourage braces around single statements | + prefer braces around single statements and add braces to all examples | | At least two core members (me and kre) preferred the change you | originally proposed over the change you committed. | | Personally I feel that braces around short statements hurt legibility | by adding unnecessary visual clutter, and make it more cumbersome to | have consistent patterns like | | if (foo() == -1) | goto fail0; | if ((x = bar()) == -1) | goto fail1; | if (baz() == -1) | goto fail2; | | which makes it more tempting to get clever with shortcuts for error | branches or with reversing the sense of the branch, and we have too | many bugs with clever shortcuts in error branches already. | | We don't have a `goto fail' problem in NetBSD -- if we did, our | toolchain would detect it with -Werror=misleading-indentation, as I | just confirmed experimentally. (Same goes for macros that expand to | multiple statements, with -Werror=multistatement-macros.) | | Can you please restore this to the change you originally suggested, | along the lines of the attached patch? | Index: share/misc/style | === | RCS file: /cvsroot/src/share/misc/style,v | retrieving revision 1.56 | diff -p -p -u -r1.56 style | --- share/misc/style1 Aug 2020 02:45:35 - 1.56 | +++ share/misc/style1 Aug 2020 22:54:53 - | @@ -241,9 +241,8 @@ main(int argc, char *argv[]) | errno = 0; | num = strtol(optarg, , 10); | if (num <= 0 || *ep != '\0' || (errno == ERANGE && | - (num == LONG_MAX || num == LONG_MIN)) ) { | + (num == LONG_MAX || num == LONG_MIN)) ) | errx(1, "illegal number -- %s", optarg); | - } | break; | case '?': | default: | @@ -256,16 +255,16 @@ main(int argc, char *argv[]) | | /* | * Space after keywords (while, for, return, switch). | -* Braces are preferred for control statements | -* with only a single statement. | +* | +* Braces around single-line bodies are optional; use discretion. | * | * Forever loops are done with for's, not while's. | */ | - for (p = buf; *p != '\0'; ++p) { | + for (p = buf; *p != '\0'; ++p) | continue; /* Explicit no-op */ | - } | for (;;) { | - stmt; | + stmt1; | + stmt2; | } | | /* | @@ -317,9 +316,8 @@ main(int argc, char *argv[]) | } | | /* No spaces after function names. */ | - if ((result = function(a1, a2, a3, a4)) == NULL) { | + if ((result = function(a1, a2, a3, a4)) == NULL) | exit(1); | - } | | /* | * Unary operators don't require spaces, binary operators do. | @@ -397,12 +395,10 @@ function(int a1, int a2, float fl, int a | * | * Use err/warn(3), don't roll your own! | */ | - if ((four = malloc(sizeof(*four))) == NULL) { | + if ((four = malloc(sizeof(*four))) == NULL) | err(1, NULL); | - } | - if ((six = (int *)overflow()) == NULL) { | + if ((six = (int *)overflow()) == NULL) | errx(1, "Number overflowed."); | - } | | /* No parentheses are needed around the return value. */ | return eight; | @@ -426,9 +422,8 @@ dirinfo(const char *p, struct stat *sb, | _DIAGASSERT(p != NULL); | _DIAGASSERT(filedesc != -1); | | - if (stat(p, sb) < 0) { | + if (stat(p, sb) < 0) | err(1, "Unable to stat %s", p); | - } | | /* | * To printf quantities that might be larger than "long", include I've reverted the change. Bikeshed away.
CVS commit: src/share/misc
Module Name:src Committed By: lukem Date: Sun Aug 2 00:20:22 UTC 2020 Modified Files: src/share/misc: style Log Message: style: revert previous I misintepreted the consensus. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/kern
> Module Name:src > Committed By: jdolecek > Date: Sat Aug 1 11:18:26 UTC 2020 > > Modified Files: > src/sys/kern: subr_autoconf.c > > Log Message: > avoid VLA for the sizeof() calculations Why?
Re: CVS commit: src/share/misc
> Module Name:src > Committed By: lukem > Date: Sat Aug 1 02:45:36 UTC 2020 > > Modified Files: > src/share/misc: style > > Log Message: > style: prefer braces for single statement control statements > > Prefer to use { braces } around single statements after > control statements, instead of discouraging them. > > Per discussion on tech-userlevel & tech-kern, where the significant > majority of developers who responded (including current and former > core members) prefer this new style. Hmm...that's not the conclusion I got from the thread. What you proposed (https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html), and got consensus on, was: - discourage braces around single statements + permit braces around single statements What you committed was: - discourage braces around single statements + prefer braces around single statements and add braces to all examples At least two core members (me and kre) preferred the change you originally proposed over the change you committed. Personally I feel that braces around short statements hurt legibility by adding unnecessary visual clutter, and make it more cumbersome to have consistent patterns like if (foo() == -1) goto fail0; if ((x = bar()) == -1) goto fail1; if (baz() == -1) goto fail2; which makes it more tempting to get clever with shortcuts for error branches or with reversing the sense of the branch, and we have too many bugs with clever shortcuts in error branches already. We don't have a `goto fail' problem in NetBSD -- if we did, our toolchain would detect it with -Werror=misleading-indentation, as I just confirmed experimentally. (Same goes for macros that expand to multiple statements, with -Werror=multistatement-macros.) Can you please restore this to the change you originally suggested, along the lines of the attached patch? Index: share/misc/style === RCS file: /cvsroot/src/share/misc/style,v retrieving revision 1.56 diff -p -p -u -r1.56 style --- share/misc/style1 Aug 2020 02:45:35 - 1.56 +++ share/misc/style1 Aug 2020 22:54:53 - @@ -241,9 +241,8 @@ main(int argc, char *argv[]) errno = 0; num = strtol(optarg, , 10); if (num <= 0 || *ep != '\0' || (errno == ERANGE && - (num == LONG_MAX || num == LONG_MIN)) ) { + (num == LONG_MAX || num == LONG_MIN)) ) errx(1, "illegal number -- %s", optarg); - } break; case '?': default: @@ -256,16 +255,16 @@ main(int argc, char *argv[]) /* * Space after keywords (while, for, return, switch). -* Braces are preferred for control statements -* with only a single statement. +* +* Braces around single-line bodies are optional; use discretion. * * Forever loops are done with for's, not while's. */ - for (p = buf; *p != '\0'; ++p) { + for (p = buf; *p != '\0'; ++p) continue; /* Explicit no-op */ - } for (;;) { - stmt; + stmt1; + stmt2; } /* @@ -317,9 +316,8 @@ main(int argc, char *argv[]) } /* No spaces after function names. */ - if ((result = function(a1, a2, a3, a4)) == NULL) { + if ((result = function(a1, a2, a3, a4)) == NULL) exit(1); - } /* * Unary operators don't require spaces, binary operators do. @@ -397,12 +395,10 @@ function(int a1, int a2, float fl, int a * * Use err/warn(3), don't roll your own! */ - if ((four = malloc(sizeof(*four))) == NULL) { + if ((four = malloc(sizeof(*four))) == NULL) err(1, NULL); - } - if ((six = (int *)overflow()) == NULL) { + if ((six = (int *)overflow()) == NULL) errx(1, "Number overflowed."); - } /* No parentheses are needed around the return value. */ return eight; @@ -426,9 +422,8 @@ dirinfo(const char *p, struct stat *sb, _DIAGASSERT(p != NULL); _DIAGASSERT(filedesc != -1); - if (stat(p, sb) < 0) { + if (stat(p, sb) < 0) err(1, "Unable to stat %s", p); - } /* * To printf quantities that might be larger than "long", include
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: riastradh Date: Sat Aug 1 22:30:57 UTC 2020 Modified Files: src/sys/rump/librump/rumpkern: threads.c Log Message: Define kthread_fpu_enter/exit for rump. XXX Not 100% sure that it's safe to touch curlwp->l_flag in this context, but this change will make progress, at least. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/rump/librump/rumpkern/threads.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/rump/librump/rumpkern/threads.c diff -u src/sys/rump/librump/rumpkern/threads.c:1.26 src/sys/rump/librump/rumpkern/threads.c:1.27 --- src/sys/rump/librump/rumpkern/threads.c:1.26 Fri Apr 21 19:16:10 2017 +++ src/sys/rump/librump/rumpkern/threads.c Sat Aug 1 22:30:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $ */ +/* $NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $ */ /* * Copyright (c) 2007-2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $"); #include #include @@ -247,6 +247,32 @@ kthread_join(struct lwp *l) return rv; } +int +kthread_fpu_enter(void) +{ + struct lwp *l = curlwp; + int s; + + KASSERTMSG(l->l_flag & LW_SYSTEM, + "%s is allowed only in kthreads", __func__); + s = l->l_flag & LW_SYSTEM_FPU; + l->l_flag |= LW_SYSTEM_FPU; + + return s; +} + +void +kthread_fpu_exit(int s) +{ + struct lwp *l = curlwp; + + KASSERT(s == (s & LW_SYSTEM_FPU)); + KASSERTMSG(l->l_flag & LW_SYSTEM, + "%s is allowed only in kthreads", __func__); + KASSERT(l->l_flag & LW_SYSTEM_FPU); + l->l_flag ^= s ^ LW_SYSTEM_FPU; +} + /* * Create a non-kernel thread that is scheduled by a rump kernel hypercall. *
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: riastradh Date: Sat Aug 1 22:30:57 UTC 2020 Modified Files: src/sys/rump/librump/rumpkern: threads.c Log Message: Define kthread_fpu_enter/exit for rump. XXX Not 100% sure that it's safe to touch curlwp->l_flag in this context, but this change will make progress, at least. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/rump/librump/rumpkern/threads.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: Sat Aug 1 21:51:22 UTC 2020 Modified Files: src/usr.bin/make: buf.c Log Message: make(1): remove redundant if clause from Buf_DestroyCompact bmake_realloc can never return NULL. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/buf.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/buf.c diff -u src/usr.bin/make/buf.c:1.29 src/usr.bin/make/buf.c:1.30 --- src/usr.bin/make/buf.c:1.29 Sat Aug 1 21:40:49 2020 +++ src/usr.bin/make/buf.c Sat Aug 1 21:51:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $ */ +/* $NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $"); +__RCSID("$NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -219,11 +219,9 @@ Buf_DestroyCompact(Buffer *buf) if (buf->size - buf->count >= BUF_COMPACT_LIMIT) { /* We trust realloc to be smart */ Byte *data = bmake_realloc(buf->buffer, buf->count + 1); - if (data) { /* XXX: can never be NULL */ - data[buf->count] = 0; - Buf_Destroy(buf, FALSE); - return data; - } + data[buf->count] = 0; + Buf_Destroy(buf, FALSE); + return data; } #endif return Buf_Destroy(buf, FALSE);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 21:51:22 UTC 2020 Modified Files: src/usr.bin/make: buf.c Log Message: make(1): remove redundant if clause from Buf_DestroyCompact bmake_realloc can never return NULL. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/buf.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: Sat Aug 1 21:48:17 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): remove line numbers from generated code coverage files The line numbers make it difficult to spot changes in the code and coverage if a line is added or removed from the code. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/usr.bin/make/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/Makefile diff -u src/usr.bin/make/Makefile:1.77 src/usr.bin/make/Makefile:1.78 --- src/usr.bin/make/Makefile:1.77 Fri Jul 31 07:29:21 2020 +++ src/usr.bin/make/Makefile Sat Aug 1 21:48:17 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.77 2020/07/31 07:29:21 rillig Exp $ +# $NetBSD: Makefile,v 1.78 2020/08/01 21:48:17 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -79,6 +79,7 @@ test: .MAKE && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} .if ${USE_COVERAGE} == yes gcov ${SRCS} + sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov .endif accept: .MAKE
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 21:48:17 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): remove line numbers from generated code coverage files The line numbers make it difficult to spot changes in the code and coverage if a line is added or removed from the code. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/usr.bin/make/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
Module Name:src Committed By: rillig Date: Sat Aug 1 21:40:50 UTC 2020 Modified Files: src/usr.bin/make: buf.c buf.h cond.c for.c main.c var.c Log Message: make(1): switch Buffer size from int to size_t This change helps to make the various integer types compatible and is a preparational step for setting WARNS=6 in the Makefile. The documentation of buf.c has been cleaned up and condensed since it was mostly redundant, and some statements were even slightly wrong. All code changes are covered by the existing unit tests, except for the few lines in for.c around for_var_len. These changes have been reviewed thoroughly and manually, like all the others in this commit. Those buffer functions that deal with sizes have been renamed by appending a Z, to make sure that no function call was accidentally forgotten. They will be renamed back in a follow-up commit. As usual, the scope of a few affected variables has been reduced, and some variables had to be split since they had been incorrectly merged before. The order of the arguments to Buf_AddBytes has changed from (mem_len, mem) to (mem, mem_len), in order to make it consistent with the functions from the C standard library, such as snprintf. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/buf.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/buf.h cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/cond.c cvs rdiff -u -r1.58 -r1.59 src/usr.bin/make/for.c cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/main.c cvs rdiff -u -r1.387 -r1.388 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/buf.c diff -u src/usr.bin/make/buf.c:1.28 src/usr.bin/make/buf.c:1.29 --- src/usr.bin/make/buf.c:1.28 Sun Jul 26 15:09:10 2020 +++ src/usr.bin/make/buf.c Sat Aug 1 21:40:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $ */ +/* $NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,40 +70,31 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.28 2020/07/26 15:09:10 rillig Exp $"); +__RCSID("$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $"); #endif #endif /* not lint */ #endif -/*- - * buf.c -- - * Functions for automatically-expanded NUL-terminated buffers. - */ +/* Functions for automatically-expanded NUL-terminated buffers. */ #include #include "make.h" #include "buf.h" #ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) #endif #define BUF_DEF_SIZE 256 /* Default buffer size */ -/*- - *--- - * Buf_Expand_1 -- - * Extend buffer for single byte add. - * - *--- - */ +/* Extend the buffer for adding a single byte. */ void Buf_Expand_1(Buffer *bp) { @@ -111,55 +102,38 @@ Buf_Expand_1(Buffer *bp) bp->buffer = bmake_realloc(bp->buffer, bp->size); } -/*- - *--- - * Buf_AddBytes -- - * Add a number of bytes to the buffer. - * - * Results: - * None. - * - * Side Effects: - * Guess what? - * - *--- - */ +/* Add the given bytes to the buffer. */ void -Buf_AddBytes(Buffer *bp, int numBytes, const Byte *bytesPtr) +Buf_AddBytesZ(Buffer *bp, const Byte *bytesPtr, size_t numBytes) { -int count = bp->count; -Byte *ptr; +size_t count = bp->count; if (__predict_false(count + numBytes >= bp->size)) { bp->size += max(bp->size, numBytes + 16); bp->buffer = bmake_realloc(bp->buffer, bp->size); } -ptr = bp->buffer + count; +Byte *ptr = bp->buffer + count; bp->count = count + numBytes; -ptr[numBytes] = 0; memcpy(ptr, bytesPtr, numBytes); +ptr[numBytes] = '\0'; } +/* Add the bytes between start and end to the buffer. */ void Buf_AddBytesBetween(Buffer *bp, const char *start, const char *end) { -Buf_AddBytes(bp, (int)(end - start), start); +Buf_AddBytesZ(bp, start, (size_t)(end - start)); } +/* Add the given string to the buffer. */ void Buf_AddStr(Buffer *bp, const char *str) { -Buf_AddBytes(bp, (int)strlen(str), str); +Buf_AddBytesZ(bp, str, strlen(str)); } -/*- - *--- - * Buf_AddInt -- - * Add the given number to the buffer. - * - *--- - */ +/* Add the
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 21:40:50 UTC 2020 Modified Files: src/usr.bin/make: buf.c buf.h cond.c for.c main.c var.c Log Message: make(1): switch Buffer size from int to size_t This change helps to make the various integer types compatible and is a preparational step for setting WARNS=6 in the Makefile. The documentation of buf.c has been cleaned up and condensed since it was mostly redundant, and some statements were even slightly wrong. All code changes are covered by the existing unit tests, except for the few lines in for.c around for_var_len. These changes have been reviewed thoroughly and manually, like all the others in this commit. Those buffer functions that deal with sizes have been renamed by appending a Z, to make sure that no function call was accidentally forgotten. They will be renamed back in a follow-up commit. As usual, the scope of a few affected variables has been reduced, and some variables had to be split since they had been incorrectly merged before. The order of the arguments to Buf_AddBytes has changed from (mem_len, mem) to (mem, mem_len), in order to make it consistent with the functions from the C standard library, such as snprintf. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/buf.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/buf.h cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/cond.c cvs rdiff -u -r1.58 -r1.59 src/usr.bin/make/for.c cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/main.c cvs rdiff -u -r1.387 -r1.388 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Aug 1 20:54:23 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: pmap_unwire - deobfuscate. Don't hide assignments inside if (). Remove redundant entry == 0 test b/c _PG_WIRED test afterwards covers that and the compiler actually elimiates it anyway. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.82 src/sys/arch/sh3/sh3/pmap.c:1.83 --- src/sys/arch/sh3/sh3/pmap.c:1.82 Thu Feb 2 21:35:29 2017 +++ src/sys/arch/sh3/sh3/pmap.c Sat Aug 1 20:54:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $ */ +/* $NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $"); #include #include @@ -736,9 +736,12 @@ pmap_unwire(pmap_t pmap, vaddr_t va) { pt_entry_t *pte, entry; - if ((pte = __pmap_pte_lookup(pmap, va)) == NULL || - (entry = *pte) == 0 || - (entry & _PG_WIRED) == 0) + pte = __pmap_pte_lookup(pmap, va); + if (pte == NULL) + return; + + entry = *pte; + if ((entry & _PG_WIRED) == 0) return; *pte = entry & ~_PG_WIRED;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Aug 1 20:54:23 UTC 2020 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: pmap_unwire - deobfuscate. Don't hide assignments inside if (). Remove redundant entry == 0 test b/c _PG_WIRED test afterwards covers that and the compiler actually elimiates it anyway. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 20:21:00 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68kGraph.c x68kKbd.c x68kMouse.c Log Message: Replace 'pointer' type with 'void *' to sync with upstream manner. https://cgit.freedesktop.org/xorg/xserver/commit/?id=60014a4a98ff924ae7f6840781f768c1cc93bbab To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c cvs rdiff -u -r1.7 -r1.8 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.7 --- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c:1.6 Sat Aug 1 20:09:03 2020 +++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c Sat Aug 1 20:21:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x68kGraph.c,v 1.6 2020/08/01 20:09:03 tsutsui Exp $ */ +/* $NetBSD: x68kGraph.c,v 1.7 2020/08/01 20:21:00 tsutsui Exp $ */ /*- * Copyright (c) 1996 Yasushi Yamasaki * All rights reserved. @@ -116,7 +116,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "fb.h" /* local functions */ -static Bool x68kCfbFinishScreenInit(ScreenPtr pScreen, pointer pbits, +static Bool x68kCfbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width); static void x68kInstallColormap(ColormapPtr cmap); @@ -235,7 +235,7 @@ x68kGraphInit(ScreenPtr pScreen, int arg * * purpose: initialize visuals and perform miscellaneous settings * argument: (ScreenPtr)pScreen : DIX screen record - *(pointer)pbits : frame buffer + *(void *)pbits : frame buffer *(int)xsize, (int)ysize : screen size *(int)dpix, (int)dpiy : screen resolution in dots per inch *(int)width : pixel width of frame buffer @@ -245,7 +245,7 @@ x68kGraphInit(ScreenPtr pScreen, int arg static Bool x68kCfbFinishScreenInit( ScreenPtr pScreen, -pointer pbits, +void *pbits, int xsize, int ysize, int dpix, int dpiy, int width) @@ -361,7 +361,7 @@ x68kInstallColormap(ColormapPtr cmap) return; if (pPriv->installedMap) WalkTree(pPriv->installedMap->pScreen, TellLostMap, - (pointer) &(pPriv->installedMap->mid)); + (void *) &(pPriv->installedMap->mid)); if (pPriv->class & DynamicClass) { if ((cmap->pVisual->class | DynamicClass) == DirectColor) { @@ -395,7 +395,7 @@ x68kInstallColormap(ColormapPtr cmap) x68kUpdateColormap(cmap->pScreen, 0, 1<<(pPriv->depth), rmap, gmap, bmap); } pPriv->installedMap = cmap; -WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid)); +WalkTree(cmap->pScreen, TellGainedMap, (void *) &(cmap->mid)); } /*- @@ -414,7 +414,7 @@ x68kUninstallColormap(ColormapPtr cmap) Colormap defMapID = cmap->pScreen->defColormap; if (cmap->mid != defMapID) { - pointer retval; + void *retval; ColormapPtr defMap; dixLookupResourceByType(, defMapID, RT_COLORMAP, serverClient, DixReadAccess); Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.7 --- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.6 Sat Aug 1 20:09:03 2020 +++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c Sat Aug 1 20:21:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x68kMouse.c,v 1.6 2020/08/01 20:09:03 tsutsui Exp $ */ +/* $NetBSD: x68kMouse.c,v 1.7 2020/08/01 20:21:00 tsutsui Exp $ */ /*- * Copyright (c) 1996 Yasushi Yamasaki * All rights reserved. @@ -131,7 +131,7 @@ x68kMouseProc(DeviceIntPtr device, int w switch (what) { case DEVICE_INIT: -pMouse->devicePrivate = (pointer) +pMouse->devicePrivate = (void *) if( (x68kMousePriv.fd = open("/dev/mouse", O_RDONLY)) == -1 ) { ErrorF("Can't open mouse device"); return !Success; Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c:1.7 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c:1.8 ---
CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 20:21:00 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68kGraph.c x68kKbd.c x68kMouse.c Log Message: Replace 'pointer' type with 'void *' to sync with upstream manner. https://cgit.freedesktop.org/xorg/xserver/commit/?id=60014a4a98ff924ae7f6840781f768c1cc93bbab To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c cvs rdiff -u -r1.7 -r1.8 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: xsrc/external/mit
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 20:09:03 UTC 2020 Modified Files: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k: X68k.man x68kConfig.c x68kFb.c x68kGraph.c x68kInit.c x68kIo.c x68kKbd.c x68kKeyMap.c x68kMouse.c x68kReg.h x68kText.c xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: X68k.man x68kConfig.c x68kFb.c x68kGraph.c x68kInit.c x68kIo.c x68kKbd.c x68kKeyMap.c x68kMouse.c x68kReg.h x68kText.c Log Message: TAB/space cleanup. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man cvs rdiff -u -r1.2 -r1.3 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kIo.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kKeyMap.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kMouse.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kReg.h \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kText.c cvs rdiff -u -r1.3 -r1.4 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kKbd.c cvs rdiff -u -r1.1 -r1.2 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/X68k.man cvs rdiff -u -r1.4 -r1.5 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c cvs rdiff -u -r1.3 -r1.4 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c cvs rdiff -u -r1.5 -r1.6 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c cvs rdiff -u -r1.7 -r1.8 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c cvs rdiff -u -r1.2 -r1.3 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kIo.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKeyMap.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kReg.h cvs rdiff -u -r1.6 -r1.7 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man diff -u xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man:1.2 --- xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man:1.1.1.1 Thu Jun 9 09:07:59 2016 +++ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man Sat Aug 1 20:09:03 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: X68k.man,v 1.1.1.1 2016/06/09 09:07:59 mrg Exp $ +.\" $NetBSD: X68k.man,v 1.2 2020/08/01 20:09:03 tsutsui Exp $ .\" .\" Copyright (c) 1998 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -39,7 +39,7 @@ .Sh DESCRIPTION .Nm is the server for Version 11 of the X Window System on X68k hardware -running +running .Nx . It will normally be started by the .Xr xdm 1 @@ -121,7 +121,7 @@ is either or .Fa Graphic , and specifies the screen to be used by this mode. Note that the type -Graphic requires the +Graphic requires the .Pa /dev/grf1 device driver configured in your kernel. @@ -142,7 +142,7 @@ are the size of the screen by pixel. Remaining arguments are set to the registers of the CRT controler and the video controler of the x68k. Be carefull to change these values, or it may -DAMAGE THE DISPLAY HARDWARE!! +DAMAGE THE DISPLAY HARDWARE!! .It Fn Mode One argument @@ -155,7 +155,7 @@ function. .It Fn Mouse One argument .Fa type -is required. Specify the pointing device type; currently +is required. Specify the pointing device type; currently .Fa standard is the only acceptable argument. .It Fn Keyboard Index: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c diff -u xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c:1.2 xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c:1.3 --- xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c:1.2 Fri Apr 10 16:49:36 2020 +++ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c Sat Aug 1 20:09:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x68kConfig.c,v 1.2 2020/04/10 16:49:36 tsutsui Exp $ */ +/* $NetBSD: x68kConfig.c,v 1.3 2020/08/01 20:09:03 tsutsui Exp $ */ /*- * Copyright (c) 1996 Yasushi Yamasaki * All rights reserved. @@ -61,7 +61,7 @@ X68kScreenRec * x68kGetScreenRecByType(int type) { int i; - + for (i = 0; i < X68K_FB_TYPES; i++) { if (x68kScreen[i].type == type) return [i]; @@
CVS commit: xsrc/external/mit
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 20:09:03 UTC 2020 Modified Files: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k: X68k.man x68kConfig.c x68kFb.c x68kGraph.c x68kInit.c x68kIo.c x68kKbd.c x68kKeyMap.c x68kMouse.c x68kReg.h x68kText.c xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: X68k.man x68kConfig.c x68kFb.c x68kGraph.c x68kInit.c x68kIo.c x68kKbd.c x68kKeyMap.c x68kMouse.c x68kReg.h x68kText.c Log Message: TAB/space cleanup. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68k.man cvs rdiff -u -r1.2 -r1.3 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kIo.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kKeyMap.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kMouse.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kReg.h \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kText.c cvs rdiff -u -r1.3 -r1.4 \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c \ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kKbd.c cvs rdiff -u -r1.1 -r1.2 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/X68k.man cvs rdiff -u -r1.4 -r1.5 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c cvs rdiff -u -r1.3 -r1.4 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c cvs rdiff -u -r1.5 -r1.6 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c cvs rdiff -u -r1.7 -r1.8 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c cvs rdiff -u -r1.2 -r1.3 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kIo.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKeyMap.c \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kReg.h cvs rdiff -u -r1.6 -r1.7 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.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: Sat Aug 1 19:19:06 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): start nesting level in ApplyModifier_Match at 0 There is no need to start at 1, and starting at 0 generates smaller code on x86_64. Reordering the --nest and the following break would increase the code size though, for unknown reasons. To generate a diff of this commit: cvs rdiff -u -r1.386 -r1.387 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.386 src/usr.bin/make/var.c:1.387 --- src/usr.bin/make/var.c:1.386 Sat Aug 1 18:36:49 2020 +++ src/usr.bin/make/var.c Sat Aug 1 19:19:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $ */ +/* $NetBSD: var.c,v 1.387 2020/08/01 19:19:05 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.387 2020/08/01 19:19:05 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.387 2020/08/01 19:19:05 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -2273,9 +2273,9 @@ ApplyModifier_Match(const char *mod, App * original brace level. * XXX This will likely not work right if $() and ${} are intermixed. */ -int nest = 1; +int nest = 0; const char *p; -for (p = mod + 1; *p != '\0' && !(*p == ':' && nest == 1); p++) { +for (p = mod + 1; *p != '\0' && !(*p == ':' && nest == 0); p++) { if (*p == '\\' && (p[1] == ':' || p[1] == st->endc || p[1] == st->startc)) { if (!needSubst) @@ -2289,7 +2289,7 @@ ApplyModifier_Match(const char *mod, App ++nest; if (*p == ')' || *p == '}') { --nest; - if (nest == 0) + if (nest < 0) break; } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 19:19:06 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): start nesting level in ApplyModifier_Match at 0 There is no need to start at 1, and starting at 0 generates smaller code on x86_64. Reordering the --nest and the following break would increase the code size though, for unknown reasons. To generate a diff of this commit: cvs rdiff -u -r1.386 -r1.387 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 18:59:17 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmatch.mk Log Message: make(1): add test for inconsistent interpretation of :M and :N modifiers To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/modmatch.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: Sat Aug 1 18:59:17 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmatch.mk Log Message: make(1): add test for inconsistent interpretation of :M and :N modifiers To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/modmatch.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/modmatch.mk diff -u src/usr.bin/make/unit-tests/modmatch.mk:1.6 src/usr.bin/make/unit-tests/modmatch.mk:1.7 --- src/usr.bin/make/unit-tests/modmatch.mk:1.6 Mon Jun 15 14:46:28 2020 +++ src/usr.bin/make/unit-tests/modmatch.mk Sat Aug 1 18:59:16 2020 @@ -1,3 +1,6 @@ +# $NetBSD: modmatch.mk,v 1.7 2020/08/01 18:59:16 rillig Exp $ +# +# Tests for the :M and :S modifiers. X=a b c d e @@ -37,3 +40,18 @@ check-cclass: # calling itself 601080390 times for 16 asterisks. slow: .PHONY @:;: ${:U:Mb:Q} + +# As of 2020-08-01, the :M and :N modifiers interpret backslashes differently, +# depending on whether there was a variable expression before the first +# backslash or not. This can be seen by setting the -dv debug flag, in the +# lines starting with "Pattern". +# +# Apart from the different and possibly confusing debug output, there is no +# difference in behavior. When parsing the modifier text, only \{, \} and \: +# are unescaped, and in the pattern matching these have the same meaning as +# their plain variants '{', '}' and ':'. In the pattern matching from +# Str_Match, only \*, \? or \[ would make a noticeable difference. +SPECIALS= \: : \\ * \* +.if ${SPECIALS:M${:U}\:} != ${SPECIALS:M\:${:U}} +.warning unexpected +.endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 18:36:49 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline and untangle the code for the :range modifier There's no need to keep the result from brk_string in memory until the buffer has been filled with the range. The only thing necessary from brk_string is the number of words. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.385 src/usr.bin/make/var.c:1.386 --- src/usr.bin/make/var.c:1.385 Sat Aug 1 18:14:08 2020 +++ src/usr.bin/make/var.c Sat Aug 1 18:36:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $ */ +/* $NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.386 2020/08/01 18:36:49 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1720,47 +1720,6 @@ VarUniq(const char *str) return Buf_Destroy(, FALSE); } -/*- - *--- - * VarRange -- - * Return an integer sequence - * - * Input: - * str String whose words provide default range - * ac range length, if 0 use str words - * - * Side Effects: - * None. - * - *--- - */ -static char * -VarRange(const char *str, int ac) -{ -Buffer buf; /* Buffer for new string */ -char **av; /* List of words to affect */ -char *as; /* Word list memory */ -int i; - -Buf_Init(, 0); -if (ac > 0) { - as = NULL; - av = NULL; -} else { - av = brk_string(str, , FALSE, ); -} -for (i = 0; i < ac; i++) { - if (i != 0) - Buf_AddByte(, ' '); - Buf_AddInt(, 1 + i); -} - -free(as); -free(av); - -return Buf_Destroy(, FALSE); -} - /*- * Parse a text part of a modifier such as the "from" and "to" in :S/from/to/ @@ -2264,7 +2223,8 @@ ApplyModifier_Exclam(const char *mod, Ap return AMR_OK; } -/* :range */ +/* The :range modifier generates an integer sequence as long as the words. + * The :range=7 modifier generates an integer sequence from 1 to 7. */ static ApplyModifierResult ApplyModifier_Range(const char *mod, ApplyModifiersState *st) { @@ -2280,7 +2240,25 @@ ApplyModifier_Range(const char *mod, App n = 0; st->next = mod + 5; } -st->newVal = VarRange(st->val, n); + +if (n == 0) { + char *as; + char **av = brk_string(st->val, , FALSE, ); + free(as); + free(av); +} + +Buffer buf; +Buf_Init(, 0); + +int i; +for (i = 0; i < n; i++) { + if (i != 0) + Buf_AddByte(, ' '); + Buf_AddInt(, 1 + i); +} + +st->newVal = Buf_Destroy(, FALSE); return AMR_OK; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 18:36:49 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline and untangle the code for the :range modifier There's no need to keep the result from brk_string in memory until the buffer has been filled with the range. The only thing necessary from brk_string is the number of words. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 18:14:09 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: Makefile modmisc.exp Log Message: make(1): fix error message when regcomp fails If regcomp fails, it's not the regex substitution that is erroneous, but the regex compilation. To generate a diff of this commit: cvs rdiff -u -r1.384 -r1.385 src/usr.bin/make/var.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/modmisc.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: Sat Aug 1 18:14:09 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: Makefile modmisc.exp Log Message: make(1): fix error message when regcomp fails If regcomp fails, it's not the regex substitution that is erroneous, but the regex compilation. To generate a diff of this commit: cvs rdiff -u -r1.384 -r1.385 src/usr.bin/make/var.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.34 -r1.35 src/usr.bin/make/unit-tests/modmisc.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/var.c diff -u src/usr.bin/make/var.c:1.384 src/usr.bin/make/var.c:1.385 --- src/usr.bin/make/var.c:1.384 Sat Aug 1 18:02:37 2020 +++ src/usr.bin/make/var.c Sat Aug 1 18:14:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $ */ +/* $NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.384 2020/08/01 18:02:37 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.385 2020/08/01 18:14:08 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -2476,7 +2476,7 @@ ApplyModifier_Regex(const char *mod, App int error = regcomp(, re, REG_EXTENDED); free(re); if (error) { - VarREError(error, , "RE substitution error"); + VarREError(error, , "Regex compilation error"); free(args.replace); return AMR_CLEANUP; } Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.79 src/usr.bin/make/unit-tests/Makefile:1.80 --- src/usr.bin/make/unit-tests/Makefile:1.79 Sat Aug 1 15:28:28 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Aug 1 18:14:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.79 2020/08/01 15:28:28 rillig Exp $ +# $NetBSD: Makefile,v 1.80 2020/08/01 18:14:08 rillig Exp $ # # Unit tests for make(1) # @@ -98,8 +98,8 @@ FLAGS.order= -j1 FLAGS.vardebug= -k -dv FROM_CMDLINE= # Some tests need extra post-processing. -SED_CMDS.moderrs+= -e 's,\(substitution error:\).*,\1 (details omitted),' -SED_CMDS.modmisc+= -e 's,\(substitution error:\).*,\1 (details omitted),' +SED_CMDS.moderrs+= -e 's,\(Regex compilation error:\).*,\1 (details omitted),' +SED_CMDS.modmisc+= -e 's,\(Regex compilation error:\).*,\1 (details omitted),' SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,' SED_CMDS.varshell+= -e 's,^[a-z]*sh: ,,' SED_CMDS.varshell+= -e '/command/s,No such.*,not found,' Index: src/usr.bin/make/unit-tests/modmisc.exp diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.34 src/usr.bin/make/unit-tests/modmisc.exp:1.35 --- src/usr.bin/make/unit-tests/modmisc.exp:1.34 Sat Aug 1 17:20:42 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Sat Aug 1 18:14:08 2020 @@ -31,7 +31,7 @@ mod-regex: :a b b c: :a b b c: : b c: -make: RE substitution error: (details omitted) +make: Regex compilation error: (details omitted) :C,word,,:Q}: :a c: :x__ 3 x__ 3: @@ -75,7 +75,7 @@ make: No subexpression \2 mod-regex-limits:22-missing:1 6 mod-regex-limits:22-ok:1 33 556 mod-regex-limits:capture:ihgfedcbaabcdefghijABCDEFGHIJa0a1a2rest -make: RE substitution error: (details omitted) +make: Regex compilation error: (details omitted) mod-regex-errors: mod-assign: first=1. mod-assign: last=3.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 18:02:37 UTC 2020 Modified Files: src/usr.bin/make: cond.c make.h nonints.h var.c Log Message: make(1): use enum for return values of Cond_Eval and friends To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/usr.bin/make/cond.c cvs rdiff -u -r1.112 -r1.113 src/usr.bin/make/make.h cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/nonints.h cvs rdiff -u -r1.383 -r1.384 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.85 src/usr.bin/make/cond.c:1.86 --- src/usr.bin/make/cond.c:1.85 Sat Aug 1 14:47:49 2020 +++ src/usr.bin/make/cond.c Sat Aug 1 18:02:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.85 2020/08/01 14:47:49 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.86 2020/08/01 18:02:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.85 2020/08/01 14:47:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.86 2020/08/01 18:02:37 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.85 2020/08/01 14:47:49 rillig Exp $"); +__RCSID("$NetBSD: cond.c,v 1.86 2020/08/01 18:02:37 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -158,7 +158,7 @@ static Token CondToken(Boolean); static Token CondT(Boolean); static Token CondF(Boolean); static Token CondE(Boolean); -static int do_Cond_EvalExpression(Boolean *); +static CondEvalResult do_Cond_EvalExpression(Boolean *); static const struct If { const char *form; /* Form of if */ @@ -1147,7 +1147,7 @@ CondE(Boolean doEval) * *--- */ -int +CondEvalResult Cond_EvalExpression(const struct If *info, char *line, Boolean *value, int eprint, Boolean strictLHS) { static const struct If *dflt_info; @@ -1186,7 +1186,7 @@ Cond_EvalExpression(const struct If *inf return rval; } -static int +static CondEvalResult do_Cond_EvalExpression(Boolean *value) { @@ -1231,16 +1231,12 @@ do_Cond_EvalExpression(Boolean *value) * COND_SKIP if should skip lines after the conditional * COND_INVALID if not a valid conditional. * - * Side Effects: - * None. - * * Note that the states IF_ACTIVE and ELSE_ACTIVE are only different in order - * to detect splurious .else lines (as are SKIP_TO_ELSE and SKIP_TO_ENDIF) + * to detect spurious .else lines (as are SKIP_TO_ELSE and SKIP_TO_ENDIF), * otherwise .else could be treated as '.elif 1'. - * *--- */ -int +CondEvalResult Cond_Eval(char *line) { #define MAXIF 128 /* maximum depth of .if'ing */ Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.112 src/usr.bin/make/make.h:1.113 --- src/usr.bin/make/make.h:1.112 Fri Jul 31 20:22:10 2020 +++ src/usr.bin/make/make.h Sat Aug 1 18:02:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.112 2020/07/31 20:22:10 sjg Exp $ */ +/* $NetBSD: make.h,v 1.113 2020/08/01 18:02:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -337,9 +337,11 @@ typedef struct GNode { /* * Values returned by Cond_Eval. */ -#define COND_PARSE 0 /* Parse the next lines */ -#define COND_SKIP 1 /* Skip the next lines */ -#define COND_INVALID 2 /* Not a conditional statement */ +typedef enum { +COND_PARSE, /* Parse the next lines */ +COND_SKIP, /* Skip the next lines */ +COND_INVALID /* Not a conditional statement */ +} CondEvalResult; /* * Definitions for the "local" variables. Used only for clarity. Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.88 src/usr.bin/make/nonints.h:1.89 --- src/usr.bin/make/nonints.h:1.88 Sat Aug 1 09:25:36 2020 +++ src/usr.bin/make/nonints.h Sat Aug 1 18:02:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.88 2020/08/01 09:25:36 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.89 2020/08/01 18:02:37 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -91,8 +91,8 @@ int Compat_Make(void *, void *); /* cond.c */ struct If; -int Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean); -int Cond_Eval(char *); +CondEvalResult Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean); +CondEvalResult Cond_Eval(char *); void Cond_restore_depth(unsigned int); unsigned int Cond_save_depth(void); Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.383 src/usr.bin/make/var.c:1.384 --- src/usr.bin/make/var.c:1.383 Sat Aug 1 17:29:00 2020 +++ src/usr.bin/make/var.c Sat Aug 1 18:02:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.383 2020/08/01 17:29:00 rillig Exp $ */ +/*
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 18:02:37 UTC 2020 Modified Files: src/usr.bin/make: cond.c make.h nonints.h var.c Log Message: make(1): use enum for return values of Cond_Eval and friends To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/usr.bin/make/cond.c cvs rdiff -u -r1.112 -r1.113 src/usr.bin/make/make.h cvs rdiff -u -r1.88 -r1.89 src/usr.bin/make/nonints.h cvs rdiff -u -r1.383 -r1.384 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Sat Aug 1 17:56:56 UTC 2020 Modified Files: src/bin/sh: expand.c Log Message: Remove a redundant set of parentheses that were added (along with a extra && or || or something ... forgotten now) as part a failed attempt to fix an earlier bug (later fixed a better way) - when the extra test (never committed) was removed, the now-redundant parentheses got forgotten... NFC. To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/bin/sh/expand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/expand.c diff -u src/bin/sh/expand.c:1.137 src/bin/sh/expand.c:1.138 --- src/bin/sh/expand.c:1.137 Thu Feb 13 05:19:05 2020 +++ src/bin/sh/expand.c Sat Aug 1 17:56:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: expand.c,v 1.137 2020/02/13 05:19:05 kre Exp $ */ +/* $NetBSD: expand.c,v 1.138 2020/08/01 17:56:56 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #else -__RCSID("$NetBSD: expand.c,v 1.137 2020/02/13 05:19:05 kre Exp $"); +__RCSID("$NetBSD: expand.c,v 1.138 2020/08/01 17:56:56 kre Exp $"); #endif #endif /* not lint */ @@ -309,7 +309,7 @@ argstr(const char *p, int flag) had_dol_at = 0; break; case CTLESC: - if ((quotes || ISCTL(*p))) + if (quotes || ISCTL(*p)) STPUTC(c, expdest); c = *p++; STPUTC(c, expdest);
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Sat Aug 1 17:56:56 UTC 2020 Modified Files: src/bin/sh: expand.c Log Message: Remove a redundant set of parentheses that were added (along with a extra && or || or something ... forgotten now) as part a failed attempt to fix an earlier bug (later fixed a better way) - when the extra test (never committed) was removed, the now-redundant parentheses got forgotten... NFC. To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/bin/sh/expand.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/w
Module Name:src Committed By: kim Date: Sat Aug 1 17:53:38 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Skip bracket processing if -n is used. XXX: This could be improved to skip even more processing. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/usr.bin/w/w.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/w
Module Name:src Committed By: kim Date: Sat Aug 1 17:53:38 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Skip bracket processing if -n is used. XXX: This could be improved to skip even more processing. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/usr.bin/w/w.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/w/w.c diff -u src/usr.bin/w/w.c:1.89 src/usr.bin/w/w.c:1.90 --- src/usr.bin/w/w.c:1.89 Sat Aug 1 17:25:57 2020 +++ src/usr.bin/w/w.c Sat Aug 1 17:53:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: w.c,v 1.89 2020/08/01 17:25:57 kim Exp $ */ +/* $NetBSD: w.c,v 1.90 2020/08/01 17:53:38 kim Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94"; #else -__RCSID("$NetBSD: w.c,v 1.89 2020/08/01 17:25:57 kim Exp $"); +__RCSID("$NetBSD: w.c,v 1.90 2020/08/01 17:53:38 kim Exp $"); #endif #endif /* not lint */ @@ -654,7 +654,7 @@ fixhost(struct entry *ep) * Leading '[' indicates an IP address inside brackets. */ b = NULL; - if (*p == '[') { + if (!nflag && (*p == '[')) { for (b = p++; b < _buf[sizeof(host_buf)]; b++) if (*b == '\0' || *b == ']') break;
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Sat Aug 1 17:51:18 UTC 2020 Modified Files: src/bin/sh: exec.c Log Message: PR bin/55526 Fix a bug that has existed since the "command" command was added in 2003. "command foo" would cause the definition of a function "foo" to be lost (not freed, simply discarded) if "foo" is (in addition to being a function) a filesystem command. The case where "foo" is a builtin was handled. For now, when a function exists with the same name as a filesystem command, the latter can never appear in the command hash table, and when used (which can only be via "command foo", just "foo" finds the function) will always result in a full PATH search. XXX pullup everything (from NetBSD 2.0 onwards). (really -8 and -9) To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/bin/sh/exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/exec.c diff -u src/bin/sh/exec.c:1.53 src/bin/sh/exec.c:1.54 --- src/bin/sh/exec.c:1.53 Wed Jul 25 14:42:50 2018 +++ src/bin/sh/exec.c Sat Aug 1 17:51:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.53 2018/07/25 14:42:50 kre Exp $ */ +/* $NetBSD: exec.c,v 1.54 2020/08/01 17:51:18 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: exec.c,v 1.53 2018/07/25 14:42:50 kre Exp $"); +__RCSID("$NetBSD: exec.c,v 1.54 2020/08/01 17:51:18 kre Exp $"); #endif #endif /* not lint */ @@ -667,6 +667,10 @@ loop: cmdp = _cmd; } else cmdp = cmdlookup(name, 1); + + if (cmdp->cmdtype == CMDFUNCTION) + cmdp = _cmd; + cmdp->cmdtype = CMDNORMAL; cmdp->param.index = idx; INTON;
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Sat Aug 1 17:51:18 UTC 2020 Modified Files: src/bin/sh: exec.c Log Message: PR bin/55526 Fix a bug that has existed since the "command" command was added in 2003. "command foo" would cause the definition of a function "foo" to be lost (not freed, simply discarded) if "foo" is (in addition to being a function) a filesystem command. The case where "foo" is a builtin was handled. For now, when a function exists with the same name as a filesystem command, the latter can never appear in the command hash table, and when used (which can only be via "command foo", just "foo" finds the function) will always result in a full PATH search. XXX pullup everything (from NetBSD 2.0 onwards). (really -8 and -9) To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/bin/sh/exec.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: Sat Aug 1 17:45:32 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): fix parameter name in Cmd_Exec A format string is not a number. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.292 src/usr.bin/make/main.c:1.293 --- src/usr.bin/make/main.c:1.292 Sat Aug 1 14:52:14 2020 +++ src/usr.bin/make/main.c Sat Aug 1 17:45:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $ */ +/* $NetBSD: main.c,v 1.293 2020/08/01 17:45:32 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.293 2020/08/01 17:45:32 rillig Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.293 2020/08/01 17:45:32 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1581,14 +1581,15 @@ found: * in a string. * * Results: - * A string containing the output of the command, or the empty string - * If errnum is not NULL, it contains the reason for the command failure + * A string containing the output of the command, or the empty string. + * *errfmt returns a format string describing the command failure, + * if any, using a single %s conversion specification. * * Side Effects: * The string must be freed by the caller. */ char * -Cmd_Exec(const char *cmd, const char **errnum) +Cmd_Exec(const char *cmd, const char **errfmt) { const char *args[4]; /* Args for invoking the shell */ int fds[2]; /* Pipe streams */ @@ -1602,7 +1603,7 @@ Cmd_Exec(const char *cmd, const char **e int savederr; /* saved errno */ -*errnum = NULL; +*errfmt = NULL; if (!shellName) Shell_Init(); @@ -1618,7 +1619,7 @@ Cmd_Exec(const char *cmd, const char **e * Open a pipe for fetching its output */ if (pipe(fds) == -1) { - *errnum = "Couldn't create pipe for \"%s\""; + *errfmt = "Couldn't create pipe for \"%s\""; goto bad; } @@ -1647,7 +1648,7 @@ Cmd_Exec(const char *cmd, const char **e /*NOTREACHED*/ case -1: - *errnum = "Couldn't exec \"%s\""; + *errfmt = "Couldn't exec \"%s\""; goto bad; default: @@ -1685,12 +1686,12 @@ Cmd_Exec(const char *cmd, const char **e res = Buf_Destroy(, FALSE); if (savederr != 0) - *errnum = "Couldn't read shell's output for \"%s\""; + *errfmt = "Couldn't read shell's output for \"%s\""; if (WIFSIGNALED(status)) - *errnum = "\"%s\" exited on a signal"; + *errfmt = "\"%s\" exited on a signal"; else if (WEXITSTATUS(status) != 0) - *errnum = "\"%s\" returned non-zero status"; + *errfmt = "\"%s\" returned non-zero status"; /* * Null-terminate the result, convert newlines to spaces and @@ -1715,9 +1716,7 @@ Cmd_Exec(const char *cmd, const char **e } return res; bad: -res = bmake_malloc(1); -*res = '\0'; -return res; +return bmake_strdup(""); } /*-
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 17:45:32 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): fix parameter name in Cmd_Exec A format string is not a number. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/script
Module Name:src Committed By: christos Date: Sat Aug 1 17:31:06 UTC 2020 Modified Files: src/usr.bin/script: script.c Log Message: PR/55529: Soumendra Ganguly: configure the terminal in raw mode during playback so that output postprocessing is not done and playback of programs using curses does not appear corrupted. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/script/script.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/script/script.c diff -u src/usr.bin/script/script.c:1.21 src/usr.bin/script/script.c:1.22 --- src/usr.bin/script/script.c:1.21 Tue Sep 6 14:29:56 2011 +++ src/usr.bin/script/script.c Sat Aug 1 13:31:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: script.c,v 1.21 2011/09/06 18:29:56 joerg Exp $ */ +/* $NetBSD: script.c,v 1.22 2020/08/01 17:31:06 christos Exp $ */ /* * Copyright (c) 1980, 1992, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: script.c,v 1.21 2011/09/06 18:29:56 joerg Exp $"); +__RCSID("$NetBSD: script.c,v 1.22 2020/08/01 17:31:06 christos Exp $"); #endif /* not lint */ #include @@ -81,6 +81,7 @@ static int usesleep, rawout; static int quiet, flush; static const char *fname; +static int isterm; static struct termios tt; __dead static void done(void); @@ -356,6 +357,34 @@ consume(FILE *fp, off_t len, char *buf, } while (0/*CONSTCOND*/) static void +termset(void) +{ + struct termios traw; + + isterm = isatty(STDOUT_FILENO); + if (!isterm) + return; + + if (tcgetattr(STDOUT_FILENO, ) != 0) + err(1, "tcgetattr"); + + traw = tt; + cfmakeraw(); + traw.c_lflag |= ISIG; + if (tcsetattr(STDOUT_FILENO, TCSANOW, ) != 0) + err(1, "tcsetattr"); +} + +static void +termreset(void) +{ + if (isterm) + tcsetattr(STDOUT_FILENO, TCSADRAIN, ); + + isterm = 0; +} + +static void playback(FILE *fp) { struct timespec tsi, tso; @@ -398,6 +427,8 @@ playback(FILE *fp) ctime()); tsi = tso; (void)consume(fp, stamp.scr_len, buf, reg); + termset(); + atexit(termreset); break; case 'e': if (!quiet)
CVS commit: src/usr.bin/script
Module Name:src Committed By: christos Date: Sat Aug 1 17:31:06 UTC 2020 Modified Files: src/usr.bin/script: script.c Log Message: PR/55529: Soumendra Ganguly: configure the terminal in raw mode during playback so that output postprocessing is not done and playback of programs using curses does not appear corrupted. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/script/script.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: Sat Aug 1 17:29:00 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): fix documentation, use safer fallback value The variable res is overwritten in every case, but better be safe than sorry. In case of programming errors it's better to issue an error message than to continue. To generate a diff of this commit: cvs rdiff -u -r1.382 -r1.383 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 17:29:00 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): fix documentation, use safer fallback value The variable res is overwritten in every case, but better be safe than sorry. In case of programming errors it's better to issue an error message than to continue. To generate a diff of this commit: cvs rdiff -u -r1.382 -r1.383 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.382 src/usr.bin/make/var.c:1.383 --- src/usr.bin/make/var.c:1.382 Sat Aug 1 16:27:03 2020 +++ src/usr.bin/make/var.c Sat Aug 1 17:29:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $ */ +/* $NetBSD: var.c,v 1.383 2020/08/01 17:29:00 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.383 2020/08/01 17:29:00 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.383 2020/08/01 17:29:00 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -3008,14 +3008,14 @@ ApplyModifier_SysV(const char *mod, Appl * * :?: * If the variable evaluates to true, return - * true value, else return the second value. - * :lhs=rhs Like :S, but the rhs goes to the end of - * the invocation. + * true-value, else return false-value. + * :lhs=rhs Similar to :S, but the rhs goes to the end of + * the invocation, including any ':'. * :sh Treat the current value as a command * to be run, new value is its output. * The following added so we can handle ODE makefiles. * :@@@ - * Assign a temporary local variable + * Assign a temporary global variable * to the current value of each word in turn * and replace each word with the result of * evaluating @@ -3028,7 +3028,7 @@ ApplyModifier_SysV(const char *mod, Appl * the common method of refering to the path * of your dependent 'x' in a rule is to use * the form '${x:P}'. - * :!! Run cmd much the same as :sh run's the + * :!! Run cmd much the same as :sh runs the * current value of the variable. * Assignment operators (see ApplyModifier_Assign). */ @@ -3110,7 +3110,7 @@ ApplyModifiers( } st.newVal = var_Error; /* default value, in case of errors */ st.next = NULL; /* fail fast if an ApplyModifier forgets to set this */ - ApplyModifierResult res = 0; + ApplyModifierResult res = AMR_BAD; /* just a safe fallback */ char modifier = *p; switch (modifier) { case ':':
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 17:26:41 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmisc.mk Log Message: make(1): add test for empty indirect modifier To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/modmisc.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/modmisc.mk diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.31 src/usr.bin/make/unit-tests/modmisc.mk:1.32 --- src/usr.bin/make/unit-tests/modmisc.mk:1.31 Sat Aug 1 17:20:42 2020 +++ src/usr.bin/make/unit-tests/modmisc.mk Sat Aug 1 17:26:41 2020 @@ -1,4 +1,4 @@ -# $Id: modmisc.mk,v 1.31 2020/08/01 17:20:42 rillig Exp $ +# $Id: modmisc.mk,v 1.32 2020/08/01 17:26:41 rillig Exp $ # # miscellaneous modifier tests @@ -313,3 +313,12 @@ mod-range: .if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE" .warning unexpected .endif + +# An indirect variable that evaluates to the empty string is allowed though. +# This makes it possible to define conditional modifiers, like this: +# +# M.little-endian= S,1234,4321, +# M.big-endian= # none +.if ${value:L:${:Dempty}S,a,A,} != "vAlue" +.warning unexpected +.endif
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 17:26:41 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmisc.mk Log Message: make(1): add test for empty indirect modifier To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/unit-tests/modmisc.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/w
Module Name:src Committed By: kim Date: Sat Aug 1 17:25:57 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Restore ']' if not using a result from an address lookup. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/usr.bin/w/w.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/w/w.c diff -u src/usr.bin/w/w.c:1.88 src/usr.bin/w/w.c:1.89 --- src/usr.bin/w/w.c:1.88 Sat Aug 1 15:52:50 2020 +++ src/usr.bin/w/w.c Sat Aug 1 17:25:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: w.c,v 1.88 2020/08/01 15:52:50 kim Exp $ */ +/* $NetBSD: w.c,v 1.89 2020/08/01 17:25:57 kim Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94"; #else -__RCSID("$NetBSD: w.c,v 1.88 2020/08/01 15:52:50 kim Exp $"); +__RCSID("$NetBSD: w.c,v 1.89 2020/08/01 17:25:57 kim Exp $"); #endif #endif /* not lint */ @@ -621,7 +621,7 @@ static void fixhost(struct entry *ep) { char host_buf[sizeof(ep->host)]; - char *p, *r, *x, *m; + char *b, *m, *p, *r, *x; struct hostent *hp; union { struct in_addr l4; @@ -653,19 +653,20 @@ fixhost(struct entry *ep) /* * Leading '[' indicates an IP address inside brackets. */ + b = NULL; if (*p == '[') { - for (p++; p < _buf[sizeof(host_buf)]; p++) - if (*p == '\0' || *p == ']') + for (b = p++; b < _buf[sizeof(host_buf)]; b++) + if (*b == '\0' || *b == ']') break; - if (p < _buf[sizeof(host_buf)] && *p == ']') { - *p = '\0'; - for (x = ++p; x < _buf[sizeof(host_buf)]; x++) + if (b < _buf[sizeof(host_buf)] && *b == ']') { + *b = '\0'; + for (x = b + 1; x < _buf[sizeof(host_buf)]; x++) if (*x == '\0' || *x == ':') break; if (x < _buf[sizeof(host_buf)] && *x == ':') *x++ = '\0'; - } - p = host_buf + 1; + } else + b = NULL; } int af = m ? AF_INET6 : AF_INET; @@ -673,8 +674,11 @@ fixhost(struct entry *ep) if (!nflag && inet_pton(af, p, ) && (hp = gethostbyaddr((char *), alen, af))) r = hp->h_name; - else + else { + if (b) + *b = ']'; r = host_buf; + } if (domain[0] != '\0') { p = r;
CVS commit: src/usr.bin/w
Module Name:src Committed By: kim Date: Sat Aug 1 17:25:57 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Restore ']' if not using a result from an address lookup. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/usr.bin/w/w.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: Sat Aug 1 17:20:42 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk Log Message: make(1): add tests for indirect modifiers To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/modmisc.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/modmisc.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/modmisc.exp diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.33 src/usr.bin/make/unit-tests/modmisc.exp:1.34 --- src/usr.bin/make/unit-tests/modmisc.exp:1.33 Fri Jul 31 14:36:58 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Sat Aug 1 17:20:42 2020 @@ -1,3 +1,4 @@ +make: Unknown modifier '$' path=':/bin:/tmp::/:.:/no/such/dir:.' path='/bin:/tmp:/:/no/such/dir' path='/bin:/tmp:/:/no/such/dir' Index: src/usr.bin/make/unit-tests/modmisc.mk diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.30 src/usr.bin/make/unit-tests/modmisc.mk:1.31 --- src/usr.bin/make/unit-tests/modmisc.mk:1.30 Fri Jul 31 14:36:58 2020 +++ src/usr.bin/make/unit-tests/modmisc.mk Sat Aug 1 17:20:42 2020 @@ -1,4 +1,4 @@ -# $Id: modmisc.mk,v 1.30 2020/07/31 14:36:58 rillig Exp $ +# $Id: modmisc.mk,v 1.31 2020/08/01 17:20:42 rillig Exp $ # # miscellaneous modifier tests @@ -296,3 +296,20 @@ mod-range: @echo ${a b c:L:range} # ok @echo ${a b c:L:rango} # misspelled @echo ${a b c:L:ranger} # modifier name too long + +# To apply a modifier indirectly via another variable, the whole +# modifier must be put into a single variable. +.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}" +.warning unexpected +.endif + +# Adding another level of indirection (the 2 nested :U expressions) helps. +.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement" +.warning unexpected +.endif + +# Multiple indirect modifiers can be applied one after another as long as +# they are separated with colons. +.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE" +.warning unexpected +.endif
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 17:20:42 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk Log Message: make(1): add tests for indirect modifiers To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/modmisc.exp cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/modmisc.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: Sat Aug 1 16:27:03 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): make ModifyWords simpler There is no need to test whether an actual word has been added. The rule is simply "add a space before every word, except for the very first". To generate a diff of this commit: cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.381 src/usr.bin/make/var.c:1.382 --- src/usr.bin/make/var.c:1.381 Sat Aug 1 15:03:43 2020 +++ src/usr.bin/make/var.c Sat Aug 1 16:27:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $ */ +/* $NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.382 2020/08/01 16:27:03 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1597,10 +1597,8 @@ ModifyWords(GNode *ctx, Byte sep, Boolea } for (i = 0; i < ac; i++) { - size_t orig_count = result.buf.count; modifyWord(av[i], , data); - size_t count = result.buf.count; - if (count != orig_count) + if (result.buf.count > 0) SepBuf_Sep(); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 16:27:03 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): make ModifyWords simpler There is no need to test whether an actual word has been added. The rule is simply "add a space before every word, except for the very first". To generate a diff of this commit: cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/w
Module Name:src Committed By: kim Date: Sat Aug 1 15:52:50 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Handle hostname from DISPLAY="[2001:db8::dead:beef]:0" or similar. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/usr.bin/w/w.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/w/w.c diff -u src/usr.bin/w/w.c:1.87 src/usr.bin/w/w.c:1.88 --- src/usr.bin/w/w.c:1.87 Sat Jul 4 23:30:31 2020 +++ src/usr.bin/w/w.c Sat Aug 1 15:52:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: w.c,v 1.87 2020/07/04 23:30:31 kim Exp $ */ +/* $NetBSD: w.c,v 1.88 2020/08/01 15:52:50 kim Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94"; #else -__RCSID("$NetBSD: w.c,v 1.87 2020/07/04 23:30:31 kim Exp $"); +__RCSID("$NetBSD: w.c,v 1.88 2020/08/01 15:52:50 kim Exp $"); #endif #endif /* not lint */ @@ -650,6 +650,24 @@ fixhost(struct entry *ep) x = NULL; } + /* + * Leading '[' indicates an IP address inside brackets. + */ + if (*p == '[') { + for (p++; p < _buf[sizeof(host_buf)]; p++) + if (*p == '\0' || *p == ']') +break; + if (p < _buf[sizeof(host_buf)] && *p == ']') { + *p = '\0'; + for (x = ++p; x < _buf[sizeof(host_buf)]; x++) +if (*x == '\0' || *x == ':') + break; + if (x < _buf[sizeof(host_buf)] && *x == ':') +*x++ = '\0'; + } + p = host_buf + 1; + } + int af = m ? AF_INET6 : AF_INET; size_t alen = m ? sizeof(l.l6) : sizeof(l.l4); if (!nflag && inet_pton(af, p, ) &&
CVS commit: src/usr.bin/w
Module Name:src Committed By: kim Date: Sat Aug 1 15:52:50 UTC 2020 Modified Files: src/usr.bin/w: w.c Log Message: Handle hostname from DISPLAY="[2001:db8::dead:beef]:0" or similar. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/usr.bin/w/w.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: Sat Aug 1 15:28:28 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile varmod-edge.exp varmod-edge.mk Log Message: make(1): improve output grouping in varmod-edge test The generated error messages are now closer to the test cases that produce them. To keep the expected output stable, the line numbers are omitted from the .info directives. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-edge.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: Sat Aug 1 15:28:28 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile varmod-edge.exp varmod-edge.mk Log Message: make(1): improve output grouping in varmod-edge test The generated error messages are now closer to the test cases that produce them. To keep the expected output stable, the line numbers are omitted from the .info directives. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-edge.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/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.78 src/usr.bin/make/unit-tests/Makefile:1.79 --- src/usr.bin/make/unit-tests/Makefile:1.78 Fri Jul 31 22:07:28 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Aug 1 15:28:28 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.78 2020/07/31 22:07:28 rillig Exp $ +# $NetBSD: Makefile,v 1.79 2020/08/01 15:28:28 rillig Exp $ # # Unit tests for make(1) # @@ -100,6 +100,7 @@ FLAGS.vardebug= -k -dv FROM_CMDLINE= # Some tests need extra post-processing. SED_CMDS.moderrs+= -e 's,\(substitution error:\).*,\1 (details omitted),' SED_CMDS.modmisc+= -e 's,\(substitution error:\).*,\1 (details omitted),' +SED_CMDS.varmod-edge+= -e 's, line [0-9]*:, line omitted:,' SED_CMDS.varshell+= -e 's,^[a-z]*sh: ,,' SED_CMDS.varshell+= -e '/command/s,No such.*,not found,' Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.6 src/usr.bin/make/unit-tests/varmod-edge.exp:1.7 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.6 Sat Aug 1 15:16:15 2020 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Aug 1 15:28:28 2020 @@ -1,21 +1,22 @@ +make: "varmod-edge.mk" line omitted: ok M-paren +make: "varmod-edge.mk" line omitted: ok M-mixed +make: "varmod-edge.mk" line omitted: ok M-unescape make: Unclosed variable specification (expecting '}') for "" (value "*)") modifier U +make: "varmod-edge.mk" line omitted: ok M-nest-mix +make: "varmod-edge.mk" line omitted: ok M-nest-brk +make: "varmod-edge.mk" line omitted: ok M-pat-err +make: "varmod-edge.mk" line omitted: ok M-bsbs +make: "varmod-edge.mk" line omitted: ok M-bs1-par +make: "varmod-edge.mk" line omitted: ok M-bs2-par +make: "varmod-edge.mk" line omitted: ok M-128 +make: "varmod-edge.mk" line omitted: ok eq-ext +make: "varmod-edge.mk" line omitted: ok eq-q +make: "varmod-edge.mk" line omitted: ok eq-bs make: Unclosed substitution for INP.eq-esc (= missing) +make: "varmod-edge.mk" line omitted: ok eq-esc +make: "varmod-edge.mk" line omitted: ok colon make: Unknown modifier ':' make: Unknown modifier ':' -ok M-paren -ok M-mixed -ok M-unescape -ok M-nest-mix -ok M-nest-brk -ok M-pat-err -ok M-bsbs -ok M-bs1-par -ok M-bs2-par -ok M-128 -ok eq-ext -ok eq-q -ok eq-bs -ok eq-esc -ok colon -ok colons +make: "varmod-edge.mk" line omitted: ok colons +ok exit status 0 Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.10 src/usr.bin/make/unit-tests/varmod-edge.mk:1.11 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.10 Sat Aug 1 15:16:15 2020 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Aug 1 15:28:28 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.10 2020/08/01 15:16:15 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.11 2020/08/01 15:28:28 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -161,12 +161,13 @@ INP.colons= value MOD.colons= ${INP.colons} EXP.colons= # empty -all: .for test in ${TESTS} . if ${MOD.${test}} == ${EXP.${test}} - @printf 'ok %s\n' ${test:Q}'' +.info ok ${test} . else - @printf 'error in %s: expected %s, got %s\n' \ - ${test:Q}'' ${EXP.${test}:Q}'' ${MOD.${test}:Q}'' +.warning error in ${test}: expected "${EXP.${test}}", got "${MOD.${test}}" . endif .endfor + +all: + @echo ok
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 15:16:15 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make(1): add test for ${VAR} It's a bit unrealistic, but at least there are good diagnostics. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-edge.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/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.5 src/usr.bin/make/unit-tests/varmod-edge.exp:1.6 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.5 Sat Aug 1 15:13:45 2020 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Aug 1 15:16:15 2020 @@ -1,5 +1,7 @@ make: Unclosed variable specification (expecting '}') for "" (value "*)") modifier U make: Unclosed substitution for INP.eq-esc (= missing) +make: Unknown modifier ':' +make: Unknown modifier ':' ok M-paren ok M-mixed ok M-unescape @@ -15,4 +17,5 @@ ok eq-q ok eq-bs ok eq-esc ok colon +ok colons exit status 0 Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.9 src/usr.bin/make/unit-tests/varmod-edge.mk:1.10 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.9 Sat Aug 1 15:13:45 2020 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Aug 1 15:16:15 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.9 2020/08/01 15:13:45 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.10 2020/08/01 15:16:15 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -156,6 +156,11 @@ INP.colon= value MOD.colon= ${INP.colon:} EXP.colon= value +TESTS+= colons +INP.colons= value +MOD.colons= ${INP.colons} +EXP.colons= # empty + all: .for test in ${TESTS} . if ${MOD.${test}} == ${EXP.${test}}
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 15:16:15 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make(1): add test for ${VAR} It's a bit unrealistic, but at least there are good diagnostics. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-edge.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: Sat Aug 1 15:13:45 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make(1): add test for empty modifier list after colon This is a good candidate for becoming an error in strict mode. Either write ${VAR} or write ${VAR:modifiers}, but not half-baked. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-edge.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/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.4 src/usr.bin/make/unit-tests/varmod-edge.exp:1.5 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.4 Mon Dec 2 01:01:08 2019 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Aug 1 15:13:45 2020 @@ -14,4 +14,5 @@ ok eq-ext ok eq-q ok eq-bs ok eq-esc +ok colon exit status 0 Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.8 src/usr.bin/make/unit-tests/varmod-edge.mk:1.9 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.8 Sun Jul 19 16:08:24 2020 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Aug 1 15:13:45 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.8 2020/07/19 16:08:24 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.9 2020/08/01 15:13:45 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -151,6 +151,11 @@ MOD.eq-esc= ${INP.eq-esc:a\=b} EXP.eq-esc= # empty # make: Unclosed substitution for INP.eq-esc (= missing) +TESTS+= colon +INP.colon= value +MOD.colon= ${INP.colon:} +EXP.colon= value + all: .for test in ${TESTS} . if ${MOD.${test}} == ${EXP.${test}}
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 15:13:45 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: make(1): add test for empty modifier list after colon This is a good candidate for becoming an error in strict mode. Either write ${VAR} or write ${VAR:modifiers}, but not half-baked. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-edge.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: Sat Aug 1 15:03:43 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline literal dollar characters This reduces the code size when compiling with GCC 5. Apparently GCC wasn't sure enough that str[0] and str[1] stay the same around the call to Buf_AddByte. To generate a diff of this commit: cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.380 src/usr.bin/make/var.c:1.381 --- src/usr.bin/make/var.c:1.380 Sat Aug 1 14:47:49 2020 +++ src/usr.bin/make/var.c Sat Aug 1 15:03:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.380 2020/08/01 14:47:49 rillig Exp $ */ +/* $NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.380 2020/08/01 14:47:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.380 2020/08/01 14:47:49 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.381 2020/08/01 15:03:43 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -3420,7 +3420,7 @@ Var_Parse(const char * const str, GNode if (v == NULL) { *lengthPtr = 2; - if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) { + if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL) { /* * If substituting a local variable in a non-local context, * assume it's for dynamic source stuff. We have to handle @@ -3689,17 +3689,16 @@ Var_Subst(const char *str, GNode *ctxt, while (*str) { if (*str == '\n' && trailingBslash) Buf_AddByte(, ' '); - if ((*str == '$') && (str[1] == '$')) { + if (*str == '$' && str[1] == '$') { /* - * A dollar sign may be escaped either with another dollar sign. + * A dollar sign may be escaped with another dollar sign. * In such a case, we skip over the escape character and store the * dollar sign into the buffer directly. */ if (save_dollars && (eflags & VARE_ASSIGN)) - Buf_AddByte(, *str); - str++; - Buf_AddByte(, *str); - str++; + Buf_AddByte(, '$'); + Buf_AddByte(, '$'); + str += 2; } else if (*str != '$') { /* * Skip as many characters as possible -- either to the end of
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 15:03:43 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline literal dollar characters This reduces the code size when compiling with GCC 5. Apparently GCC wasn't sure enough that str[0] and str[1] stay the same around the call to Buf_AddByte. To generate a diff of this commit: cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 14:52:14 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): use ordinary string concatenation in usage text To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.291 src/usr.bin/make/main.c:1.292 --- src/usr.bin/make/main.c:1.291 Sat Aug 1 14:47:49 2020 +++ src/usr.bin/make/main.c Sat Aug 1 14:52:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.291 2020/08/01 14:47:49 rillig Exp $ */ +/* $NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.291 2020/08/01 14:47:49 rillig Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.291 2020/08/01 14:47:49 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.292 2020/08/01 14:52:14 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1921,13 +1921,13 @@ usage(void) { char *p; if ((p = strchr(progname, '[')) != NULL) - *p = '\0'; + *p = '\0'; (void)fprintf(stderr, -"usage: %s [-BeikNnqrstWwX] \n\ -[-C directory] [-D variable] [-d flags] [-f makefile]\n\ -[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n\ -[-V variable] [-v variable] [variable=value] [target ...]\n", +"usage: %s [-BeikNnqrstWwX] \n" +"[-C directory] [-D variable] [-d flags] [-f makefile]\n" +"[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n" +"[-V variable] [-v variable] [variable=value] [target ...]\n", progname); exit(2); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 14:52:14 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): use ordinary string concatenation in usage text To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 14:47:49 UTC 2020 Modified Files: src/usr.bin/make: arch.c compat.c cond.c dir.c for.c hash.c hash.h job.c lst.c main.c make_malloc.h parse.c suff.c util.c var.c Log Message: make(1): use consistent indentation in source code Tabs for multiples of 8, then spaces. The usage string has been kept as-is since the spaces there are indentional and do influence the output. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/arch.c cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/compat.c cvs rdiff -u -r1.84 -r1.85 src/usr.bin/make/cond.c cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/dir.c cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/for.c src/usr.bin/make/util.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/hash.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/hash.h cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/job.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/lst.c cvs rdiff -u -r1.290 -r1.291 src/usr.bin/make/main.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/make_malloc.h cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/parse.c cvs rdiff -u -r1.92 -r1.93 src/usr.bin/make/suff.c cvs rdiff -u -r1.379 -r1.380 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/arch.c diff -u src/usr.bin/make/arch.c:1.79 src/usr.bin/make/arch.c:1.80 --- src/usr.bin/make/arch.c:1.79 Sat Aug 1 09:55:00 2020 +++ src/usr.bin/make/arch.c Sat Aug 1 14:47:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.80 2020/08/01 14:47:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.80 2020/08/01 14:47:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.79 2020/08/01 09:55:00 rillig Exp $"); +__RCSID("$NetBSD: arch.c,v 1.80 2020/08/01 14:47:49 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -534,7 +534,7 @@ ArchStatMember(const char *archive, cons Hash_Entry *he; /* Entry containing member's description */ struct ar_hdr arh;/* archive-member header for reading archive */ char memName[MAXPATHLEN+1]; - /* Current member name while hashing. */ + /* Current member name while hashing. */ /* * Because of space constraints and similar things, files are archived @@ -604,7 +604,7 @@ ArchStatMember(const char *archive, cons * can handle... */ if ((fread(magic, SARMAG, 1, arch) != 1) || - (strncmp(magic, ARMAG, SARMAG) != 0)) { + (strncmp(magic, ARMAG, SARMAG) != 0)) { fclose(arch); return NULL; } @@ -786,7 +786,7 @@ ArchSVR4Entry(Arch *ar, char *name, size } if (DEBUG(ARCH)) { fprintf(debug_file, "Found svr4 archive name table with %lu entries\n", - (unsigned long)entry); + (unsigned long)entry); } return 0; } @@ -862,7 +862,7 @@ ArchFindMember(const char *archive, cons * can handle... */ if ((fread(magic, SARMAG, 1, arch) != 1) || - (strncmp(magic, ARMAG, SARMAG) != 0)) { + (strncmp(magic, ARMAG, SARMAG) != 0)) { fclose(arch); return NULL; } Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.117 src/usr.bin/make/compat.c:1.118 --- src/usr.bin/make/compat.c:1.117 Sat Aug 1 09:55:00 2020 +++ src/usr.bin/make/compat.c Sat Aug 1 14:47:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.118 2020/08/01 14:47:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.118 2020/08/01 14:47:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.117 2020/08/01 09:55:00 rillig Exp $"); +__RCSID("$NetBSD: compat.c,v 1.118 2020/08/01 14:47:49 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -212,7 +212,7 @@ CompatRunCommand(void *cmdp, void *gnp) char *cmdStart; /* Start of expanded command */ char *cp, *bp; Boolean silent, /* Don't print command */ - doIt; /* Execute even if -n */ + doIt; /* Execute even if -n */ volatile Boolean errCheck; /* Check errors */ int reason; /* Reason for child's death */ int status; /* Description of child's death */ @@ -433,18 +433,18 @@ again: #endif if (status != 0) { if
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 14:47:49 UTC 2020 Modified Files: src/usr.bin/make: arch.c compat.c cond.c dir.c for.c hash.c hash.h job.c lst.c main.c make_malloc.h parse.c suff.c util.c var.c Log Message: make(1): use consistent indentation in source code Tabs for multiples of 8, then spaces. The usage string has been kept as-is since the spaces there are indentional and do influence the output. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/arch.c cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/compat.c cvs rdiff -u -r1.84 -r1.85 src/usr.bin/make/cond.c cvs rdiff -u -r1.82 -r1.83 src/usr.bin/make/dir.c cvs rdiff -u -r1.57 -r1.58 src/usr.bin/make/for.c src/usr.bin/make/util.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/make/hash.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/hash.h cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/job.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/lst.c cvs rdiff -u -r1.290 -r1.291 src/usr.bin/make/main.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/make_malloc.h cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/parse.c cvs rdiff -u -r1.92 -r1.93 src/usr.bin/make/suff.c cvs rdiff -u -r1.379 -r1.380 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 13:51:41 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline function in SysV modifier processing To generate a diff of this commit: cvs rdiff -u -r1.378 -r1.379 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 13:51:41 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): inline function in SysV modifier processing To generate a diff of this commit: cvs rdiff -u -r1.378 -r1.379 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.378 src/usr.bin/make/var.c:1.379 --- src/usr.bin/make/var.c:1.378 Sat Aug 1 13:35:13 2020 +++ src/usr.bin/make/var.c Sat Aug 1 13:51:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $ */ +/* $NetBSD: var.c,v 1.379 2020/08/01 13:51:40 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.379 2020/08/01 13:51:40 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.379 2020/08/01 13:51:40 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1219,36 +1219,6 @@ Str_SYSVMatch(const char *word, const ch return w; } - -/*- - *--- - * Str_SYSVSubst -- - * Append rhs to the buffer, substituting the first '%' with the - * match, but only if the lhs had a '%' as well. - * If the rhs does not contain a '%', prepend the match. - *--- - */ -static void -Str_SYSVSubst(SepBuf *buf, const char *rhs, - const char *match, size_t match_len, Boolean lhsHasPercent) -{ -const char *percent = strchr(rhs, '%'); - -if (percent != NULL && lhsHasPercent) { - /* Copy the prefix of the replacement pattern */ - SepBuf_AddBytesBetween(buf, rhs, percent); - rhs = percent + 1; -} -if (percent != NULL || !lhsHasPercent) { - /* Copy the matched part of the original word */ - SepBuf_AddBytes(buf, match, match_len); -} - -/* Append the suffix of the replacement pattern */ -SepBuf_AddStr(buf, rhs); -} - - typedef struct { GNode *ctx; const char *lhs; @@ -1264,13 +1234,31 @@ ModifyWord_SYSVSubst(const char *word, S size_t match_len; Boolean lhsPercent; const char *match = Str_SYSVMatch(word, args->lhs, _len, ); -if (match != NULL) { - char *rhs_expanded = Var_Subst(args->rhs, args->ctx, VARE_WANTRES); - Str_SYSVSubst(buf, rhs_expanded, match, match_len, lhsPercent); - free(rhs_expanded); -} else { +if (match == NULL) { SepBuf_AddStr(buf, word); + return; +} + +/* Append rhs to the buffer, substituting the first '%' with the + * match, but only if the lhs had a '%' as well. */ + +char *rhs_expanded = Var_Subst(args->rhs, args->ctx, VARE_WANTRES); + +const char *rhs = rhs_expanded; +const char *percent = strchr(rhs, '%'); + +if (percent != NULL && lhsPercent) { + /* Copy the prefix of the replacement pattern */ + SepBuf_AddBytesBetween(buf, rhs, percent); + rhs = percent + 1; } +if (percent != NULL || !lhsPercent) + SepBuf_AddBytes(buf, match, match_len); + +/* Append the suffix of the replacement pattern */ +SepBuf_AddStr(buf, rhs); + +free(rhs_expanded); } #endif
CVS commit: xsrc/external/mit/xorg-server.old/dist/hw/sun
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 13:40:55 UTC 2020 Modified Files: xsrc/external/mit/xorg-server.old/dist/hw/sun: sun.h sunCfb.c sunFbs.c sunInit.c sunKbd.c sunKeyMap.c Log Message: Cherry-pick non-Xorg-1.20-specific fixes from xorg-server dir. Use proper ANSI offsetof(3) to specify framebuffer offset in struct. Add prototype declarations for CG2 functions. Implement functions to restore palette settings on exiting Xserver. Explicitly initialize origColormapValid for readability. Fix LED defintions to match xkb/xkbInit.c. Remove unused functions required to handle non-XKB autorepeat. Initialize ModMap dynamically using keymap data per each keyboard. Remove now unused ModMap data for each keyboard. Use "empty" for rmlvo model and layout to avoid lingering default settings. Trailing whitespace. Note it looks there is some serious performance regression between Xorg 1.10 and 1.20 on rendering root_weave to root window on 3/60 bwtwo mono server. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunFbs.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunInit.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunKbd.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunKeyMap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h diff -u xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h:1.1 xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h:1.2 --- xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h:1.1 Wed Jul 22 19:17:03 2020 +++ xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h Sat Aug 1 13:40:55 2020 @@ -247,11 +247,21 @@ typedef struct { CursorPtr pCursor; /* current cursor */ } sunCursorRec, *sunCursorPtr; +#define NCMAP 256 +typedef struct { +u_char origRed[NCMAP]; +u_char origGreen[NCMAP]; +u_char origBlue[NCMAP]; +} sunCmapRec, *sunCmapPtr; + typedef struct { ColormapPtr installedMap; CloseScreenProcPtr CloseScreen; void (*UpdateColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *); void (*GetColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *); +Bool origColormapValid; +sunCmapRec origColormap; +void (*RestoreColormap)(ScreenPtr); sunCursorRechardwareCursor; Bool hasHardwareCursor; } sunScreenRec, *sunScreenPtr; @@ -296,10 +306,8 @@ extern Bool sunNoGX; /* sunKeyMap.c */ extern KeySymsRec sunKeySyms[]; -extern const SunModmapRec *sunModMaps[]; extern const int sunMaxLayout; extern KeySym *sunType4KeyMaps[]; -extern const SunModmapRec *sunType4ModMaps[]; /* sunKbd.c */ extern long sunAutoRepeatInitiate; @@ -351,8 +359,6 @@ extern Firm_event* sunKbdGetEvents(int, extern void sunKbdEnqueueEvent(DeviceIntPtr, Firm_event *); extern int sunKbdProc(DeviceIntPtr, int); extern void sunKbdWait(void); -void sunBlockHandler(int, pointer, pointer, pointer); -void sunWakeupHandler(int, pointer, unsigned long, pointer); /* sunMouse.c */ extern Firm_event* sunMouseGetEvents(int, Bool, int *, Bool *); Index: xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c diff -u xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c:1.1 xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c:1.2 --- xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c:1.1 Wed Jul 22 19:17:03 2020 +++ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c Sat Aug 1 13:40:55 2020 @@ -94,8 +94,18 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. static void CGUpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *); static void CGGetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *); static void CGStoreColors(ColormapPtr, int, xColorItem *); +static void CGSaveColormap(ScreenPtr); +static void CGRestoreColormap(ScreenPtr); +static void CGScreenInitCommon(ScreenPtr); static void CGScreenInit(ScreenPtr); static void checkMono(int, char **); +#ifdef INCLUDE_CG2_HEADER +static void CG2UpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *); +static void CG2GetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *); +static void CG2RestoreColormap(ScreenPtr); +static Bool CG2SaveScreen(ScreenPtr, int); +static void CG2ScreenInit(ScreenPtr pScreen); +#endif static void CG4Switch(ScreenPtr, int); static void @@ -239,22 +249,61 @@ CGStoreColors(ColormapPtr pmap, int ndef } static void -CGScreenInit(ScreenPtr pScreen) +CGSaveColormap(ScreenPtr pScreen) +{ +sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen); +sunCmapPtr origColormap; +u_char *rmap, *gmap, *bmap; + +origColormap = >origColormap; +rmap = origColormap->origRed; +gmap =
CVS commit: xsrc/external/mit/xorg-server.old/dist/hw/sun
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 13:40:55 UTC 2020 Modified Files: xsrc/external/mit/xorg-server.old/dist/hw/sun: sun.h sunCfb.c sunFbs.c sunInit.c sunKbd.c sunKeyMap.c Log Message: Cherry-pick non-Xorg-1.20-specific fixes from xorg-server dir. Use proper ANSI offsetof(3) to specify framebuffer offset in struct. Add prototype declarations for CG2 functions. Implement functions to restore palette settings on exiting Xserver. Explicitly initialize origColormapValid for readability. Fix LED defintions to match xkb/xkbInit.c. Remove unused functions required to handle non-XKB autorepeat. Initialize ModMap dynamically using keymap data per each keyboard. Remove now unused ModMap data for each keyboard. Use "empty" for rmlvo model and layout to avoid lingering default settings. Trailing whitespace. Note it looks there is some serious performance regression between Xorg 1.10 and 1.20 on rendering root_weave to root window on 3/60 bwtwo mono server. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/xorg-server.old/dist/hw/sun/sun.h \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunCfb.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunFbs.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunInit.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunKbd.c \ xsrc/external/mit/xorg-server.old/dist/hw/sun/sunKeyMap.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: Sat Aug 1 13:35:13 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): reduce the number of string comparisons in ${VAR:%.c=%.o} There is only a single position in the word where the tail ".c" can match, since it is implicitly anchored at the end. Therefore there's no need to do several string comparisons. To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/var.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/sysv.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/var.c diff -u src/usr.bin/make/var.c:1.377 src/usr.bin/make/var.c:1.378 --- src/usr.bin/make/var.c:1.377 Sat Aug 1 13:16:29 2020 +++ src/usr.bin/make/var.c Sat Aug 1 13:35:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $ */ +/* $NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.378 2020/08/01 13:35:13 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1205,19 +1205,18 @@ Str_SYSVMatch(const char *word, const ch } } -const char *suffix = w; +/* Test whether the tail matches */ +size_t w_len = strlen(w); +size_t p_len = strlen(p); +if (w_len < p_len) + return NULL; -/* Find a matching tail */ -/* XXX: This loop should not be necessary since there is only one - * possible position where strcmp could ever return 0. */ -do { - if (strcmp(p, w) == 0) { - *match_len = w - suffix; - return suffix; - } -} while (*w++ != '\0'); +const char *w_tail = w + w_len - p_len; +if (memcmp(p, w_tail, p_len) != 0) +return NULL; -return NULL; +*match_len = w_tail - w; +return w; } Index: src/usr.bin/make/unit-tests/sysv.mk diff -u src/usr.bin/make/unit-tests/sysv.mk:1.11 src/usr.bin/make/unit-tests/sysv.mk:1.12 --- src/usr.bin/make/unit-tests/sysv.mk:1.11 Sat Aug 1 12:47:56 2020 +++ src/usr.bin/make/unit-tests/sysv.mk Sat Aug 1 13:35:13 2020 @@ -1,4 +1,4 @@ -# $Id: sysv.mk,v 1.11 2020/08/01 12:47:56 rillig Exp $ +# $Id: sysv.mk,v 1.12 2020/08/01 13:35:13 rillig Exp $ all: foo fun sam bla words ampersand anchor-dollar all: mismatch @@ -87,8 +87,10 @@ EXPR.7= ${LIST:o%%e=X} # Only the first EXP.7= one two # None of the words contains a literal '%'. EXPR.8= ${LIST:%=%%} EXP.8= one% two% +EXPR.9= ${LIST:%nes=%xxx} # lhs is longer than the word "one" +EXP.9= one two -.for i in ${:U:range=8} +.for i in ${:U:range=9} .if ${EXPR.$i} != ${EXP.$i} .warning test case $i expected "${EXP.$i}", got "${EXPR.$i} .endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 13:35:13 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): reduce the number of string comparisons in ${VAR:%.c=%.o} There is only a single position in the word where the tail ".c" can match, since it is implicitly anchored at the end. Therefore there's no need to do several string comparisons. To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/var.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/sysv.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: Sat Aug 1 13:16:29 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): make variable names in SysV modifier more expressive When matching a word against a substitution having a lhs and a rhs, including a possible wildcard, there are just too many string variables around to know what a simple "len" means and where it belongs. To generate a diff of this commit: cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 13:16:29 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): make variable names in SysV modifier more expressive When matching a word against a substitution having a lhs and a rhs, including a possible wildcard, there are just too many string variables around to know what a simple "len" means and where it belongs. To generate a diff of this commit: cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.376 src/usr.bin/make/var.c:1.377 --- src/usr.bin/make/var.c:1.376 Sat Aug 1 12:04:46 2020 +++ src/usr.bin/make/var.c Sat Aug 1 13:16:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $ */ +/* $NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.377 2020/08/01 13:16:29 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1165,55 +1165,55 @@ ModifyWord_NoMatch(const char *word, Sep * Input: * word Word to examine * pattern Pattern to examine against - * len Number of characters to substitute * * Results: - * Returns the beginning position of a match or null. The number - * of characters matched is returned in len. + * Returns the start of the match, or NULL. + * *match_len returns the length of the match, if any. + * *hasPercent returns whether the pattern contains a percent. *--- */ static const char * -Str_SYSVMatch(const char *word, const char *pattern, size_t *len, +Str_SYSVMatch(const char *word, const char *pattern, size_t *match_len, Boolean *hasPercent) { const char *p = pattern; const char *w = word; -const char *m; *hasPercent = FALSE; -if (*p == '\0') { - /* Null pattern is the whole string */ - *len = strlen(w); +if (*p == '\0') { /* ${VAR:=suffix} */ + *match_len = strlen(w); /* Null pattern is the whole string */ return w; } -if ((m = strchr(p, '%')) != NULL) { +const char *percent = strchr(p, '%'); +if (percent != NULL) { /* ${VAR:...%...=...} */ *hasPercent = TRUE; - if (*w == '\0') { - /* empty word does not match pattern */ - return NULL; - } + if (*w == '\0') + return NULL; /* empty word does not match pattern */ + /* check that the prefix matches */ - for (; p != m && *w && *w == *p; w++, p++) + for (; p != percent && *w != '\0' && *w == *p; w++, p++) continue; - - if (p != m) + if (p != percent) return NULL; /* No match */ - if (*++p == '\0') { + p++; /* Skip the percent */ + if (*p == '\0') { /* No more pattern, return the rest of the string */ - *len = strlen(w); + *match_len = strlen(w); return w; } } -m = w; +const char *suffix = w; /* Find a matching tail */ +/* XXX: This loop should not be necessary since there is only one + * possible position where strcmp could ever return 0. */ do { if (strcmp(p, w) == 0) { - *len = w - m; - return m; + *match_len = w - suffix; + return suffix; } } while (*w++ != '\0'); @@ -1224,32 +1224,29 @@ Str_SYSVMatch(const char *word, const ch /*- *--- * Str_SYSVSubst -- - * Substitute '%' on the pattern with len characters from src. - * If the pattern does not contain a '%' prepend len characters - * from src. - * - * Side Effects: - * Places result on buf + * Append rhs to the buffer, substituting the first '%' with the + * match, but only if the lhs had a '%' as well. + * If the rhs does not contain a '%', prepend the match. *--- */ static void -Str_SYSVSubst(SepBuf *buf, const char *pat, const char *src, size_t src_len, - Boolean lhsHasPercent) +Str_SYSVSubst(SepBuf *buf, const char *rhs, + const char *match, size_t match_len, Boolean lhsHasPercent) { -const char *percent = strchr(pat, '%'); +const char *percent = strchr(rhs, '%'); if (percent != NULL && lhsHasPercent) { - /* Copy the prefix */ - SepBuf_AddBytesBetween(buf, pat, percent); - pat = percent + 1; + /* Copy the prefix of the replacement pattern */ + SepBuf_AddBytesBetween(buf, rhs, percent); + rhs = percent + 1; } if (percent != NULL || !lhsHasPercent) { - /* Copy the
CVS commit: xsrc/external/mit/xorg-server/dist/hw/sun
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 13:15:57 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/sun: sunKbd.c Log Message: Trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c diff -u xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.5 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.6 --- xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c:1.5 Sat Aug 1 01:49:58 2020 +++ xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.c Sat Aug 1 13:15:57 2020 @@ -716,7 +716,7 @@ sunInitModMap( { KeySym *k; int i, min, max, width; - + for (i = 0; i < MAP_LENGTH; i++) ModMap[i] = NoSymbol;
CVS commit: xsrc/external/mit/xorg-server/dist/hw/sun
Module Name:xsrc Committed By: tsutsui Date: Sat Aug 1 13:15:57 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/sun: sunKbd.c Log Message: Trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/hw/sun/sunKbd.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: Sat Aug 1 12:47:56 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): fix typo in newly added SysV modifier test case I should have been more suspicious when all my test cases succeeded at the first try. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/sysv.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/sysv.mk diff -u src/usr.bin/make/unit-tests/sysv.mk:1.10 src/usr.bin/make/unit-tests/sysv.mk:1.11 --- src/usr.bin/make/unit-tests/sysv.mk:1.10 Sat Aug 1 12:04:00 2020 +++ src/usr.bin/make/unit-tests/sysv.mk Sat Aug 1 12:47:56 2020 @@ -1,4 +1,4 @@ -# $Id: sysv.mk,v 1.10 2020/08/01 12:04:00 rillig Exp $ +# $Id: sysv.mk,v 1.11 2020/08/01 12:47:56 rillig Exp $ all: foo fun sam bla words ampersand anchor-dollar all: mismatch @@ -76,20 +76,20 @@ EXP.1= one twX EXPR.2= ${LIST:o=} EXP.2= one tw EXPR.3= ${LIST:o=%} -EXP.3= one twtwo +EXP.3= one tw% EXPR.4= ${LIST:%o=X} EXP.4= one X EXPR.5= ${LIST:o%=X} -EXP.5= X twX +EXP.5= X two EXPR.6= ${LIST:o%e=X} -EXP.6= oXe two +EXP.6= X two EXPR.7= ${LIST:o%%e=X} # Only the first '%' is the wildcard. EXP.7= one two # None of the words contains a literal '%'. EXPR.8= ${LIST:%=%%} -EXP.8= oneone twotwo +EXP.8= one% two% .for i in ${:U:range=8} -.if ${EXPR.1} != ${EXP.1} -.warning expected "${EXP.$i}", got "${EXPR.$i} +.if ${EXPR.$i} != ${EXP.$i} +.warning test case $i expected "${EXP.$i}", got "${EXPR.$i} .endif .endfor
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 12:47:56 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): fix typo in newly added SysV modifier test case I should have been more suspicious when all my test cases succeeded at the first try. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/sysv.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/xen/x86
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:39:40 UTC 2020 Modified Files: src/sys/arch/xen/x86: pintr.c xen_intr.c Log Message: adjust includes to pull __HAVE_PCI_MSI_MSIX properly To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/x86/pintr.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/x86/xen_intr.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/xen/x86/pintr.c diff -u src/sys/arch/xen/x86/pintr.c:1.19 src/sys/arch/xen/x86/pintr.c:1.20 --- src/sys/arch/xen/x86/pintr.c:1.19 Sun Jul 19 16:20:36 2020 +++ src/sys/arch/xen/x86/pintr.c Sat Aug 1 12:39:40 2020 @@ -103,12 +103,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.19 2020/07/19 16:20:36 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.20 2020/08/01 12:39:40 jdolecek Exp $"); #include "opt_multiprocessor.h" #include "opt_xen.h" #include "isa.h" #include "pci.h" +#include "opt_pci.h" #include #include @@ -126,6 +127,8 @@ __KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1. #include #include +#include + #ifdef __HAVE_PCI_MSI_MSIX #include #endif Index: src/sys/arch/xen/x86/xen_intr.c diff -u src/sys/arch/xen/x86/xen_intr.c:1.27 src/sys/arch/xen/x86/xen_intr.c:1.28 --- src/sys/arch/xen/x86/xen_intr.c:1.27 Thu May 7 19:48:58 2020 +++ src/sys/arch/xen/x86/xen_intr.c Sat Aug 1 12:39:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_intr.c,v 1.27 2020/05/07 19:48:58 bouyer Exp $ */ +/* $NetBSD: xen_intr.c,v 1.28 2020/08/01 12:39:40 jdolecek Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -30,9 +30,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.27 2020/05/07 19:48:58 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.28 2020/08/01 12:39:40 jdolecek Exp $"); #include "opt_multiprocessor.h" +#include "opt_pci.h" #include #include
CVS commit: src/sys/arch/xen/x86
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:39:40 UTC 2020 Modified Files: src/sys/arch/xen/x86: pintr.c xen_intr.c Log Message: adjust includes to pull __HAVE_PCI_MSI_MSIX properly To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/x86/pintr.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/x86/xen_intr.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/x86
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:36:36 UTC 2020 Modified Files: src/sys/arch/x86/pci: pci_intr_machdep.c src/sys/arch/x86/x86: mainbus.c Log Message: reorder includes to pull __HAVE_PCI_MSI_MSIX properly via To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/pci_intr_machdep.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/mainbus.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/x86
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:36:36 UTC 2020 Modified Files: src/sys/arch/x86/pci: pci_intr_machdep.c src/sys/arch/x86/x86: mainbus.c Log Message: reorder includes to pull __HAVE_PCI_MSI_MSIX properly via To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/pci_intr_machdep.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/mainbus.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/x86/pci/pci_intr_machdep.c diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.50 src/sys/arch/x86/pci/pci_intr_machdep.c:1.51 --- src/sys/arch/x86/pci/pci_intr_machdep.c:1.50 Mon Jun 17 06:38:29 2019 +++ src/sys/arch/x86/pci/pci_intr_machdep.c Sat Aug 1 12:36:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_intr_machdep.c,v 1.50 2019/06/17 06:38:29 msaitoh Exp $ */ +/* $NetBSD: pci_intr_machdep.c,v 1.51 2020/08/01 12:36:35 jdolecek Exp $ */ /*- * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.50 2019/06/17 06:38:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.51 2020/08/01 12:36:35 jdolecek Exp $"); #include #include @@ -85,13 +85,14 @@ __KERNEL_RCSID(0, "$NetBSD: pci_intr_mac #include #include -#include - #include "ioapic.h" #include "eisa.h" #include "acpica.h" #include "opt_mpbios.h" #include "opt_acpi.h" +#include "opt_pci.h" + +#include #include Index: src/sys/arch/x86/x86/mainbus.c diff -u src/sys/arch/x86/x86/mainbus.c:1.4 src/sys/arch/x86/x86/mainbus.c:1.5 --- src/sys/arch/x86/x86/mainbus.c:1.4 Sat Apr 25 15:26:18 2020 +++ src/sys/arch/x86/x86/mainbus.c Sat Aug 1 12:36:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.4 2020/04/25 15:26:18 bouyer Exp $ */ +/* $NetBSD: mainbus.c,v 1.5 2020/08/01 12:36:35 jdolecek Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -28,15 +28,18 @@ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2020/04/25 15:26:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2020/08/01 12:36:35 jdolecek Exp $"); + +#include "opt_acpi.h" +#include "opt_mpbios.h" +#include "opt_pcifixup.h" +#include "opt_pci.h" #include #include #include #include -#include - #include #include #include @@ -48,10 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v #include "acpica.h" #include "ipmi.h" -#include "opt_acpi.h" -#include "opt_mpbios.h" -#include "opt_pcifixup.h" - #if NACPICA > 0 #include #endif @@ -63,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v #endif #if NPCI > 0 +#include #if defined(PCI_BUS_FIXUP) #include #if defined(PCI_ADDR_FIXUP)
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:28:19 UTC 2020 Modified Files: src/sys/arch/amd64/conf: ALL Log Message: remove CISS_NO_INTERRUPT_HACK from ALL kernel config too, it's no longer supported in ciss(4) To generate a diff of this commit: cvs rdiff -u -r1.159 -r1.160 src/sys/arch/amd64/conf/ALL 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/amd64/conf/ALL diff -u src/sys/arch/amd64/conf/ALL:1.159 src/sys/arch/amd64/conf/ALL:1.160 --- src/sys/arch/amd64/conf/ALL:1.159 Sat Aug 1 08:20:47 2020 +++ src/sys/arch/amd64/conf/ALL Sat Aug 1 12:28:19 2020 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.159 2020/08/01 08:20:47 maxv Exp $ +# $NetBSD: ALL,v 1.160 2020/08/01 12:28:19 jdolecek Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.159 $" +#ident "ALL-$Revision: 1.160 $" maxusers 64 # estimated number of users @@ -831,7 +831,6 @@ amr* at pci? dev ? function ? # AMI/LSI arcmsr* at pci? dev ? function ? # Areca SATA RAID controllers cac* at pci? dev ? function ? # Compaq PCI array controllers ciss* at pci? dev ? function ? # HP Smart Array controllers -options CISS_NO_INTERRUPT_HACK icp* at pci? dev ? function ? # ICP-Vortex GDT & Intel RAID ips* at pci? dev ? function ? # Adaptec/IBM ServeRAID
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:28:19 UTC 2020 Modified Files: src/sys/arch/amd64/conf: ALL Log Message: remove CISS_NO_INTERRUPT_HACK from ALL kernel config too, it's no longer supported in ciss(4) To generate a diff of this commit: cvs rdiff -u -r1.159 -r1.160 src/sys/arch/amd64/conf/ALL Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/conf
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:15:40 UTC 2020 Modified Files: src/sys/arch/x86/conf: files.x86 Log Message: defflag NO_PCI_MSI_MSIX To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x86/conf/files.x86 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/x86/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.118 src/sys/arch/x86/conf/files.x86:1.119 --- src/sys/arch/x86/conf/files.x86:1.118 Sat Jul 25 22:49:20 2020 +++ src/sys/arch/x86/conf/files.x86 Sat Aug 1 12:15:40 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.118 2020/07/25 22:49:20 riastradh Exp $ +# $NetBSD: files.x86,v 1.119 2020/08/01 12:15:40 jdolecek Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI @@ -13,6 +13,7 @@ defflag opt_intrdebug.h INTRDEBUG # PCI fixup options defflag opt_pcifixup.h PCI_ADDR_FIXUP PCI_BUS_FIXUP PCI_INTR_FIXUP PCI_INTR_FIXUP_FORCE +defflag opt_pci.h NO_PCI_MSI_MSIX # To be able to test for NetBSD/xen in shared files defflag opt_xen.h DO_NOT_DEFINE
CVS commit: src/sys/arch/x86/conf
Module Name:src Committed By: jdolecek Date: Sat Aug 1 12:15:40 UTC 2020 Modified Files: src/sys/arch/x86/conf: files.x86 Log Message: defflag NO_PCI_MSI_MSIX To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x86/conf/files.x86 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: jdolecek Date: Sat Aug 1 12:14:40 UTC 2020 Modified Files: src/sys/arch/amd64/include: types.h src/sys/arch/i386/include: types.h src/sys/arch/x86/include: pci_machdep_common.h Log Message: move __HAVE_PCI_MSI_MSIX to To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/amd64/include/types.h cvs rdiff -u -r1.91 -r1.92 src/sys/arch/i386/include/types.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/include/pci_machdep_common.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: jdolecek Date: Sat Aug 1 12:14:40 UTC 2020 Modified Files: src/sys/arch/amd64/include: types.h src/sys/arch/i386/include: types.h src/sys/arch/x86/include: pci_machdep_common.h Log Message: move __HAVE_PCI_MSI_MSIX to To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/amd64/include/types.h cvs rdiff -u -r1.91 -r1.92 src/sys/arch/i386/include/types.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/include/pci_machdep_common.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/amd64/include/types.h diff -u src/sys/arch/amd64/include/types.h:1.68 src/sys/arch/amd64/include/types.h:1.69 --- src/sys/arch/amd64/include/types.h:1.68 Mon May 4 15:55:56 2020 +++ src/sys/arch/amd64/include/types.h Sat Aug 1 12:14:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.68 2020/05/04 15:55:56 jdolecek Exp $ */ +/* $NetBSD: types.h,v 1.69 2020/08/01 12:14:39 jdolecek Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -100,9 +100,6 @@ typedef unsigned char __cpu_simple_lock #define __HAVE_MM_MD_DIRECT_MAPPED_IO #define __HAVE_MM_MD_DIRECT_MAPPED_PHYS #define __HAVE_UCAS_FULL -#if !defined(NO_PCI_MSI_MSIX) -#define __HAVE_PCI_MSI_MSIX -#endif #ifdef _KERNEL_OPT #define __HAVE_RAS Index: src/sys/arch/i386/include/types.h diff -u src/sys/arch/i386/include/types.h:1.91 src/sys/arch/i386/include/types.h:1.92 --- src/sys/arch/i386/include/types.h:1.91 Mon May 4 15:55:56 2020 +++ src/sys/arch/i386/include/types.h Sat Aug 1 12:14:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.91 2020/05/04 15:55:56 jdolecek Exp $ */ +/* $NetBSD: types.h,v 1.92 2020/08/01 12:14:40 jdolecek Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -133,9 +133,6 @@ typedef __register_t register_t; #define __HAVE_TLS_VARIANT_II #define __HAVE_COMMON___TLS_GET_ADDR #define __HAVE_UCAS_FULL -#if !defined(NO_PCI_MSI_MSIX) -#define __HAVE_PCI_MSI_MSIX -#endif #define __HAVE_RAS #endif /* _I386_MACHTYPES_H_ */ Index: src/sys/arch/x86/include/pci_machdep_common.h diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.24 src/sys/arch/x86/include/pci_machdep_common.h:1.25 --- src/sys/arch/x86/include/pci_machdep_common.h:1.24 Sat Apr 25 15:26:18 2020 +++ src/sys/arch/x86/include/pci_machdep_common.h Sat Aug 1 12:14:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep_common.h,v 1.24 2020/04/25 15:26:18 bouyer Exp $ */ +/* $NetBSD: pci_machdep_common.h,v 1.25 2020/08/01 12:14:40 jdolecek Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -33,6 +33,10 @@ #ifndef _X86_PCI_MACHDEP_COMMON_H_ #define _X86_PCI_MACHDEP_COMMON_H_ +#if !defined(NO_PCI_MSI_MSIX) +#define __HAVE_PCI_MSI_MSIX +#endif + /* * Machine-specific definitions for PCI autoconfiguration. */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 12:04:46 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): more descriptive variable names in Str_SYSVSubst To generate a diff of this commit: cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Aug 1 12:04:46 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): more descriptive variable names in Str_SYSVSubst To generate a diff of this commit: cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.375 src/usr.bin/make/var.c:1.376 --- src/usr.bin/make/var.c:1.375 Sat Aug 1 09:25:36 2020 +++ src/usr.bin/make/var.c Sat Aug 1 12:04:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.375 2020/08/01 09:25:36 rillig Exp $ */ +/* $NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.375 2020/08/01 09:25:36 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.375 2020/08/01 09:25:36 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.376 2020/08/01 12:04:46 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -1233,20 +1233,19 @@ Str_SYSVMatch(const char *word, const ch *--- */ static void -Str_SYSVSubst(SepBuf *buf, const char *pat, const char *src, size_t len, +Str_SYSVSubst(SepBuf *buf, const char *pat, const char *src, size_t src_len, Boolean lhsHasPercent) { -const char *m; +const char *percent = strchr(pat, '%'); -if ((m = strchr(pat, '%')) != NULL && lhsHasPercent) { +if (percent != NULL && lhsHasPercent) { /* Copy the prefix */ - SepBuf_AddBytesBetween(buf, pat, m); - /* skip the % */ - pat = m + 1; + SepBuf_AddBytesBetween(buf, pat, percent); + pat = percent + 1; } -if (m != NULL || !lhsHasPercent) { +if (percent != NULL || !lhsHasPercent) { /* Copy the pattern */ - SepBuf_AddBytes(buf, src, len); + SepBuf_AddBytes(buf, src, src_len); } /* append the rest */
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Aug 1 12:04:00 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): add more tests for the SysV modifier To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/sysv.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: Sat Aug 1 12:04:00 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sysv.mk Log Message: make(1): add more tests for the SysV modifier To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/sysv.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/sysv.mk diff -u src/usr.bin/make/unit-tests/sysv.mk:1.9 src/usr.bin/make/unit-tests/sysv.mk:1.10 --- src/usr.bin/make/unit-tests/sysv.mk:1.9 Sun Jul 26 11:19:04 2020 +++ src/usr.bin/make/unit-tests/sysv.mk Sat Aug 1 12:04:00 2020 @@ -1,4 +1,4 @@ -# $Id: sysv.mk,v 1.9 2020/07/26 11:19:04 rillig Exp $ +# $Id: sysv.mk,v 1.10 2020/08/01 12:04:00 rillig Exp $ all: foo fun sam bla words ampersand anchor-dollar all: mismatch @@ -68,3 +68,28 @@ anchor-dollar: mismatch: @echo $@: ${:Ufile.c file.h:%.c=%.cpp} @echo $@: ${:Ufile.c other.c:file.%=renamed.%} + +# Trying to cover all possible variants of the SysV modifier. +LIST= one two +EXPR.1= ${LIST:o=X} +EXP.1= one twX +EXPR.2= ${LIST:o=} +EXP.2= one tw +EXPR.3= ${LIST:o=%} +EXP.3= one twtwo +EXPR.4= ${LIST:%o=X} +EXP.4= one X +EXPR.5= ${LIST:o%=X} +EXP.5= X twX +EXPR.6= ${LIST:o%e=X} +EXP.6= oXe two +EXPR.7= ${LIST:o%%e=X} # Only the first '%' is the wildcard. +EXP.7= one two # None of the words contains a literal '%'. +EXPR.8= ${LIST:%=%%} +EXP.8= oneone twotwo + +.for i in ${:U:range=8} +.if ${EXPR.1} != ${EXP.1} +.warning expected "${EXP.$i}", got "${EXPR.$i} +.endif +.endfor
CVS commit: src/sys/kern
Module Name:src Committed By: jdolecek Date: Sat Aug 1 11:18:26 UTC 2020 Modified Files: src/sys/kern: subr_autoconf.c Log Message: avoid VLA for the sizeof() calculations To generate a diff of this commit: cvs rdiff -u -r1.272 -r1.273 src/sys/kern/subr_autoconf.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/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.272 src/sys/kern/subr_autoconf.c:1.273 --- src/sys/kern/subr_autoconf.c:1.272 Sat Jun 27 13:53:10 2020 +++ src/sys/kern/subr_autoconf.c Sat Aug 1 11:18:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.272 2020/06/27 13:53:10 jmcneill Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.273 2020/08/01 11:18:26 jdolecek Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.272 2020/06/27 13:53:10 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.273 2020/08/01 11:18:26 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1213,7 +1213,7 @@ config_makeroom(int n, struct cfdriver * * sleep. */ mutex_exit(_lock); - nsp = kmem_alloc(sizeof(device_t[nndevs]), KM_SLEEP); + nsp = kmem_alloc(sizeof(device_t) * nndevs, KM_SLEEP); mutex_enter(_lock); /* @@ -1222,20 +1222,20 @@ config_makeroom(int n, struct cfdriver * */ if (cd->cd_devs != osp) { mutex_exit(_lock); - kmem_free(nsp, sizeof(device_t[nndevs])); + kmem_free(nsp, sizeof(device_t) * nndevs); mutex_enter(_lock); continue; } - memset(nsp + ondevs, 0, sizeof(device_t[nndevs - ondevs])); + memset(nsp + ondevs, 0, sizeof(device_t) * (nndevs - ondevs)); if (ondevs != 0) - memcpy(nsp, cd->cd_devs, sizeof(device_t[ondevs])); + memcpy(nsp, cd->cd_devs, sizeof(device_t) * ondevs); cd->cd_ndevs = nndevs; cd->cd_devs = nsp; if (ondevs != 0) { mutex_exit(_lock); - kmem_free(osp, sizeof(device_t[ondevs])); + kmem_free(osp, sizeof(device_t) * ondevs); mutex_enter(_lock); } } @@ -1314,7 +1314,7 @@ config_devdelete(device_t dev) device_lock_t dvl = device_getlock(dev); if (dg->dg_devs != NULL) - kmem_free(dg->dg_devs, sizeof(device_t[dg->dg_ndevs])); + kmem_free(dg->dg_devs, sizeof(device_t) * dg->dg_ndevs); cv_destroy(>dvl_cv); mutex_destroy(>dvl_mtx); @@ -1447,9 +1447,9 @@ config_devalloc(const device_t parent, c KASSERT(parent); /* no locators at root */ ia = cfiattr_lookup(cfdata_ifattr(cf), parent->dv_cfdriver); dev->dv_locators = - kmem_alloc(sizeof(int [ia->ci_loclen + 1]), KM_SLEEP); - *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]); - memcpy(dev->dv_locators, locs, sizeof(int [ia->ci_loclen])); + kmem_alloc(sizeof(int) * (ia->ci_loclen + 1), KM_SLEEP); + *dev->dv_locators++ = sizeof(int) * (ia->ci_loclen + 1); + memcpy(dev->dv_locators, locs, sizeof(int) * ia->ci_loclen); } dev->dv_properties = prop_dictionary_create(); KASSERT(dev->dv_properties != NULL); @@ -2710,7 +2710,7 @@ device_active_register(device_t dev, voi } new_size = old_size + 4; - new_handlers = kmem_alloc(sizeof(void *[new_size]), KM_SLEEP); + new_handlers = kmem_alloc(sizeof(void *) * new_size, KM_SLEEP); for (i = 0; i < old_size; ++i) new_handlers[i] = old_handlers[i]; @@ -2724,7 +2724,7 @@ device_active_register(device_t dev, voi splx(s); if (old_size > 0) - kmem_free(old_handlers, sizeof(void * [old_size])); + kmem_free(old_handlers, sizeof(void *) * old_size); return true; } @@ -2758,7 +2758,7 @@ device_active_deregister(device_t dev, v dev->dv_activity_count = 0; dev->dv_activity_handlers = NULL; splx(s); - kmem_free(old_handlers, sizeof(void *[old_size])); + kmem_free(old_handlers, sizeof(void *) * old_size); } return; }
CVS commit: src/sys/kern
Module Name:src Committed By: jdolecek Date: Sat Aug 1 11:18:26 UTC 2020 Modified Files: src/sys/kern: subr_autoconf.c Log Message: avoid VLA for the sizeof() calculations To generate a diff of this commit: cvs rdiff -u -r1.272 -r1.273 src/sys/kern/subr_autoconf.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: Sat Aug 1 10:44:23 UTC 2020 Modified Files: src/usr.bin/make: str.c Log Message: make(1): reduce scope of local variables in brk_string This also removes the unused assignment to words_cap. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/usr.bin/make/str.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.