CVS commit: src
Module Name:src Committed By: ryo Date: Sat Jan 2 08:38:56 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile Removed Files: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: meson-g12b-odroid-n2-plus.dts Log Message: revert http://mail-index.netbsd.org/source-changes/2021/01/01/msg125648.html FYI: http://mail-index.netbsd.org/source-changes-d/2021/01/01/msg013085.html To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/dtb/ad.aarch64eb cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile cvs rdiff -u -r1.1 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts 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/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.4 src/distrib/sets/lists/dtb/ad.aarch64:1.5 --- src/distrib/sets/lists/dtb/ad.aarch64:1.4 Fri Jan 1 07:41:46 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64 Sat Jan 2 08:38:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64,v 1.4 2021/01/01 07:41:46 ryo Exp $ +# $NetBSD: ad.aarch64,v 1.5 2021/01/02 08:38:55 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,7 +40,6 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb -./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/distrib/sets/lists/dtb/ad.aarch64eb diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.3 src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 --- src/distrib/sets/lists/dtb/ad.aarch64eb:1.3 Fri Jan 1 07:41:46 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64eb Sat Jan 2 08:38:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64eb,v 1.3 2021/01/01 07:41:46 ryo Exp $ +# $NetBSD: ad.aarch64eb,v 1.4 2021/01/02 08:38:55 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,7 +40,6 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb -./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.3 --- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2 Fri Jan 1 07:41:46 2021 +++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile Sat Jan 2 08:38:55 2021 @@ -6,7 +6,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb
CVS commit: src/games/testpat
Module Name:src Committed By: wiz Date: Sat Jan 2 08:55:51 UTC 2021 Modified Files: src/games/testpat: testpat.6 Log Message: Markup/typo fixes. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/games/testpat/testpat.6 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/testpat/testpat.6 diff -u src/games/testpat/testpat.6:1.1 src/games/testpat/testpat.6:1.2 --- src/games/testpat/testpat.6:1.1 Sat Jan 2 03:21:39 2021 +++ src/games/testpat/testpat.6 Sat Jan 2 08:55:51 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: testpat.6,v 1.1 2021/01/02 03:21:39 nat Exp $ +.\" $NetBSD: testpat.6,v 1.2 2021/01/02 08:55:51 wiz Exp $ .\" .\" Copyright (c) 2021 Nathanial Sloss .\" All rights reserved. @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd Janurary 2, 2021 +.Dd January 2, 2021 .Dt TESTPAT 6 .Os .Sh NAME @@ -38,7 +38,6 @@ The .Nm command displays a test pattern on a color capable terminal using .Xr curses 3 . - Title is a string to display as the title of the test pattern. .Sh SEE ALSO .Xr curses 3 @@ -47,4 +46,4 @@ Title is a string to display as the titl appeared in .Nx 10.0 . .Sh AUTHORS -Nathanial Sloss +.An Nathanial Sloss
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sat Jan 2 10:24:42 UTC 2021 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Ammend ticket #1173 for additional pullups To generate a diff of this commit: cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.30 src/doc/CHANGES-9.2:1.1.2.31 --- src/doc/CHANGES-9.2:1.1.2.30 Fri Jan 1 13:19:02 2021 +++ src/doc/CHANGES-9.2 Sat Jan 2 10:24:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.30 2021/01/01 13:19:02 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.31 2021/01/02 10:24:42 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1368,7 +1368,7 @@ sys/arch/aarch64/include/ptrace.h 1.10 Add support of ptrace(2) for COMPAT_NETBSD32. [rin, ticket #1172] -sys/kern/core_elf32.c1.65 (patch) +sys/kern/core_elf32.c1.65 (patch),1.67 Fix 32-bit core file format for aarch64. [rin, ticket #1173]
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Sat Jan 2 10:23:46 UTC 2021 Modified Files: src/sys/kern [netbsd-9]: core_elf32.c Log Message: Additionally pull up following revision(s) (requested by rin in ticket #1173): sys/kern/core_elf32.c: revision 1.67 Use instead of , which is not intended for standalone use. Compile tested for all ports with their own COMPAT_NETBSD32 codes: aarch64, amd64, arm, mips64, sparc64, and algor64. Should fix build failure for mips64 in netbsd-9, where netbsd32.h is not included by other header files. To generate a diff of this commit: cvs rdiff -u -r1.58.4.1 -r1.58.4.2 src/sys/kern/core_elf32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/core_elf32.c diff -u src/sys/kern/core_elf32.c:1.58.4.1 src/sys/kern/core_elf32.c:1.58.4.2 --- src/sys/kern/core_elf32.c:1.58.4.1 Fri Jan 1 13:04:08 2021 +++ src/sys/kern/core_elf32.c Sat Jan 2 10:23:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: core_elf32.c,v 1.58.4.1 2021/01/01 13:04:08 martin Exp $ */ +/* $NetBSD: core_elf32.c,v 1.58.4.2 2021/01/02 10:23:46 martin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.58.4.1 2021/01/01 13:04:08 martin Exp $"); +__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.58.4.2 2021/01/02 10:23:46 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_coredump.h" @@ -68,7 +68,7 @@ __KERNEL_RCSID(1, "$NetBSD: core_elf32.c #ifdef COREDUMP #ifdef COMPAT_NETBSD32 -#include +#include #endif struct writesegs_state {
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 11:12:34 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp t_integration.sh Log Message: lint: demonstrate that -t mode is practically unusable Since main1.c from 2014-04-18, running lint in -t mode produces strange warnings in lines 1 to 3 of no file at all. This is caused by the builtins that are parsed in main(). These builtins are incompatible with traditional mode because they use long double, which had not been known at that time. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_219.c \ src/tests/usr.bin/xlint/lint1/msg_219.exp cvs rdiff -u -r1.18 -r1.19 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/msg_219.c diff -u src/tests/usr.bin/xlint/lint1/msg_219.c:1.1 src/tests/usr.bin/xlint/lint1/msg_219.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_219.c:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_219.c Sat Jan 2 11:12:34 2021 @@ -1,7 +1,12 @@ -/* $NetBSD: msg_219.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */ +/* $NetBSD: msg_219.c,v 1.2 2021/01/02 11:12:34 rillig Exp $ */ # 3 "msg_219.c" -// Test for message: concatenated strings are illegal in traditional C [219] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +/* Test for message: concatenated strings are illegal in traditional C [219] */ + +/* lint1-flags: -t -w */ + +char concat1[] = "one"; +char concat2[] = "one" "two"; +char concat3[] = "one" "two" "three"; +char concat4[] = "one" "two" "three" "four"; Index: src/tests/usr.bin/xlint/lint1/msg_219.exp diff -u src/tests/usr.bin/xlint/lint1/msg_219.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_219.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_219.exp:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_219.exp Sat Jan 2 11:12:34 2021 @@ -1 +1,10 @@ -msg_219.c(6): syntax error ':' [249] +(1): warning: 'long double' is illegal in traditional C [266] +(1): warning: function prototypes are illegal in traditional C [270] +(2): warning: 'long double' is illegal in traditional C [266] +(2): warning: function prototypes are illegal in traditional C [270] +(3): warning: 'long double' is illegal in traditional C [266] +(3): warning: 'long double' is illegal in traditional C [266] +(3): warning: function prototypes are illegal in traditional C [270] +msg_219.c(10): warning: concatenated strings are illegal in traditional C [219] +msg_219.c(11): warning: concatenated strings are illegal in traditional C [219] +msg_219.c(12): warning: concatenated strings are illegal in traditional C [219] Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.18 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.19 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.18 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sat Jan 2 11:12:34 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.18 2021/01/02 10:22:44 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.19 2021/01/02 11:12:34 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -147,17 +147,19 @@ test_case long_double_int "Checks for co test_case all_messages all_messages_body() { - local srcdir status msg base + local srcdir status msg base flags srcdir="$(atf_get_srcdir)" status="0" for msg in $(seq 0 329); do base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")" + flags="$(sed -n 's,^/\* lint1-flags: \(.*\) \*/$,\1,p' "${base}.c")" + flags="${flags:--g -S -w}" - # shellcheck disable=SC2154 + # shellcheck disable=SC2154 disable=SC2086 ${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \ - ${LINT1} -g -S -w "${base}.c" /dev/null \ + ${LINT1} ${flags} "${base}.c" /dev/null \ || status="1" done return "${status}"
CVS commit: src
Module Name:src Committed By: ryo Date: Sat Jan 2 11:36:36 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb src/sys/dtb/arm64/amlogic: Makefile Added Files: src/sys/arch/arm/dts: meson-g12b-odroid-n2-plus.dts Log Message: add dts for odroid-N2 plus To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/dtb/ad.aarch64eb cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts cvs rdiff -u -r1.1 -r1.2 src/sys/dtb/arm64/amlogic/Makefile 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/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.5 src/distrib/sets/lists/dtb/ad.aarch64:1.6 --- src/distrib/sets/lists/dtb/ad.aarch64:1.5 Sat Jan 2 08:38:55 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64 Sat Jan 2 11:36:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64,v 1.5 2021/01/02 08:38:55 ryo Exp $ +# $NetBSD: ad.aarch64,v 1.6 2021/01/02 11:36:36 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/distrib/sets/lists/dtb/ad.aarch64eb diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 src/distrib/sets/lists/dtb/ad.aarch64eb:1.5 --- src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 Sat Jan 2 08:38:55 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64eb Sat Jan 2 11:36:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64eb,v 1.4 2021/01/02 08:38:55 ryo Exp $ +# $NetBSD: ad.aarch64eb,v 1.5 2021/01/02 11:36:36 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/sys/dtb/arm64/amlogic/Makefile diff -u src/sys/dtb/arm64/amlogic/Makefile:1.1 src/sys/dtb/arm64/amlogic/Makefile:1.2 --- src/sys/dtb/arm64/amlogic/Makefile:1.1 Mon May 18 21:19:35 2020 +++ src/sys/dtb/arm64/amlogic/Makefile Sat Jan 2 11:36:36 2021 @@ -1,8 +1,11 @@ -# $NetBSD: Makefile,v 1.1 2020/05/18 21:19:35 jmcneill Exp $ +# $NetBSD: Makefile,v 1.2 2021/01/02 11:36:36 ryo Exp $ DTSSUBDIR= amlogic DTSMAKEVARS= CONFIG_ARCH_MESON=y DTSFILESCMD= ${MAKE} -C ${ARCHDTSDIR}/${DTSSUBDIR} ${DTSMAKEVARS} -v dtb-y DTS= ${DTSFILESCMD:sh} +# Extra .dts files from sys/arch/arm/dts +DTS+= meson-g12b-odroid-n2-plus.dts + .include Added files: Index: src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts diff -u /dev/null src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts:1.1 --- /dev/null Sat Jan 2 11:36:36 2021 +++ src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts Sat Jan 2 11:36:36 2021 @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong + */ + +/dts-v1/; + +#include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts" + +/ { + compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", "amlogic,g12b"; + model = "Hardkernel ODROID-N2Plus"; + + vddcpu_a: regulator-vddcpu-a { + regulator-min-microvolt = <68>; + regulator-max-microvolt = <104>; + + pwms = <&pwm_ab 0 1500 0>; + + /delete-property/ pwm-dutycycle-range; + + /* Voltage Duty-Cycle */ + voltage-table = <104 0>, + <103 3>, + <102 6>, + <101 8>, + <100 11>, + <99 14>, + <98 17>, + <97 20>, + <96 23>, + <95 26>, + <94 29>, + <93 31>, + <92 34>, + <91 37>, + <90 40>, + <89 43>, + <88 45>, + <87 48>, + <86 51>, + <85 54>, + <84 56>, + <83 59>, + <82 62>, + <81 65>, + <80 68>, + <79 70>, + <78 73>, + <77 76>, + <76 79>, + <75 81>, + <74 84>, + <73 87>, + <72 89
CVS commit: src/games/testpat
Module Name:src Committed By: jmcneill Date: Sat Jan 2 12:10:17 UTC 2021 Modified Files: src/games/testpat: testpat.c Log Message: trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/games/testpat/testpat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/testpat/testpat.c diff -u src/games/testpat/testpat.c:1.1 src/games/testpat/testpat.c:1.2 --- src/games/testpat/testpat.c:1.1 Sat Jan 2 03:21:39 2021 +++ src/games/testpat/testpat.c Sat Jan 2 12:10:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: testpat.c,v 1.1 2021/01/02 03:21:39 nat Exp $ */ +/* $NetBSD: testpat.c,v 1.2 2021/01/02 12:10:17 jmcneill Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss @@ -66,9 +66,9 @@ int main(int argc, char *argv[]) { if (argc > 2) { endwin(); - errx(EINVAL, "usage: testpat [title]"); + errx(EINVAL, "usage: testpat [title]"); } - + if (argc == 2 && strlen(argv[1]) < (size_t)COLS) snprintf(title, sizeof(title), "%s", argv[1]); else if (argc == 2 && (int)strlen(argv[1]) > COLS) { @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { if (colourOK) { start_color(); - + init_pair( 0, COLOR_WHITE, COLOR_BLACK ); init_pair( 1, COLOR_WHITE, COLOR_RED ); init_pair( 2, COLOR_WHITE, COLOR_GREEN ); @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { mvaddch(i, col, 32 | A_REVERSE); } } - + /* Add title segment. */ for (i = roundf(1 * grid_unit); i < roundf(2 * grid_unit); i++) { if (colourOK) @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) { mvaddch(i, col, ' '); } - i = roundf(1.4 * grid_unit); + i = roundf(1.4 * grid_unit); col = y_limit - (strlen(title) / 2) + circle_pos[y_limit / 2][0]; mvprintw(i, col, "%s", title); @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) { mvaddch(line, xpos, ' '); } - for (col = roundf((9.5 * grid_unit * 2)); col < + for (col = roundf((9.5 * grid_unit * 2)); col < roundf((13 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) { if (colourOK) attrset(COLOR_PAIR(colour)); - if (i == 0) + if (i == 0) spacing_start = 0; else spacing_start = (spacing * i) + spacing_residual; @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) { col++) mvaddch(line, col, ' '); - for (col = roundf((1.5 * grid_unit * 2)); col < + for (col = roundf((1.5 * grid_unit * 2)); col < roundf((4.3 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) { mvaddch(line, xpos, 120 | A_ALTCHARSET); } - for (col = roundf((4.3 * grid_unit * 2)); col < + for (col = roundf((4.3 * grid_unit * 2)); col < roundf((7.6 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -309,7 +309,7 @@ int main(int argc, char *argv[]) { mvaddch(line, xpos, '|'); } - for (col = roundf((7.6 * grid_unit * 2)); col < + for (col = roundf((7.6 * grid_unit * 2)); col < roundf((11.5 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) { if (colourOK) attrset(COLOR_PAIR(COLOR_BLACK)); - for (col = roundf((0 * grid_unit * 2)); col < + for (col = roundf((0 * grid_unit * 2)); col < roundf((4 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) { mvaddch(line, xpos, ' '); } - for (col = roundf((4 * grid_unit * 2)); col < + for (col = roundf((4 * grid_unit * 2)); col < roundf((6.5 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -343,7 +343,7 @@ int main(int argc, char *argv[]) { if (colourOK) attrset(COLOR_PAIR(COLOR_WHITE)); - for (col = roundf((6.5 * grid_unit * 2)); col < + for (col = roundf((6.5 * grid_unit * 2)); col < roundf((9 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) { mvaddch(line, xpos, 97 | A_ALTCHARSET); } - for (col = roundf((9 * grid_unit * 2)); col < + for (col = roundf((9 * grid_unit * 2)); col < roundf((13 * grid_unit * 2)); col++) { xpos = col + circle_pos[y_limit / 2][0]; if (xpos >= circle_pos[line][0] && @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) { if (colourOK) attrset(COLOR_PAIR(COLOR_RED)); - for (col = roundf((6 * grid_unit * 2)); col < + for (col = roundf((6 * grid_unit * 2)
CVS commit: src/games/testpat
Module Name:src Committed By: jmcneill Date: Sat Jan 2 12:12:26 UTC 2021 Modified Files: src/games/testpat: testpat.c Log Message: set the cursor to invisible To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/games/testpat/testpat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/games/testpat/testpat.c diff -u src/games/testpat/testpat.c:1.2 src/games/testpat/testpat.c:1.3 --- src/games/testpat/testpat.c:1.2 Sat Jan 2 12:10:17 2021 +++ src/games/testpat/testpat.c Sat Jan 2 12:12:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: testpat.c,v 1.2 2021/01/02 12:10:17 jmcneill Exp $ */ +/* $NetBSD: testpat.c,v 1.3 2021/01/02 12:12:26 jmcneill Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss @@ -63,6 +63,7 @@ int main(int argc, char *argv[]) { printf("\n"); return EXIT_FAILURE; } + curs_set(0); if (argc > 2) { endwin();
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 2 12:39:03 UTC 2021 Modified Files: src/sys/dev/usb: usb_mem.c usb_mem.h Log Message: Add USBMALLOC_ZERO flag for requesting zero initialized DMA memory. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/usb_mem.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/usb_mem.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/dev/usb/usb_mem.c diff -u src/sys/dev/usb/usb_mem.c:1.77 src/sys/dev/usb/usb_mem.c:1.78 --- src/sys/dev/usb/usb_mem.c:1.77 Fri May 15 06:26:44 2020 +++ src/sys/dev/usb/usb_mem.c Sat Jan 2 12:39:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $ */ +/* $NetBSD: usb_mem.c,v 1.78 2021/01/02 12:39:03 jmcneill Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.78 2021/01/02 12:39:03 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -179,9 +179,16 @@ usb_block_allocmem(bus_dma_tag_t tag, si goto destroy; *dmap = b; + #ifdef USB_FRAG_DMA_WORKAROUND - memset(b->kaddr, 0, b->size); + flags |= USBMALLOC_ZERO; #endif + if ((flags & USBMALLOC_ZERO) != 0) { + memset(b->kaddr, 0, b->size); + bus_dmamap_sync(b->tag, b->map, 0, b->size, + BUS_DMASYNC_PREWRITE); + } + mutex_enter(&usb_blk_lock); return USBD_NORMAL_COMPLETION; Index: src/sys/dev/usb/usb_mem.h diff -u src/sys/dev/usb/usb_mem.h:1.32 src/sys/dev/usb/usb_mem.h:1.33 --- src/sys/dev/usb/usb_mem.h:1.32 Sun Apr 5 20:59:38 2020 +++ src/sys/dev/usb/usb_mem.h Sat Jan 2 12:39:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_mem.h,v 1.32 2020/04/05 20:59:38 skrll Exp $ */ +/* $NetBSD: usb_mem.h,v 1.33 2021/01/02 12:39:03 jmcneill Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -49,6 +49,7 @@ typedef struct usb_dma_block { #define USBMALLOC_MULTISEG __BIT(0) #define USBMALLOC_COHERENT __BIT(1) +#define USBMALLOC_ZERO __BIT(2) usbd_status usb_allocmem(struct usbd_bus *, size_t, size_t, u_int, usb_dma_t *); void usb_freemem(struct usbd_bus *, usb_dma_t *);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 2 12:39:33 UTC 2021 Modified Files: src/sys/dev/usb: xhci.c Log Message: Use USBMALLOC_ZERO to ensure that all DMA memory is zero initialized. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/dev/usb/xhci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/xhci.c diff -u src/sys/dev/usb/xhci.c:1.136 src/sys/dev/usb/xhci.c:1.137 --- src/sys/dev/usb/xhci.c:1.136 Tue Dec 22 01:07:23 2020 +++ src/sys/dev/usb/xhci.c Sat Jan 2 12:39:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.136 2020/12/22 01:07:23 riastradh Exp $ */ +/* $NetBSD: xhci.c,v 1.137 2021/01/02 12:39:33 jmcneill Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.136 2020/12/22 01:07:23 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.137 2021/01/02 12:39:33 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1087,7 +1087,8 @@ xhci_init(struct xhci_softc *sc) if (sc->sc_maxspbuf != 0) { err = usb_allocmem(&sc->sc_bus, sizeof(uint64_t) * sc->sc_maxspbuf, sizeof(uint64_t), - USBMALLOC_COHERENT, &sc->sc_spbufarray_dma); + USBMALLOC_COHERENT | USBMALLOC_ZERO, + &sc->sc_spbufarray_dma); if (err) { aprint_error_dev(sc->sc_dev, "spbufarray init fail, err %d\n", err); @@ -1101,7 +1102,8 @@ xhci_init(struct xhci_softc *sc) usb_dma_t * const dma = &sc->sc_spbuf_dma[i]; /* allocate contexts */ err = usb_allocmem(&sc->sc_bus, sc->sc_pgsz, - sc->sc_pgsz, USBMALLOC_COHERENT, dma); + sc->sc_pgsz, USBMALLOC_COHERENT | USBMALLOC_ZERO, + dma); if (err) { aprint_error_dev(sc->sc_dev, "spbufarray_dma init fail, err %d\n", err); @@ -1149,7 +1151,8 @@ xhci_init(struct xhci_softc *sc) XHCI_EVENT_RING_SEGMENT_TABLE_ALIGN); KASSERTMSG(size <= (512 * 1024), "eventst size %zu too large", size); align = XHCI_EVENT_RING_SEGMENT_TABLE_ALIGN; - err = usb_allocmem(&sc->sc_bus, size, align, USBMALLOC_COHERENT, dma); + err = usb_allocmem(&sc->sc_bus, size, align, + USBMALLOC_COHERENT | USBMALLOC_ZERO, dma); if (err) { aprint_error_dev(sc->sc_dev, "eventst init fail, err %d\n", err); @@ -1157,8 +1160,6 @@ xhci_init(struct xhci_softc *sc) goto bad3; } - memset(KERNADDR(dma, 0), 0, size); - usb_syncmem(dma, 0, size, BUS_DMASYNC_PREWRITE); aprint_debug_dev(sc->sc_dev, "eventst: 0x%016jx %p %zx\n", (uintmax_t)DMAADDR(&sc->sc_eventst_dma, 0), KERNADDR(&sc->sc_eventst_dma, 0), @@ -1168,7 +1169,8 @@ xhci_init(struct xhci_softc *sc) size = (1 + sc->sc_maxslots) * sizeof(uint64_t); KASSERTMSG(size <= 2048, "dcbaa size %zu too large", size); align = XHCI_DEVICE_CONTEXT_BASE_ADDRESS_ARRAY_ALIGN; - err = usb_allocmem(&sc->sc_bus, size, align, USBMALLOC_COHERENT, dma); + err = usb_allocmem(&sc->sc_bus, size, align, + USBMALLOC_COHERENT | USBMALLOC_ZERO, dma); if (err) { aprint_error_dev(sc->sc_dev, "dcbaa init fail, err %d\n", err); rv = ENOMEM; @@ -1179,15 +1181,14 @@ xhci_init(struct xhci_softc *sc) KERNADDR(&sc->sc_dcbaa_dma, 0), sc->sc_dcbaa_dma.udma_block->size); - memset(KERNADDR(dma, 0), 0, size); if (sc->sc_maxspbuf != 0) { /* * DCBA entry 0 hold the scratchbuf array pointer. */ *(uint64_t *)KERNADDR(dma, 0) = htole64(DMAADDR(&sc->sc_spbufarray_dma, 0)); + usb_syncmem(dma, 0, size, BUS_DMASYNC_PREWRITE); } - usb_syncmem(dma, 0, size, BUS_DMASYNC_PREWRITE); sc->sc_slots = kmem_zalloc(sizeof(*sc->sc_slots) * sc->sc_maxslots, KM_SLEEP); @@ -2580,8 +2581,8 @@ xhci_ring_init(struct xhci_softc * const xr = kmem_zalloc(sizeof(struct xhci_ring), KM_SLEEP); DPRINTFN(1, "ring %#jx", (uintptr_t)xr, 0, 0, 0); - err = usb_allocmem(&sc->sc_bus, size, align, USBMALLOC_COHERENT, - &xr->xr_dma); + err = usb_allocmem(&sc->sc_bus, size, align, + USBMALLOC_COHERENT | USBMALLOC_ZERO, &xr->xr_dma); if (err) { kmem_free(xr, sizeof(struct xhci_ring)); DPRINTFN(1, "alloc xr_dma failed %jd", err, 0, 0, 0); @@ -3020,22 +3021,20 @@ xhci_init_slot(struct usbd_device *dev, /* allocate contexts */ err = usb_allocmem(&sc->sc_bus, sc->sc_pgsz, sc->sc_pgsz, - USBMALLOC_COHERENT, &xs->xs_dc_dma); + USBMALLOC_COHERENT | USBMALLOC_ZERO, &xs->xs_dc_dma); if (err) { DPRINTFN(1, "failed to allocmem output device context %jd", err, 0, 0, 0); return err; } - memset(KERNADDR(&xs->xs_dc_dma, 0), 0, sc->sc_pgsz); err = usb_allocmem(&sc->sc_bus, sc->sc_pgsz, sc->sc_pgsz, - USBMALLOC_COHERENT, &xs->xs_ic_dma); + USBMALLOC_COHERENT | USBMALLOC_ZERO, &xs->xs_ic_dma); if (err) { DPRINTFN(1, "failed to allocmem input device context %jd", err, 0, 0, 0); goto bad1; } - memset(KERNADDR(&xs->xs_ic_dma, 0), 0, sc->sc_pgsz); memset(&xs->xs_xr[0]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 15:55:54 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp Log Message: lint: add test for message 35: illegal bit-field type Bug: _Bool is not accepted as a bit-field, but it should be. Bug: lint aborts in a controlled manner with message "common/tyname.c, 190: tspec_name(0)" when it sees a declaration of a _Complex bit-field. (Not that a _Complex bit-field would make any sense.) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_035.c \ src/tests/usr.bin/xlint/lint1/msg_035.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/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.1 src/tests/usr.bin/xlint/lint1/msg_035.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 15:55:54 2021 @@ -1,7 +1,53 @@ -/* $NetBSD: msg_035.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */ +/* $NetBSD: msg_035.c,v 1.2 2021/01/02 15:55:54 rillig Exp $ */ # 3 "msg_035.c" // Test for message: illegal bit-field type [35] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +typedef struct { + int dummy; +} example_struct; + +typedef union { + int dummy; +} example_union; + +typedef enum { + NO, YES +} example_enum; + +typedef void (example_function)(int, const char *); + +/* Try all types from tspec_t. */ +struct example { + signed signed_flag: 1; + unsigned unsigned_flag: 1; + _Bool boolean_flag: 1; // FIXME: allowed since C99 6.7.2.1p5 + char char_flag: 1; + signed char signed_char_flag: 1; + unsigned char unsigned_char_flag: 1; + short short_flag: 1; + unsigned short unsigned_short_flag: 1; + int int_flag: 1; + unsigned int unsigned_int_flag: 1; + long long_flag: 1; + unsigned long unsigned_long_flag: 1; + long long long_long_flag: 1; + unsigned long long unsigned_long_long_flag: 1; + /* __int128_t omitted since it is not always defined */ + /* __uint128_t omitted since it is not always defined */ + float float_flag: 1; + double double_flag: 1; + long double long_double_flag: 1; + void void_flag: 1; + example_struct struct_flag: 1; + example_union union_flag: 1; + example_enum enum_flag: 1; + void *pointer_flag: 1; + unsigned int array_flag[4]: 1; + example_function function_flag: 1; +// FIXME: aborts: _Complex complex_flag: 1; + _Complex complex_flag: 1; + float _Complex float_complex_flag: 1; + double _Complex double_complex_flag: 1; + long double _Complex long_double_complex_flag: 1; +}; Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 15:55:54 2021 @@ -1 +1,18 @@ -msg_035.c(6): syntax error ':' [249] +msg_035.c(24): warning: illegal bit-field type [35] +msg_035.c(32): warning: illegal bit-field type [35] +msg_035.c(33): warning: illegal bit-field type [35] +msg_035.c(34): warning: illegal bit-field type [35] +msg_035.c(35): warning: illegal bit-field type [35] +msg_035.c(38): warning: illegal bit-field type [35] +msg_035.c(39): warning: illegal bit-field type [35] +msg_035.c(40): warning: illegal bit-field type [35] +msg_035.c(41): void type for void_flag [19] +msg_035.c(41): zero size bit-field [37] +msg_035.c(42): warning: illegal bit-field type [35] +msg_035.c(43): warning: illegal bit-field type [35] +msg_035.c(45): warning: illegal bit-field type [35] +msg_035.c(46): warning: illegal bit-field type [35] +msg_035.c(47): warning: illegal bit-field type [35] +msg_035.c(49): warning: illegal bit-field type [35] +msg_035.c(50): warning: illegal bit-field type [35] +msg_035.c(51): warning: illegal bit-field type [35]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 16:12:39 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp Log Message: lint: fix and document test for illegal bit-fields The _Complex bit-field should have been commented out. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_035.c \ src/tests/usr.bin/xlint/lint1/msg_035.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/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.2 src/tests/usr.bin/xlint/lint1/msg_035.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.2 Sat Jan 2 15:55:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 16:12:39 2021 @@ -1,8 +1,17 @@ -/* $NetBSD: msg_035.c,v 1.2 2021/01/02 15:55:54 rillig Exp $ */ +/* $NetBSD: msg_035.c,v 1.3 2021/01/02 16:12:39 rillig Exp $ */ # 3 "msg_035.c" // Test for message: illegal bit-field type [35] +/* + * In traditional C, only unsigned int is a portable bit-field type. + * + * In C89, only int, signed int and unsigned int are allowed (3.5.2.1p7). + * + * In C99 and C11, only _Bool, signed int and unsigned int are allowed, + * plus implementation-defined types (6.7.2.1p5). + */ + typedef struct { int dummy; } example_struct; @@ -46,7 +55,6 @@ struct example { unsigned int array_flag[4]: 1; example_function function_flag: 1; // FIXME: aborts: _Complex complex_flag: 1; - _Complex complex_flag: 1; float _Complex float_complex_flag: 1; double _Complex double_complex_flag: 1; long double _Complex long_double_complex_flag: 1; Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.2 Sat Jan 2 15:55:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 16:12:39 2021 @@ -1,18 +1,18 @@ -msg_035.c(24): warning: illegal bit-field type [35] -msg_035.c(32): warning: illegal bit-field type [35] msg_035.c(33): warning: illegal bit-field type [35] -msg_035.c(34): warning: illegal bit-field type [35] -msg_035.c(35): warning: illegal bit-field type [35] -msg_035.c(38): warning: illegal bit-field type [35] -msg_035.c(39): warning: illegal bit-field type [35] -msg_035.c(40): warning: illegal bit-field type [35] -msg_035.c(41): void type for void_flag [19] -msg_035.c(41): zero size bit-field [37] +msg_035.c(41): warning: illegal bit-field type [35] msg_035.c(42): warning: illegal bit-field type [35] msg_035.c(43): warning: illegal bit-field type [35] -msg_035.c(45): warning: illegal bit-field type [35] -msg_035.c(46): warning: illegal bit-field type [35] +msg_035.c(44): warning: illegal bit-field type [35] msg_035.c(47): warning: illegal bit-field type [35] +msg_035.c(48): warning: illegal bit-field type [35] msg_035.c(49): warning: illegal bit-field type [35] -msg_035.c(50): warning: illegal bit-field type [35] +msg_035.c(50): void type for void_flag [19] +msg_035.c(50): zero size bit-field [37] msg_035.c(51): warning: illegal bit-field type [35] +msg_035.c(52): warning: illegal bit-field type [35] +msg_035.c(54): warning: illegal bit-field type [35] +msg_035.c(55): warning: illegal bit-field type [35] +msg_035.c(56): warning: illegal bit-field type [35] +msg_035.c(58): warning: illegal bit-field type [35] +msg_035.c(59): warning: illegal bit-field type [35] +msg_035.c(60): warning: illegal bit-field type [35]
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Jan 2 16:33:39 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: allow _Bool for bit-fields To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_035.c \ src/tests/usr.bin/xlint/lint1/msg_035.exp cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/decl.c 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/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.3 src/tests/usr.bin/xlint/lint1/msg_035.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.3 Sat Jan 2 16:12:39 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 16:33:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_035.c,v 1.3 2021/01/02 16:12:39 rillig Exp $ */ +/* $NetBSD: msg_035.c,v 1.4 2021/01/02 16:33:39 rillig Exp $ */ # 3 "msg_035.c" // Test for message: illegal bit-field type [35] @@ -30,7 +30,7 @@ typedef void (example_function)(int, con struct example { signed signed_flag: 1; unsigned unsigned_flag: 1; - _Bool boolean_flag: 1; // FIXME: allowed since C99 6.7.2.1p5 + _Bool boolean_flag: 1; char char_flag: 1; signed char signed_char_flag: 1; unsigned char unsigned_char_flag: 1; Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 Sat Jan 2 16:12:39 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 16:33:39 2021 @@ -1,4 +1,3 @@ -msg_035.c(33): warning: illegal bit-field type [35] msg_035.c(41): warning: illegal bit-field type [35] msg_035.c(42): warning: illegal bit-field type [35] msg_035.c(43): warning: illegal bit-field type [35] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.98 src/usr.bin/xlint/lint1/decl.c:1.99 --- src/usr.bin/xlint/lint1/decl.c:1.98 Sat Jan 2 03:49:25 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 16:33:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.98 2021/01/02 03:49:25 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.99 2021/01/02 16:33:39 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.98 2021/01/02 03:49:25 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.99 2021/01/02 16:33:39 rillig Exp $"); #endif #include @@ -1118,7 +1118,7 @@ declarator_1_struct_union(sym_t *dsym) /* nonportable bit-field type */ warning(34); } - } else if (t != INT && t != UINT) { + } else if (t != INT && t != UINT && t != BOOL) { /* * Non-integer types are always illegal for * bitfields, regardless of BITFIELDTYPE.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 16:55:45 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_308.c msg_308.exp Log Message: lint: add test for message 308 "Invalid type %s for _Complex" To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_308.c \ src/tests/usr.bin/xlint/lint1/msg_308.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/msg_308.c diff -u src/tests/usr.bin/xlint/lint1/msg_308.c:1.1 src/tests/usr.bin/xlint/lint1/msg_308.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_308.c:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.c Sat Jan 2 16:55:45 2021 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_308.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */ +/* $NetBSD: msg_308.c,v 1.2 2021/01/02 16:55:45 rillig Exp $ */ # 3 "msg_308.c" // Test for message: Invalid type %s for _Complex [308] +float _Complex float_complex; +double _Complex double_complex; +long double _Complex long_double_complex; +// FIXME: aborts: _Complex plain_complex; +// FIXME: aborts: int _Complex int_complex; + TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_308.exp diff -u src/tests/usr.bin/xlint/lint1/msg_308.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_308.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_308.exp:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.exp Sat Jan 2 16:55:45 2021 @@ -1 +1 @@ -msg_308.c(6): syntax error ':' [249] +msg_308.c(12): syntax error ':' [249]
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Jan 2 17:17:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp msg_308.c msg_308.exp src/usr.bin/xlint/lint1: decl.c err.c Log Message: lint: fix message 308 "Invalid type for _Complex" Previously, lint aborted since it didn't expect tspec_name to be called with NOTSPEC, which at that point was the only possible value of dcs->d_cmod. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_035.c \ src/tests/usr.bin/xlint/lint1/msg_035.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_308.c \ src/tests/usr.bin/xlint/lint1/msg_308.exp cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.59 -r1.60 src/usr.bin/xlint/lint1/err.c 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/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.4 src/tests/usr.bin/xlint/lint1/msg_035.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.4 Sat Jan 2 16:33:39 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 17:17:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_035.c,v 1.4 2021/01/02 16:33:39 rillig Exp $ */ +/* $NetBSD: msg_035.c,v 1.5 2021/01/02 17:17:00 rillig Exp $ */ # 3 "msg_035.c" // Test for message: illegal bit-field type [35] @@ -54,7 +54,7 @@ struct example { void *pointer_flag: 1; unsigned int array_flag[4]: 1; example_function function_flag: 1; -// FIXME: aborts: _Complex complex_flag: 1; + _Complex complex_flag: 1; float _Complex float_complex_flag: 1; double _Complex double_complex_flag: 1; long double _Complex long_double_complex_flag: 1; Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.4 Sat Jan 2 16:33:39 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 17:17:00 2021 @@ -12,6 +12,8 @@ msg_035.c(52): warning: illegal bit-fiel msg_035.c(54): warning: illegal bit-field type [35] msg_035.c(55): warning: illegal bit-field type [35] msg_035.c(56): warning: illegal bit-field type [35] +msg_035.c(57): Invalid type for _Complex [308] +msg_035.c(57): warning: illegal bit-field type [35] msg_035.c(58): warning: illegal bit-field type [35] msg_035.c(59): warning: illegal bit-field type [35] msg_035.c(60): warning: illegal bit-field type [35] Index: src/tests/usr.bin/xlint/lint1/msg_308.c diff -u src/tests/usr.bin/xlint/lint1/msg_308.c:1.2 src/tests/usr.bin/xlint/lint1/msg_308.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_308.c:1.2 Sat Jan 2 16:55:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.c Sat Jan 2 17:17:00 2021 @@ -1,13 +1,10 @@ -/* $NetBSD: msg_308.c,v 1.2 2021/01/02 16:55:45 rillig Exp $ */ +/* $NetBSD: msg_308.c,v 1.3 2021/01/02 17:17:00 rillig Exp $ */ # 3 "msg_308.c" -// Test for message: Invalid type %s for _Complex [308] +// Test for message: Invalid type for _Complex [308] float _Complex float_complex; double _Complex double_complex; long double _Complex long_double_complex; -// FIXME: aborts: _Complex plain_complex; -// FIXME: aborts: int _Complex int_complex; - -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +_Complex plain_complex; +int _Complex int_complex; Index: src/tests/usr.bin/xlint/lint1/msg_308.exp diff -u src/tests/usr.bin/xlint/lint1/msg_308.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_308.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_308.exp:1.2 Sat Jan 2 16:55:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_308.exp Sat Jan 2 17:17:00 2021 @@ -1 +1,3 @@ -msg_308.c(12): syntax error ':' [249] +msg_308.c(9): Invalid type for _Complex [308] +msg_308.c(10): Invalid type for _Complex [308] +msg_308.c(10): illegal type combination [4] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.99 src/usr.bin/xlint/lint1/decl.c:1.100 --- src/usr.bin/xlint/lint1/decl.c:1.99 Sat Jan 2 16:33:39 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 17:17:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.99 2021/01/02 16:33:39 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.100 2021/01/02 17:17:00 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.99 2021/01/02 16:33:39 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.100 2021/01/02 17:17:00 rillig Exp $"); #endif #include @@ -303,9 +303,11 @@ add_type(type_t *tp) t = FCOMPLEX; else if (dcs->d_cmod == DOUBLE) t = DCOMPLEX; - else - /* Invalid type %s for _Complex */ - error(308, tspec_name(dcs->d_cmod)); + else { + /* Invalid type for _Complex */ + error(308); + t = DCOMPLEX; /* just as a f
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Jan 2 18:06:01 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_000.c msg_000.exp msg_001.c msg_001.exp msg_002.c msg_002.exp msg_004.c msg_004.exp msg_005.c msg_005.exp msg_085.c msg_085.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: add a few more tests No serious bugs found this time. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_000.c \ src/tests/usr.bin/xlint/lint1/msg_000.exp \ src/tests/usr.bin/xlint/lint1/msg_001.c \ src/tests/usr.bin/xlint/lint1/msg_001.exp \ src/tests/usr.bin/xlint/lint1/msg_002.c \ src/tests/usr.bin/xlint/lint1/msg_002.exp \ src/tests/usr.bin/xlint/lint1/msg_004.c \ src/tests/usr.bin/xlint/lint1/msg_004.exp \ src/tests/usr.bin/xlint/lint1/msg_005.c \ src/tests/usr.bin/xlint/lint1/msg_005.exp \ src/tests/usr.bin/xlint/lint1/msg_085.c \ src/tests/usr.bin/xlint/lint1/msg_085.exp cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/lint1/decl.c 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/msg_000.c diff -u src/tests/usr.bin/xlint/lint1/msg_000.c:1.1 src/tests/usr.bin/xlint/lint1/msg_000.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_000.c:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_000.c Sat Jan 2 18:06:01 2021 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_000.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */ +/* $NetBSD: msg_000.c,v 1.2 2021/01/02 18:06:01 rillig Exp $ */ # 3 "msg_000.c" // Test for message: empty declaration [0] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +extern int extern_declared; + +; + +static int local_defined; Index: src/tests/usr.bin/xlint/lint1/msg_000.exp diff -u src/tests/usr.bin/xlint/lint1/msg_000.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_000.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_000.exp:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_000.exp Sat Jan 2 18:06:01 2021 @@ -1 +1,2 @@ -msg_000.c(6): syntax error ':' [249] +msg_000.c(8): warning: empty declaration [0] +msg_000.c(10): warning: static variable local_defined unused [226] Index: src/tests/usr.bin/xlint/lint1/msg_001.c diff -u src/tests/usr.bin/xlint/lint1/msg_001.c:1.1 src/tests/usr.bin/xlint/lint1/msg_001.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_001.c:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_001.c Sat Jan 2 18:06:01 2021 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_001.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */ +/* $NetBSD: msg_001.c,v 1.2 2021/01/02 18:06:01 rillig Exp $ */ # 3 "msg_001.c" // Test for message: old style declaration; add int [1] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +old_style = 1; + +int new_style = 1; Index: src/tests/usr.bin/xlint/lint1/msg_001.exp diff -u src/tests/usr.bin/xlint/lint1/msg_001.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_001.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_001.exp:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_001.exp Sat Jan 2 18:06:01 2021 @@ -1 +1 @@ -msg_001.c(6): syntax error ':' [249] +msg_001.c(6): warning: old style declaration; add int [1] Index: src/tests/usr.bin/xlint/lint1/msg_002.c diff -u src/tests/usr.bin/xlint/lint1/msg_002.c:1.1 src/tests/usr.bin/xlint/lint1/msg_002.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_002.c:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_002.c Sat Jan 2 18:06:01 2021 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_002.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */ +/* $NetBSD: msg_002.c,v 1.2 2021/01/02 18:06:01 rillig Exp $ */ # 3 "msg_002.c" // Test for message: empty declaration [2] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +int; + +int local_variable; Index: src/tests/usr.bin/xlint/lint1/msg_002.exp diff -u src/tests/usr.bin/xlint/lint1/msg_002.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_002.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_002.exp:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_002.exp Sat Jan 2 18:06:01 2021 @@ -1 +1 @@ -msg_002.c(6): syntax error ':' [249] +msg_002.c(6): warning: empty declaration [2] Index: src/tests/usr.bin/xlint/lint1/msg_004.c diff -u src/tests/usr.bin/xlint/lint1/msg_004.c:1.1 src/tests/usr.bin/xlint/lint1/msg_004.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_004.c:1.1 Sat Jan 2 10:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_004.c Sat Jan 2 18:06:01 2021 @@ -1,7 +1,21 @@ -/* $NetBSD: msg_004.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */ +/* $NetBSD: msg_004.c,v 1.2 2021/01/02 18:06:01 rillig Exp $ */ # 3 "msg_004.c" // Test for message: illegal type combination [4] -TODO:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 18:26:44 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c emit1.c lint1.h tree.c Log Message: lint: fix lint warning 161 "constant in conditional context" To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.115 -r1.116 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.101 src/usr.bin/xlint/lint1/decl.c:1.102 --- src/usr.bin/xlint/lint1/decl.c:1.101 Sat Jan 2 18:06:01 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 18:26:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.101 2021/01/02 18:06:01 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 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.101 2021/01/02 18:06:01 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 rillig Exp $"); #endif #include @@ -661,7 +661,7 @@ popdecl(void) /* there is nothing after external declarations */ /* FALLTHROUGH */ default: - lint_assert(0); + lint_assert(/*CONSTCOND*/0); } free(di); } @@ -1566,7 +1566,7 @@ declarator_name(sym_t *sym) } break; default: - lint_assert(0); + lint_assert(/*CONSTCOND*/0); } sym->s_scl = sc; @@ -1749,7 +1749,7 @@ storage_class_name(scl_t sc) case STRTAG: s = "struct"; break; case UNIONTAG: s = "union"; break; case ENUMTAG: s = "enum"; break; - default: lint_assert(0); + default: lint_assert(/*CONSTCOND*/0); } return s; } @@ -2629,7 +2629,7 @@ decl1loc(sym_t *dsym, int initflg) */ break; default: -lint_assert(0); +lint_assert(/*CONSTCOND*/0); } } else if (dcs->d_rdcsym->s_blklev == blklev) { @@ -3074,7 +3074,7 @@ check_tag_usage(sym_t *sym) warning(235, sym->s_name); break; default: - lint_assert(0); + lint_assert(/*CONSTCOND*/0); } } Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.31 src/usr.bin/xlint/lint1/emit1.c:1.32 --- src/usr.bin/xlint/lint1/emit1.c:1.31 Fri Jan 1 09:28:22 2021 +++ src/usr.bin/xlint/lint1/emit1.c Sat Jan 2 18:26:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.31 2021/01/01 09:28:22 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.32 2021/01/02 18:26:44 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.31 2021/01/01 09:28:22 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.32 2021/01/02 18:26:44 rillig Exp $"); #endif #include @@ -128,7 +128,7 @@ outtype(type_t *tp) case DCOMPLEX: t = 'X'; s = '\0'; break; case LCOMPLEX: t = 'X'; s = 'l'; break; default: - lint_assert(0); + lint_assert(/*CONSTCOND*/0); } if (tp->t_const) outchar('c'); @@ -268,7 +268,7 @@ outsym(sym_t *sym, scl_t sc, def_t def) outchar('e'); break; default: - lint_assert(0); + lint_assert(/*CONSTCOND*/0); } if (llibflg && def != DECL) { /* Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.47 src/usr.bin/xlint/lint1/lint1.h:1.48 --- src/usr.bin/xlint/lint1/lint1.h:1.47 Sat Jan 2 01:06:15 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sat Jan 2 18:26:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.47 2021/01/02 01:06:15 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.48 2021/01/02 18:26:44 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -70,7 +70,7 @@ typedef struct { curr_pos.p_uniq++; \ if (curr_pos.p_file == csrc_pos.p_file) \ csrc_pos.p_uniq++;\ - } while (0) + } while (/*CONSTCOND*/0) /* * Strings cannot be referenced to simply by a pointer to its first Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.115 src/usr.bin/xlint/lint1/tree.c:1.116 --- src/usr.bin/xlint/lint1/tree.c:1.115 Sat Jan 2 03:49:25 2021 +++ src/usr.bin/xlint/lint1/tree.c Sat Jan 2 18:26:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.115 2021/01/02 03:49:25 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.116 2021/01/02 18:26:44 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.115 2021/01/02 03:49:25 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.116 2021/01/02 18:26:44 rillig Exp $"); #endif #include @@ -1968,7 +1968,7 @@ cvtcon(op_t op, int arg, type_t *tp, val case LCOMPLEX: max = LDBL_MAX; min = -LDBL_MAX; break; default: - lint_assert(0); + lint_assert(/*C
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 18:44:58 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c externs1.h func.c Log Message: lint: convert bitfieldtype_ok from int to bool No functional change intended, except for the output in debug mode. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.46 -r1.47 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/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.102 src/usr.bin/xlint/lint1/decl.c:1.103 --- src/usr.bin/xlint/lint1/decl.c:1.102 Sat Jan 2 18:26:44 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 18:44:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.103 2021/01/02 18:44:58 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.102 2021/01/02 18:26:44 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.103 2021/01/02 18:44:58 rillig Exp $"); #endif #include @@ -1106,7 +1106,7 @@ declarator_1_struct_union(sym_t *dsym) */ if (t == CHAR || t == UCHAR || t == SCHAR || t == SHORT || t == USHORT || t == ENUM) { - if (bitfieldtype_ok == 0) { + if (!bitfieldtype_ok) { if (sflag) { /* bit-field type '%s' invalid ... */ warning(273, type_name(tp)); @@ -1116,7 +1116,7 @@ declarator_1_struct_union(sym_t *dsym) } } } else if (t == INT && dcs->d_smod == NOTSPEC) { - if (pflag && bitfieldtype_ok == 0) { + if (pflag && !bitfieldtype_ok) { /* nonportable bit-field type */ warning(34); } @@ -1127,7 +1127,7 @@ declarator_1_struct_union(sym_t *dsym) * Integer types not dealt with above are * okay only if BITFIELDTYPE is in effect. */ - if (bitfieldtype_ok == 0 || tspec_is_int(t) == 0) { + if (!bitfieldtype_ok || !tspec_is_int(t)) { /* illegal bit-field type */ warning(35); sz = tp->t_flen; @@ -1194,7 +1194,7 @@ declarator_1_struct_union(sym_t *dsym) * Clear the BITFIELDTYPE indicator after processing each * structure element. */ - bitfieldtype_ok = 0; + bitfieldtype_ok = false; return dsym; } Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.43 src/usr.bin/xlint/lint1/externs1.h:1.44 --- src/usr.bin/xlint/lint1/externs1.h:1.43 Fri Jan 1 10:55:28 2021 +++ src/usr.bin/xlint/lint1/externs1.h Sat Jan 2 18:44:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.43 2021/01/01 10:55:28 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.44 2021/01/02 18:44:58 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -239,7 +239,7 @@ extern pos_t scanflike_pos; extern int constcond_flag; extern int llibflg; extern int lwarn; -extern int bitfieldtype_ok; +extern bool bitfieldtype_ok; extern int plibflg; extern int quadflg; Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.46 src/usr.bin/xlint/lint1/func.c:1.47 --- src/usr.bin/xlint/lint1/func.c:1.46 Fri Jan 1 11:41:01 2021 +++ src/usr.bin/xlint/lint1/func.c Sat Jan 2 18:44:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.46 2021/01/01 11:41:01 rillig Exp $ */ +/* $NetBSD: func.c,v 1.47 2021/01/02 18:44:58 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.46 2021/01/01 11:41:01 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.47 2021/01/02 18:44:58 rillig Exp $"); #endif #include @@ -138,10 +138,10 @@ int llibflg; int lwarn = LWARN_ALL; /* - * Nonzero if bitfield type errors are suppressed by a BITFIELDTYPE + * Whether bitfield type errors are suppressed by a BITFIELDTYPE * directive. */ -int bitfieldtype_ok; +bool bitfieldtype_ok; /* * Nonzero if complaints about use of "long long" are suppressed in @@ -1261,10 +1261,10 @@ bitfieldtype(int n) { #ifdef DEBUG - printf("%s, %d: bitfieldtype_ok = 1\n", curr_pos.p_file, + printf("%s, %d: bitfieldtype_ok = true\n", curr_pos.p_file, curr_pos.p_line); #endif - bitfieldtype_ok = 1; + bitfieldtype_ok = true; } /*
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jan 2 19:22:42 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: t_integration.sh Log Message: lint: fix integration test The body of an ATF test must never return 1 but instead report failure via atf_fail. Otherwise the following error message appears: Failed: Test case body returned a non-ok exit code, but this is not allowed The test program t_integration intentionally bypasses the official ATF API for performance reasons. But even then, it should stick to the API as close as possible. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 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.19 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.20 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.19 Sat Jan 2 11:12:34 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sat Jan 2 19:22:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.19 2021/01/02 11:12:34 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.20 2021/01/02 19:22:42 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -147,10 +147,10 @@ test_case long_double_int "Checks for co test_case all_messages all_messages_body() { - local srcdir status msg base flags + local srcdir ok msg base flags srcdir="$(atf_get_srcdir)" - status="0" + ok="true" for msg in $(seq 0 329); do base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")" @@ -160,9 +160,10 @@ all_messages_body() { # shellcheck disable=SC2154 disable=SC2086 ${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \ ${LINT1} ${flags} "${base}.c" /dev/null \ - || status="1" + || ok="false" done - return "${status}" + + atf_check "${ok}" }
CVS commit: src/sbin/route
Module Name:src Committed By: uwe Date: Sat Jan 2 19:50:42 UTC 2021 Modified Files: src/sbin/route: route.8 Log Message: route(8): don't split -blackhole and -noblackhole. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sbin/route/route.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/route/route.8 diff -u src/sbin/route/route.8:1.62 src/sbin/route/route.8:1.63 --- src/sbin/route/route.8:1.62 Sat Aug 29 19:27:08 2020 +++ src/sbin/route/route.8 Sat Jan 2 19:50:42 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: route.8,v 1.62 2020/08/29 19:27:08 christos Exp $ +.\" $NetBSD: route.8,v 1.63 2021/01/02 19:50:42 uwe Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -299,8 +299,8 @@ by indicating the following correspondin .It Li 1 Ta -proto1 Ta " RTF_PROTO1" Ta set protocol specific flag #1 .It Li 2 Ta -proto2 Ta " RTF_PROTO2" Ta set protocol specific flag #2 .It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates) -.It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address .It Li " " Ta -noblackhole Ta ~RTF_BLACKHOLE Ta clear blackhole flag +.It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address .It Li C Ta -cloning Ta " RTF_CLONING" Ta (deprecated) same as .Fl connected .It Li " " Ta -nocloning Ta ~RTF_CLONING Ta (deprecated) same as
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Jan 2 20:09:06 UTC 2021 Modified Files: src/usr.bin/make: job.c Log Message: make(1): add a few remarks to JobOutput That function is not used in practice. Still, there are a lot of subtle details that can get wrong in that code. To generate a diff of this commit: cvs rdiff -u -r1.391 -r1.392 src/usr.bin/make/job.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/job.c diff -u src/usr.bin/make/job.c:1.391 src/usr.bin/make/job.c:1.392 --- src/usr.bin/make/job.c:1.391 Wed Dec 30 10:03:16 2020 +++ src/usr.bin/make/job.c Sat Jan 2 20:09:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.391 2020/12/30 10:03:16 rillig Exp $ */ +/* $NetBSD: job.c,v 1.392 2021/01/02 20:09:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.391 2020/12/30 10:03:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.392 2021/01/02 20:09:06 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1736,41 +1736,42 @@ JobStart(GNode *gn, Boolean special) } /* - * Print the output of the shell command, skipping the noPrint command of - * the shell, if any. + * Print the output of the shell command, skipping the noPrint text of the + * shell, if any. The default shell does not have noPrint though, which means + * that in all practical cases, handling the output is left to the caller. */ static char * -JobOutput(char *cp, char *endp) +JobOutput(char *cp, char *endp) /* XXX: should all be const */ { - char *ecp; + char *ecp; /* XXX: should be const */ if (shell->noPrint == NULL || shell->noPrint[0] == '\0') return cp; + /* + * XXX: What happens if shell->noPrint occurs on the boundary of + * the buffer? To work correctly in all cases, this should rather + * be a proper stream filter instead of doing string matching on + * selected chunks of the output. + */ while ((ecp = strstr(cp, shell->noPrint)) != NULL) { if (ecp != cp) { - *ecp = '\0'; + *ecp = '\0'; /* XXX: avoid writing to the buffer */ /* * The only way there wouldn't be a newline after * this line is if it were the last in the buffer. - * however, since the non-printable comes after it, + * however, since the noPrint output comes after it, * there must be a newline, so we don't print one. */ + /* XXX: What about null bytes in the output? */ (void)fprintf(stdout, "%s", cp); (void)fflush(stdout); } cp = ecp + shell->noPrintLen; - if (cp != endp) { - /* - * Still more to print, look again after skipping - * the whitespace following the non-printable - * command. - */ - cp++; - pp_skip_whitespace(&cp); - } else { - return cp; - } + if (cp == endp) + break; + cp++; /* skip over the (XXX: assumed) newline */ + pp_skip_whitespace(&cp); } return cp; }
CVS commit: src/sbin/route
Module Name:src Committed By: uwe Date: Sat Jan 2 20:36:02 UTC 2021 Modified Files: src/sbin/route: route.8 Log Message: route(8): be consistent about capitalization. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sbin/route/route.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/route/route.8 diff -u src/sbin/route/route.8:1.63 src/sbin/route/route.8:1.64 --- src/sbin/route/route.8:1.63 Sat Jan 2 19:50:42 2021 +++ src/sbin/route/route.8 Sat Jan 2 20:36:02 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: route.8,v 1.63 2021/01/02 19:50:42 uwe Exp $ +.\" $NetBSD: route.8,v 1.64 2021/01/02 20:36:02 uwe Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -300,7 +300,7 @@ by indicating the following correspondin .It Li 2 Ta -proto2 Ta " RTF_PROTO2" Ta set protocol specific flag #2 .It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates) .It Li " " Ta -noblackhole Ta ~RTF_BLACKHOLE Ta clear blackhole flag -.It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address +.It Li b Ta "" Ta " RTF_BROADCAST" Ta route represents a broadcast address .It Li C Ta -cloning Ta " RTF_CLONING" Ta (deprecated) same as .Fl connected .It Li " " Ta -nocloning Ta ~RTF_CLONING Ta (deprecated) same as @@ -311,7 +311,7 @@ by indicating the following correspondin .It Li G Ta "" Ta " RTF_GATEWAY" Ta forwarded to dest by intermediary .It Li H Ta "" Ta " RTF_HOST" Ta host entry (net otherwise) .It Li L Ta "" Ta " RTF_LLDATA" Ta local link, generated by ARP or NDP -.It Li l Ta "" Ta " RTF_LOCAL" Ta Route represents a local address +.It Li l Ta "" Ta " RTF_LOCAL" Ta route represents a local address .It Li M Ta "" Ta " RTF_MODIFIED" Ta modified dynamically (redirect) .It Li p Ta -proxy Ta " RTF_ANNOUNCE" Ta make entry a link level proxy .It Li R Ta -reject Ta " RTF_REJECT" Ta send ICMP unreachable on match
CVS commit: src/sbin/route
Module Name:src Committed By: uwe Date: Sat Jan 2 22:02:27 UTC 2021 Modified Files: src/sbin/route: route.8 Log Message: route(8): group RTF_GATEWAY and ~RTF_GATEWAY (-iface). While here, tweak RTF_GATEWAY description. Passive voice elsewhere in this table is used to talk about the routes themselves, while here it's about packets. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sbin/route/route.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/route/route.8 diff -u src/sbin/route/route.8:1.64 src/sbin/route/route.8:1.65 --- src/sbin/route/route.8:1.64 Sat Jan 2 20:36:02 2021 +++ src/sbin/route/route.8 Sat Jan 2 22:02:27 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: route.8,v 1.64 2021/01/02 20:36:02 uwe Exp $ +.\" $NetBSD: route.8,v 1.65 2021/01/02 22:02:27 uwe Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -295,7 +295,6 @@ display and may be set (or sometimes cle by indicating the following corresponding modifiers: .Bl -column "ID" "xnoblackhole" "xRTF_BLACKHOLE" "x" .It Sy "ID" Ta Sy "Modifier" Ta Sy " Flag Bit" Ta Sy "Description" -.It Li " " Ta -iface Ta ~RTF_GATEWAY Ta destination is directly reachable .It Li 1 Ta -proto1 Ta " RTF_PROTO1" Ta set protocol specific flag #1 .It Li 2 Ta -proto2 Ta " RTF_PROTO2" Ta set protocol specific flag #2 .It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates) @@ -308,7 +307,8 @@ by indicating the following correspondin .It Li C Ta -connected Ta " RTF_CONNECTED" Ta treat as a connected route .It Li " " Ta -noconnected Ta ~RTF_CONNECTED Ta stop treating a connected route .It Li D Ta "" Ta " RTF_DYNAMIC" Ta created dynamically (redirect) -.It Li G Ta "" Ta " RTF_GATEWAY" Ta forwarded to dest by intermediary +.It Li G Ta "" Ta " RTF_GATEWAY" Ta forward to dest by intermediary +.It Li " " Ta -iface Ta ~RTF_GATEWAY Ta destination is directly reachable .It Li H Ta "" Ta " RTF_HOST" Ta host entry (net otherwise) .It Li L Ta "" Ta " RTF_LLDATA" Ta local link, generated by ARP or NDP .It Li l Ta "" Ta " RTF_LOCAL" Ta route represents a local address
CVS commit: src/bin/df
Module Name:src Committed By: ginsbach Date: Sun Jan 3 01:43:13 UTC 2021 Modified Files: src/bin/df: df.1 df.c Log Message: df: add grand total option Add a grand total option, -c, similar to the du(1) -c option. Adapted from the same option (-c) in FreeBSD df(1). To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/bin/df/df.1 cvs rdiff -u -r1.97 -r1.98 src/bin/df/df.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/df/df.1 diff -u src/bin/df/df.1:1.54 src/bin/df/df.1:1.55 --- src/bin/df/df.1:1.54 Mon Sep 23 15:24:44 2019 +++ src/bin/df/df.1 Sun Jan 3 01:43:12 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: df.1,v 1.54 2019/09/23 15:24:44 christos Exp $ +.\" $NetBSD: df.1,v 1.55 2021/01/03 01:43:12 ginsbach Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -37,7 +37,7 @@ .Nd display free disk space .Sh SYNOPSIS .Nm -.Op Fl aglnW +.Op Fl acglnW .Op Fl Ghkm | Fl ihkm | Fl Pk .Op Fl t Ar type .Op Ar file | Ar file_system ... @@ -72,6 +72,8 @@ Show all mount points, including those that were mounted with the .Dv MNT_IGNORE flag. +.It Fl c +Display a grand total for all shown mount points. .It Fl G Display all the fields of the structure(s) returned by .Xr statvfs 2 . Index: src/bin/df/df.c diff -u src/bin/df/df.c:1.97 src/bin/df/df.c:1.98 --- src/bin/df/df.c:1.97 Fri Aug 21 16:41:06 2020 +++ src/bin/df/df.c Sun Jan 3 01:43:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: df.c,v 1.97 2020/08/21 16:41:06 ryo Exp $ */ +/* $NetBSD: df.c,v 1.98 2021/01/03 01:43:12 ginsbach Exp $ */ /* * Copyright (c) 1980, 1990, 1993, 1994 @@ -45,7 +45,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: df.c,v 1.97 2020/08/21 16:41:06 ryo Exp $"); +__RCSID("$NetBSD: df.c,v 1.98 2021/01/03 01:43:12 ginsbach Exp $"); #endif #endif /* not lint */ @@ -67,6 +67,7 @@ __RCSID("$NetBSD: df.c,v 1.97 2020/08/21 #include static char *getmntpt(const char *); +static void addstat(struct statvfs *, const struct statvfs *); static void prtstat(const struct statvfs *, int); static int selected(const char *, size_t); static void maketypelist(char *); @@ -75,7 +76,7 @@ __dead static void usage(void); static void prthumanval(int64_t, int); static void prthuman(const struct statvfs *, int64_t, int64_t); -static int aflag, gflag, hflag, iflag, lflag, nflag, Pflag, Wflag; +static int aflag, cflag, gflag, hflag, iflag, lflag, nflag, Pflag, Wflag; static long usize; static char **typelist; @@ -87,7 +88,7 @@ int main(int argc, char *argv[]) { struct stat stbuf; - struct statvfs *mntbuf; + struct statvfs *mntbuf, totals; int ch, maxwidth, width; size_t i, mntcount; char *mntpt; @@ -95,11 +96,14 @@ main(int argc, char *argv[]) setprogname(argv[0]); (void)setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "aGghiklmnPt:W")) != -1) + while ((ch = getopt(argc, argv, "acGghiklmnPt:W")) != -1) switch (ch) { case 'a': aflag = 1; break; + case 'c': + cflag = 1; + break; case 'g': hflag = 0; usize = 1024 * 1024 * 1024; @@ -207,15 +211,28 @@ main(int argc, char *argv[]) } } + if (cflag) { + memset(&totals, 0, sizeof(totals)); + totals.f_bsize = DEV_BSIZE; + strlcpy(totals.f_mntfromname, "total", + sizeof(totals.f_mntfromname)); + } + maxwidth = 0; for (i = 0; i < mntcount; i++) { width = (int)strlen(Wflag && mntbuf[i].f_mntfromlabel[0] ? mntbuf[i].f_mntfromlabel : mntbuf[i].f_mntfromname); if (width > maxwidth) maxwidth = width; + if (cflag) + addstat(&totals, &mntbuf[i]); } for (i = 0; i < mntcount; i++) prtstat(&mntbuf[i], maxwidth); + + if (cflag) + prtstat(&totals, maxwidth); + return 0; } @@ -361,6 +378,22 @@ prthuman(const struct statvfs *sfsp, int (int64_t)(num) / (int64_t)((bs) / (fsbs)) : \ (int64_t)(num) * (int64_t)((fsbs) / (bs))) +static void +addstat(struct statvfs *totalfsp, const struct statvfs *sfsp) +{ + uint64_t frsize; + + frsize = sfsp->f_frsize / totalfsp->f_frsize; + totalfsp->f_blocks += sfsp->f_blocks * frsize; + totalfsp->f_bfree += sfsp->f_bfree * frsize; + totalfsp->f_bavail += sfsp->f_bavail * frsize; + totalfsp->f_bresvd += sfsp->f_bresvd * frsize; + totalfsp->f_files += sfsp->f_files; + totalfsp->f_ffree += sfsp->f_ffree; + totalfsp->f_favail += sfsp->f_favail; + totalfsp->f_fresvd += sfsp->f_fresvd; +} + /* * Print out status about a filesystem. */