CVS commit: src/doc
Module Name:src Committed By: kre Date: Thu Dec 31 07:54:13 UTC 2020 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: Note update of tzdata to 2020f To generate a diff of this commit: cvs rdiff -u -r1.1771 -r1.1772 src/doc/3RDPARTY cvs rdiff -u -r1.2772 -r1.2773 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1771 src/doc/3RDPARTY:1.1772 --- src/doc/3RDPARTY:1.1771 Mon Dec 28 13:59:50 2020 +++ src/doc/3RDPARTY Thu Dec 31 07:54:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1771 2020/12/28 13:59:50 roy Exp $ +# $NetBSD: 3RDPARTY,v 1.1772 2020/12/31 07:54:13 kre Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1409,14 +1409,14 @@ Notes: Added changes from a5 -> a12 manually. Package: tz -Version: tzcode2020c / tzdata2020d -Current Vers: tzcode2020d / tzdata2020d +Version: tzcode2020c / tzdata2020f +Current Vers: tzcode2020f / tzdata2020f Maintainer: Paul Eggert Archive Site: ftp://ftp.iana.org/tz/releases/ Archive Site: ftp://munnari.oz.au/pub/oldtz/ Old Archive Site: ftp://elsie.nci.nih.gov/pub/ Home Page: http://www.iana.org/time-zones -Date: 2020-06-13 +Date: 2020-12-31 Mailing List: t...@iana.org Responsible: kleink, christos, kre License: Public domain Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2772 src/doc/CHANGES:1.2773 --- src/doc/CHANGES:1.2772 Mon Dec 28 13:59:50 2020 +++ src/doc/CHANGES Thu Dec 31 07:54:13 2020 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2772 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2773 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -325,3 +325,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: resize: Import Xterm's resize(1) for querying (x)terminal sizes in base for headless clients [reinoud 20201227] dhcpcd: Update to version 9.4.0 [roy 20201228] + tzdata updated to 2020f (includes update to 2020e) [kre 20201231]
CVS commit: src/external/public-domain/tz/dist
Module Name:src Committed By: kre Date: Thu Dec 31 07:50:44 UTC 2020 Modified Files: src/external/public-domain/tz/dist: TZDATA_VERSION Log Message: Merge tzdata2020f To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/external/public-domain/tz/dist/TZDATA_VERSION Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/public-domain/tz/dist/TZDATA_VERSION diff -u src/external/public-domain/tz/dist/TZDATA_VERSION:1.22 src/external/public-domain/tz/dist/TZDATA_VERSION:1.23 --- src/external/public-domain/tz/dist/TZDATA_VERSION:1.22 Thu Oct 22 08:24:04 2020 +++ src/external/public-domain/tz/dist/TZDATA_VERSION Thu Dec 31 07:50:43 2020 @@ -1 +1 @@ -tzdata-2020d +tzdata-2020f
CVS import: src/external/public-domain/tz/dist
Module Name:src Committed By: kre Date: Thu Dec 31 07:50:15 UTC 2020 Update of /cvsroot/src/external/public-domain/tz/dist In directory ivanova.netbsd.org:/tmp/cvs-serv337 Log Message: Import tzdata2020f from ftp://ftp.iana.org/tz/releases/tzdata2020f.tar.gz Release 2020f - 2020-12-29 00:17:46 -0800 No changes to tzdata, just to a part of the build procedure not used on NetBSD Release 2020e - 2020-12-22 15:14:34 -0800 Volgograd switched to Moscow time on 2020-12-27 at 02:00. Correct many pre-1986 transitions, fixing entries originally derived from Shanks. The fixes include changes to: Australia, Bahamas, Bermuda, Belize, Ghana, Israel and Palestine, Kenya and adjacent, Nigeria and adjacent, Seychelles, Vanuatu Australia/Currie has been moved to the 'backward' file and its corrected data moved to the 'backzone' file. To better match legislation in Turks and Caicos, the 2015 shift to year-round observance of -04 is now modeled as AST throughout before returning to Eastern Time with US DST in 2018, rather than as maintaining EDT until 2015-11-01. Status: Vendor Tag: TZDATA Release Tags: TZDATA2020F U src/external/public-domain/tz/dist/leap-seconds.list U src/external/public-domain/tz/dist/calendars U src/external/public-domain/tz/dist/CONTRIBUTING U src/external/public-domain/tz/dist/LICENSE U src/external/public-domain/tz/dist/Makefile U src/external/public-domain/tz/dist/NEWS U src/external/public-domain/tz/dist/README U src/external/public-domain/tz/dist/theory.html U src/external/public-domain/tz/dist/version U src/external/public-domain/tz/dist/africa U src/external/public-domain/tz/dist/antarctica U src/external/public-domain/tz/dist/asia U src/external/public-domain/tz/dist/australasia U src/external/public-domain/tz/dist/europe U src/external/public-domain/tz/dist/northamerica U src/external/public-domain/tz/dist/southamerica U src/external/public-domain/tz/dist/etcetera U src/external/public-domain/tz/dist/factory U src/external/public-domain/tz/dist/backward U src/external/public-domain/tz/dist/backzone U src/external/public-domain/tz/dist/iso3166.tab U src/external/public-domain/tz/dist/checklinks.awk U src/external/public-domain/tz/dist/leapseconds U src/external/public-domain/tz/dist/zone1970.tab U src/external/public-domain/tz/dist/zone.tab U src/external/public-domain/tz/dist/leapseconds.awk U src/external/public-domain/tz/dist/checktab.awk U src/external/public-domain/tz/dist/zoneinfo2tdf.pl U src/external/public-domain/tz/dist/ziguard.awk U src/external/public-domain/tz/dist/zishrink.awk No conflicts created by this import
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: mrg Date: Thu Dec 31 06:44:11 UTC 2020 Modified Files: src/sys/arch/arm/rockchip: rk_i2s.c Log Message: save the return value of fdtbus_clock_enable() so we can both report it correctly instead of always 0, and also return failure to the caller. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_i2s.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/rockchip/rk_i2s.c diff -u src/sys/arch/arm/rockchip/rk_i2s.c:1.3 src/sys/arch/arm/rockchip/rk_i2s.c:1.4 --- src/sys/arch/arm/rockchip/rk_i2s.c:1.3 Sat Feb 29 05:51:10 2020 +++ src/sys/arch/arm/rockchip/rk_i2s.c Thu Dec 31 06:44:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_i2s.c,v 1.3 2020/02/29 05:51:10 isaki Exp $ */ +/* $NetBSD: rk_i2s.c,v 1.4 2020/12/31 06:44:11 mrg Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.3 2020/02/29 05:51:10 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.4 2020/12/31 06:44:11 mrg Exp $"); #include #include @@ -536,7 +536,8 @@ rk_i2s_clock_init(struct rk_i2s_softc *s } /* Enable bus clock */ - if (fdtbus_clock_enable(phandle, "i2s_hclk", true) != 0) { + error = fdtbus_clock_enable(phandle, "i2s_hclk", true); + if (error != 0) { aprint_error(": couldn't enable i2s_hclk clock: %d\n", error); return error; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 04:38:55 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): move detailed comment to ForSubstBody To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.128 src/usr.bin/make/for.c:1.129 --- src/usr.bin/make/for.c:1.128 Thu Dec 31 04:31:36 2020 +++ src/usr.bin/make/for.c Thu Dec 31 04:38:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.128 2020/12/31 04:31:36 rillig Exp $ */ +/* $NetBSD: for.c,v 1.129 2020/12/31 04:38:55 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.128 2020/12/31 04:31:36 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.129 2020/12/31 04:38:55 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -429,6 +429,15 @@ SubstVarShort(For *f, const char **pp, c /* * Compute the body for the current iteration by copying the unexpanded body, * replacing the expressions for the iteration variables on the way. + * + * Using variable expressions ensures that the .for loop can't generate + * syntax, and that the later parsing will still see a variable. + * This code assumes that the variable with the empty name will never be + * defined, see unit-tests/varname-empty.mk for more details. + * + * The detection of substitutions of the loop control variable is naive. + * Many of the modifiers use \ to escape $ (not $) so it is possible + * to contrive a makefile where an unwanted substitution happens. */ static void ForSubstBody(For *f) @@ -454,17 +463,8 @@ ForSubstBody(For *f) } /* - * Scan the for loop body and replace references to the loop variables - * with variable references that expand to the required text. - * - * Using variable expressions ensures that the .for loop can't generate - * syntax, and that the later parsing will still see a variable. - * This code assumes that the variable with the empty name will never be - * defined, see unit-tests/varname-empty.mk for more details. - * - * The detection of substitutions of the loop control variable is naive. - * Many of the modifiers use \ to escape $ (not $) so it is possible - * to contrive a makefile where an unwanted substitution happens. + * Compute the body for the current iteration by copying the unexpanded body, + * replacing the expressions for the iteration variables on the way. */ static char * ForReadMore(void *v_arg, size_t *out_len)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 04:31:36 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): extract ForSubstBody from ForReadMore This leaves ForReadMore with the single responsibility of interfacing with ReadMoreProc in Parse_SetInput. To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.127 src/usr.bin/make/for.c:1.128 --- src/usr.bin/make/for.c:1.127 Thu Dec 31 03:49:36 2020 +++ src/usr.bin/make/for.c Thu Dec 31 04:31:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.127 2020/12/31 03:49:36 rillig Exp $ */ +/* $NetBSD: for.c,v 1.128 2020/12/31 04:31:36 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.127 2020/12/31 03:49:36 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.128 2020/12/31 04:31:36 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -427,6 +427,33 @@ SubstVarShort(For *f, const char **pp, c } /* + * Compute the body for the current iteration by copying the unexpanded body, + * replacing the expressions for the iteration variables on the way. + */ +static void +ForSubstBody(For *f) +{ + const char *p; + const char *mark; /* where the last replacement left off */ + + Buf_Empty(&f->curBody); + + mark = f->body.data; + for (p = mark; (p = strchr(p, '$')) != NULL;) { + if (p[1] == '{' || p[1] == '(') { + p += 2; + SubstVarLong(f, &p, &mark, p[-1] == '{' ? '}' : ')'); + } else if (p[1] != '\0') { + p++; + SubstVarShort(f, &p, &mark); + } else + break; + } + + Buf_AddBytesBetween(&f->curBody, mark, f->body.data + f->body.len); +} + +/* * Scan the for loop body and replace references to the loop variables * with variable references that expand to the required text. * @@ -443,10 +470,6 @@ static char * ForReadMore(void *v_arg, size_t *out_len) { For *f = v_arg; - const char *p; - const char *mark; /* where the last replacement left off */ - const char *body_end; - char *cmds_str; if (f->sub_next == f->items.len) { /* No more iterations */ @@ -454,30 +477,12 @@ ForReadMore(void *v_arg, size_t *out_len return NULL; } - Buf_Empty(&f->curBody); - - mark = Buf_GetAll(&f->body, NULL); - body_end = mark + Buf_Len(&f->body); - for (p = mark; (p = strchr(p, '$')) != NULL;) { - if (p[1] == '{' || p[1] == '(') { - p += 2; - SubstVarLong(f, &p, &mark, p[-1] == '{' ? '}' : ')'); - } else if (p[1] != '\0') { - p++; - SubstVarShort(f, &p, &mark); - } else - break; - - } - Buf_AddBytesBetween(&f->curBody, mark, body_end); - - *out_len = Buf_Len(&f->curBody); - cmds_str = Buf_GetAll(&f->curBody, NULL); - DEBUG1(FOR, "For: loop body:\n%s", cmds_str); - + ForSubstBody(f); + DEBUG1(FOR, "For: loop body:\n%s", f->curBody.data); f->sub_next += f->vars.len; - return cmds_str; + *out_len = f->curBody.len; + return f->curBody.data; } /* Run the .for loop, imitating the actions of an include file. */
CVS commit: src/usr.bin/nl
Module Name:src Committed By: ginsbach Date: Thu Dec 31 04:07:37 UTC 2020 Modified Files: src/usr.bin/nl: nl.c Log Message: PR/55891 supress displaying separator when numbers supressed Fix based on patch provided by Kobayashi Takashi. This brings nl(1) further in to POSIX compliance. Verified behavior with classic SysV nl(1) and GNU nl(1). There could still be edge cases here not specified by POSIX. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/nl/nl.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/nl/nl.c diff -u src/usr.bin/nl/nl.c:1.14 src/usr.bin/nl/nl.c:1.15 --- src/usr.bin/nl/nl.c:1.14 Wed Dec 30 01:42:31 2020 +++ src/usr.bin/nl/nl.c Thu Dec 31 04:07:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nl.c,v 1.14 2020/12/30 01:42:31 ginsbach Exp $ */ +/* $NetBSD: nl.c,v 1.15 2020/12/31 04:07:37 ginsbach Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1999\ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: nl.c,v 1.14 2020/12/30 01:42:31 ginsbach Exp $"); +__RCSID("$NetBSD: nl.c,v 1.15 2020/12/31 04:07:37 ginsbach Exp $"); #endif #include @@ -332,13 +332,13 @@ filter(void) if (donumber) { consumed = snprintf(intbuffer, intbuffersize, format, width, line); - (void)printf("%s", - intbuffer + max(0, consumed - width)); + (void)printf("%s%s", + intbuffer + max(0, consumed - width), sep); line += incr; } else { - (void)printf("%*s", width, ""); + (void)printf("%*s%*s", width, "", (int)strlen(sep), ""); } - (void)printf("%s%s", sep, buffer); + (void)printf("%s", buffer); if (ferror(stdout)) err(EXIT_FAILURE, "output error");
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 03:49:36 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): rename ech to endc Focusing on the "end" is more important than on the data type "ch". To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.126 src/usr.bin/make/for.c:1.127 --- src/usr.bin/make/for.c:1.126 Thu Dec 31 03:33:10 2020 +++ src/usr.bin/make/for.c Thu Dec 31 03:49:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.126 2020/12/31 03:33:10 rillig Exp $ */ +/* $NetBSD: for.c,v 1.127 2020/12/31 03:49:36 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.126 2020/12/31 03:33:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.127 2020/12/31 03:49:36 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -325,16 +325,16 @@ NeedsEscapes(const char *word, char endc * The result is later unescaped by ApplyModifier_Defined. */ static void -Buf_AddEscaped(Buffer *cmds, const char *item, char ech) +Buf_AddEscaped(Buffer *cmds, const char *item, char endc) { char ch; - if (!NeedsEscapes(item, ech)) { + if (!NeedsEscapes(item, endc)) { Buf_AddStr(cmds, item); return; } - /* Escape ':', '$', '\\' and 'ech' - these will be removed later by + /* Escape ':', '$', '\\' and 'endc' - these will be removed later by * :U processing, see ApplyModifier_Defined. */ while ((ch = *item++) != '\0') { if (ch == '$') { @@ -345,7 +345,7 @@ Buf_AddEscaped(Buffer *cmds, const char continue; } Buf_AddByte(cmds, '\\'); - } else if (ch == ':' || ch == '\\' || ch == ech) + } else if (ch == ':' || ch == '\\' || ch == endc) Buf_AddByte(cmds, '\\'); Buf_AddByte(cmds, ch); } @@ -356,7 +356,7 @@ Buf_AddEscaped(Buffer *cmds, const char * expression like ${i} or ${i:...} or $(i) or $(i:...) with ":Uvalue". */ static void -SubstVarLong(For *f, const char **pp, const char **inout_mark, char ech) +SubstVarLong(For *f, const char **pp, const char **inout_mark, char endc) { size_t i; const char *p = *pp; @@ -370,7 +370,7 @@ SubstVarLong(For *f, const char **pp, co if (memcmp(p, varname, varnameLen) != 0) continue; /* XXX: why test for backslash here? */ - if (p[varnameLen] != ':' && p[varnameLen] != ech && + if (p[varnameLen] != ':' && p[varnameLen] != endc && p[varnameLen] != '\\') continue; @@ -378,7 +378,7 @@ SubstVarLong(For *f, const char **pp, co Buf_AddBytesBetween(&f->curBody, *inout_mark, p); Buf_AddStr(&f->curBody, ":U"); Buf_AddEscaped(&f->curBody, - f->items.words[f->sub_next + i], ech); + f->items.words[f->sub_next + i], endc); p += varnameLen; *inout_mark = p;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 03:33:10 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): inline variable in ForReadMore This variable was intended to help the compilers produce efficient code by avoiding a duplicate memory read. As it turned out, GCC 5.5 doesn't need this help, and probably newer compilers don't need it either. Well done, GCC, keeping track of the memory locations even if the pointer to it changes in the middle. To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.125 src/usr.bin/make/for.c:1.126 --- src/usr.bin/make/for.c:1.125 Thu Dec 31 03:19:00 2020 +++ src/usr.bin/make/for.c Thu Dec 31 03:33:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $ */ +/* $NetBSD: for.c,v 1.126 2020/12/31 03:33:10 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.126 2020/12/31 03:33:10 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -459,11 +459,10 @@ ForReadMore(void *v_arg, size_t *out_len mark = Buf_GetAll(&f->body, NULL); body_end = mark + Buf_Len(&f->body); for (p = mark; (p = strchr(p, '$')) != NULL;) { - char ch = p[1]; - if (ch == '{' || ch == '(') { + if (p[1] == '{' || p[1] == '(') { p += 2; - SubstVarLong(f, &p, &mark, ch == '{' ? '}' : ')'); - } else if (ch != '\0') { + SubstVarLong(f, &p, &mark, p[-1] == '{' ? '}' : ')'); + } else if (p[1] != '\0') { p++; SubstVarShort(f, &p, &mark); } else
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 03:19:01 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): clean up ForReadMore After the previous clean up in for.c 1.123 from 2020-12-30, GCC 5.5 did not inline the function SubstVarLong anymore since it was now called from 2 places. GCC didn't notice that the function call was essentially the same since in differed only in the end character. By combining the cases for ${V} and $(V), the code becomes even shorter than before, while still being understandable. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.124 src/usr.bin/make/for.c:1.125 --- src/usr.bin/make/for.c:1.124 Thu Dec 31 03:10:29 2020 +++ src/usr.bin/make/for.c Thu Dec 31 03:19:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $ */ +/* $NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.125 2020/12/31 03:19:00 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -459,13 +459,11 @@ ForReadMore(void *v_arg, size_t *out_len mark = Buf_GetAll(&f->body, NULL); body_end = mark + Buf_Len(&f->body); for (p = mark; (p = strchr(p, '$')) != NULL;) { - if (p[1] == '{') { + char ch = p[1]; + if (ch == '{' || ch == '(') { p += 2; - SubstVarLong(f, &p, &mark, '}'); - } else if (p[1] == '(') { - p += 2; - SubstVarLong(f, &p, &mark, ')'); - } else if (p[1] != '\0') { + SubstVarLong(f, &p, &mark, ch == '{' ? '}' : ')'); + } else if (ch != '\0') { p++; SubstVarShort(f, &p, &mark); } else
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 31 03:10:29 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): simplify termination condition for .for loop At this point, the number of iteration items is always a multiple of the number of iteration variables, which makes any addition more complicated than absolutely necessary. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.123 src/usr.bin/make/for.c:1.124 --- src/usr.bin/make/for.c:1.123 Wed Dec 30 14:28:32 2020 +++ src/usr.bin/make/for.c Thu Dec 31 03:10:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $ */ +/* $NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.124 2020/12/31 03:10:29 rillig Exp $"); static int forLevel = 0; /* Nesting level */ @@ -448,7 +448,7 @@ ForReadMore(void *v_arg, size_t *out_len const char *body_end; char *cmds_str; - if (f->sub_next + f->vars.len > f->items.len) { + if (f->sub_next == f->items.len) { /* No more iterations */ For_Free(f); return NULL;
CVS commit: src
Module Name:src Committed By: rillig Date: Thu Dec 31 03:05:12 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: directive-for-errors.exp directive-for-errors.mk directive-for-escape.exp directive-for-escape.mk Log Message: make(1): add test for error handling and expansion in .for loops To generate a diff of this commit: cvs rdiff -u -r1.1002 -r1.1003 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/directive-for-errors.exp \ src/usr.bin/make/unit-tests/directive-for-errors.mk \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/directive-for-escape.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1002 src/distrib/sets/lists/tests/mi:1.1003 --- src/distrib/sets/lists/tests/mi:1.1002 Wed Dec 30 14:50:08 2020 +++ src/distrib/sets/lists/tests/mi Thu Dec 31 03:05:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1002 2020/12/30 14:50:08 rillig Exp $ +# $NetBSD: mi,v 1.1003 2020/12/31 03:05:12 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5058,6 +5058,10 @@ ./usr/tests/usr.bin/make/unit-tests/directive-export-literal.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-export.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-export.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-for-errors.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-for-errors.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-for-escape.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-for-escape.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-for-generating-endif.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-for-generating-endif.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-for-lines.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.259 src/usr.bin/make/unit-tests/Makefile:1.260 --- src/usr.bin/make/unit-tests/Makefile:1.259 Wed Dec 30 14:50:08 2020 +++ src/usr.bin/make/unit-tests/Makefile Thu Dec 31 03:05:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.259 2020/12/30 14:50:08 rillig Exp $ +# $NetBSD: Makefile,v 1.260 2020/12/31 03:05:12 rillig Exp $ # # Unit tests for make(1) # @@ -162,6 +162,8 @@ TESTS+= directive-export-impl TESTS+= directive-export-gmake TESTS+= directive-export-literal TESTS+= directive-for +TESTS+= directive-for-errors +TESTS+= directive-for-escape TESTS+= directive-for-generating-endif TESTS+= directive-for-lines TESTS+= directive-for-null Added files: Index: src/usr.bin/make/unit-tests/directive-for-errors.exp diff -u /dev/null src/usr.bin/make/unit-tests/directive-for-errors.exp:1.1 --- /dev/null Thu Dec 31 03:05:12 2020 +++ src/usr.bin/make/unit-tests/directive-for-errors.exp Thu Dec 31 03:05:12 2020 @@ -0,0 +1,22 @@ +make: "directive-for-errors.mk" line 7: Unknown directive "fori" +make: "directive-for-errors.mk" line 8: warning: +make: "directive-for-errors.mk" line 9: for-less endfor +make: "directive-for-errors.mk" line 19: Unknown directive "for" +make: "directive-for-errors.mk" line 20: warning: +make: "directive-for-errors.mk" line 21: for-less endfor +make: "directive-for-errors.mk" line 37: Dollar $ 1 1 and backslash 2 2 2. +make: "directive-for-errors.mk" line 37: Dollar $ 3 3 and backslash 4 4 4. +make: "directive-for-errors.mk" line 43: no iteration variables in for +make: "directive-for-errors.mk" line 47: warning: Should not be reached. +make: "directive-for-errors.mk" line 48: for-less endfor +make: "directive-for-errors.mk" line 53: Wrong number of words (5) in .for substitution list with 3 variables +make: "directive-for-errors.mk" line 64: missing `in' in for +make: "directive-for-errors.mk" line 66: warning: Should not be reached. +make: "directive-for-errors.mk" line 67: for-less endfor +make: "directive-for-errors.mk" line 73: Unknown modifier 'Z' +make: "directive-for-errors.mk" line 74: warning: Should not be reached. +make: "directive-for-errors.mk" line 74: warning: Should not be reached. +make: "directive-for-errors.mk" line 74: warning: Should not be reached. +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/directive-for-
CVS commit: src/sys/arch/arm/imx
Module Name:src Committed By: uwe Date: Thu Dec 31 02:16:14 UTC 2020 Modified Files: src/sys/arch/arm/imx: if_enet.c Log Message: enet(4): fix refactoring accident. Spotted by mrg@. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/imx/if_enet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/imx/if_enet.c diff -u src/sys/arch/arm/imx/if_enet.c:1.32 src/sys/arch/arm/imx/if_enet.c:1.33 --- src/sys/arch/arm/imx/if_enet.c:1.32 Thu May 14 08:34:19 2020 +++ src/sys/arch/arm/imx/if_enet.c Thu Dec 31 02:16:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_enet.c,v 1.32 2020/05/14 08:34:19 msaitoh Exp $ */ +/* $NetBSD: if_enet.c,v 1.33 2020/12/31 02:16:14 uwe Exp $ */ /* * Copyright (c) 2014 Ryo Shimizu @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.32 2020/05/14 08:34:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.33 2020/12/31 02:16:14 uwe Exp $"); #include "vlan.h" @@ -1844,7 +1844,7 @@ enet_init_regs(struct enet_softc *sc, in sc->sc_rxdesc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE); /* enable interrupts */ - val = ENET_EIMR | ENET_EIR_TXF | ENET_EIR_RXF | ENET_EIR_EBERR; + val = ENET_EIR_TXF | ENET_EIR_RXF | ENET_EIR_EBERR; if (sc->sc_imxtype == 7) val |= ENET_EIR_TXF2 | ENET_EIR_RXF2 | ENET_EIR_TXF1 | ENET_EIR_RXF1;
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Wed Dec 30 15:12:38 UTC 2020 Modified Files: src/sys/arch/arm/nvidia [netbsd-9]: tegra_ahcisata.c src/sys/dev/ata [netbsd-9]: satareg.h src/sys/dev/ic [netbsd-9]: ahcisata_core.c ahcisatavar.h Log Message: Pull up following revision(s) (requested by jmcneill in ticket #1167): sys/dev/ic/ahcisata_core.c: revision 1.84 sys/dev/ic/ahcisata_core.c: revision 1.85 sys/dev/ic/ahcisata_core.c: revision 1.88 sys/dev/ic/ahcisata_core.c: revision 1.89 sys/arch/arm/nvidia/tegra_ahcisata.c: revision 1.13 sys/dev/ic/ahcisatavar.h: revision 1.26 sys/dev/ic/ahcisata_core.c: revision 1.90 sys/dev/ic/ahcisata_core.c: revision 1.91 sys/dev/ic/ahcisata_core.c: revision 1.92 sys/dev/ata/satareg.h: revision 1.6 ahci_exec_fis: wait for the correct amount of time when AT_WAIT is set Retry clearing WDCTL_RST a few times before giving up. Makes SATA work in Solidrun Honeycomb LX2K. AHCI 1.3.1 specification says that it is good practice for system software to 'zero-out' the memory allocated and referenced by PxCLB and PxFB. ahci_intr: use ffs in the port bitmask instead of looping over all 32 bits AHCI 1.3.1 section 5.5.3 "Processing Completed Commands" says that we should clear PxIS before IS.IPS. Add G3 and DevSleep definitions. This changes the mask used by SControl_IPM_NONE from 0x3 to 0x7. Make sure to ack IS after PxIS when polling and when using multiple MSI-X messages. Remove the AHCI_QUIRK_SKIP_RESET quirk now that the underlying issue is fixed. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.4.1 src/sys/arch/arm/nvidia/tegra_ahcisata.c cvs rdiff -u -r1.5 -r1.5.94.1 src/sys/dev/ata/satareg.h cvs rdiff -u -r1.75.4.3 -r1.75.4.4 src/sys/dev/ic/ahcisata_core.c cvs rdiff -u -r1.22.4.1 -r1.22.4.2 src/sys/dev/ic/ahcisatavar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/nvidia/tegra_ahcisata.c diff -u src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.12 src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.12.4.1 --- src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.12 Fri Dec 14 12:29:22 2018 +++ src/sys/arch/arm/nvidia/tegra_ahcisata.c Wed Dec 30 15:12:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_ahcisata.c,v 1.12 2018/12/14 12:29:22 skrll Exp $ */ +/* $NetBSD: tegra_ahcisata.c,v 1.12.4.1 2020/12/30 15:12:38 martin Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.12 2018/12/14 12:29:22 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.12.4.1 2020/12/30 15:12:38 martin Exp $"); #include #include @@ -202,7 +202,6 @@ tegra_ahcisata_attach(device_t parent, d aprint_error(": couldn't map ahci registers: %d\n", error); return; } - sc->sc.sc_ahci_quirks = AHCI_QUIRK_SKIP_RESET; aprint_naive("\n"); aprint_normal(": SATA\n"); Index: src/sys/dev/ata/satareg.h diff -u src/sys/dev/ata/satareg.h:1.5 src/sys/dev/ata/satareg.h:1.5.94.1 --- src/sys/dev/ata/satareg.h:1.5 Mon Apr 28 20:23:47 2008 +++ src/sys/dev/ata/satareg.h Wed Dec 30 15:12:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: satareg.h,v 1.5 2008/04/28 20:23:47 martin Exp $ */ +/* $NetBSD: satareg.h,v 1.5.94.1 2020/12/30 15:12:38 martin Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ #define SStatus_SPD_NONE (0x0 << 4) /* no negotiated speed */ #define SStatus_SPD_G1 (0x1 << 4) /* Generation 1 (1.5Gb/s) */ #define SStatus_SPD_G2 (0x2 << 4) /* Generation 2 (3.0Gb/s) */ +#define SStatus_SPD_G3 (0x3 << 4) /* Generation 3 (6.0Gb/s) */ #define SStatus_SPD_mask (0xf << 4) #define SStatus_SPD_shift 4 /* @@ -75,6 +76,7 @@ #define SStatus_IPM_ACTIVE (0x1 << 8) /* ACTIVE state */ #define SStatus_IPM_PARTIAL (0x2 << 8) /* PARTIAL pm state */ #define SStatus_IPM_SLUMBER (0x6 << 8) /* SLUMBER pm state */ +#define SStatus_IPM_DEVSLEEP (0x8 << 8) /* DevSleep pm state */ #define SStatus_IPM_mask (0xf << 8) #define SStatus_IPM_shift 8 @@ -130,6 +132,7 @@ #define SControl_SPD_ANY (0x0 << 4) /* No restrictions */ #define SControl_SPD_G1 (0x1 << 4) /* Generation 1 (1.5Gb/s) */ #define SControl_SPD_G2 (0x2 << 4) /* Generation 2 (3.0Gb/s) */ +#define SControl_SPD_G3 (0x3 << 4) /* Generation 3 (6.0Gb/s) */ /* * The IPM field represents the enabled interface power management * states that can be invoked via the Serial ATA interface power @@ -138,7 +141,8 @@ #define SControl_IPM_ANY (0x0 << 8) /* No restrictions */ #define SControl_IPM_NOPARTIAL (0x1 << 8) /* PARTIAL disabled */ #define SControl_IPM_NOSLUMBER (0x2 << 8) /* SLUMBER disabled */ -#define SControl_IPM_NONE (0x3 << 8) /* No power management */ +#define SControl_IPM_NODEVSLEEP (0x4 << 8) /* DevSleep disabled */ +#define SControl_IPM_NONE (0x7 << 8) /* No power management */ /* * The SPM f
CVS commit: src
Module Name:src Committed By: rillig Date: Wed Dec 30 14:50:08 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: directive-endfor.exp directive-endfor.mk Log Message: make(1): add test for .endfor without corresponding .for To generate a diff of this commit: cvs rdiff -u -r1.1001 -r1.1002 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.258 -r1.259 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/directive-endfor.exp \ src/usr.bin/make/unit-tests/directive-endfor.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1001 src/distrib/sets/lists/tests/mi:1.1002 --- src/distrib/sets/lists/tests/mi:1.1001 Wed Dec 30 13:15:07 2020 +++ src/distrib/sets/lists/tests/mi Wed Dec 30 14:50:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1001 2020/12/30 13:15:07 rillig Exp $ +# $NetBSD: mi,v 1.1002 2020/12/30 14:50:08 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5042,6 +5042,8 @@ ./usr/tests/usr.bin/make/unit-tests/directive-elifnmake.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-else.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-else.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-endfor.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-endfor.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-endif.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-endif.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-error.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.258 src/usr.bin/make/unit-tests/Makefile:1.259 --- src/usr.bin/make/unit-tests/Makefile:1.258 Tue Dec 29 01:45:06 2020 +++ src/usr.bin/make/unit-tests/Makefile Wed Dec 30 14:50:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.258 2020/12/29 01:45:06 rillig Exp $ +# $NetBSD: Makefile,v 1.259 2020/12/30 14:50:08 rillig Exp $ # # Unit tests for make(1) # @@ -153,6 +153,7 @@ TESTS+= directive-elifmake TESTS+= directive-elifndef TESTS+= directive-elifnmake TESTS+= directive-else +TESTS+= directive-endfor TESTS+= directive-endif TESTS+= directive-error TESTS+= directive-export Added files: Index: src/usr.bin/make/unit-tests/directive-endfor.exp diff -u /dev/null src/usr.bin/make/unit-tests/directive-endfor.exp:1.1 --- /dev/null Wed Dec 30 14:50:08 2020 +++ src/usr.bin/make/unit-tests/directive-endfor.exp Wed Dec 30 14:50:08 2020 @@ -0,0 +1,4 @@ +make: "directive-endfor.mk" line 9: for-less endfor +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/directive-endfor.mk diff -u /dev/null src/usr.bin/make/unit-tests/directive-endfor.mk:1.1 --- /dev/null Wed Dec 30 14:50:08 2020 +++ src/usr.bin/make/unit-tests/directive-endfor.mk Wed Dec 30 14:50:08 2020 @@ -0,0 +1,9 @@ +# $NetBSD: directive-endfor.mk,v 1.1 2020/12/30 14:50:08 rillig Exp $ +# +# Test for the directive .endfor, which ends a .for loop. +# +# See also: +# directive-for.mk + +# An .endfor without a corresponding .for is a parse error. +.endfor
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Dec 30 14:28:32 UTC 2020 Modified Files: src/usr.bin/make: for.c Log Message: make(1): improve .for loop documentation, clean up ForReadMore The comma expression in ForReadMore may be a nice trick, but it's not as easy to read as a simple if-then-else chain. Test for '{' before '(' since BSD makefiles use braces by convention. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/usr.bin/make/for.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/for.c diff -u src/usr.bin/make/for.c:1.122 src/usr.bin/make/for.c:1.123 --- src/usr.bin/make/for.c:1.122 Wed Dec 30 10:03:16 2020 +++ src/usr.bin/make/for.c Wed Dec 30 14:28:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.122 2020/12/30 10:03:16 rillig Exp $ */ +/* $NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -32,24 +32,22 @@ /*- * Handling of .for/.endfor loops in a makefile. * - * For loops are of the form: + * For loops have the form: * - * .for in - * ... - * .endfor - * - * When a .for line is parsed, all following lines are accumulated into a - * buffer, up to but excluding the corresponding .endfor line. To find the - * corresponding .endfor, the number of nested .for and .endfor directives - * are counted. - * - * During parsing, any nested .for loops are just passed through; they get - * handled recursively in For_Eval when the enclosing .for loop is evaluated - * in For_Run. - * - * When the .for loop has been parsed completely, the variable expressions - * for the iteration variables are replaced with expressions of the form - * ${:Uvalue}, and then this modified body is "included" as a special file. + * .for in + * # the body + * .endfor + * + * When a .for line is parsed, the following lines are copied to the body of + * the .for loop, until the corresponding .endfor line is reached. In this + * phase, the body is not yet evaluated. This also applies to any nested + * .for loops. + * + * After reaching the .endfor, the values from the .for line are grouped + * according to the number of variables. For each such group, the unexpanded + * body is scanned for variable expressions, and those that match the variable + * names are replaced with expressions of the form ${:U...} or $(:U...). + * After that, the body is treated like a file from an .include directive. * * Interface: * For_Eval Evaluate the loop in the passed line. @@ -60,14 +58,14 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.122 2020/12/30 10:03:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.123 2020/12/30 14:28:32 rillig Exp $"); static int forLevel = 0; /* Nesting level */ /* One of the variables to the left of the "in" in a .for loop. */ typedef struct ForVar { char *name; - size_t len; + size_t nameLen; } ForVar; /* @@ -92,7 +90,7 @@ ForAddVar(For *f, const char *name, size { ForVar *var = Vector_Push(&f->vars); var->name = bmake_strldup(name, len); - var->len = len; + var->nameLen = len; } static void @@ -354,8 +352,8 @@ Buf_AddEscaped(Buffer *cmds, const char } /* - * While expanding the body of a .for loop, replace expressions like - * ${i}, ${i:...}, $(i) or $(i:...) with their ${:U...} expansion. + * While expanding the body of a .for loop, replace the inner part of an + * expression like ${i} or ${i:...} or $(i) or $(i:...) with ":Uvalue". */ static void SubstVarLong(For *f, const char **pp, const char **inout_mark, char ech) @@ -365,14 +363,15 @@ SubstVarLong(For *f, const char **pp, co for (i = 0; i < f->vars.len; i++) { ForVar *forVar = Vector_Get(&f->vars, i); - char *var = forVar->name; - size_t vlen = forVar->len; + char *varname = forVar->name; + size_t varnameLen = forVar->nameLen; - /* XXX: undefined behavior for p if vlen is longer than p? */ - if (memcmp(p, var, vlen) != 0) + /* XXX: undefined behavior for p if varname is longer than p? */ + if (memcmp(p, varname, varnameLen) != 0) continue; /* XXX: why test for backslash here? */ - if (p[vlen] != ':' && p[vlen] != ech && p[vlen] != '\\') + if (p[varnameLen] != ':' && p[varnameLen] != ech && + p[varnameLen] != '\\') continue; /* Found a variable match. Replace with :U */ @@ -381,7 +380,7 @@ SubstVarLong(For *f, const char **pp, co Buf_AddEscaped(&f->curBody, f->items.words[f->sub_next + i], ech); - p += vlen; + p += varnameLen; *inout_mark = p; break; } @@ -394,9 +393,10 @@ SubstVarLong(For *f, const char **pp, co * variable expressions like $i with their ${:U...} expansion. */ static void -SubstVarShort(For *f, char ch, const char **pp, const char **inout_mark) +SubstVarShort(For *f, const char **pp, const char **inout_mark) { const char *p = *pp; + const char ch = *
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 13:42:19 UTC 2020 Modified Files: src/tests/usr.bin/xlint/lint1: t_integration.sh Log Message: lint: remove a bit of redundancy from the test suite To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/t_integration.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.13 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.14 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.13 Wed Dec 30 13:15:07 2020 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Wed Dec 30 13:42:19 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.13 2020/12/30 13:15:07 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.14 2020/12/30 13:42:19 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -83,13 +83,11 @@ test_case c99_struct_init test_case c99_union_init1 test_case c99_union_init2 test_case c99_union_init3 -test_case c99_recursive_init "Checks C99 recursive struct/union" \ -"initialization" -test_case c9x_recursive_init "Checks C9X struct/union member" \ -"init, with nested union and trailing member" +test_case c99_recursive_init +test_case c9x_recursive_init test_case nested_structs test_case packed_structs -test_case struct_init_nested "Initialization of nested structures" +test_case struct_init_nested test_case cast_init test_case cast_init2 "Checks cast initialization as the rhs of a" \ @@ -139,7 +137,7 @@ test_case type_conv2 "Checks failing on test_case type_conv3 "Checks failing on information-losing" \ "type conversion in argument lists" -test_case incorrect_array_size "Checks failing on incorrect array sizes" +test_case incorrect_array_size test_case long_double_int "Checks for confusion of 'long double' with" \ "'long int'; PR bin/39639"
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 13:41:27 UTC 2020 Modified Files: src/tests/usr.bin/xlint/lint1: d_struct_init_nested.c d_struct_init_nested.exp Log Message: lint: document purpose of the test d_struct_init_nested To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c \ src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c diff -u src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c:1.1 src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c:1.2 --- src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c:1.1 Mon Dec 28 10:22:21 2020 +++ src/tests/usr.bin/xlint/lint1/d_struct_init_nested.c Wed Dec 30 13:41:27 2020 @@ -1,5 +1,12 @@ # 2 "d_struct_init_nested.c" +/* + * Initialization of a nested struct, in which some parts are initialized + * from non-constant expressions of the inner struct type. + * + * In C99, 6.7.8p13 describes exactly this case. + */ + typedef enum O1 { O1C = 101 } O1; typedef enum O2 { O2C = 102 } O2; typedef enum O3 { O3C = 103 } O3; Index: src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp diff -u src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp:1.1 src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp:1.2 --- src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp:1.1 Mon Dec 28 10:26:23 2020 +++ src/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp Wed Dec 30 13:41:27 2020 @@ -1,4 +1,4 @@ -d_struct_init_nested.c(27): initialisation type mismatch (enum I1) and (struct Inner1) [185] -d_struct_init_nested.c(29): too many struct/union initializers [172] -d_struct_init_nested.c(54): initialisation type mismatch (enum I1) and (struct Inner2) [185] -d_struct_init_nested.c(56): warning: enum type mismatch in initialisation [210] +d_struct_init_nested.c(34): initialisation type mismatch (enum I1) and (struct Inner1) [185] +d_struct_init_nested.c(36): too many struct/union initializers [172] +d_struct_init_nested.c(61): initialisation type mismatch (enum I1) and (struct Inner2) [185] +d_struct_init_nested.c(63): warning: enum type mismatch in initialisation [210]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 13:17:42 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h func.c Log Message: lint: split cluparg into separate functions That function did more than its short name could express, and the things it did were not related in any way. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.86 -r1.87 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.37 -r1.38 src/usr.bin/xlint/lint1/func.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/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.121 src/usr.bin/xlint/lint1/cgram.y:1.122 --- src/usr.bin/xlint/lint1/cgram.y:1.121 Wed Dec 30 10:56:51 2020 +++ src/usr.bin/xlint/lint1/cgram.y Wed Dec 30 13:17:42 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.121 2020/12/30 10:56:51 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.122 2020/12/30 13:17:42 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.121 2020/12/30 10:56:51 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.122 2020/12/30 13:17:42 rillig Exp $"); #endif #include @@ -429,7 +429,8 @@ func_def: } opt_arg_declaration_list { popdecl(); blklev--; - cluparg(); + check_func_lint_directives(); + check_func_old_style_arguments(); pushctrl(0); } comp_stmnt { funcend(); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.86 src/usr.bin/xlint/lint1/decl.c:1.87 --- src/usr.bin/xlint/lint1/decl.c:1.86 Wed Dec 30 11:56:10 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 13:17:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.86 2020/12/30 11:56:10 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.87 2020/12/30 13:17:42 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.86 2020/12/30 11:56:10 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.87 2020/12/30 13:17:42 rillig Exp $"); #endif #include @@ -2392,22 +2392,12 @@ decl1arg(sym_t *sym, int initflg) return sym; } -/* - * Does some checks for lint directives which apply to functions. - * Processes arguments in old style function definitions which default - * to int. - * Checks compatiblility of old style function definition with previous - * prototype. - */ void -cluparg(void) +check_func_lint_directives(void) { - sym_t *args, *arg, *pargs, *parg; - int narg, nparg, n, msg; - tspec_t t; - - args = funcsym->s_args; - pargs = funcsym->s_type->t_args; + sym_t *arg; + int narg, n; + tspec_t t; /* check for illegal combinations of lint directives */ if (prflstrg != -1 && scflstrg != -1) { @@ -2465,6 +2455,21 @@ cluparg(void) prflstrg = scflstrg = -1; } } +} + +/* + * Warn about arguments in old style function definitions that default to int. + * Check that an old style function definition is compatible to a previous + * prototype. + */ +void +check_func_old_style_arguments(void) +{ + sym_t *args, *arg, *pargs, *parg; + int narg, nparg, msg; + + args = funcsym->s_args; + pargs = funcsym->s_type->t_args; /* * print a warning for each argument of an old style function @@ -2514,9 +2519,7 @@ cluparg(void) /* from now on the prototype is valid */ funcsym->s_osdef = 0; funcsym->s_args = NULL; - } - } /* Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.41 src/usr.bin/xlint/lint1/externs1.h:1.42 --- src/usr.bin/xlint/lint1/externs1.h:1.41 Wed Dec 30 01:33:30 2020 +++ src/usr.bin/xlint/lint1/externs1.h Wed Dec 30 13:17:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.41 2020/12/30 01:33:30 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.42 2020/12/30 13:17:42 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -178,7 +178,9 @@ extern int eqptrtype(type_t *, type_t *, extern int eqtype(type_t *, type_t *, int, int, int *); extern void complete_type(sym_t *, sym_t *); extern sym_t *decl1arg(sym_t *, int); -extern void cluparg(void); +extern void check_func_lint_directives(void); +extern void check_func_old_style_arguments(void); + extern void decl1loc(sym_t *, int); extern sym_t *abstract_name(void); extern void global_clean_up(void); Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.37 src/usr.bin/xlint/lint1/func.c:1.38 --- src/usr.bin/xlint/lint1/func.c:1.37 Wed Dec 30 11:56:10 2020 +++ src/usr.bin/xlint/lint1/func.c Wed Dec 30 13:17:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.37 2020/12/30 11:56:10 rillig Exp $ */ +/* $NetBSD: func.c,v 1.38 2020/12/30 13:17:42 rillig Exp $ */ /* * Copyright (c
CVS commit: src
Module Name:src Committed By: rillig Date: Wed Dec 30 13:15:07 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh Added Files: src/tests/usr.bin/xlint/lint1: d_decl_old_style_arguments.c d_decl_old_style_arguments.exp Log Message: lint: add test for old style function arguments To generate a diff of this commit: cvs rdiff -u -r1.1000 -r1.1001 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.20 -r1.21 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 \ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c \ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.exp cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/t_integration.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1000 src/distrib/sets/lists/tests/mi:1.1001 --- src/distrib/sets/lists/tests/mi:1.1000 Tue Dec 29 01:45:06 2020 +++ src/distrib/sets/lists/tests/mi Wed Dec 30 13:15:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1000 2020/12/29 01:45:06 rillig Exp $ +# $NetBSD: mi,v 1.1001 2020/12/30 13:15:07 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5773,6 +5773,8 @@ ./usr/tests/usr.bin/xlint/lint1/d_cvt_constant.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_cvt_constant.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_cvt_in_ternary.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_ellipsis_in_switch.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.20 src/tests/usr.bin/xlint/lint1/Makefile:1.21 --- src/tests/usr.bin/xlint/lint1/Makefile:1.20 Mon Dec 28 12:47:39 2020 +++ src/tests/usr.bin/xlint/lint1/Makefile Wed Dec 30 13:15:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.20 2020/12/28 12:47:39 rillig Exp $ +# $NetBSD: Makefile,v 1.21 2020/12/30 13:15:07 rillig Exp $ NOMAN= # defined @@ -47,6 +47,8 @@ FILES+= d_constant_conv2.exp FILES+= d_cvt_constant.c FILES+= d_cvt_constant.exp FILES+= d_cvt_in_ternary.c +FILES+= d_decl_old_style_arguments.c +FILES+= d_decl_old_style_arguments.exp FILES+= d_ellipsis_in_switch.c FILES+= d_gcc_compound_statements1.c FILES+= d_gcc_compound_statements2.c @@ -76,4 +78,18 @@ FILES+= d_typefun.c FILES+= d_typename_as_var.c FILES+= d_zero_sized_arrays.c +# Note: only works for adding tests. +# To remove a test, the $$mi file must be edited manually. +sync-mi: .PHONY + @set -eu; \ + cd "${MAKEFILE:tA:H}/../../../..";\ + mi="distrib/sets/lists/tests/mi";\ + cvs update "$$mi"; \ + fmt="./usr/tests/usr.bin/xlint/lint1/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ + cat "$$mi" > "$$mi.tmp"; \ + printf "$$fmt" ${FILES:M*.c} ${FILES:M*.exp} >> "$$mi.tmp"; \ + distrib/sets/fmt-list "$$mi.tmp";\ + mv "$$mi.tmp" "$$mi"; \ + cvs diff "$$mi" || true + .include Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.12 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.13 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.12 Mon Dec 28 17:00:37 2020 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Wed Dec 30 13:15:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.12 2020/12/28 17:00:37 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.13 2020/12/30 13:15:07 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -73,6 +73,7 @@ test_case c99_union_cast test_case c99_union_init4 test_case cast_fun_array_param test_case cast_typeof +test_case decl_old_style_arguments test_case gcc_extension test_case type_question_colon test_case typefun Added files: Index: src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c:1.1 --- /dev/null Wed Dec 30 13:15:07 2020 +++ src/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c Wed Dec 30 13:15:07 2020 @@ -0,0 +1,15 @@ +# 2 "d_decl_old_style_arguments.c" + +/* + * A function is declared with a prototype, followed by an old style definition + * that is completely different. + */ + +void func(int a, int b, int c); + +void func(num, ptr, dbl, def) +int num; +char *ptr; +double dbl; +{ +} Index: src/t
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 12:22:52 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: replace LERROR with lint_assert This removes the redundancy of mentioning the function name in the error message. This redundancy had been correct in all but 2 cases: build_real_imag and tsize. To generate a diff of this commit: cvs rdiff -u -r1.106 -r1.107 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.106 src/usr.bin/xlint/lint1/tree.c:1.107 --- src/usr.bin/xlint/lint1/tree.c:1.106 Wed Dec 30 11:56:10 2020 +++ src/usr.bin/xlint/lint1/tree.c Wed Dec 30 12:22:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.106 2020/12/30 11:56:10 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.107 2020/12/30 12:22:51 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.106 2020/12/30 11:56:10 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.107 2020/12/30 12:22:51 rillig Exp $"); #endif #include @@ -595,8 +595,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) break; default: rtp = mp->m_logical ? gettyp(INT) : ln->tn_type; - if (!mp->m_binary && rn != NULL) - LERROR("build()"); + lint_assert(mp->m_binary || rn == NULL); ntn = new_tnode(op, rtp, ln, rn); break; } @@ -703,14 +702,12 @@ typeok(op_t op, int arg, tnode_t *ln, tn mp = &modtab[op]; - if ((ltp = ln->tn_type) == NULL) - LERROR("typeok()"); + lint_assert((ltp = ln->tn_type) != NULL); if ((lt = ltp->t_tspec) == PTR) lst = (lstp = ltp->t_subt)->t_tspec; if (mp->m_binary) { - if ((rtp = rn->tn_type) == NULL) - LERROR("typeok()"); + lint_assert((rtp = rn->tn_type) != NULL); if ((rt = rtp->t_tspec) == PTR) rst = (rstp = rtp->t_subt)->t_tspec; } @@ -984,8 +981,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn } while (rn->tn_op == CVT) rn = rn->tn_left; - if (rn->tn_op != COLON) - LERROR("typeok()"); + lint_assert(rn->tn_op == COLON); break; case COLON: if (tspec_is_arith(lt) && tspec_is_arith(rt)) @@ -1505,13 +1501,10 @@ new_tnode(op_t op, type_t *type, tnode_t #endif case STAR: case FSEL: - if (ln->tn_type->t_tspec == PTR) { - t = ln->tn_type->t_subt->t_tspec; - if (t != FUNC && t != VOID) -ntn->tn_lvalue = 1; - } else { - LERROR("new_tnode()"); - } + lint_assert(ln->tn_type->t_tspec == PTR); + t = ln->tn_type->t_subt->t_tspec; + if (t != FUNC && t != VOID) + ntn->tn_lvalue = 1; break; default: break; @@ -1550,8 +1543,7 @@ promote(op_t op, int farg, tnode_t *tn) if (size(INT) > len) { t = INT; } else { -if (size(INT) != len) - LERROR("promote()"); +lint_assert(len == size(INT)); if (tspec_is_uint(t)) { t = UINT; } else { @@ -1987,11 +1979,10 @@ cvtcon(op_t op, int arg, type_t *tp, val case LCOMPLEX: max = LDBL_MAX; min = -LDBL_MAX; break; default: - LERROR("cvtcon()"); + lint_assert(0); } if (v->v_ldbl > max || v->v_ldbl < min) { - if (nt == LDOUBLE) -LERROR("cvtcon()"); + lint_assert(nt != LDOUBLE); if (op == FARG) { /* conv. of %s to %s is out of rng., arg #%d */ warning(295, @@ -2245,8 +2236,8 @@ warn_incompatible_pointers(mod_t *mp, ty { tspec_t lt, rt; - if (ltp->t_tspec != PTR || rtp->t_tspec != PTR) - LERROR("warn_incompatible_pointers()"); + lint_assert(ltp->t_tspec == PTR); + lint_assert(rtp->t_tspec == PTR); lt = ltp->t_subt->t_tspec; rt = rtp->t_subt->t_tspec; @@ -2278,10 +2269,9 @@ static void merge_qualifiers(type_t **tpp, type_t *tp1, type_t *tp2) { - if ((*tpp)->t_tspec != PTR || - tp1->t_tspec != PTR || tp2->t_tspec != PTR) { - LERROR("merge_qualifiers()"); - } + lint_assert((*tpp)->t_tspec == PTR); + lint_assert(tp1->t_tspec == PTR); + lint_assert(tp2->t_tspec == PTR); if ((*tpp)->t_subt->t_const == (tp1->t_subt->t_const | tp2->t_subt->t_const) && @@ -2308,8 +2298,8 @@ has_constant_member(type_t *tp) sym_t *m; tspec_t t; - if ((t = tp->t_tspec) != STRUCT && t != UNION) - LERROR("has_constant_member()"); + lint_assert((t = tp->t_tspec) == STRUCT || t == UNION); + for (m = tp->t_str->memb; m != NULL; m = m->s_next) { tp = m->s_type; if (tp->t_const) @@ -2331,12 +2321,9 @@ build_struct_access(op_t op, tnode_t *ln tnode_t *ntn, *ctn; int nolval; - if (rn->tn_op != NAME) - LERROR("build_struct_access()"); - if (rn->tn_sym->s_value.v_tspec != INT) - LERROR("build_struct_access()"); - if (rn->tn_sym->s_scl != MOS && rn->tn_sym->s_scl != MOU) - LERROR("build_struct_access()"); + lint_assert(rn->tn_op == NAME); + lint_assert(rn->tn_sym->s_value.v_tspec == INT); + lint_assert(rn->tn_sym->s_scl == MOS || rn->tn_sym->s_scl == MOU); /* * Remember if the left operand is an
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 11:56:10 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: decl.c func.c scan.l tree.c Log Message: lint: spell check comments To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.104 -r1.105 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.105 -r1.106 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.85 src/usr.bin/xlint/lint1/decl.c:1.86 --- src/usr.bin/xlint/lint1/decl.c:1.85 Wed Dec 30 11:39:55 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 11:56:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.85 2020/12/30 11:39:55 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.86 2020/12/30 11:56:10 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.85 2020/12/30 11:39:55 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.86 2020/12/30 11:56:10 rillig Exp $"); #endif #include @@ -473,7 +473,7 @@ tdeferr(type_t *td, tspec_t t) * or enum tag if the typedef name is the first defined for this tag. * * If the tag is unnamed, the typdef name is used for identification - * of this tag in lint2. Although its possible that more than one typedef + * of this tag in lint2. Although it's possible that more than one typedef * name is defined for one tag, the first name defined should be unique * if the tag is unnamed. */ @@ -1172,7 +1172,7 @@ declarator_1_struct_union(sym_t *dsym) /* * bit-fields of length 0 are not warned about because length() * does not return the length of the bit-field but the length - * of the type the bit-field is packed in (its ok) + * of the type the bit-field is packed in (it's ok) */ if ((sz = length(dsym->s_type, dsym->s_name)) == 0) { if (t == ARRAY && dsym->s_type->t_dim == 0) { @@ -1460,7 +1460,7 @@ old_style_function(sym_t *decl, sym_t *a decl->s_type == dcs->d_next->d_type) { /* * We assume that this becomes a function definition. If - * we are wrong, its corrected in check_function_definition(). + * we are wrong, it's corrected in check_function_definition(). */ if (args != NULL) { decl->s_osdef = 1; @@ -1475,7 +1475,7 @@ old_style_function(sym_t *decl, sym_t *a /* * Lists of Identifiers in functions declarations are allowed only if - * its also a function definition. If this is not the case, print a + * it's also a function definition. If this is not the case, print a * error message. */ void @@ -2072,7 +2072,7 @@ check_redeclaration(sym_t *dsym, int *do return(0); } /* - * Now its on of: + * Now it's one of: * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;" */ /* redeclaration of %s; ANSI C requires "static" */ @@ -2646,7 +2646,7 @@ decl1loc(sym_t *dsym, int initflg) } else if (dcs->d_rdcsym->s_blklev == blklev) { - /* no hflag, because its illegal! */ + /* no hflag, because it's illegal! */ if (dcs->d_rdcsym->s_arg) { /* * if !tflag, a "redeclaration of %s" error Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.36 src/usr.bin/xlint/lint1/func.c:1.37 --- src/usr.bin/xlint/lint1/func.c:1.36 Wed Dec 30 11:39:55 2020 +++ src/usr.bin/xlint/lint1/func.c Wed Dec 30 11:56:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.36 2020/12/30 11:39:55 rillig Exp $ */ +/* $NetBSD: func.c,v 1.37 2020/12/30 11:56:10 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.36 2020/12/30 11:39:55 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.37 2020/12/30 11:56:10 rillig Exp $"); #endif #include @@ -597,8 +597,8 @@ switch1(tnode_t *tn) } /* - * Remember the type of the expression. Because its possible - * that (*tp) is allocated on tree memory the type must be + * Remember the type of the expression. Because it's possible + * that (*tp) is allocated on tree memory, the type must be * duplicated. This is not too complicated because it is * only an integer type. */ Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.104 src/usr.bin/xlint/lint1/scan.l:1.105 --- src/usr.bin/xlint/lint1/scan.l:1.104 Wed Dec 30 11:14:03 2020 +++ src/usr.bin/xlint/lint1/scan.l Wed Dec 30 11:56:10 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.104 2020/12/30 11:14:03 rillig Exp $ */ +/* $NetBSD: scan.l,v 1.105 2020/12/30 11:56:10 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD:
CVS commit: src/usr.bin/xlint/common
Module Name:src Committed By: rillig Date: Wed Dec 30 11:47:16 UTC 2020 Modified Files: src/usr.bin/xlint/common: emit.c Log Message: lint: fix Clang-tidy warning about narrowing conversion To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/emit.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/xlint/common/emit.c diff -u src/usr.bin/xlint/common/emit.c:1.8 src/usr.bin/xlint/common/emit.c:1.9 --- src/usr.bin/xlint/common/emit.c:1.8 Wed Dec 30 10:46:11 2020 +++ src/usr.bin/xlint/common/emit.c Wed Dec 30 11:47:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $ */ +/* $NetBSD: emit.c,v 1.9 2020/12/30 11:47:15 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $"); +__RCSID("$NetBSD: emit.c,v 1.9 2020/12/30 11:47:15 rillig Exp $"); #endif #include @@ -133,7 +133,7 @@ outchar(int c) } /* - * write a character to the output buffer, qouted if necessary + * write a character to the output buffer, quoted if necessary */ void outqchar(int c) @@ -175,8 +175,8 @@ outqchar(int c) outchar('a'); break; default: - outcharu_int)c >> 6) & 07) + '0'); - outcharu_int)c >> 3) & 07) + '0'); + outcharunsigned char)c >> 6) & 07) + '0'); + outcharunsigned char)c >> 3) & 07) + '0'); outchar((c & 07) + '0'); break; }
CVS commit: src/usr.bin/xlint/common
Module Name:src Committed By: rillig Date: Wed Dec 30 11:43:13 UTC 2020 Modified Files: src/usr.bin/xlint/common: param.h Log Message: lint: remove unused macro STRBLEN To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/common/param.h diff -u src/usr.bin/xlint/common/param.h:1.7 src/usr.bin/xlint/common/param.h:1.8 --- src/usr.bin/xlint/common/param.h:1.7 Wed Dec 30 11:39:55 2020 +++ src/usr.bin/xlint/common/param.h Wed Dec 30 11:43:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.7 2020/12/30 11:39:55 rillig Exp $ */ +/* $NetBSD: param.h,v 1.8 2020/12/30 11:43:13 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -32,12 +32,6 @@ */ /* - * Minimun size of string buffer. If this is not enough, the buffer - * is enlarged in steps of STRBLEN bytes. - */ -#define STRBLEN 256 - -/* * The size of memory blocks which are used to allocate memory in larger * chunks. */
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Wed Dec 30 11:39:55 UTC 2020 Modified Files: src/usr.bin/xlint/common: inittyp.c param.h src/usr.bin/xlint/lint1: decl.c func.c lint1.h mkops src/usr.bin/xlint/lint2: read.c Log Message: lint: inline STRUCT_ASSIGN This had only been necessary for some pre-C90 compilers. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/common/inittyp.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/common/param.h cvs rdiff -u -r1.84 -r1.85 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint1/mkops cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/lint2/read.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/xlint/common/inittyp.c diff -u src/usr.bin/xlint/common/inittyp.c:1.12 src/usr.bin/xlint/common/inittyp.c:1.13 --- src/usr.bin/xlint/common/inittyp.c:1.12 Fri Sep 7 15:16:15 2018 +++ src/usr.bin/xlint/common/inittyp.c Wed Dec 30 11:39:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: inittyp.c,v 1.12 2018/09/07 15:16:15 christos Exp $ */ +/* $NetBSD: inittyp.c,v 1.13 2020/12/30 11:39:55 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: inittyp.c,v 1.12 2018/09/07 15:16:15 christos Exp $"); +__RCSID("$NetBSD: inittyp.c,v 1.13 2020/12/30 11:39:55 rillig Exp $"); #endif #include @@ -155,7 +155,7 @@ inittyp(void) }; for (i = 0; i < sizeof (ittab) / sizeof (ittab[0]); i++) - STRUCT_ASSIGN(ttab[ittab[i].it_tspec], ittab[i].it_ttab); + ttab[ittab[i].it_tspec] = ittab[i].it_ttab; if (!pflag) { for (i = 0; i < NTSPEC; i++) ttab[i].tt_psz = ttab[i].tt_sz; Index: src/usr.bin/xlint/common/param.h diff -u src/usr.bin/xlint/common/param.h:1.6 src/usr.bin/xlint/common/param.h:1.7 --- src/usr.bin/xlint/common/param.h:1.6 Mon Dec 28 21:24:55 2020 +++ src/usr.bin/xlint/common/param.h Wed Dec 30 11:39:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.6 2020/12/28 21:24:55 rillig Exp $ */ +/* $NetBSD: param.h,v 1.7 2020/12/30 11:39:55 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -74,8 +74,3 @@ typedef long double ldbl_t; #else typedef double ldbl_t; #endif - -/* - * Some traditional compilers are not able to assign structures. - */ -#define STRUCT_ASSIGN(dest, src) (dest) = (src) Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.84 src/usr.bin/xlint/lint1/decl.c:1.85 --- src/usr.bin/xlint/lint1/decl.c:1.84 Wed Dec 30 11:14:03 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 11:39:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.85 2020/12/30 11:39:55 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.85 2020/12/30 11:39:55 rillig Exp $"); #endif #include @@ -149,7 +149,7 @@ duptyp(const type_t *tp) type_t *ntp; ntp = getblk(sizeof (type_t)); - STRUCT_ASSIGN(*ntp, *tp); + *ntp = *tp; return ntp; } @@ -163,7 +163,7 @@ tduptyp(const type_t *tp) type_t *ntp; ntp = tgetblk(sizeof (type_t)); - STRUCT_ASSIGN(*ntp, *tp); + *ntp = *tp; return ntp; } @@ -1951,7 +1951,7 @@ decl1ext(sym_t *dsym, int initflg) if (rdsym->s_osdef && !dsym->s_type->t_proto) { dsym->s_osdef = rdsym->s_osdef; dsym->s_args = rdsym->s_args; -STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); +dsym->s_def_pos = rdsym->s_def_pos; } /* @@ -1961,9 +1961,9 @@ decl1ext(sym_t *dsym, int initflg) * was defined and the new is not. */ if (rdsym->s_type->t_proto && !dsym->s_type->t_proto) { -STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); +dsym->s_def_pos = rdsym->s_def_pos; } else if (rdsym->s_def == DEF && dsym->s_def != DEF) { -STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); +dsym->s_def_pos = rdsym->s_def_pos; } /* @@ -2940,7 +2940,7 @@ check_usage_sym(int novar, sym_t *sym) if (sym->s_blklev == -1) return; - STRUCT_ASSIGN(cpos, curr_pos); + cpos = curr_pos; if (sym->s_kind == FVFT) { if (sym->s_arg) { @@ -2954,7 +2954,7 @@ check_usage_sym(int novar, sym_t *sym) check_tag_usage(sym); } - STRUCT_ASSIGN(curr_pos, cpos); + curr_pos = cpos; } static void @@ -2968,7 +2968,7 @@ check_argument_usage(int novar, sym_t *a return; if (!arg->s_used && vflag) { - STRUCT_ASSIGN(curr_pos, arg->s_def_pos); + curr_pos = arg->s_def_pos; /* argument %s unused in function %s */ warning(231, arg->s_name, funcsym->s_name); } @@ -3001,17 +3001,17 @@ check_variable_usage(int nova
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 11:14:03 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: decl.c emit1.c func.c lint1.h scan.l Log Message: lint: un-abbreviate s_dpos, s_spos and s_upos To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/scan.l 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/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.83 src/usr.bin/xlint/lint1/decl.c:1.84 --- src/usr.bin/xlint/lint1/decl.c:1.83 Wed Dec 30 11:04:48 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 11:14:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.83 2020/12/30 11:04:48 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.83 2020/12/30 11:04:48 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 rillig Exp $"); #endif #include @@ -1663,7 +1663,7 @@ mktag(sym_t *tag, tspec_t kind, int decl } else { tag = getblk(sizeof (sym_t)); tag->s_name = unnamed; - UNIQUE_CURR_POS(tag->s_dpos); + UNIQUE_CURR_POS(tag->s_def_pos); tag->s_kind = FTAG; tag->s_scl = scl; tag->s_blklev = -1; @@ -1918,7 +1918,7 @@ decl1ext(sym_t *dsym, int initflg) * written as a function definition to the output file. */ rval = dsym->s_type->t_subt->t_tspec != VOID; - outfdef(dsym, &dsym->s_dpos, rval, 0, NULL); + outfdef(dsym, &dsym->s_def_pos, rval, 0, NULL); } else { outsym(dsym, dsym->s_scl, dsym->s_def); } @@ -1951,7 +1951,7 @@ decl1ext(sym_t *dsym, int initflg) if (rdsym->s_osdef && !dsym->s_type->t_proto) { dsym->s_osdef = rdsym->s_osdef; dsym->s_args = rdsym->s_args; -STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos); +STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); } /* @@ -1961,9 +1961,9 @@ decl1ext(sym_t *dsym, int initflg) * was defined and the new is not. */ if (rdsym->s_type->t_proto && !dsym->s_type->t_proto) { -STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos); +STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); } else if (rdsym->s_def == DEF && dsym->s_def != DEF) { -STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos); +STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos); } /* @@ -2003,8 +2003,8 @@ void copy_usage_info(sym_t *sym, sym_t *rdsym) { - sym->s_spos = rdsym->s_spos; - sym->s_upos = rdsym->s_upos; + sym->s_set_pos = rdsym->s_set_pos; + sym->s_use_pos = rdsym->s_use_pos; sym->s_set = rdsym->s_set; sym->s_used = rdsym->s_used; } @@ -2875,7 +2875,7 @@ mark_as_set(sym_t *sym) if (!sym->s_set) { sym->s_set = 1; - UNIQUE_CURR_POS(sym->s_spos); + UNIQUE_CURR_POS(sym->s_set_pos); } } @@ -2888,7 +2888,7 @@ mark_as_used(sym_t *sym, int fcall, int if (!sym->s_used) { sym->s_used = 1; - UNIQUE_CURR_POS(sym->s_upos); + UNIQUE_CURR_POS(sym->s_use_pos); } /* * for function calls another record is written @@ -2968,7 +2968,7 @@ check_argument_usage(int novar, sym_t *a return; if (!arg->s_used && vflag) { - STRUCT_ASSIGN(curr_pos, arg->s_dpos); + STRUCT_ASSIGN(curr_pos, arg->s_def_pos); /* argument %s unused in function %s */ warning(231, arg->s_name, funcsym->s_name); } @@ -3001,17 +3001,17 @@ check_variable_usage(int novar, sym_t *s if (sc == EXTERN) { if (!sym->s_used && !sym->s_set) { - STRUCT_ASSIGN(curr_pos, sym->s_dpos); + STRUCT_ASSIGN(curr_pos, sym->s_def_pos); /* %s unused in function %s */ warning(192, sym->s_name, funcsym->s_name); } } else { if (sym->s_set && !sym->s_used) { - STRUCT_ASSIGN(curr_pos, sym->s_spos); + STRUCT_ASSIGN(curr_pos, sym->s_set_pos); /* %s set but not used in function %s */ warning(191, sym->s_name, funcsym->s_name); } else if (!sym->s_used) { - STRUCT_ASSIGN(curr_pos, sym->s_dpos); + STRUCT_ASSIGN(curr_pos, sym->s_def_pos); /* %s unused in function %s */ warning(192, sym->s_name, funcsym->s_name); } @@ -3031,11 +3031,11 @@ check_variable_usage(int novar, sym_t *s if ((xsym = sym->s_ext_sym) != NULL) { if (sym->s_used && !xsym->s_used) { xsym->s_used = 1; -STRUCT_ASSIGN(xsym->s_upos, sym->s_upos); +STRUCT_ASSIGN(xsym->s_use_pos, sym->s_use_pos); } if (sym->s_set && !xsym->s_set) { xsym->s_set = 1; -STRUCT_ASSIGN(xsym->s_spos, sym->s_spos); +STRUCT_ASSIGN(xsym->s_set_pos, sym->s_set_pos); } } } @@ -3049,11 +3049,11 @@ check_label_usage(sym_t *lab) LERROR("check_label_usage()"); if (lab->s_set && !lab->s_u
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 11:04:48 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: decl.c init.c lint1.h scan.l tree.c Log Message: lint: un-abbreviate s_field, s_keyw and s_xsym To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.104 -r1.105 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.82 src/usr.bin/xlint/lint1/decl.c:1.83 --- src/usr.bin/xlint/lint1/decl.c:1.82 Wed Dec 30 10:49:10 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 11:04:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.82 2020/12/30 10:49:10 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.83 2020/12/30 11:04:48 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.82 2020/12/30 10:49:10 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.83 2020/12/30 11:04:48 rillig Exp $"); #endif #include @@ -1106,10 +1106,8 @@ declarator_1_struct_union(sym_t *dsym) t = (tp = dsym->s_type)->t_tspec; - if (dsym->s_field) { + if (dsym->s_bitfield) { /* - * bit field - * * only unsigned and signed int are portable bit-field types *(at least in ANSI C, in traditional C only unsigned int) */ @@ -1163,7 +1161,7 @@ declarator_1_struct_union(sym_t *dsym) /* illegal use of bit-field */ error(41); dsym->s_type->t_isfield = 0; - dsym->s_field = 0; + dsym->s_bitfield = 0; } } else if (t == FUNC) { /* function illegal in structure or union */ @@ -1187,7 +1185,7 @@ declarator_1_struct_union(sym_t *dsym) o = dcs->d_offset; dcs->d_offset = 0; } - if (dsym->s_field) { + if (dsym->s_bitfield) { align(getbound(tp), tp->t_flen); dsym->s_value.v_quad = (dcs->d_offset / size(t)) * size(t); tp->t_foffs = dcs->d_offset - (int)dsym->s_value.v_quad; @@ -1254,7 +1252,7 @@ bitfield(sym_t *dsym, int len) dsym->s_type = duptyp(dsym->s_type); dsym->s_type->t_isfield = 1; dsym->s_type->t_flen = len; - dsym->s_field = 1; + dsym->s_bitfield = 1; return dsym; } @@ -2610,10 +2608,10 @@ decl1loc(sym_t *dsym, int initflg) * XXX if the static variable at level 0 is only defined * later, checking will be possible. */ - if (dsym->s_xsym == NULL) { + if (dsym->s_ext_sym == NULL) { outsym(dsym, EXTERN, dsym->s_def); } else { - outsym(dsym, dsym->s_xsym->s_scl, dsym->s_def); + outsym(dsym, dsym->s_ext_sym->s_scl, dsym->s_def); } } @@ -2746,7 +2744,7 @@ ledecl(sym_t *dsym) * Remember the external symbol so we can update usage * information at the end of the block. */ - dsym->s_xsym = esym; + dsym->s_ext_sym = esym; } } @@ -3030,7 +3028,7 @@ check_variable_usage(int novar, sym_t *s * because symbols at level 0 only used in sizeof() are * considered to not be used. */ - if ((xsym = sym->s_xsym) != NULL) { + if ((xsym = sym->s_ext_sym) != NULL) { if (sym->s_used && !xsym->s_used) { xsym->s_used = 1; STRUCT_ASSIGN(xsym->s_upos, sym->s_upos); Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.47 src/usr.bin/xlint/lint1/init.c:1.48 --- src/usr.bin/xlint/lint1/init.c:1.47 Wed Dec 30 10:56:51 2020 +++ src/usr.bin/xlint/lint1/init.c Wed Dec 30 11:04:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.47 2020/12/30 10:56:51 rillig Exp $ */ +/* $NetBSD: init.c,v 1.48 2020/12/30 11:04:48 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.47 2020/12/30 10:56:51 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.48 2020/12/30 11:04:48 rillig Exp $"); #endif #include @@ -182,7 +182,7 @@ initstack_pop_item(void) for (m = istk->i_type->t_str->memb; m != NULL; m = m->s_next) { DPRINTF(("%s: pop lhs.name=%s rhs.name=%s\n", __func__, m->s_name, namedmem->n_name)); - if (m->s_field && m->s_name == unnamed) + if (m->s_bitfield && m->s_name == unnamed) continue; if (strcmp(m->s_name, namedmem->n_name) == 0) { istk->i_subt = m->s_type; @@ -207,7 +207,7 @@ initstack_pop_item(void) m = istk->i_mem = istk->i_mem->s_next; lint_assert(m != NULL); DPRINTF(("%s: pop %s\n", __func__, m->s_name)); - } while (m->s_field && m->s_name == unnamed); + } while (m->s_bitfield && m->s_name == unnamed); istk->i_subt = m->s_type; } } @@ -327,7 +327,7 @@ again: tyname(buf, sizeof(buf), istk->i_type), namedmem ? namedmem->n_name : "*none*", istk->i_namedmem)); for (m = istk->i
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 10:56:51 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: cgram.y emit1.c init.c lint1.h print.c scan.l tree.c Log Message: lint: un-abbreviate parenthesized and _strg To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.46 -r1.47 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/print.c cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.120 src/usr.bin/xlint/lint1/cgram.y:1.121 --- src/usr.bin/xlint/lint1/cgram.y:1.120 Wed Dec 30 10:35:38 2020 +++ src/usr.bin/xlint/lint1/cgram.y Wed Dec 30 10:56:51 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.121 2020/12/30 10:56:51 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.121 2020/12/30 10:56:51 rillig Exp $"); #endif #include @@ -133,7 +133,7 @@ anonymize(sym_t *s) type_t *y_type; tnode_t *y_tnode; range_t y_range; - strg_t *y_strg; + strg_t *y_string; pqinf_t *y_pqinf; }; @@ -265,7 +265,7 @@ anonymize(sym_t *s) %token T_NAME %token T_TYPENAME %token T_CON -%token T_STRING +%token T_STRING %type func_decl %type notype_decl @@ -323,8 +323,8 @@ anonymize(sym_t *s) %type abstract_declaration %type do_while_expr %type opt_expr -%type string -%type string2 +%type string +%type string2 %type opt_asm_or_symbolrename %type range %type lorange @@ -1857,7 +1857,7 @@ term: } | T_LPARN expr T_RPARN { if ($2 != NULL) - $2->tn_parn = 1; + $2->tn_parenthesized = 1; $$ = $2; } | T_LPARN comp_stmnt_lbrace declaration_list expr_stmnt_list { Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.27 src/usr.bin/xlint/lint1/emit1.c:1.28 --- src/usr.bin/xlint/lint1/emit1.c:1.27 Wed Dec 30 10:46:11 2020 +++ src/usr.bin/xlint/lint1/emit1.c Wed Dec 30 10:56:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.27 2020/12/30 10:46:11 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.28 2020/12/30 10:56:51 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit1.c,v 1.27 2020/12/30 10:46:11 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.28 2020/12/30 10:56:51 rillig Exp $"); #endif #include @@ -461,11 +461,11 @@ outcall(tnode_t *tn, int rvused, int rvd } } else if (arg->tn_op == AMPER && arg->tn_left->tn_op == STRING && - arg->tn_left->tn_strg->st_tspec == CHAR) { + arg->tn_left->tn_string->st_tspec == CHAR) { /* constant string, write all format specifiers */ outchar('s'); outint(n); - outfstrg(arg->tn_left->tn_strg); + outfstrg(arg->tn_left->tn_string); } } Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.46 src/usr.bin/xlint/lint1/init.c:1.47 --- src/usr.bin/xlint/lint1/init.c:1.46 Wed Dec 30 10:46:11 2020 +++ src/usr.bin/xlint/lint1/init.c Wed Dec 30 10:56:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.46 2020/12/30 10:46:11 rillig Exp $ */ +/* $NetBSD: init.c,v 1.47 2020/12/30 10:56:51 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.46 2020/12/30 10:46:11 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.47 2020/12/30 10:56:51 rillig Exp $"); #endif #include @@ -622,7 +622,7 @@ initstack_string(tnode_t *tn) return 0; istk = initstk; - strg = tn->tn_strg; + strg = tn->tn_string; /* * Check if we have an array type which can be initialized by Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.41 src/usr.bin/xlint/lint1/lint1.h:1.42 --- src/usr.bin/xlint/lint1/lint1.h:1.41 Wed Dec 30 10:49:10 2020 +++ src/usr.bin/xlint/lint1/lint1.h Wed Dec 30 10:56:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.41 2020/12/30 10:49:10 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.42 2020/12/30 10:56:51 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -285,8 +285,8 @@ typedef struct tnode { op_t tn_op; /* operator */ type_t *tn_type; /* type */ u_int tn_lvalue : 1; /* node is lvalue */ - u_int tn_cast : 1; /* if tn_op == CVT its an explicit cas
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 10:49:10 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: decl.c func.c lint1.h scan.l tree.c Log Message: lint: rename remaining _nxt members to _next To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.81 src/usr.bin/xlint/lint1/decl.c:1.82 --- src/usr.bin/xlint/lint1/decl.c:1.81 Wed Dec 30 10:35:38 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 10:49:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.82 2020/12/30 10:49:10 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.82 2020/12/30 10:49:10 rillig Exp $"); #endif #include @@ -590,7 +590,7 @@ pushdecl(scl_t sc) /* put a new element on the declaration stack */ di = xcalloc(1, sizeof (dinfo_t)); - di->d_nxt = dcs; + di->d_next = dcs; dcs = di; di->d_ctx = sc; di->d_ldlsym = &di->d_dlsyms; @@ -610,10 +610,10 @@ popdecl(void) if (dflag) (void)printf("popdecl(%p %d)\n", dcs, (int)dcs->d_ctx); - if (dcs->d_nxt == NULL) + if (dcs->d_next == NULL) LERROR("popdecl()"); di = dcs; - dcs = di->d_nxt; + dcs = di->d_next; switch (di->d_ctx) { case EXTERN: /* there is nothing after external declarations */ @@ -692,7 +692,7 @@ setasm(void) { dinfo_t *di; - for (di = dcs; di != NULL; di = di->d_nxt) + for (di = dcs; di != NULL; di = di->d_next) di->d_asm = 1; } @@ -1271,9 +1271,9 @@ merge_pointers_and_qualifiers(pqinf_t *p if (p2->p_pcnt != 0) { /* left '*' at the end of the list */ - for (p = p2; p->p_nxt != NULL; p = p->p_nxt) + for (p = p2; p->p_next != NULL; p = p->p_next) continue; - p->p_nxt = p1; + p->p_next = p1; return p2; } else { if (p2->p_const) { @@ -1321,7 +1321,7 @@ add_pointer(sym_t *decl, pqinf_t *pi) tp->t_const = pi->p_const; tp->t_volatile = pi->p_volatile; *(tpp = &tp->t_subt) = dcs->d_type; - npi = pi->p_nxt; + npi = pi->p_next; free(pi); pi = npi; } @@ -1380,27 +1380,27 @@ add_function(sym_t *decl, sym_t *args) * The symbols are removed from the symbol table by popdecl() after * add_function(). To be able to restore them if this is a function * definition, a pointer to the list of all symbols is stored in - * dcs->d_nxt->d_fpsyms. Also a list of the arguments (concatenated - * by s_next) is stored in dcs->d_nxt->d_fargs. - * (dcs->d_nxt must be used because *dcs is the declaration stack + * dcs->d_next->d_fpsyms. Also a list of the arguments (concatenated + * by s_next) is stored in dcs->d_next->d_fargs. + * (dcs->d_next must be used because *dcs is the declaration stack * element created for the list of params and is removed after * add_function()) */ - if (dcs->d_nxt->d_ctx == EXTERN && - decl->s_type == dcs->d_nxt->d_type) { - dcs->d_nxt->d_fpsyms = dcs->d_dlsyms; - dcs->d_nxt->d_fargs = args; + if (dcs->d_next->d_ctx == EXTERN && + decl->s_type == dcs->d_next->d_type) { + dcs->d_next->d_fpsyms = dcs->d_dlsyms; + dcs->d_next->d_fargs = args; } tpp = &decl->s_type; - while (*tpp && *tpp != dcs->d_nxt->d_type) + while (*tpp && *tpp != dcs->d_next->d_type) tpp = &(*tpp)->t_subt; if (*tpp == NULL) return decl; *tpp = tp = getblk(sizeof (type_t)); tp->t_tspec = FUNC; - tp->t_subt = dcs->d_nxt->d_type; + tp->t_subt = dcs->d_next->d_type; if ((tp->t_proto = dcs->d_proto) != 0) tp->t_args = args; tp->t_vararg = dcs->d_vararg; @@ -1458,8 +1458,8 @@ old_style_function(sym_t *decl, sym_t *a * Remember list of params only if this is really seams to be * a function definition. */ - if (dcs->d_nxt->d_ctx == EXTERN && - decl->s_type == dcs->d_nxt->d_type) { + if (dcs->d_next->d_ctx == EXTERN && + decl->s_type == dcs->d_next->d_type) { /* * We assume that this becomes a function definition. If * we are wrong, its corrected in check_function_definition(). @@ -1648,7 +1648,7 @@ mktag(sym_t *tag, tspec_t kind, int decl tag = newtag(tag, scl, decl, semi); } else { /* a new tag, no empty declaration */ - dcs->d_nxt->d_nedecl = 1; + dcs->d_next->d_nedecl = 1; if (scl == ENUMTAG && !decl) { if (!tflag && (sflag || pflag)) /* forward reference to enum type */ @@ -1671,7 +1671,7 @@ mktag(sym_t *tag, tspec_t kind, int decl t
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Wed Dec 30 10:46:11 UTC 2020 Modified Files: src/usr.bin/xlint/common: emit.c lint.h src/usr.bin/xlint/lint1: emit1.c func.c init.c lint1.h mem1.c scan.l src/usr.bin/xlint/lint2: chk.c lint2.h read.c Log Message: lint: rename more _nxt members to _next To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/common/emit.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/common/lint.h cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.39 -r1.40 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/mem1.c cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint2/lint2.h cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/lint2/read.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/xlint/common/emit.c diff -u src/usr.bin/xlint/common/emit.c:1.7 src/usr.bin/xlint/common/emit.c:1.8 --- src/usr.bin/xlint/common/emit.c:1.7 Mon Dec 28 21:24:55 2020 +++ src/usr.bin/xlint/common/emit.c Wed Dec 30 10:46:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit.c,v 1.7 2020/12/28 21:24:55 rillig Exp $ */ +/* $NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit.c,v 1.7 2020/12/28 21:24:55 rillig Exp $"); +__RCSID("$NetBSD: emit.c,v 1.8 2020/12/30 10:46:11 rillig Exp $"); #endif #include @@ -71,7 +71,7 @@ outopen(const char *name) /* Create output buffer */ ob.o_len = 1024; - ob.o_end = (ob.o_buf = ob.o_nxt = xmalloc(ob.o_len)) + ob.o_len; + ob.o_end = (ob.o_buf = ob.o_next = xmalloc(ob.o_len)) + ob.o_len; } /* @@ -94,10 +94,10 @@ outxbuf(void) { ptrdiff_t coffs; - coffs = ob.o_nxt - ob.o_buf; + coffs = ob.o_next - ob.o_buf; ob.o_len *= 2; ob.o_end = (ob.o_buf = xrealloc(ob.o_buf, ob.o_len)) + ob.o_len; - ob.o_nxt = ob.o_buf + coffs; + ob.o_next = ob.o_buf + coffs; } /* @@ -109,14 +109,14 @@ outclr(void) { size_t sz; - if (ob.o_buf != ob.o_nxt) { + if (ob.o_buf != ob.o_next) { outchar('\n'); - sz = ob.o_nxt - ob.o_buf; + sz = ob.o_next - ob.o_buf; if (sz > ob.o_len) errx(1, "internal error: outclr() 1"); if (fwrite(ob.o_buf, sz, 1, lout) != 1) err(1, "cannot write to %s", loname); - ob.o_nxt = ob.o_buf; + ob.o_next = ob.o_buf; } } @@ -127,9 +127,9 @@ void outchar(int c) { - if (ob.o_nxt == ob.o_end) + if (ob.o_next == ob.o_end) outxbuf(); - *ob.o_nxt++ = (char)c; + *ob.o_next++ = (char)c; } /* @@ -193,9 +193,9 @@ outstrg(const char *s) { while (*s != '\0') { - if (ob.o_nxt == ob.o_end) + if (ob.o_next == ob.o_end) outxbuf(); - *ob.o_nxt++ = *s++; + *ob.o_next++ = *s++; } } @@ -206,9 +206,9 @@ void outint(int i) { - if ((size_t)(ob.o_end - ob.o_nxt) < 3 * sizeof (int)) + if ((size_t)(ob.o_end - ob.o_next) < 3 * sizeof (int)) outxbuf(); - ob.o_nxt += sprintf(ob.o_nxt, "%d", i); + ob.o_next += sprintf(ob.o_next, "%d", i); } /* Index: src/usr.bin/xlint/common/lint.h diff -u src/usr.bin/xlint/common/lint.h:1.17 src/usr.bin/xlint/common/lint.h:1.18 --- src/usr.bin/xlint/common/lint.h:1.17 Mon Dec 28 21:24:55 2020 +++ src/usr.bin/xlint/common/lint.h Wed Dec 30 10:46:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lint.h,v 1.17 2020/12/28 21:24:55 rillig Exp $ */ +/* $NetBSD: lint.h,v 1.18 2020/12/30 10:46:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -131,7 +131,7 @@ typedef struct ob { char *o_buf; /* buffer */ char *o_end; /* first byte after buffer */ size_t o_len; /* length of buffer */ - char *o_nxt; /* next free byte in buffer */ + char *o_next; /* next free byte in buffer */ } ob_t; typedef struct type type_t; Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.26 src/usr.bin/xlint/lint1/emit1.c:1.27 --- src/usr.bin/xlint/lint1/emit1.c:1.26 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/emit1.c Wed Dec 30 10:46:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.26 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.27 2020/12/30 10:46:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit1.c,v 1.26 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.27 2020/12/30 10:46:11 rillig Exp $"); #endif #include @@ -173,13 +173,13 @@ ttos(type_t *tp) if (tob.o_buf == NULL) { tob.o_len = 64; - tob.o_buf = tob.o_nxt = xmalloc(tob.o_len); + tob.o_buf = tob.o_next = xmalloc(tob.o_len); tob.o_end = tob.o_bu
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Dec 30 10:35:38 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h scan.l tree.c Log Message: lint: rename symt_t constants There's no need to abbreviate them, furthermore FMOS was imprecise. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.80 -r1.81 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.119 src/usr.bin/xlint/lint1/cgram.y:1.120 --- src/usr.bin/xlint/lint1/cgram.y:1.119 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/cgram.y Wed Dec 30 10:35:38 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.119 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.119 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.120 2020/12/30 10:35:38 rillig Exp $"); #endif #include @@ -785,13 +785,13 @@ member_declaration_list: member_declaration: noclass_declmods deftyp { /* too late, i know, but getsym() compensates it */ - symtyp = FMOS; + symtyp = FMEMBER; } notype_member_decls opt_type_attribute { symtyp = FVFT; $$ = $4; } | noclass_declspecs deftyp { - symtyp = FMOS; + symtyp = FMEMBER; } type_member_decls opt_type_attribute { symtyp = FVFT; $$ = $4; @@ -851,7 +851,7 @@ notype_member_decls: $$ = declarator_1_struct_union($1); } | notype_member_decls { - symtyp = FMOS; + symtyp = FMEMBER; } T_COMMA type_member_decl { $$ = lnklst($1, declarator_1_struct_union($4)); } @@ -862,7 +862,7 @@ type_member_decls: $$ = declarator_1_struct_union($1); } | type_member_decls { - symtyp = FMOS; + symtyp = FMEMBER; } T_COMMA type_member_decl { $$ = lnklst($1, declarator_1_struct_union($4)); } @@ -1488,7 +1488,7 @@ labeled_stmnt: label: T_NAME T_COLON { - symtyp = FLAB; + symtyp = FLABEL; label(T_NAME, getsym($1), NULL); } | T_CASE constant T_COLON { @@ -1753,7 +1753,7 @@ jump_stmnt: goto: T_GOTO { - symtyp = FLAB; + symtyp = FLABEL; } ; @@ -1948,7 +1948,7 @@ term: } | T_BUILTIN_OFFSETOF T_LPARN type_name T_COMMA identifier T_RPARN %prec T_BUILTIN_OFFSETOF { - symtyp = FMOS; + symtyp = FMEMBER; $$ = build_offsetof($3, getsym($5)); } | T_SIZEOF term %prec T_SIZEOF { @@ -2008,7 +2008,7 @@ func_arg_list: point_or_arrow: T_STROP { - symtyp = FMOS; + symtyp = FMEMBER; $$ = $1; } ; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.80 src/usr.bin/xlint/lint1/decl.c:1.81 --- src/usr.bin/xlint/lint1/decl.c:1.80 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 10:35:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.80 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.80 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.81 2020/12/30 10:35:38 rillig Exp $"); #endif #include @@ -1246,7 +1246,7 @@ bitfield(sym_t *dsym, int len) if (dsym == NULL) { dsym = getblk(sizeof (sym_t)); dsym->s_name = unnamed; - dsym->s_kind = FMOS; + dsym->s_kind = FMEMBER; dsym->s_scl = MOS; dsym->s_type = gettyp(UINT); dsym->s_blklev = -1; @@ -2950,7 +2950,7 @@ check_usage_sym(int novar, sym_t *sym) } else { check_variable_usage(novar, sym); } - } else if (sym->s_kind == FLAB) { + } else if (sym->s_kind == FLABEL) { check_label_usage(sym); } else if (sym->s_kind == FTAG) { check_tag_usage(sym); @@ -3118,7 +3118,7 @@ check_global_symbols(void) } else if (sym->s_kind == FTAG) { check_tag_usage(sym); } else { - if (sym->s_kind != FMOS) + if (sym->s_kind != FMEMBER) LERROR("check_global_symbols()"); } } Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.38 src/usr.bin/xlint/lint1/lint1.h:1.39 --- src/usr.bin/xlint/lint1/lint1.h:1.38 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint1/lint1.h Wed Dec 30 10:35:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.38 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.39 2020/12/30 10:35:38 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -184,9 +184,9 @@
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Wed Dec 30 10:26:12 UTC 2020 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c emit1.c func.c init.c lint1.h tree.c src/usr.bin/xlint/lint2: chk.c emit2.c lint2.h read.c Log Message: lint: rename s_nxt to s_next To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.37 -r1.38 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint2/emit2.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/xlint/lint2/lint2.h cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/lint2/read.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/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.118 src/usr.bin/xlint/lint1/cgram.y:1.119 --- src/usr.bin/xlint/lint1/cgram.y:1.118 Wed Dec 30 01:44:32 2020 +++ src/usr.bin/xlint/lint1/cgram.y Wed Dec 30 10:26:12 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.118 2020/12/30 01:44:32 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.119 2020/12/30 10:26:12 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.118 2020/12/30 01:44:32 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.119 2020/12/30 10:26:12 rillig Exp $"); #endif #include @@ -114,7 +114,7 @@ static inline void RESTORE(const char *f static void anonymize(sym_t *s) { - for ( ; s; s = s->s_nxt) + for ( ; s; s = s->s_next) s->s_styp = NULL; } %} Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.79 src/usr.bin/xlint/lint1/decl.c:1.80 --- src/usr.bin/xlint/lint1/decl.c:1.79 Tue Dec 29 21:32:46 2020 +++ src/usr.bin/xlint/lint1/decl.c Wed Dec 30 10:26:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.79 2020/12/29 21:32:46 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.80 2020/12/30 10:26:12 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.79 2020/12/29 21:32:46 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.80 2020/12/30 10:26:12 rillig Exp $"); #endif #include @@ -133,7 +133,7 @@ initdecl(void) /* * Returns a shared type structure for arithmetic types and void. * - * It's important to duplicate this structure (using duptyp() or tdupdyp()) + * It's important to duplicate this structure (using duptyp() or tduptyp()) * if it is to be modified (adding qualifiers or anything else). */ type_t * @@ -497,7 +497,7 @@ bitfieldsize(sym_t **mem) size_t len = (*mem)->s_type->t_flen; while (*mem && (*mem)->s_type->t_isfield) { len += (*mem)->s_type->t_flen; - *mem = (*mem)->s_nxt; + *mem = (*mem)->s_next; } return ((len + INT_SIZE - 1) / INT_SIZE) * INT_SIZE; } @@ -514,7 +514,7 @@ setpackedsize(type_t *tp) case UNION: sp = tp->t_str; sp->size = 0; - for (mem = sp->memb; mem != NULL; mem = mem->s_nxt) { + for (mem = sp->memb; mem != NULL; mem = mem->s_next) { if (mem->s_type->t_isfield) { sp->size += bitfieldsize(&mem); if (mem == NULL) @@ -962,7 +962,7 @@ getbound(type_t *tp) } /* - * Concatenate two lists of symbols by s_nxt. Used by declarations of + * Concatenate two lists of symbols by s_next. Used by declarations of * struct/union/enum elements and parameters. */ sym_t * @@ -972,9 +972,9 @@ lnklst(sym_t *l1, sym_t *l2) if ((l = l1) == NULL) return l2; - while (l1->s_nxt != NULL) - l1 = l1->s_nxt; - l1->s_nxt = l2; + while (l1->s_next != NULL) + l1 = l1->s_next; + l1->s_next = l2; return l; } @@ -1381,7 +1381,7 @@ add_function(sym_t *decl, sym_t *args) * add_function(). To be able to restore them if this is a function * definition, a pointer to the list of all symbols is stored in * dcs->d_nxt->d_fpsyms. Also a list of the arguments (concatenated - * by s_nxt) is stored in dcs->d_nxt->d_fargs. + * by s_next) is stored in dcs->d_nxt->d_fargs. * (dcs->d_nxt must be used because *dcs is the declaration stack * element created for the list of params and is removed after * add_function()) @@ -1432,9 +1432,9 @@ new_style_function(sym_t *decl, sym_t *a } n = 1; - for (arg = args; arg != NULL; arg = arg->s_nxt) { + for (arg = args; arg != NULL; arg = arg->s_next) { if (arg->s_type->t_tspec == VOID) { - if (n > 1 || arg->s_nxt != NULL) { + if (n > 1 || arg->s_next != NULL) { /* "void" must be sole parameter */ error(
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Wed Dec 30 10:03:16 UTC 2020 Modified Files: src/usr.bin/make: arch.c buf.c compat.c cond.c dir.c enum.c enum.h for.c hash.c job.c job.h lst.c lst.h main.c make.c make.h make_malloc.h parse.c str.c suff.c util.c var.c Log Message: make(1): format multi-line comments To generate a diff of this commit: cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/arch.c cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/buf.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/compat.c cvs rdiff -u -r1.232 -r1.233 src/usr.bin/make/cond.c src/usr.bin/make/make.c cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/dir.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/enum.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/enum.h cvs rdiff -u -r1.121 -r1.122 src/usr.bin/make/for.c cvs rdiff -u -r1.59 -r1.60 src/usr.bin/make/hash.c cvs rdiff -u -r1.390 -r1.391 src/usr.bin/make/job.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/make/job.h cvs rdiff -u -r1.101 -r1.102 src/usr.bin/make/lst.c cvs rdiff -u -r1.93 -r1.94 src/usr.bin/make/lst.h cvs rdiff -u -r1.506 -r1.507 src/usr.bin/make/main.c cvs rdiff -u -r1.240 -r1.241 src/usr.bin/make/make.h cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/make_malloc.h cvs rdiff -u -r1.523 -r1.524 src/usr.bin/make/parse.c cvs rdiff -u -r1.75 -r1.76 src/usr.bin/make/str.c cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/suff.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/make/util.c cvs rdiff -u -r1.777 -r1.778 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.191 src/usr.bin/make/arch.c:1.192 --- src/usr.bin/make/arch.c:1.191 Sun Dec 20 13:46:27 2020 +++ src/usr.bin/make/arch.c Wed Dec 30 10:03:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.191 2020/12/20 13:46:27 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.192 2020/12/30 10:03:16 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -68,7 +68,8 @@ * SUCH DAMAGE. */ -/* Manipulate libraries, archives and their members. +/* + * Manipulate libraries, archives and their members. * * The first time an archive is referenced, all of its members' headers are * read and cached and the archive closed again. All cached archives are kept @@ -125,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.191 2020/12/20 13:46:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.192 2020/12/30 10:03:16 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -387,7 +388,8 @@ Arch_ParseArchive(char **pp, GNodeList * return TRUE; } -/* Locate a member of an archive, given the path of the archive and the path +/* + * Locate a member of an archive, given the path of the archive and the path * of the desired member. * * Input: @@ -688,7 +690,8 @@ ArchiveMember_HasName(const struct ar_hd return FALSE; } -/* Locate a member of an archive, given the path of the archive and the path +/* + * Locate a member of an archive, given the path of the archive and the path * of the desired member. * * Input: @@ -832,7 +835,8 @@ ArchFindMember(const char *archive, cons return NULL; } -/* Touch a member of an archive, on disk. +/* + * Touch a member of an archive, on disk. * The GNode's modification time is left as-is. * * The st_mtime of the entire archive is also changed. @@ -860,11 +864,13 @@ Arch_Touch(GNode *gn) fclose(f); /* TODO: handle errors */ } -/* Given a node which represents a library, touch the thing, making sure that +/* + * Given a node which represents a library, touch the thing, making sure that * the table of contents is also touched. * * Both the modification time of the library and of the RANLIBMAG member are - * set to 'now'. */ + * set to 'now'. + */ void Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED) { @@ -886,8 +892,10 @@ Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED #endif } -/* Update the mtime of the GNode with the mtime from the archive member on - * disk (or in the cache). */ +/* + * Update the mtime of the GNode with the mtime from the archive member on + * disk (or in the cache). + */ void Arch_UpdateMTime(GNode *gn) { @@ -900,8 +908,10 @@ Arch_UpdateMTime(GNode *gn) gn->mtime = 0; } -/* Given a nonexistent archive member's node, update gn->mtime from its - * archived form, if it exists. */ +/* + * Given a nonexistent archive member's node, update gn->mtime from its + * archived form, if it exists. + */ void Arch_UpdateMemberMTime(GNode *gn) { @@ -939,7 +949,8 @@ Arch_UpdateMemberMTime(GNode *gn) } } -/* Search for a library along the given search path. +/* + * Search for a library along the given search path. * * The node's 'path' field is set to the found path (including the * actual file name, not -l...). If the system can handle the -L @@ -967,7 +978,8 @@ Arch_Fi