CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: simonb Date: Mon Jan 18 05:44:21 UTC 2021 Modified Files: src/tests/lib/libc/sys: t_syscall.c Log Message: Check for MAP_FAILED instead of NULL when looking for an error from mmap(2). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_syscall.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/lib/libc/sys/t_syscall.c diff -u src/tests/lib/libc/sys/t_syscall.c:1.3 src/tests/lib/libc/sys/t_syscall.c:1.4 --- src/tests/lib/libc/sys/t_syscall.c:1.3 Mon May 28 07:55:56 2018 +++ src/tests/lib/libc/sys/t_syscall.c Mon Jan 18 05:44:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: t_syscall.c,v 1.3 2018/05/28 07:55:56 martin Exp $ */ +/* $NetBSD: t_syscall.c,v 1.4 2021/01/18 05:44:20 simonb Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_syscall.c,v 1.3 2018/05/28 07:55:56 martin Exp $"); +__RCSID("$NetBSD: t_syscall.c,v 1.4 2021/01/18 05:44:20 simonb Exp $"); #include @@ -75,7 +75,7 @@ ATF_TC_BODY(mmap_syscall, tc) p = (const char *)syscall(SYS_mmap, 0, sizeof(secrect_data), PROT_READ, MAP_PRIVATE, fd, 0, 0, 0); - ATF_REQUIRE(p != NULL); + ATF_REQUIRE(p != MAP_FAILED); ATF_REQUIRE(strcmp(p, secrect_data) == 0); } @@ -101,7 +101,7 @@ ATF_TC_BODY(mmap___syscall, tc) p = (const char *)__SYSCALL_TO_UINTPTR_T(__syscall(SYS_mmap, 0, sizeof(secrect_data), PROT_READ, MAP_PRIVATE, fd, /* pad*/ 0, (off_t)0)); - ATF_REQUIRE(p != NULL); + ATF_REQUIRE(p != MAP_FAILED); ATF_REQUIRE(strcmp(p, secrect_data) == 0); }
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:35:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Invoke hardclock() and statclock() in the interrupt context. Otherwise, entropy_enter() is used instead of entropy_enter_intr() in statclock(), which results in KASSERT() failure. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/ibm4xx/clock.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/powerpc/ibm4xx/clock.c diff -u src/sys/arch/powerpc/ibm4xx/clock.c:1.30 src/sys/arch/powerpc/ibm4xx/clock.c:1.31 --- src/sys/arch/powerpc/ibm4xx/clock.c:1.30 Mon Jan 18 04:30:12 2021 +++ src/sys/arch/powerpc/ibm4xx/clock.c Mon Jan 18 04:35:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $ */ +/* $NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $ */ /* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */ /* @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -104,8 +104,11 @@ stat_intr(struct clockframe *frame) */ __asm volatile ("wrteei 1"); - if (IPL_CLOCK > s) + if (IPL_CLOCK > s) { + ci->ci_idepth++; statclock(frame); + ci->ci_idepth--; + } splx(s); } @@ -156,8 +159,10 @@ decr_intr(struct clockframe *frame) /* * Do standard timer interrupt stuff. */ + ci->ci_idepth++; while (nticks-- > 0) hardclock(frame); + ci->ci_idepth--; } splx(pcpl); }
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:30:13 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Simplify and correct stale comment; nticks-th hardclock() had no longer been special since rev 1.24: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/clock.c#rev1.24 No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/ibm4xx/clock.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/powerpc/ibm4xx/clock.c diff -u src/sys/arch/powerpc/ibm4xx/clock.c:1.29 src/sys/arch/powerpc/ibm4xx/clock.c:1.30 --- src/sys/arch/powerpc/ibm4xx/clock.c:1.29 Mon Jul 6 10:31:23 2020 +++ src/sys/arch/powerpc/ibm4xx/clock.c Mon Jan 18 04:30:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.29 2020/07/06 10:31:23 rin Exp $ */ +/* $NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $ */ /* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */ /* @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.29 2020/07/06 10:31:23 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -155,11 +155,9 @@ decr_intr(struct clockframe *frame) /* * Do standard timer interrupt stuff. - * Do softclock stuff only on the last iteration. */ - while (--nticks > 0) + while (nticks-- > 0) hardclock(frame); - hardclock(frame); } splx(pcpl); }
CVS commit: src/distrib/amd64/installimage
Module Name:src Committed By: pgoyette Date: Mon Jan 18 03:35:11 UTC 2021 Modified Files: src/distrib/amd64/installimage: Makefile Log Message: Oooppss we need another size bump To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/distrib/amd64/installimage/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/amd64/installimage/Makefile diff -u src/distrib/amd64/installimage/Makefile:1.13 src/distrib/amd64/installimage/Makefile:1.14 --- src/distrib/amd64/installimage/Makefile:1.13 Fri Jan 15 21:14:53 2021 +++ src/distrib/amd64/installimage/Makefile Mon Jan 18 03:35:11 2021 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.13 2021/01/15 21:14:53 pgoyette Exp $ +# $NetBSD: Makefile,v 1.14 2021/01/18 03:35:11 pgoyette Exp $ .include INSTIMGBASE= NetBSD-${DISTRIBVER}-amd64-install # gives ${IMGBASE}.img -INSTIMAGEMB?= 1580 # for all installation binaries +INSTIMAGEMB?= 1590 # for all installation binaries PRIMARY_BOOT= bootxx_ffsv1 SECONDARY_BOOT= boot
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 02:43:27 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: white space --> tab To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.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/powerpc/ibm4xx/ibm4xx_machdep.c diff -u src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.33 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.34 --- src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.33 Wed Jan 6 08:07:36 2021 +++ src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Mon Jan 18 02:43:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $ */ +/* $NetBSD: ibm4xx_machdep.c,v 1.34 2021/01/18 02:43:27 rin Exp $ */ /* Original: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.34 2021/01/18 02:43:27 rin Exp $"); #include "ksyms.h" @@ -208,7 +208,7 @@ ibm4xx_init(vaddr_t startkernel, vaddr_t * external interrupt handler install */ if (handler) - ibm4xx_install_extint(handler); + ibm4xx_install_extint(handler); /* * Now enable translation (and machine checks/recoverable interrupts).
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: rin Date: Mon Jan 18 01:38:44 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: Fix build as crash(8); Protect db_md_meminfo_cmd() by defined(_KERNEL). To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/aarch64/db_machdep.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/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.31 src/sys/arch/aarch64/aarch64/db_machdep.c:1.32 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.31 Sun Jan 17 00:23:59 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Mon Jan 18 01:38:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.31 2021/01/17 00:23:59 mrg Exp $ */ +/* $NetBSD: db_machdep.c,v 1.32 2021/01/18 01:38:44 rin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.31 2021/01/17 00:23:59 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.32 2021/01/18 01:38:44 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -79,7 +79,9 @@ void db_md_watch_cmd(db_expr_t, bool, db #if defined(_KERNEL) && defined(MULTIPROCESSOR) void db_md_switch_cpu_cmd(db_expr_t, bool, db_expr_t, const char *); #endif +#if defined(_KERNEL) static void db_md_meminfo_cmd(db_expr_t, bool, db_expr_t, const char *); +#endif const struct db_command db_machine_command_table[] = { #if defined(_KERNEL) && defined(MULTIPROCESSOR) @@ -1083,6 +1085,7 @@ kdb_trap(int type, struct trapframe *tf) } #endif +#if defined(_KERNEL) static void db_md_meminfo_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) @@ -1097,3 +1100,4 @@ db_md_meminfo_cmd(db_expr_t addr, bool h bootconfig.dram[blk].pages); } } +#endif
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: nia Date: Mon Jan 18 00:32:38 UTC 2021 Modified Files: src/sys/arch/evbarm/conf: GENERIC.common Log Message: disable compat_ossaudio, it's not useful without compat_linux when running netbsd binaries we use userspace libossaudio instead. "oh. plz undo then. badly named option" - jmcneill To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/arch/evbarm/conf/GENERIC.common Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/GENERIC.common diff -u src/sys/arch/evbarm/conf/GENERIC.common:1.45 src/sys/arch/evbarm/conf/GENERIC.common:1.46 --- src/sys/arch/evbarm/conf/GENERIC.common:1.45 Sat Jan 16 20:33:32 2021 +++ src/sys/arch/evbarm/conf/GENERIC.common Mon Jan 18 00:32:38 2021 @@ -1,5 +1,5 @@ # -# $NetBSD: GENERIC.common,v 1.45 2021/01/16 20:33:32 jmcneill Exp $ +# $NetBSD: GENERIC.common,v 1.46 2021/01/18 00:32:38 nia Exp $ # # GENERIC evbarm kernel config (template) # @@ -69,7 +69,6 @@ options NFS_BOOT_RWSIZE=1024 # Compatibility options include "conf/compat_netbsd60.config" -options COMPAT_OSSAUDIO # OSS audio emulation options COMPAT_NETBSD32 # allow running arm (e.g. non-earm) binaries # on arm or arm binaries on arm64
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 23:04:09 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c d_c99_bool_strict_syshdr.exp src/usr.bin/xlint/lint1: externs1.h scan.l tree.c Log Message: lint: allow system headers to use int as bool, even in strict bool mode To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.180 -r1.181 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/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.1 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.2 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c:1.1 Sun Jan 17 23:00:41 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c Sun Jan 17 23:04:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.1 2021/01/17 23:00:41 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.2 2021/01/17 23:04:09 rillig Exp $ */ # 3 "d_c99_bool_strict_syshdr.c" /* @@ -26,7 +26,7 @@ strict_bool_system_header_statement_macr # 27 "d_c99_bool_strict_syshdr.c" 3 4 do { println("nothing"); - } while (/*CONSTCOND*/0); /*FIXME*//* expect: 333 */ + } while (/*CONSTCOND*/0); /* ok */ # 32 "d_c99_bool_strict_syshdr.c" do { Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.1 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.2 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp:1.1 Sun Jan 17 23:00:41 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp Sun Jan 17 23:04:09 2021 @@ -1,5 +1,4 @@ d_c99_bool_strict_syshdr.c(24): controlling expression must be bool, not 'int' [333] -d_c99_bool_strict_syshdr.c(29): controlling expression must be bool, not 'int' [333] d_c99_bool_strict_syshdr.c(34): controlling expression must be bool, not 'int' [333] d_c99_bool_strict_syshdr.c(71): operands of '=' have incompatible types (_Bool != int) [107] d_c99_bool_strict_syshdr.c(77): operands of '=' have incompatible types (int != _Bool) [107] Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.57 src/usr.bin/xlint/lint1/externs1.h:1.58 --- src/usr.bin/xlint/lint1/externs1.h:1.57 Sun Jan 17 15:40:27 2021 +++ src/usr.bin/xlint/lint1/externs1.h Sun Jan 17 23:04:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.57 2021/01/17 15:40:27 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.58 2021/01/17 23:04:09 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -71,6 +71,7 @@ extern int yyparse(void); extern bool attron; extern pos_t curr_pos; extern pos_t csrc_pos; +extern bool in_system_header; extern symt_t symtyp; extern FILE *yyin; extern uint64_t qbmasks[], qlmasks[], qumasks[]; Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.120 src/usr.bin/xlint/lint1/scan.l:1.121 --- src/usr.bin/xlint/lint1/scan.l:1.120 Sun Jan 17 15:09:56 2021 +++ src/usr.bin/xlint/lint1/scan.l Sun Jan 17 23:04:09 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 rillig Exp $ */ +/* $NetBSD: scan.l,v 1.121 2021/01/17 23:04:09 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 rillig Exp $"); +__RCSID("$NetBSD: scan.l,v 1.121 2021/01/17 23:04:09 rillig Exp $"); #endif #include @@ -63,6 +63,8 @@ pos_t csrc_pos = { 1, "", 0 }; /* Are we parsing a gcc attribute? */ bool attron; +bool in_system_header = false; + static void incline(void); static void badchar(int); static sbuf_t *allocsb(void); @@ -1115,6 +1117,29 @@ getescc(int d) return c; } +/* See https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html */ +static void +parse_line_directive_flags(const char *p) +{ + + in_system_header = false; + + while (ch_isspace(*p)) + p++; + while (ch_isdigit(*p)) { + if (*p == '3' && !ch_isdigit(p[1])) + in_system_header = true; + p++; + while (ch_isspace(*p)) + p++; + } + +#if 0 + if (c != '\0') + warning("extra character(s) after directive"); +#endif +} + /* * Called for preprocessor directives. Currently implemented are: * # lineno @@ -1158,12 +1183,7 @@ directive(void) goto error; if ((fnl = cp++ - fn) > PATH_MAX) goto error; - while ((c = *cp++) == ' ' || c == '\t') - continue; -#if 0 - if (c != '\0') - warning("extra character(s) after directive"); -#endif +
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 23:00:41 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile d_c99_bool_strict.c d_c99_bool_strict.exp t_integration.sh Added Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict_syshdr.c d_c99_bool_strict_syshdr.exp Log Message: lint: add more tests for system headers in strict bool mode To generate a diff of this commit: cvs rdiff -u -r1.1011 -r1.1012 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.29 -r1.30 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.14 -r1.15 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp cvs rdiff -u -r0 -r1.1 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp cvs rdiff -u -r1.26 -r1.27 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.1011 src/distrib/sets/lists/tests/mi:1.1012 --- src/distrib/sets/lists/tests/mi:1.1011 Thu Jan 14 22:18:13 2021 +++ src/distrib/sets/lists/tests/mi Sun Jan 17 23:00:41 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1011 2021/01/14 22:18:13 rillig Exp $ +# $NetBSD: mi,v 1.1012 2021/01/17 23:00:41 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5749,6 +5749,8 @@ ./usr/tests/usr.bin/xlint/lint1/d_c99_bool.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_complex_num.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_complex_split.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.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.29 src/tests/usr.bin/xlint/lint1/Makefile:1.30 --- src/tests/usr.bin/xlint/lint1/Makefile:1.29 Thu Jan 14 22:18:14 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jan 17 23:00:41 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.29 2021/01/14 22:18:14 rillig Exp $ +# $NetBSD: Makefile,v 1.30 2021/01/17 23:00:41 rillig Exp $ NOMAN= # defined @@ -15,6 +15,8 @@ FILES+= d_c99_bool.c FILES+= d_c99_bool.exp FILES+= d_c99_bool_strict.c FILES+= d_c99_bool_strict.exp +FILES+= d_c99_bool_strict_syshdr.c +FILES+= d_c99_bool_strict_syshdr.exp FILES+= d_c99_anon_struct.c FILES+= d_c99_anon_union.c FILES+= d_c99_complex_num.c Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.16 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.17 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.16 Sun Jan 17 21:19:06 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sun Jan 17 23:00:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.16 2021/01/17 21:19:06 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.17 2021/01/17 23:00:41 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -727,26 +727,3 @@ strict_bool_assign_bit_field_then_compar (void)((s.flag = s.flag) != __lint_false); } - -/* - * Macros from system headers that have return type bool may or may not - * include the '!= 0' test, that is, their result can have any scalar type. - */ -void -strict_bool_system_header(void) -{ - - do { - println("nothing"); - } while (/*CONSTCOND*/0); /* expect: 333 */ - -# 744 "d_c99_bool_strict.c" 3 4 - do { - println("nothing"); - } while (/*CONSTCOND*/0); /*TODO*//* expect: 333 */ - -# 749 "d_c99_bool_strict.c" - do { - println("nothing"); - } while (/*CONSTCOND*/0); /* expect: 333 */ -} Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.14 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.15 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.14 Sun Jan 17 21:19:06 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sun Jan 17 23:00:41 2021 @@ -146,6 +146,3 @@ d_c99_bool_strict.c(670): operands of '= d_c99_bool_strict.c(677): operands of '=' have incompatible types (_Bool != int) [107] d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool_bitwise_and_enum [231] d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107]
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: chs Date: Sun Jan 17 22:32:25 UTC 2021 Modified Files: src/sys/rump/librump/rumpkern: rump.c Log Message: rump_component_init() is called recursively, so LIST_FOREACH_SAFE is not actually safe, since the recursive calls can result in elements other than the current element being removed from the list. instead use an explicit marker element to do safe list traversal. To generate a diff of this commit: cvs rdiff -u -r1.352 -r1.353 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.352 src/sys/rump/librump/rumpkern/rump.c:1.353 --- src/sys/rump/librump/rumpkern/rump.c:1.352 Sat Jan 16 23:50:49 2021 +++ src/sys/rump/librump/rumpkern/rump.c Sun Jan 17 22:32:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $ */ +/* $NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $"); #include #define ELFSIZE ARCH_ELFSIZE @@ -605,14 +605,22 @@ rump_component_count(enum rump_component void rump_component_init(enum rump_component_type type) { - struct rump_component *rc, *rc_safe; + struct rump_component *rc, *rc_next, rc_marker; KASSERT(curlwp == bootlwp); KASSERT(!compinited[type]); - LIST_FOREACH_SAFE(rc, , rc_entries, rc_safe) { + + rc_marker.rc_type = RUMP_COMPONENT_MAX; + rc_marker.rc_init = NULL; + for (rc = LIST_FIRST(); rc != NULL; rc = rc_next) { if (rc->rc_type == type) { + LIST_INSERT_AFTER(rc, _marker, rc_entries); rc->rc_init(); LIST_REMOVE(rc, rc_entries); + rc_next = LIST_NEXT(_marker, rc_entries); + LIST_REMOVE(_marker, rc_entries); + } else { + rc_next = LIST_NEXT(rc, rc_entries); } } compinited[type] = 1;
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Jan 17 21:56:20 UTC 2021 Modified Files: src/sys/dev/i2c: at24cxx.c axppmic.c ds1307.c fan53555.c m41st84.c pcagpio.c pcai2cmux.c rkpmic.c src/sys/sys: device.h Log Message: Change the device_compatible_entry struct to have a union of a scalar value (uintptr_t value) and a pointer value (const void *data), rather than just "uintptr_t data". This eliminates the need for drivers to cast this value, and doesn't lose const'ness of pointers assigned to the field. Update all of the users of this field to use the correct set of designated initialisers for each specific case. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/i2c/at24cxx.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/i2c/axppmic.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/i2c/ds1307.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/fan53555.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/i2c/m41st84.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/pcagpio.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/pcai2cmux.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/rkpmic.c cvs rdiff -u -r1.159 -r1.160 src/sys/sys/device.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/i2c/at24cxx.c diff -u src/sys/dev/i2c/at24cxx.c:1.36 src/sys/dev/i2c/at24cxx.c:1.37 --- src/sys/dev/i2c/at24cxx.c:1.36 Wed Jan 15 06:09:36 2020 +++ src/sys/dev/i2c/at24cxx.c Sun Jan 17 21:56:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: at24cxx.c,v 1.36 2020/01/15 06:09:36 thorpej Exp $ */ +/* $NetBSD: at24cxx.c,v 1.37 2021/01/17 21:56:20 thorpej Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.36 2020/01/15 06:09:36 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.37 2021/01/17 21:56:20 thorpej Exp $"); #include #include @@ -112,21 +112,22 @@ const struct cdevsw seeprom_cdevsw = { static int seeprom_wait_idle(struct seeprom_softc *); static const struct device_compatible_entry compat_data[] = { - { "i2c-at24c01", 128 }, - { "i2c-at24c02", 256 }, - { "i2c-at24c04", 512 }, - { "i2c-at24c08", 1024 }, - { "i2c-at24c16", 2048 }, - { "i2c-at24c32", 4096 }, - { "i2c-at24c64", 8192 }, - { "i2c-at24c128", 16384 }, - { "i2c-at24c256", 32768 }, - { "i2c-at24c512", 65536 }, - { "i2c-at34c02", 256 }, - { "atmel,24c02", 256 }, - { "atmel,24c16", 2048 }, - { "atmel,24c256", 32768 }, - { NULL,0 } + { .compat = "i2c-at24c01", .value = 128 }, + { .compat = "i2c-at24c02", .value = 256 }, + { .compat = "i2c-at24c04", .value = 512 }, + { .compat = "i2c-at24c08", .value = 1024 }, + { .compat = "i2c-at24c16", .value = 2048 }, + { .compat = "i2c-at24c32", .value = 4096 }, + { .compat = "i2c-at24c64", .value = 8192 }, + { .compat = "i2c-at24c128", .value = 16384 }, + { .compat = "i2c-at24c256", .value = 32768 }, + { .compat = "i2c-at24c512", .value = 65536 }, + { .compat = "i2c-at34c02", .value = 256 }, + { .compat = "atmel,24c02", .value = 256 }, + { .compat = "atmel,24c16", .value = 2048 }, + { .compat = "atmel,24c256", .value = 32768 }, + + { 0 } }; static int @@ -182,7 +183,7 @@ seeprom_attach(device_t parent, device_t if (sc->sc_size <= 0 && ia->ia_ncompat > 0) { if (iic_compatible_match(ia, compat_data, )) - sc->sc_size = dce->data; + sc->sc_size = dce->value; } switch (sc->sc_size) { Index: src/sys/dev/i2c/axppmic.c diff -u src/sys/dev/i2c/axppmic.c:1.29 src/sys/dev/i2c/axppmic.c:1.30 --- src/sys/dev/i2c/axppmic.c:1.29 Sun Feb 16 20:32:29 2020 +++ src/sys/dev/i2c/axppmic.c Sun Jan 17 21:56:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: axppmic.c,v 1.29 2020/02/16 20:32:29 thorpej Exp $ */ +/* $NetBSD: axppmic.c,v 1.30 2021/01/17 21:56:20 thorpej Exp $ */ /*- * Copyright (c) 2014-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.29 2020/02/16 20:32:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.30 2021/01/17 21:56:20 thorpej Exp $"); #include #include @@ -466,12 +466,13 @@ static const struct axppmic_config axp81 }; static const struct device_compatible_entry compat_data[] = { - { "x-powers,axp803", (uintptr_t)_config }, - { "x-powers,axp805", (uintptr_t)_config }, - { "x-powers,axp806", (uintptr_t)_config }, - { "x-powers,axp809", (uintptr_t)_config }, - { "x-powers,axp813", (uintptr_t)_config }, - { NULL,0 } + { .compat = "x-powers,axp803", .data = _config }, + { .compat = "x-powers,axp805", .data = _config }, + { .compat = "x-powers,axp806", .data = _config }, + { .compat = "x-powers,axp809", .data = _config }, + { .compat = "x-powers,axp813", .data = _config }, + + { 0 } }; static int @@ -950,7 +951,7 @@ axppmic_attach(device_t parent, device_t (void) iic_compatible_match(ia, compat_data, ); KASSERT(dce != NULL); - c = (void *)dce->data; + c = dce->data; sc->sc_dev = self;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun Jan 17 21:47:50 UTC 2021 Modified Files: src/sys/dev/i2c: ihidev.c tsllux.c Log Message: Use designated initializers and a consistent termination style in compat_data[]. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/ihidev.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/tsllux.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/i2c/ihidev.c diff -u src/sys/dev/i2c/ihidev.c:1.12 src/sys/dev/i2c/ihidev.c:1.13 --- src/sys/dev/i2c/ihidev.c:1.12 Thu Jan 9 04:04:01 2020 +++ src/sys/dev/i2c/ihidev.c Sun Jan 17 21:47:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ihidev.c,v 1.12 2020/01/09 04:04:01 thorpej Exp $ */ +/* $NetBSD: ihidev.c,v 1.13 2021/01/17 21:47:50 thorpej Exp $ */ /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */ /*- @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.12 2020/01/09 04:04:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.13 2021/01/17 21:47:50 thorpej Exp $"); #include #include @@ -126,8 +126,9 @@ static int ihidev_print(void *, const ch static int ihidev_submatch(device_t, cfdata_t, const int *, void *); static const struct device_compatible_entry compat_data[] = { - { "hid-over-i2c", 0 }, - { NULL,0 } + { .compat = "hid-over-i2c" }, + + { 0 } }; static int Index: src/sys/dev/i2c/tsllux.c diff -u src/sys/dev/i2c/tsllux.c:1.1 src/sys/dev/i2c/tsllux.c:1.2 --- src/sys/dev/i2c/tsllux.c:1.1 Mon Jan 4 22:09:35 2021 +++ src/sys/dev/i2c/tsllux.c Sun Jan 17 21:47:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tsllux.c,v 1.1 2021/01/04 22:09:35 thorpej Exp $ */ +/* $NetBSD: tsllux.c,v 1.2 2021/01/17 21:47:50 thorpej Exp $ */ /*- * Copyright (c) 2018 Jason R. Thorpe @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.1 2021/01/04 22:09:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tsllux.c,v 1.2 2021/01/17 21:47:50 thorpej Exp $"); #include #include @@ -78,9 +78,10 @@ CFATTACH_DECL_NEW(tsllux, sizeof(struct tsllux_match, tsllux_attach, NULL, NULL); static const struct device_compatible_entry tsllux_compat_data[] = { - { "amstaos,tsl2560", 0 }, - { "amstaos,tsl2561", 0 }, - { NULL,0 } + { .compat = "amstaos,tsl2560" }, + { .compat = "amstaos,tsl2561" }, + + { 0 } }; static int tsllux_read1(struct tsllux_softc *, uint8_t, uint8_t *);
CVS commit: src/sys/dev
Module Name:src Committed By: thorpej Date: Sun Jan 17 21:42:35 UTC 2021 Modified Files: src/sys/dev/i2c: ac100.c adadc.c adm1021.c adm1026.c anxedp.c as3722.c asms.c axp20x.c axp22x.c cwfg.c dbcool.c dstemp.c em3027.c es8316ac.c fcu.c hytp14.c lm75.c lm87.c max77620.c pca9685.c pcf8563.c pcf8574.c spdmem_i2c.c ssdfb_i2c.c sy8106a.c tcagpio.c tcakp.c tda19988.c titemp.c tps65217pmic.c twl4030.c src/sys/dev/spi: m25p.c oj6sh.c ssdfb_spi.c Log Message: Use designated initializers and a consistent termination style in compat_data[]. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/ac100.c src/sys/dev/i2c/tda19988.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/adadc.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/i2c/adm1021.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/i2c/adm1026.c src/sys/dev/i2c/max77620.c \ src/sys/dev/i2c/titemp.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/anxedp.c src/sys/dev/i2c/pca9685.c \ src/sys/dev/i2c/twl4030.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/i2c/as3722.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/asms.c src/sys/dev/i2c/cwfg.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2c/axp20x.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/axp22x.c src/sys/dev/i2c/dstemp.c \ src/sys/dev/i2c/pcf8574.c cvs rdiff -u -r1.56 -r1.57 src/sys/dev/i2c/dbcool.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/em3027.c src/sys/dev/i2c/ssdfb_i2c.c \ src/sys/dev/i2c/sy8106a.c src/sys/dev/i2c/tcagpio.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/es8316ac.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/fcu.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/hytp14.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/i2c/lm75.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/i2c/lm87.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/pcf8563.c src/sys/dev/i2c/tcakp.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/i2c/spdmem_i2c.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2c/tps65217pmic.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/spi/m25p.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/oj6sh.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/spi/ssdfb_spi.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/i2c/ac100.c diff -u src/sys/dev/i2c/ac100.c:1.4 src/sys/dev/i2c/ac100.c:1.5 --- src/sys/dev/i2c/ac100.c:1.4 Sat Jul 27 16:02:27 2019 +++ src/sys/dev/i2c/ac100.c Sun Jan 17 21:42:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ac100.c,v 1.4 2019/07/27 16:02:27 thorpej Exp $ */ +/* $NetBSD: ac100.c,v 1.5 2021/01/17 21:42:35 thorpej Exp $ */ /*- * Copyright (c) 2014 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: ac100.c,v 1.4 2019/07/27 16:02:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ac100.c,v 1.5 2021/01/17 21:42:35 thorpej Exp $"); #include #include @@ -93,8 +93,9 @@ __KERNEL_RCSID(0, "$NetBSD: ac100.c,v 1. #define AC100_RTC_UPD_TRIG_WRITE __BIT(15) static const struct device_compatible_entry compat_data[] = { - { "x-powers,ac100", 0 }, - { NULL,0 } + { .compat = "x-powers,ac100" }, + + { 0 } }; struct ac100_softc { Index: src/sys/dev/i2c/tda19988.c diff -u src/sys/dev/i2c/tda19988.c:1.4 src/sys/dev/i2c/tda19988.c:1.5 --- src/sys/dev/i2c/tda19988.c:1.4 Mon Dec 23 15:05:32 2019 +++ src/sys/dev/i2c/tda19988.c Sun Jan 17 21:42:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tda19988.c,v 1.4 2019/12/23 15:05:32 thorpej Exp $ */ +/* $NetBSD: tda19988.c,v 1.5 2021/01/17 21:42:35 thorpej Exp $ */ /*- * Copyright (c) 2015 Oleksandr Tymoshenko @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tda19988.c,v 1.4 2019/12/23 15:05:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tda19988.c,v 1.5 2021/01/17 21:42:35 thorpej Exp $"); /* * NXP TDA19988 HDMI encoder @@ -244,8 +244,9 @@ enum { #define TDA19988 0x0301 static const struct device_compatible_entry compat_data[] = { - { "nxp,tda998x", 1 }, - { NULL } + { .compat = "nxp,tda998x" }, + + { 0 } }; struct tda19988_softc; Index: src/sys/dev/i2c/adadc.c diff -u src/sys/dev/i2c/adadc.c:1.7 src/sys/dev/i2c/adadc.c:1.8 --- src/sys/dev/i2c/adadc.c:1.7 Sat Jun 15 02:00:21 2019 +++ src/sys/dev/i2c/adadc.c Sun Jan 17 21:42:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: adadc.c,v 1.7 2019/06/15 02:00:21 macallan Exp $ */ +/* $NetBSD: adadc.c,v 1.8 2021/01/17 21:42:35 thorpej Exp $ */ /*- * Copyright (c) 2018 Michael Lorenz @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.7 2019/06/15 02:00:21 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.8 2021/01/17 21:42:35 thorpej Exp $"); #include #include @@ -94,8 +94,9 @@ CFATTACH_DECL_NEW(adadc, sizeof(struct a adadc_match, adadc_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { "ad7417", 0 }, - { NULL, 0 } + { .compat = "ad7417" }, + + { 0 } }; /* calibaration table from Darwin via Linux */ Index: src/sys/dev/i2c/adm1021.c diff
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 21:19:06 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict.exp Log Message: lint: add test for macro from system header in strict bool mode Seen in usr.bin/make/meta.c:1670: FD_ZERO(). These macros cannot be fixed since system headers must not include . Therefore INT constants should be accepted as controlling expressions as well. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.13 -r1.14 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.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_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.15 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.16 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.15 Sun Jan 17 13:50:33 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sun Jan 17 21:19:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.15 2021/01/17 13:50:33 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.16 2021/01/17 21:19:06 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -727,3 +727,26 @@ strict_bool_assign_bit_field_then_compar (void)((s.flag = s.flag) != __lint_false); } + +/* + * Macros from system headers that have return type bool may or may not + * include the '!= 0' test, that is, their result can have any scalar type. + */ +void +strict_bool_system_header(void) +{ + + do { + println("nothing"); + } while (/*CONSTCOND*/0); /* expect: 333 */ + +# 744 "d_c99_bool_strict.c" 3 4 + do { + println("nothing"); + } while (/*CONSTCOND*/0); /*TODO*//* expect: 333 */ + +# 749 "d_c99_bool_strict.c" + do { + println("nothing"); + } while (/*CONSTCOND*/0); /* expect: 333 */ +} Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.13 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.14 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.13 Sun Jan 17 13:50:33 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sun Jan 17 21:19:06 2021 @@ -146,3 +146,6 @@ d_c99_bool_strict.c(670): operands of '= d_c99_bool_strict.c(677): operands of '=' have incompatible types (_Bool != int) [107] d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool_bitwise_and_enum [231] d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107] +d_c99_bool_strict.c(741): controlling expression must be bool, not 'int' [333] +d_c99_bool_strict.c(746): controlling expression must be bool, not 'int' [333] +d_c99_bool_strict.c(751): controlling expression must be bool, not 'int' [333]
CVS commit: src/sys/arch/sparc64/dev
Module Name:src Committed By: thorpej Date: Sun Jan 17 21:03:27 UTC 2021 Modified Files: src/sys/arch/sparc64/dev: pcf8591_envctrl.c Log Message: Use designated initializers and a consistent termination style in compat_data[]. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/pcf8591_envctrl.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/sparc64/dev/pcf8591_envctrl.c diff -u src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.16 src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.17 --- src/sys/arch/sparc64/dev/pcf8591_envctrl.c:1.16 Wed Dec 23 07:09:50 2020 +++ src/sys/arch/sparc64/dev/pcf8591_envctrl.c Sun Jan 17 21:03:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pcf8591_envctrl.c,v 1.16 2020/12/23 07:09:50 jdc Exp $ */ +/* $NetBSD: pcf8591_envctrl.c,v 1.17 2021/01/17 21:03:27 thorpej Exp $ */ /* $OpenBSD: pcf8591_envctrl.c,v 1.6 2007/10/25 21:17:20 kettenis Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.16 2020/12/23 07:09:50 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcf8591_envctrl.c,v 1.17 2021/01/17 21:03:27 thorpej Exp $"); #include #include @@ -97,8 +97,9 @@ CFATTACH_DECL3_NEW(ecadc, sizeof(struct DVF_DETACH_SHUTDOWN); static const struct device_compatible_entry compat_data[] = { - { "ecadc", 0 }, - { NULL, 0 } + { .compat = "ecadc" }, + + { 0 } }; static int
CVS commit: src/sys/arch/macppc/dev
Module Name:src Committed By: thorpej Date: Sun Jan 17 21:02:33 UTC 2021 Modified Files: src/sys/arch/macppc/dev: deq.c lmu.c psoc.c smusat.c Log Message: Use designated initializers and a consistent termination style in compat_data[]. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/macppc/dev/deq.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/macppc/dev/lmu.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/psoc.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/dev/smusat.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/macppc/dev/deq.c diff -u src/sys/arch/macppc/dev/deq.c:1.17 src/sys/arch/macppc/dev/deq.c:1.18 --- src/sys/arch/macppc/dev/deq.c:1.17 Fri Sep 20 17:25:11 2019 +++ src/sys/arch/macppc/dev/deq.c Sun Jan 17 21:02:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $ */ +/* $NetBSD: deq.c,v 1.18 2021/01/17 21:02:33 thorpej Exp $ */ /*- * Copyright (C) 2005 Michael Lorenz @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.18 2021/01/17 21:02:33 thorpej Exp $"); #include #include @@ -53,12 +53,13 @@ CFATTACH_DECL_NEW(deq, sizeof(struct deq deq_match, deq_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { "deq", 0 }, - { "tas3004", 0 }, - { "pcm3052", 0 }, - { "cs8416", 0 }, - { "codec", 0 }, - { NULL, 0 } + { .compat = "deq" }, + { .compat = "tas3004" }, + { .compat = "pcm3052" }, + { .compat = "cs8416" }, + { .compat = "codec" }, + + { 0 } }; int Index: src/sys/arch/macppc/dev/lmu.c diff -u src/sys/arch/macppc/dev/lmu.c:1.5 src/sys/arch/macppc/dev/lmu.c:1.6 --- src/sys/arch/macppc/dev/lmu.c:1.5 Sat Sep 12 18:12:53 2020 +++ src/sys/arch/macppc/dev/lmu.c Sun Jan 17 21:02:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $ */ +/* $NetBSD: lmu.c,v 1.6 2021/01/17 21:02:33 thorpej Exp $ */ /*- * Copyright (c) 2020 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.6 2021/01/17 21:02:33 thorpej Exp $"); #include #include @@ -81,9 +81,10 @@ CFATTACH_DECL_NEW(lmu, sizeof(struct lmu lmu_match, lmu_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { "lmu-micro", 0 }, - { "lmu-controller", 0 }, - { NULL, 0 } + { .compat = "lmu-micro" }, + { .compat = "lmu-controller" }, + + { 0 } }; /* time between polling the light sensors */ Index: src/sys/arch/macppc/dev/psoc.c diff -u src/sys/arch/macppc/dev/psoc.c:1.3 src/sys/arch/macppc/dev/psoc.c:1.4 --- src/sys/arch/macppc/dev/psoc.c:1.3 Sat Nov 23 05:13:11 2019 +++ src/sys/arch/macppc/dev/psoc.c Sun Jan 17 21:02:33 2021 @@ -1,4 +1,4 @@ - /* $NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $ */ + /* $NetBSD: psoc.c,v 1.4 2021/01/17 21:02:33 thorpej Exp $ */ /*- * Copyright (c) 2019 Michael Lorenz @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.4 2021/01/17 21:02:33 thorpej Exp $"); #include #include @@ -81,8 +81,9 @@ CFATTACH_DECL_NEW(psoc, sizeof(struct ps psoc_match, psoc_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { "Psoc", 0 }, - { NULL, 0 } + { .compat = "Psoc" }, + + { 0 } }; static int Index: src/sys/arch/macppc/dev/smusat.c diff -u src/sys/arch/macppc/dev/smusat.c:1.6 src/sys/arch/macppc/dev/smusat.c:1.7 --- src/sys/arch/macppc/dev/smusat.c:1.6 Tue Jun 26 06:03:57 2018 +++ src/sys/arch/macppc/dev/smusat.c Sun Jan 17 21:02:33 2021 @@ -106,9 +106,10 @@ CFATTACH_DECL_NEW(smusat, sizeof(struct smusat_match, smusat_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { "sat", 0 }, - { "smu-sat", 0 }, - { NULL, 0 } + { .compat = "sat" }, + { .compat = "smu-sat" }, + + { 0 } }; static int
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:54:23 UTC 2021 Modified Files: src/sys/dev/fdt: amdccp_fdt.c fixedregulator.c gpioregulator.c i2cmux_fdt.c Log Message: trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/amdccp_fdt.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fixedregulator.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/gpioregulator.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/i2cmux_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/amdccp_fdt.c diff -u src/sys/dev/fdt/amdccp_fdt.c:1.1 src/sys/dev/fdt/amdccp_fdt.c:1.2 --- src/sys/dev/fdt/amdccp_fdt.c:1.1 Fri Oct 19 21:09:10 2018 +++ src/sys/dev/fdt/amdccp_fdt.c Sun Jan 17 19:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: amdccp_fdt.c,v 1.1 2018/10/19 21:09:10 jakllsch Exp $ */ +/* $NetBSD: amdccp_fdt.c,v 1.2 2021/01/17 19:54:23 jmcneill Exp $ */ /* * Copyright (c) 2018 Jonathan A. Kollasch @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.1 2018/10/19 21:09:10 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.2 2021/01/17 19:54:23 jmcneill Exp $"); #include #include @@ -76,7 +76,7 @@ amdccp_fdt_attach(device_t parent, devic if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); - return; + return; } sc->sc_bst = faa->faa_bst; Index: src/sys/dev/fdt/fixedregulator.c diff -u src/sys/dev/fdt/fixedregulator.c:1.8 src/sys/dev/fdt/fixedregulator.c:1.9 --- src/sys/dev/fdt/fixedregulator.c:1.8 Thu May 23 21:36:26 2019 +++ src/sys/dev/fdt/fixedregulator.c Sun Jan 17 19:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fixedregulator.c,v 1.8 2019/05/23 21:36:26 jmcneill Exp $ */ +/* $NetBSD: fixedregulator.c,v 1.9 2021/01/17 19:54:23 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.8 2019/05/23 21:36:26 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.9 2021/01/17 19:54:23 jmcneill Exp $"); #include #include @@ -152,7 +152,7 @@ fixedregulator_acquire(device_t dev) return 0; } -static void +static void fixedregulator_release(device_t dev) { } Index: src/sys/dev/fdt/gpioregulator.c diff -u src/sys/dev/fdt/gpioregulator.c:1.2 src/sys/dev/fdt/gpioregulator.c:1.3 --- src/sys/dev/fdt/gpioregulator.c:1.2 Sat Jan 19 20:51:12 2019 +++ src/sys/dev/fdt/gpioregulator.c Sun Jan 17 19:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gpioregulator.c,v 1.2 2019/01/19 20:51:12 jmcneill Exp $ */ +/* $NetBSD: gpioregulator.c,v 1.3 2021/01/17 19:54:23 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gpioregulator.c,v 1.2 2019/01/19 20:51:12 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gpioregulator.c,v 1.3 2021/01/17 19:54:23 jmcneill Exp $"); #include #include @@ -189,7 +189,7 @@ gpioregulator_acquire(device_t dev) return 0; } -static void +static void gpioregulator_release(device_t dev) { } Index: src/sys/dev/fdt/i2cmux_fdt.c diff -u src/sys/dev/fdt/i2cmux_fdt.c:1.4 src/sys/dev/fdt/i2cmux_fdt.c:1.5 --- src/sys/dev/fdt/i2cmux_fdt.c:1.4 Mon Dec 28 20:29:57 2020 +++ src/sys/dev/fdt/i2cmux_fdt.c Sun Jan 17 19:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2cmux_fdt.c,v 1.4 2020/12/28 20:29:57 thorpej Exp $ */ +/* $NetBSD: i2cmux_fdt.c,v 1.5 2021/01/17 19:54:23 jmcneill Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i2cmux_fdt.c,v 1.4 2020/12/28 20:29:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2cmux_fdt.c,v 1.5 2021/01/17 19:54:23 jmcneill Exp $"); #include #include @@ -278,4 +278,4 @@ iicmux_fdt_attach(device_t const parent, } CFATTACH_DECL_NEW(iicmux_fdt, sizeof(struct iicmux_softc), -iicmux_fdt_match, iicmux_fdt_attach, NULL, NULL); +iicmux_fdt_match, iicmux_fdt_attach, NULL, NULL);
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:53:05 UTC 2021 Modified Files: src/sys/arch/arm/fdt: acpi_fdt.c Log Message: trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/fdt/acpi_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/fdt/acpi_fdt.c diff -u src/sys/arch/arm/fdt/acpi_fdt.c:1.16 src/sys/arch/arm/fdt/acpi_fdt.c:1.17 --- src/sys/arch/arm/fdt/acpi_fdt.c:1.16 Sat Oct 10 15:34:05 2020 +++ src/sys/arch/arm/fdt/acpi_fdt.c Sun Jan 17 19:53:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_fdt.c,v 1.16 2020/10/10 15:34:05 jmcneill Exp $ */ +/* $NetBSD: acpi_fdt.c,v 1.17 2021/01/17 19:53:05 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -30,7 +30,7 @@ #include "opt_efi.h" #include -__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.16 2020/10/10 15:34:05 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.17 2021/01/17 19:53:05 jmcneill Exp $"); #include #include @@ -105,7 +105,7 @@ acpi_fdt_attach(device_t parent, device_ #if NPCI > 0 aa.aa_pciflags = /*PCI_FLAGS_IO_OKAY |*/ PCI_FLAGS_MEM_OKAY | - PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | + PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY; #ifdef __HAVE_PCI_MSI_MSIX aa.aa_pciflags |= PCI_FLAGS_MSI_OKAY | PCI_FLAGS_MSIX_OKAY;
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:51:43 UTC 2021 Modified Files: src/sys/arch/arm/fdt: arm_simplefb.c Log Message: Fit in 80 columns. NFC. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/arm_simplefb.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/fdt/arm_simplefb.c diff -u src/sys/arch/arm/fdt/arm_simplefb.c:1.6 src/sys/arch/arm/fdt/arm_simplefb.c:1.7 --- src/sys/arch/arm/fdt/arm_simplefb.c:1.6 Sun Jan 17 19:03:49 2021 +++ src/sys/arch/arm/fdt/arm_simplefb.c Sun Jan 17 19:51:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arm_simplefb.c,v 1.6 2021/01/17 19:03:49 jmcneill Exp $ */ +/* $NetBSD: arm_simplefb.c,v 1.7 2021/01/17 19:51:43 jmcneill Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "opt_vcons.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.6 2021/01/17 19:03:49 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.7 2021/01/17 19:51:43 jmcneill Exp $"); #include #include @@ -93,7 +93,9 @@ static bus_space_handle_t arm_simplefb_b static int arm_simplefb_find_node(void) { - static const char * simplefb_compatible[] = { "simple-framebuffer", NULL }; + static const char * simplefb_compatible[] = { + "simple-framebuffer", NULL + }; int chosen_phandle, child; chosen_phandle = OF_finddevice("/chosen"); @@ -146,7 +148,8 @@ arm_simplefb_init_screen(void *cookie, s } static int -arm_simplefb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l) +arm_simplefb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, +lwp_t *l) { return EPASSTHROUGH; } @@ -172,7 +175,8 @@ arm_simplefb_reconfig(void *arg, uint64_ bus_space_unmap(bst, arm_simplefb_bsh, arm_simplefb_size); bus_space_map(bst, new_addr, arm_simplefb_size, - BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, _simplefb_bsh); + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, + _simplefb_bsh); sc->sc_bits = bus_space_vaddr(bst, arm_simplefb_bsh); ri->ri_bits = sc->sc_bits; @@ -258,7 +262,8 @@ arm_simplefb_preattach(void) #ifdef VCONS_DRAW_INTR arm_simplefb_vcons_data.use_intr = 0; #endif - vcons_init_screen(_simplefb_vcons_data, _simplefb_screen, 1, ); + vcons_init_screen(_simplefb_vcons_data, _simplefb_screen, 1, + ); arm_simplefb_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; if (ri->ri_rows < 1 || ri->ri_cols < 1)
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 19:32:53 UTC 2021 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/comp: mi src/etc/mtree: NetBSD.dist.base src/usr.bin/xlint/xlint: Makefile Log Message: lint: install custom stdbool.h, used for strict bool mode To generate a diff of this commit: cvs rdiff -u -r1.1273 -r1.1274 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.2370 -r1.2371 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.232 -r1.233 src/etc/mtree/NetBSD.dist.base cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/xlint/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/base/mi diff -u src/distrib/sets/lists/base/mi:1.1273 src/distrib/sets/lists/base/mi:1.1274 --- src/distrib/sets/lists/base/mi:1.1273 Sun Dec 27 21:13:18 2020 +++ src/distrib/sets/lists/base/mi Sun Jan 17 19:32:52 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1273 2020/12/27 21:13:18 reinoud Exp $ +# $NetBSD: mi,v 1.1274 2021/01/17 19:32:52 rillig Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -1560,6 +1560,7 @@ ./usr/libdata/firmware/radeon/VERDE_smc.bin base-obsolete obsolete ./usr/libdata/ldscriptsbase-c-usr ./usr/libdata/lintbase-c-usr +./usr/libdata/lint/strict-bool base-c-usr ./usr/libexec base-sys-usr ./usr/libexec/atf-checkbase-atf-bin atf ./usr/libexec/atf-cleanup base-obsolete obsolete Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2370 src/distrib/sets/lists/comp/mi:1.2371 --- src/distrib/sets/lists/comp/mi:1.2370 Sat Jan 16 22:18:14 2021 +++ src/distrib/sets/lists/comp/mi Sun Jan 17 19:32:52 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2370 2021/01/16 22:18:14 rillig Exp $ +# $NetBSD: mi,v 1.2371 2021/01/17 19:32:52 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -4134,6 +4134,7 @@ ./usr/libdata/lint/llib-lwrap.ln comp-c-lintlib lint ./usr/libdata/lint/llib-ly.ln comp-c-lintlib lint ./usr/libdata/lint/llib-lz.ln comp-c-lintlib lint +./usr/libdata/lint/strict-bool/stdbool.h comp-c-bin ./usr/libexec/cc1comp-c-bin gcccmds ./usr/libexec/cc1objcomp-objc-bin gcccmds ./usr/libexec/cc1pluscomp-cxx-bin gcccmds Index: src/etc/mtree/NetBSD.dist.base diff -u src/etc/mtree/NetBSD.dist.base:1.232 src/etc/mtree/NetBSD.dist.base:1.233 --- src/etc/mtree/NetBSD.dist.base:1.232 Sat Jan 16 22:18:14 2021 +++ src/etc/mtree/NetBSD.dist.base Sun Jan 17 19:32:53 2021 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.base,v 1.232 2021/01/16 22:18:14 rillig Exp $ +# $NetBSD: NetBSD.dist.base,v 1.233 2021/01/17 19:32:53 rillig Exp $ # @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93 # Do not customize this file as it may be overwritten on upgrades. @@ -297,6 +297,7 @@ ./usr/libdata/firmware/bcm43xx ./usr/libdata/ldscripts ./usr/libdata/lint +./usr/libdata/lint/strict-bool ./usr/libexec ./usr/libexec/ching ./usr/libexec/lpr Index: src/usr.bin/xlint/xlint/Makefile diff -u src/usr.bin/xlint/xlint/Makefile:1.18 src/usr.bin/xlint/xlint/Makefile:1.19 --- src/usr.bin/xlint/xlint/Makefile:1.18 Sat Jan 16 22:18:14 2021 +++ src/usr.bin/xlint/xlint/Makefile Sun Jan 17 19:32:53 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.18 2021/01/16 22:18:14 rillig Exp $ +# $NetBSD: Makefile,v 1.19 2021/01/17 19:32:53 rillig Exp $ .PATH: ${.CURDIR}/../lint1 .PATH: ${.CURDIR}/../../mkdep @@ -16,8 +16,8 @@ DPADD+= ${LIBUTIL} LDADD+= -lutil .endif -#FILES+= strict-bool-stdbool.h -#FILESDIR= /usr/libdata/lint/strict-bool -#FILESNAME_strict-bool-stdbool.h= stdbool.h +FILES+= strict-bool-stdbool.h +FILESDIR= /usr/libdata/lint/strict-bool +FILESNAME_strict-bool-stdbool.h= stdbool.h .include
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:03:50 UTC 2021 Modified Files: src/sys/arch/arm/fdt: arm_simplefb.c Log Message: Use vcons_earlyinit To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/arm_simplefb.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/fdt/arm_simplefb.c diff -u src/sys/arch/arm/fdt/arm_simplefb.c:1.5 src/sys/arch/arm/fdt/arm_simplefb.c:1.6 --- src/sys/arch/arm/fdt/arm_simplefb.c:1.5 Sun Jan 17 14:28:25 2021 +++ src/sys/arch/arm/fdt/arm_simplefb.c Sun Jan 17 19:03:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arm_simplefb.c,v 1.5 2021/01/17 14:28:25 jmcneill Exp $ */ +/* $NetBSD: arm_simplefb.c,v 1.6 2021/01/17 19:03:49 jmcneill Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "opt_vcons.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.5 2021/01/17 14:28:25 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.6 2021/01/17 19:03:49 jmcneill Exp $"); #include #include @@ -252,8 +252,8 @@ arm_simplefb_preattach(void) arm_simplefb_accessops.mmap = arm_simplefb_mmap; arm_simplefb_accessops.pollc = arm_simplefb_pollc; - vcons_init(_simplefb_vcons_data, sc, _simplefb_stdscreen, - _simplefb_accessops); + vcons_earlyinit(_simplefb_vcons_data, sc, _simplefb_stdscreen, + _simplefb_accessops); arm_simplefb_vcons_data.init_screen = arm_simplefb_init_screen; #ifdef VCONS_DRAW_INTR arm_simplefb_vcons_data.use_intr = 0;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:03:32 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h Log Message: Revert previous and introduce vcons_earlyinit, which is like vcons_init except it does not setup a vcons_intr thread. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsdisplay_vcons.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wscons/wsdisplay_vconsvar.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/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.46 src/sys/dev/wscons/wsdisplay_vcons.c:1.47 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.46 Sun Jan 17 16:51:12 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Jan 17 19:03:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $"); #include #include @@ -121,17 +121,18 @@ static void vcons_unlock(struct vcons_sc #ifdef VCONS_DRAW_INTR static void vcons_intr(void *); static void vcons_softintr(void *); -static int vcons_intr_enable(device_t); +static void vcons_init_thread(void *); #endif -int -vcons_init(struct vcons_data *vd, void *cookie, struct wsscreen_descr *def, -struct wsdisplay_accessops *ao) +static int +vcons_init_common(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao, +int enable_intr) { /* zero out everything so we can rely on untouched fields being 0 */ memset(vd, 0, sizeof(struct vcons_data)); - + vd->cookie = cookie; vd->init_screen = vcons_dummy_init_screen; @@ -174,26 +175,37 @@ vcons_init(struct vcons_data *vd, void * vd->switch_poll_count = 0; #endif #ifdef VCONS_DRAW_INTR - vd->intr_softint = softint_establish(SOFTINT_SERIAL, - vcons_softintr, vd); - callout_init(>intr, CALLOUT_MPSAFE); - callout_setfunc(>intr, vcons_intr, vd); - vd->intr_valid = 1; - - /* - * Defer intr drawing until after autoconfiguration has completed - * to serialize device attachment messages w/ the initial screen - * redraw as a workaround for the lack of MP-safeness in this - * subsystem. To register with autoconf, we need to create a fake - * device_t and pass that in as a handle to config_interrupts. - */ - snprintf(vd->fake_dev.dv_xname, sizeof(vd->fake_dev.dv_xname), "vcons"); - vd->fake_dev.dv_private = vd; - config_finalize_register(>fake_dev, vcons_intr_enable); + if (enable_intr) { + vd->intr_softint = softint_establish(SOFTINT_SERIAL, + vcons_softintr, vd); + callout_init(>intr, CALLOUT_MPSAFE); + callout_setfunc(>intr, vcons_intr, vd); + vd->intr_valid = 1; + + if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, + NULL, "vcons_init") != 0) { + printf("%s: unable to create thread.\n", __func__); + return -1; + } + } #endif return 0; } +int +vcons_init(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao) +{ + return vcons_init_common(vd, cookie, def, ao, 1); +} + +int +vcons_earlyinit(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao) +{ + return vcons_init_common(vd, cookie, def, ao, 0); +} + static void vcons_lock(struct vcons_screen *scr) { @@ -1498,15 +1510,14 @@ vcons_softintr(void *cookie) callout_schedule(>intr, mstohz(33)); } -static int -vcons_intr_enable(device_t fake_dev) +static void +vcons_init_thread(void *cookie) { - struct vcons_data *vd = device_private(fake_dev); + struct vcons_data *vd = (struct vcons_data *)cookie; vd->use_intr = 2; callout_schedule(>intr, mstohz(33)); - - return 0; + kthread_exit(0); } #endif /* VCONS_DRAW_INTR */ Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.30 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 Sun Jan 17 15:13:15 2021 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sun Jan 17 19:03:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.29 2021/01/17 15:13:15 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.30 2021/01/17 19:03:32 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -143,7 +143,9 @@ struct vcons_data { #endif }; -int vcons_init(struct vcons_data *, void *cookie, struct wsscreen_descr *, +int vcons_init(struct vcons_data *, void *, struct wsscreen_descr *, +struct wsdisplay_accessops *); +int vcons_earlyinit(struct vcons_data *, void *, struct wsscreen_descr *, struct wsdisplay_accessops
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 17:16:47 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: rename typeok_amper to typeok_address This is about the address-of operator, not about the '&' sign that is also used for bitwise and. To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 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.179 src/usr.bin/xlint/lint1/tree.c:1.180 --- src/usr.bin/xlint/lint1/tree.c:1.179 Sun Jan 17 17:14:34 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 17:16:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.179 2021/01/17 17:14:34 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.180 2021/01/17 17:16:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.179 2021/01/17 17:14:34 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.180 2021/01/17 17:16:47 rillig Exp $"); #endif #include @@ -775,8 +775,8 @@ typeok_incdec(const mod_t *mp, const tno } static bool -typeok_amper(const mod_t *mp, - const tnode_t *tn, const type_t *tp, tspec_t t) +typeok_address(const mod_t *mp, + const tnode_t *tn, const type_t *tp, tspec_t t) { if (t == ARRAY || t == FUNC) { /* ok, a warning comes later (in build_address()) */ @@ -1284,7 +1284,7 @@ typeok_op(op_t op, const mod_t *mp, int return false; break; case ADDR: - if (!typeok_amper(mp, ln, ltp, lt)) + if (!typeok_address(mp, ln, ltp, lt)) return false; break; case INDIR:
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 17:14:34 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_126.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add type information to message 126 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_126.exp cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.178 -r1.179 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/tests/usr.bin/xlint/lint1/msg_126.exp diff -u src/tests/usr.bin/xlint/lint1/msg_126.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_126.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_126.exp:1.2 Fri Jan 8 21:25:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_126.exp Sun Jan 17 17:14:34 2021 @@ -1,4 +1,4 @@ -msg_126.c(9): incompatible types in conditional [126] +msg_126.c(9): incompatible types 'pointer to void' and 'double' in conditional [126] msg_126.c(9): warning: function max expects to return value [214] msg_126.c(7): warning: argument cond unused in function max [231] msg_126.c(7): warning: argument ptr unused in function max [231] Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.68 src/usr.bin/xlint/lint1/err.c:1.69 --- src/usr.bin/xlint/lint1/err.c:1.68 Sun Jan 17 11:55:55 2021 +++ src/usr.bin/xlint/lint1/err.c Sun Jan 17 17:14:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.68 2021/01/17 11:55:55 rillig Exp $ */ +/* $NetBSD: err.c,v 1.69 2021/01/17 17:14:34 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.68 2021/01/17 11:55:55 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.69 2021/01/17 17:14:34 rillig Exp $"); #endif #include @@ -185,7 +185,7 @@ const char *msgs[] = { "illegal combination of %s (%s) and %s (%s), op %s", /* 123 */ "illegal pointer combination (%s) and (%s), op %s", /* 124 */ "ANSI C forbids ordered comparisons of pointers to functions",/* 125 */ - "incompatible types in conditional", /* 126 */ + "incompatible types '%s' and '%s' in conditional", /* 126 */ "'&' before array or function: ignored", /* 127 */ "operands have incompatible pointer types, op %s (%s != %s)", /* 128 */ "expression has null effect", /* 129 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.178 src/usr.bin/xlint/lint1/tree.c:1.179 --- src/usr.bin/xlint/lint1/tree.c:1.178 Sun Jan 17 16:32:36 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 17:14:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.178 2021/01/17 16:32:36 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.179 2021/01/17 17:14:34 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.178 2021/01/17 16:32:36 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.179 2021/01/17 17:14:34 rillig Exp $"); #endif #include @@ -1040,8 +1040,8 @@ typeok_colon(const mod_t *mp, if (lt == VOID || rt == VOID) { if (lt != VOID || rt != VOID) - /* incompatible types in conditional */ - warning(126); + /* incompatible types '%s' and '%s' in conditional */ + warning(126, type_name(ltp), type_name(rtp)); return true; } @@ -1063,8 +1063,8 @@ typeok_colon(const mod_t *mp, return true; } - /* incompatible types in conditional */ - error(126); + /* incompatible types '%s' and '%s' in conditional */ + error(126, type_name(ltp), type_name(rtp)); return false; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 16:51:12 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: The change from config_interrupts to a kthread for VCONS_DRAW_INTR init unfortunately makes it easier to trigger a race that results in characters not being erased properly at boot. Work around the original issue a different way by creating a fake device_t and defer initialization until we are sure that config_interrupt threads are done. This is not ideal and the race is still present but fixing this properly would require a rewrite to make this code MP-safe. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.45 src/sys/dev/wscons/wsdisplay_vcons.c:1.46 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.45 Sat Jan 2 03:00:56 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Jan 17 16:51:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $"); #include #include @@ -121,7 +121,7 @@ static void vcons_unlock(struct vcons_sc #ifdef VCONS_DRAW_INTR static void vcons_intr(void *); static void vcons_softintr(void *); -static void vcons_init_thread(void *); +static int vcons_intr_enable(device_t); #endif int @@ -180,11 +180,16 @@ vcons_init(struct vcons_data *vd, void * callout_setfunc(>intr, vcons_intr, vd); vd->intr_valid = 1; - if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, NULL, - "vcons_init") != 0) { - printf("%s: unable to create thread.\n", __func__); - return -1; - } + /* + * Defer intr drawing until after autoconfiguration has completed + * to serialize device attachment messages w/ the initial screen + * redraw as a workaround for the lack of MP-safeness in this + * subsystem. To register with autoconf, we need to create a fake + * device_t and pass that in as a handle to config_interrupts. + */ + snprintf(vd->fake_dev.dv_xname, sizeof(vd->fake_dev.dv_xname), "vcons"); + vd->fake_dev.dv_private = vd; + config_finalize_register(>fake_dev, vcons_intr_enable); #endif return 0; } @@ -1493,14 +1498,15 @@ vcons_softintr(void *cookie) callout_schedule(>intr, mstohz(33)); } -static void -vcons_init_thread(void *cookie) +static int +vcons_intr_enable(device_t fake_dev) { - struct vcons_data *vd = (struct vcons_data *)cookie; + struct vcons_data *vd = device_private(fake_dev); vd->use_intr = 2; callout_schedule(>intr, mstohz(33)); - kthread_exit(0); + + return 0; } #endif /* VCONS_DRAW_INTR */
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 16:32:36 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: flatten typeok_ordered_comparison To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 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.177 src/usr.bin/xlint/lint1/tree.c:1.178 --- src/usr.bin/xlint/lint1/tree.c:1.177 Sun Jan 17 16:25:30 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 16:32:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.177 2021/01/17 16:25:30 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.178 2021/01/17 16:32:36 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.177 2021/01/17 16:25:30 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.178 2021/01/17 16:32:36 rillig Exp $"); #endif #include @@ -962,22 +962,23 @@ typeok_ordered_comparison(op_t op, const tnode_t *ln, const type_t *ltp, tspec_t lt, const tnode_t *rn, const type_t *rtp, tspec_t rt) { - if ((lt == PTR || rt == PTR) && lt != rt) { - if (is_integer(lt) || is_integer(rt)) { - const char *lx = lt == PTR ? - "pointer" : "integer"; - const char *rx = rt == PTR ? - "pointer" : "integer"; - /* illegal combination of %s (%s) and ... */ - warning(123, lx, type_name(ltp), - rx, type_name(rtp), getopname(op)); - } else { - warn_incompatible_types(op, lt, rt); - return false; - } - } else if (lt == PTR && rt == PTR) { + if (lt == PTR && rt == PTR) { check_pointer_comparison(op, ln, rn); + return true; } + + if (lt != PTR && rt != PTR) + return true; + + if (!is_integer(lt) && !is_integer(rt)) { + warn_incompatible_types(op, lt, rt); + return false; + } + + const char *lx = lt == PTR ? "pointer" : "integer"; + const char *rx = rt == PTR ? "pointer" : "integer"; + /* illegal combination of %s (%s) and %s (%s), op %s */ + warning(123, lx, type_name(ltp), rx, type_name(rtp), getopname(op)); return true; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 16:25:30 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c lint1.h tree.c Log Message: lint: extend a few message comments To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.176 -r1.177 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.126 src/usr.bin/xlint/lint1/decl.c:1.127 --- src/usr.bin/xlint/lint1/decl.c:1.126 Sun Jan 17 15:24:03 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Jan 17 16:25:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.126 2021/01/17 15:24:03 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.127 2021/01/17 16:25:30 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.126 2021/01/17 15:24:03 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.127 2021/01/17 16:25:30 rillig Exp $"); #endif #include @@ -406,7 +406,7 @@ tdeferr(type_t *td, tspec_t t) case LONG: if (t2 == INT || t2 == UINT || t2 == LONG || t2 == ULONG || t2 == FLOAT || t2 == DOUBLE || t2 == DCOMPLEX) { - /* modifying typedef with ... */ + /* modifying typedef with '%s'; only qualifiers ... */ warning(5, "long"); if (t2 == INT) { td = gettyp(LONG); @@ -826,7 +826,7 @@ deftyp(void) } } else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) { if (scl != NOSCL && scl != REG) { - /* only register valid ... */ + /* only register valid as formal parameter storage... */ error(9); scl = NOSCL; } Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.57 src/usr.bin/xlint/lint1/lint1.h:1.58 --- src/usr.bin/xlint/lint1/lint1.h:1.57 Sat Jan 16 16:53:23 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sun Jan 17 16:25:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.57 2021/01/16 16:53:23 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.58 2021/01/17 16:25:30 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -154,7 +154,7 @@ struct type { bool t_const : 1; /* const modifier */ bool t_volatile : 1; /* volatile modifier */ bool t_proto : 1; /* function prototype (t_args valid) */ - bool t_vararg : 1; /* prototype with ... */ + bool t_vararg : 1; /* prototype with '...' */ bool t_typedef : 1; /* type defined with typedef */ bool t_bitfield : 1; bool t_isenum : 1; /* type is (or was) enum (t_enum valid) */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.176 src/usr.bin/xlint/lint1/tree.c:1.177 --- src/usr.bin/xlint/lint1/tree.c:1.176 Sun Jan 17 16:19:54 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 16:25:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.177 2021/01/17 16:25:30 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.177 2021/01/17 16:25:30 rillig Exp $"); #endif #include @@ -464,7 +464,6 @@ struct_or_union_member(tnode_t *tn, op_t error(103); } } else { - /* left operand of "->" must be pointer to ... */ if (tflag && tn->tn_type->t_tspec == PTR) { /* left operand of '->' must be pointer ... */ warning(104, type_name(tn->tn_type)); @@ -886,7 +885,7 @@ typeok_shr(const mod_t *mp, */ if (hflag && (ln->tn_op != CON || ln->tn_val->v_quad < 0)) { - /* semantics of '%s' change in ANSI C; ... */ + /* semantics of '%s' change in ANSI C; use ... */ warning(118, mp->m_name); } } else if (!tflag && !sflag && !is_uinteger(olt) && !is_uinteger(ort) && @@ -2953,7 +2952,7 @@ plength(type_t *tp) error(110); break; case VOID: - /* cannot do pointer arithmetic on operand of ... */ + /* cannot do pointer arithmetic on operand of unknown size */ gnuism(136); break; case STRUCT: @@ -2979,7 +2978,7 @@ plength(type_t *tp) } if (elem == 0 && elsz != 0) { - /* cannot do pointer arithmetic on operand of ... */ + /* cannot do pointer arithmetic on operand of unknown size */ error(136); } @@ -3493,7 +3492,7 @@ cast(tnode_t *tn, type_t *tp) } else if (nt == PTR && ot == PTR) { if (!tp->t_subt->t_const && tn->tn_type->t_subt->t_const) { if (hflag) -/* cast discards 'const' from ... */ +/* cast discards 'const' from pointer tar... */ warning(275); } } else {
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 16:19:54 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_115.c msg_115.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: add test for incrementing const variable To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_115.c \ src/tests/usr.bin/xlint/lint1/msg_115.exp cvs rdiff -u -r1.175 -r1.176 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/tests/usr.bin/xlint/lint1/msg_115.c diff -u src/tests/usr.bin/xlint/lint1/msg_115.c:1.2 src/tests/usr.bin/xlint/lint1/msg_115.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_115.c:1.2 Fri Jan 8 21:25:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_115.c Sun Jan 17 16:19:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_115.c,v 1.2 2021/01/08 21:25:03 rillig Exp $ */ +/* $NetBSD: msg_115.c,v 1.3 2021/01/17 16:19:54 rillig Exp $ */ # 3 "msg_115.c" // Test for message: %soperand of '%s' must be modifiable lvalue [115] @@ -13,4 +13,5 @@ example(const int *const_ptr) *const_ptr *= 1; *const_ptr /= 5; *const_ptr %= 9; + (*const_ptr)++; } Index: src/tests/usr.bin/xlint/lint1/msg_115.exp diff -u src/tests/usr.bin/xlint/lint1/msg_115.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_115.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_115.exp:1.2 Fri Jan 8 21:25:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_115.exp Sun Jan 17 16:19:54 2021 @@ -4,3 +4,4 @@ msg_115.c(12): warning: left operand of msg_115.c(13): warning: left operand of '*=' must be modifiable lvalue [115] msg_115.c(14): warning: left operand of '/=' must be modifiable lvalue [115] msg_115.c(15): warning: left operand of '%=' must be modifiable lvalue [115] +msg_115.c(16): warning: operand of 'x++' must be modifiable lvalue [115] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.175 src/usr.bin/xlint/lint1/tree.c:1.176 --- src/usr.bin/xlint/lint1/tree.c:1.175 Sun Jan 17 16:01:19 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 16:19:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.175 2021/01/17 16:01:19 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.175 2021/01/17 16:01:19 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 rillig Exp $"); #endif #include @@ -769,7 +769,7 @@ typeok_incdec(const mod_t *mp, const tno return false; } else if (tp->t_const) { if (!tflag) - /* %soperand of '%s' must be modifiable ... */ + /* %soperand of '%s' must be modifiable lvalue */ warning(115, "", mp->m_name); } return true;
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 16:16:10 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_163.c msg_163.exp Log Message: lint: add test for rvalue ++ after cast To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_163.c \ src/tests/usr.bin/xlint/lint1/msg_163.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_163.c diff -u src/tests/usr.bin/xlint/lint1/msg_163.c:1.1 src/tests/usr.bin/xlint/lint1/msg_163.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_163.c:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_163.c Sun Jan 17 16:16:09 2021 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_163.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */ +/* $NetBSD: msg_163.c,v 1.2 2021/01/17 16:16:09 rillig Exp $ */ # 3 "msg_163.c" // Test for message: a cast does not yield an lvalue [163] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +void +example(char *p, int i) +{ + p++; + ((char *)p)++; /* XXX: why is this ok? */ + i++; + ((int)i)++; /* expect: 163, 114 */ +} Index: src/tests/usr.bin/xlint/lint1/msg_163.exp diff -u src/tests/usr.bin/xlint/lint1/msg_163.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_163.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_163.exp:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_163.exp Sun Jan 17 16:16:09 2021 @@ -1 +1,2 @@ -msg_163.c(6): syntax error ':' [249] +msg_163.c(12): a cast does not yield an lvalue [163] +msg_163.c(12): operand of 'x++' must be lvalue [114]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 16:01:19 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: clean up typeok_ordered_comparison To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 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.174 src/usr.bin/xlint/lint1/tree.c:1.175 --- src/usr.bin/xlint/lint1/tree.c:1.174 Sun Jan 17 15:40:27 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 16:01:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.174 2021/01/17 15:40:27 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.175 2021/01/17 16:01:19 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.174 2021/01/17 15:40:27 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.175 2021/01/17 16:01:19 rillig Exp $"); #endif #include @@ -959,7 +959,7 @@ typeok_eq(const tnode_t *ln, tspec_t lt, } static bool -typeok_ordered_comparison(op_t op, const mod_t *mp, +typeok_ordered_comparison(op_t op, const tnode_t *ln, const type_t *ltp, tspec_t lt, const tnode_t *rn, const type_t *rtp, tspec_t rt) { @@ -971,7 +971,7 @@ typeok_ordered_comparison(op_t op, const "pointer" : "integer"; /* illegal combination of %s (%s) and ... */ warning(123, lx, type_name(ltp), - rx, type_name(rtp), mp->m_name); + rx, type_name(rtp), getopname(op)); } else { warn_incompatible_types(op, lt, rt); return false; @@ -1320,8 +1320,7 @@ typeok_op(op_t op, const mod_t *mp, int case GT: case LE: case GE: - if (!typeok_ordered_comparison(op, mp, - ln, ltp, lt, rn, rtp, rt)) + if (!typeok_ordered_comparison(op, ln, ltp, lt, rn, rtp, rt)) return false; break; case QUEST:
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 16:00:16 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_123.c msg_123.exp Log Message: lint: add test for ordered comparison between incompatible types To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_123.c \ src/tests/usr.bin/xlint/lint1/msg_123.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_123.c diff -u src/tests/usr.bin/xlint/lint1/msg_123.c:1.1 src/tests/usr.bin/xlint/lint1/msg_123.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_123.c:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_123.c Sun Jan 17 16:00:16 2021 @@ -1,7 +1,28 @@ -/* $NetBSD: msg_123.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */ +/* $NetBSD: msg_123.c,v 1.2 2021/01/17 16:00:16 rillig Exp $ */ # 3 "msg_123.c" // Test for message: illegal combination of %s (%s) and %s (%s), op %s [123] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +void ok(_Bool); +void bad(_Bool); + +void +compare(_Bool b, int i, double d, const char *p) +{ + ok(b < b); + ok(b < i); + ok(b < d); + bad(b < p); /* expect: 123 */ + ok(i < b); + ok(i < i); + ok(i < d); + bad(i < p); /* expect: 123 */ + ok(d < b); + ok(d < i); + ok(d < d); + bad(d < p); /* expect: 107 */ + bad(p < b); /* expect: 123 */ + bad(p < i); /* expect: 123 */ + bad(p < d); /* expect: 107 */ + ok(p < p); +} Index: src/tests/usr.bin/xlint/lint1/msg_123.exp diff -u src/tests/usr.bin/xlint/lint1/msg_123.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_123.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_123.exp:1.1 Sat Jan 2 10:22:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_123.exp Sun Jan 17 16:00:16 2021 @@ -1 +1,6 @@ -msg_123.c(6): syntax error ':' [249] +msg_123.c(15): warning: illegal combination of integer (_Bool) and pointer (pointer to const char), op < [123] +msg_123.c(19): warning: illegal combination of integer (int) and pointer (pointer to const char), op < [123] +msg_123.c(23): operands of '<' have incompatible types (double != pointer) [107] +msg_123.c(24): warning: illegal combination of pointer (pointer to const char) and integer (_Bool), op < [123] +msg_123.c(25): warning: illegal combination of pointer (pointer to const char) and integer (int), op < [123] +msg_123.c(26): operands of '<' have incompatible types (pointer != double) [107]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 15:40:28 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: externs1.h init.c tree.c Log Message: lint: fix return type of conaddr To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.173 -r1.174 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/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.56 src/usr.bin/xlint/lint1/externs1.h:1.57 --- src/usr.bin/xlint/lint1/externs1.h:1.56 Sat Jan 16 02:40:02 2021 +++ src/usr.bin/xlint/lint1/externs1.h Sun Jan 17 15:40:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.56 2021/01/16 02:40:02 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.57 2021/01/17 15:40:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -219,7 +219,7 @@ extern val_t *constant(tnode_t *, bool); extern void expr(tnode_t *, bool, bool, bool); extern void check_expr_misc(const tnode_t *, bool, bool, bool, bool, bool, bool); -extern int conaddr(tnode_t *, sym_t **, ptrdiff_t *); +extern bool constant_addr(tnode_t *, sym_t **, ptrdiff_t *); extern strg_t *cat_strings(strg_t *, strg_t *); extern int64_t tsize(type_t *); Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.63 src/usr.bin/xlint/lint1/init.c:1.64 --- src/usr.bin/xlint/lint1/init.c:1.63 Sat Jan 16 16:53:23 2021 +++ src/usr.bin/xlint/lint1/init.c Sun Jan 17 15:40:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.63 2021/01/16 16:53:23 rillig Exp $ */ +/* $NetBSD: init.c,v 1.64 2021/01/17 15:40:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.63 2021/01/16 16:53:23 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.64 2021/01/17 15:40:27 rillig Exp $"); #endif #include @@ -646,7 +646,7 @@ mkinit(tnode_t *tn) if (tn != NULL && tn->tn_op != CON) { sym = NULL; offs = 0; - if (conaddr(tn, , ) == -1) { + if (!constant_addr(tn, , )) { if (sc == AUTO || sc == REG) { /* non-constant initializer */ c99ism(177); Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.173 src/usr.bin/xlint/lint1/tree.c:1.174 --- src/usr.bin/xlint/lint1/tree.c:1.173 Sun Jan 17 15:31:11 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:40:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.173 2021/01/17 15:31:11 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.174 2021/01/17 15:40:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.173 2021/01/17 15:31:11 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.174 2021/01/17 15:40:27 rillig Exp $"); #endif #include @@ -4174,8 +4174,7 @@ check_integer_comparison(op_t op, tnode_ } /* - * Takes an expression an returns 0 if this expression can be used - * for static initialisation, otherwise -1. + * Return whether the expression can be used for static initialisation. * * Constant initialisation expressions must be constant or an address * of a static object with an optional offset. In the first case, @@ -4186,8 +4185,8 @@ check_integer_comparison(op_t op, tnode_ * CON. Type conversions are allowed if they do not change binary * representation (including width). */ -int -conaddr(tnode_t *tn, sym_t **symp, ptrdiff_t *offsp) +bool +constant_addr(tnode_t *tn, sym_t **symp, ptrdiff_t *offsp) { sym_t *sym; ptrdiff_t offs1, offs2; @@ -4196,24 +4195,24 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi switch (tn->tn_op) { case MINUS: if (tn->tn_right->tn_op == CVT) - return conaddr(tn->tn_right, symp, offsp); + return constant_addr(tn->tn_right, symp, offsp); else if (tn->tn_right->tn_op != CON) - return -1; + return false; /* FALLTHROUGH */ case PLUS: offs1 = offs2 = 0; if (tn->tn_left->tn_op == CON) { offs1 = (ptrdiff_t)tn->tn_left->tn_val->v_quad; - if (conaddr(tn->tn_right, , ) == -1) -return -1; + if (!constant_addr(tn->tn_right, , )) +return false; } else if (tn->tn_right->tn_op == CON) { offs2 = (ptrdiff_t)tn->tn_right->tn_val->v_quad; if (tn->tn_op == MINUS) offs2 = -offs2; - if (conaddr(tn->tn_left, , ) == -1) -return -1; + if (!constant_addr(tn->tn_left, , )) +return false; } else { - return -1; + return false; } *symp = sym; *offsp = offs1 + offs2; @@ -4235,7 +4234,7 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi ot = tn->tn_left->tn_type->t_tspec; if ((!is_integer(t) && t != PTR) || (!is_integer(ot) && ot != PTR)) { - return -1; + return false; } #ifdef notdef /* @@ -4250,13 +4249,13 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi else if
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 15:31:11 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: reduce scope of local variables in check_expr_misc To generate a diff of this commit: cvs rdiff -u -r1.172 -r1.173 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.172 src/usr.bin/xlint/lint1/tree.c:1.173 --- src/usr.bin/xlint/lint1/tree.c:1.172 Sun Jan 17 15:24:03 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:31:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.173 2021/01/17 15:31:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.173 2021/01/17 15:31:11 rillig Exp $"); #endif #include @@ -3885,7 +3885,6 @@ check_expr_misc(const tnode_t *tn, bool { tnode_t *ln, *rn; mod_t *mp; - bool nrvdisc, cvctx, ctctx; op_t op; scl_t sc; dinfo_t *di; @@ -4016,8 +4015,10 @@ check_expr_misc(const tnode_t *tn, bool break; } - cvctx = mp->m_left_value_context; - ctctx = mp->m_left_test_context; + bool cvctx = mp->m_left_value_context; + bool ctctx = mp->m_left_test_context; + bool eq = mp->m_warn_if_operand_eq; + /* * values of operands of ':' are not used if the type of at least * one of the operands (for gcc compatibility) is void @@ -4026,27 +4027,29 @@ check_expr_misc(const tnode_t *tn, bool */ if (op == COLON && tn->tn_type->t_tspec == VOID) cvctx = ctctx = false; - nrvdisc = op == CVT && tn->tn_type->t_tspec == VOID; - check_expr_misc(ln, cvctx, ctctx, mp->m_warn_if_operand_eq, op == CALL, nrvdisc, szof); + bool discard = op == CVT && tn->tn_type->t_tspec == VOID; + check_expr_misc(ln, cvctx, ctctx, eq, op == CALL, discard, szof); switch (op) { case PUSH: if (rn != NULL) - check_expr_misc(rn, false, false, mp->m_warn_if_operand_eq, false, false, szof); + check_expr_misc(rn, false, false, eq, false, false, + szof); break; case LOGAND: case LOGOR: - check_expr_misc(rn, false, true, mp->m_warn_if_operand_eq, false, false, szof); + check_expr_misc(rn, false, true, eq, false, false, szof); break; case COLON: - check_expr_misc(rn, cvctx, ctctx, mp->m_warn_if_operand_eq, false, false, szof); + check_expr_misc(rn, cvctx, ctctx, eq, false, false, szof); break; case COMMA: - check_expr_misc(rn, vctx, tctx, mp->m_warn_if_operand_eq, false, false, szof); + check_expr_misc(rn, vctx, tctx, eq, false, false, szof); break; default: if (mp->m_binary) - check_expr_misc(rn, true, false, mp->m_warn_if_operand_eq, false, false, szof); + check_expr_misc(rn, true, false, eq, false, false, + szof); break; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 15:24:03 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c tree.c Log Message: lint: replace integer constants with bool constants To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.171 -r1.172 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.125 src/usr.bin/xlint/lint1/decl.c:1.126 --- src/usr.bin/xlint/lint1/decl.c:1.125 Sun Jan 17 11:28:01 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Jan 17 15:24:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.125 2021/01/17 11:28:01 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.126 2021/01/17 15:24: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.125 2021/01/17 11:28:01 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.126 2021/01/17 15:24:03 rillig Exp $"); #endif #include @@ -1389,7 +1389,7 @@ add_function(sym_t *decl, sym_t *args) *tpp = tp = getblk(sizeof (type_t)); tp->t_tspec = FUNC; tp->t_subt = dcs->d_next->d_type; - if ((tp->t_proto = dcs->d_proto) != 0) + if ((tp->t_proto = dcs->d_proto) != false) tp->t_args = args; tp->t_vararg = dcs->d_vararg; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.171 src/usr.bin/xlint/lint1/tree.c:1.172 --- src/usr.bin/xlint/lint1/tree.c:1.171 Sun Jan 17 15:06:54 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:24:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.171 2021/01/17 15:06:54 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.171 2021/01/17 15:06:54 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 rillig Exp $"); #endif #include @@ -534,14 +534,14 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * Promote the left operand if it is in a test or value context */ if (mp->m_left_value_context || mp->m_left_test_context) - ln = promote(op, 0, ln); + ln = promote(op, false, ln); /* * Promote the right operand, but only if it is no struct or * union member, or if it is not to be assigned to the left operand */ if (mp->m_binary && op != ARROW && op != POINT && op != ASSIGN && op != RETURN) { - rn = promote(op, 0, rn); + rn = promote(op, false, rn); } /* @@ -586,7 +586,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) ntn = build_prepost_incdec(op, ln); break; case ADDR: - ntn = build_address(ln, 0); + ntn = build_address(ln, false); break; case INDIR: ntn = new_tnode(INDIR, ln->tn_type->t_subt, ln, NULL); @@ -704,7 +704,7 @@ cconv(tnode_t *tn) * of type T) */ if (tn->tn_type->t_tspec == FUNC) - tn = build_address(tn, 1); + tn = build_address(tn, true); /* lvalue to rvalue */ if (tn->tn_lvalue) { @@ -848,7 +848,7 @@ typeok_minus(op_t op, return false; } if (lt == PTR && rt == PTR) { - if (!eqtype(ltp->t_subt, rtp->t_subt, 1, 0, NULL)) { + if (!eqtype(ltp->t_subt, rtp->t_subt, true, false, NULL)) { /* illegal pointer subtraction */ error(116); } @@ -1056,9 +1056,9 @@ typeok_colon(const mod_t *mp, } if (rt == PTR && lt == PTR) { - if (eqptrtype(lstp, rstp, 1)) + if (eqptrtype(lstp, rstp, true)) return true; - if (!eqtype(lstp, rstp, 1, 0, NULL)) + if (!eqtype(lstp, rstp, true, false, NULL)) warn_incompatible_pointers(mp, ltp, rtp); return true; } @@ -1475,7 +1475,7 @@ check_pointer_comparison(op_t op, const return; } - if (!eqtype(ltp->t_subt, rtp->t_subt, 1, 0, NULL)) { + if (!eqtype(ltp->t_subt, rtp->t_subt, true, false, NULL)) { warn_incompatible_pointers([op], ltp, rtp); return; } @@ -1548,7 +1548,7 @@ check_assign_types_compatible(op_t op, i } if (lt == PTR && rt == PTR && (lst == VOID || rst == VOID || - eqtype(lstp, rstp, 1, 0, NULL))) { + eqtype(lstp, rstp, true, false, NULL))) { /* compatible pointer types (qualifiers ignored) */ if (!tflag && ((!lstp->t_const && rstp->t_const) || @@ -2052,7 +2052,7 @@ check_prototype_conversion(int arg, tspe return; /* get default promotion */ - ptn = promote(NOOP, 1, tn); + ptn = promote(NOOP, true, tn); ot = ptn->tn_type->t_tspec; /* return if types are the same with and without prototype */ @@ -2614,7 +2614,7 @@ build_struct_access(op_t op, tnode_t *ln nolval = op == POINT && !ln->tn_lvalue; if (op == POINT) { - ln = build_address(ln, 1); + ln = build_address(ln, true); } else if (ln->tn_type->t_tspec != PTR) { lint_assert(tflag); lint_assert(is_integer(ln->tn_type->t_tspec));
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 15:13:15 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vconsvar.h Log Message: Add appropriate memory barriers around sc_busy accesses. Fixes an issue where character cells are sometimes not erased properly on aarch64 at boot. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/wscons/wsdisplay_vconsvar.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/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 Sat Jan 16 23:19:50 2021 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sun Jan 17 15:13:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.28 2021/01/16 23:19:50 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.29 2021/01/17 15:13:15 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -34,6 +34,8 @@ #include "opt_vcons.h" #endif +#include + struct vcons_data; struct vcons_screen { @@ -84,10 +86,10 @@ struct vcons_screen { }; #define SCREEN_IS_VISIBLE(scr) (((scr)->scr_status & VCONS_IS_VISIBLE) != 0) -#define SCREEN_IS_BUSY(scr) ((scr)->scr_busy != 0) +#define SCREEN_IS_BUSY(scr) (membar_consumer(), (scr)->scr_busy != 0) #define SCREEN_CAN_DRAW(scr) (((scr)->scr_flags & VCONS_DONT_DRAW) == 0) -#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1) -#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0) +#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1, membar_producer()) +#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0, membar_producer()) #define SCREEN_VISIBLE(scr) ((scr)->scr_status |= VCONS_IS_VISIBLE) #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE) #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 15:09:56 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y scan.l Log Message: lint: rename T_AND to T_AMPER When parsing a text into a C program, the character '&' does not yet mean 'bitwise and', it could also be the address operator. To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.119 -r1.120 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/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.144 src/usr.bin/xlint/lint1/cgram.y:1.145 --- src/usr.bin/xlint/lint1/cgram.y:1.144 Sun Jan 17 15:06:54 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 15:09:56 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.144 2021/01/17 15:06:54 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.145 2021/01/17 15:09:56 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.144 2021/01/17 15:06:54 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.145 2021/01/17 15:09:56 rillig Exp $"); #endif #include @@ -153,7 +153,7 @@ anonymize(sym_t *s) %token T_SHFTOP %token T_RELOP %token T_EQOP -%token T_AND +%token T_AMPER %token T_XOR %token T_OR %token T_LOGAND @@ -254,7 +254,7 @@ anonymize(sym_t *s) %left T_LOGAND %left T_OR %left T_XOR -%left T_AND +%left T_AMPER %left T_EQOP %left T_RELOP %left T_SHFTOP @@ -1817,7 +1817,7 @@ expr: | expr T_EQOP expr { $$ = build($2, $1, $3); } - | expr T_AND expr { + | expr T_AMPER expr { $$ = build(BITAND, $1, $3); } | expr T_XOR expr { @@ -1902,7 +1902,7 @@ term: | T_ASTERISK term { $$ = build(INDIR, $2, NULL); } - | T_AND term { + | T_AMPER term { $$ = build(ADDR, $2, NULL); } | T_UNOP term { Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.119 src/usr.bin/xlint/lint1/scan.l:1.120 --- src/usr.bin/xlint/lint1/scan.l:1.119 Sun Jan 17 15:06:54 2021 +++ src/usr.bin/xlint/lint1/scan.l Sun Jan 17 15:09:56 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.119 2021/01/17 15:06:54 rillig Exp $ */ +/* $NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: scan.l,v 1.119 2021/01/17 15:06:54 rillig Exp $"); +__RCSID("$NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 rillig Exp $"); #endif #include @@ -125,7 +125,7 @@ TL ([fFlL]?[i]?) "||"return operator(T_LOGOR, LOGOR); "&&"return operator(T_LOGAND, LOGAND); "|"return operator(T_OR, BITOR); -"&"return operator(T_AND, BITAND); +"&"return operator(T_AMPER, BITAND); "^"return operator(T_XOR, BITXOR); "=="return operator(T_EQOP, EQ); "!="return operator(T_EQOP, NE);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 15:06:54 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y ops.def scan.l tree.c Log Message: lint: rename bitwise operators When there are several variants of the AND operator, both of them should get a distinguishing prefix, otherwise it's not clear which of the two possible operators is meant by the plain AND. To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint1/ops.def cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/scan.l cvs rdiff -u -r1.170 -r1.171 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.143 src/usr.bin/xlint/lint1/cgram.y:1.144 --- src/usr.bin/xlint/lint1/cgram.y:1.143 Sun Jan 17 14:55:22 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 15:06:54 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.143 2021/01/17 14:55:22 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.144 2021/01/17 15:06:54 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.143 2021/01/17 14:55:22 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.144 2021/01/17 15:06:54 rillig Exp $"); #endif #include @@ -1818,13 +1818,13 @@ expr: $$ = build($2, $1, $3); } | expr T_AND expr { - $$ = build(AND, $1, $3); + $$ = build(BITAND, $1, $3); } | expr T_XOR expr { - $$ = build(XOR, $1, $3); + $$ = build(BITXOR, $1, $3); } | expr T_OR expr { - $$ = build(OR, $1, $3); + $$ = build(BITOR, $1, $3); } | expr T_LOGAND expr { $$ = build(LOGAND, $1, $3); Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.14 src/usr.bin/xlint/lint1/ops.def:1.15 --- src/usr.bin/xlint/lint1/ops.def:1.14 Sun Jan 17 14:55:22 2021 +++ src/usr.bin/xlint/lint1/ops.def Sun Jan 17 15:06:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.def,v 1.14 2021/01/17 14:55:22 rillig Exp $ */ +/* $NetBSD: ops.def,v 1.15 2021/01/17 15:06:54 rillig Exp $ */ begin_ops() @@ -39,9 +39,9 @@ op( EQ, "==", 1,1,1, , , , ,1,1,1, ,1, op( NE, "!=", 1,1,1, , , , ,1,1,1, ,1, , , , ,1,1, ,1,1) /* name repr b l b o i c a s f v t b s l r p c e e = act */ -op( AND, "&", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) -op( XOR, "^", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) -op( OR, "|", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) +op( BITAND, "&", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) +op( BITXOR, "^", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) +op( BITOR, "|", 1, ,1, ,1, , , ,1,1, ,1, , , ,1, , ,1, ,1) op( LOGAND, "&&", 1,1,1,1, , , ,1,1, ,1, , , , , , , ,1, ,1) op( LOGOR, "||", 1,1,1,1, , , ,1,1, ,1, , , , ,1, , ,1, ,1) op( QUEST, "?", 1, , , , , , , ,1, ,1, , , , , , , , , ,1) Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.118 src/usr.bin/xlint/lint1/scan.l:1.119 --- src/usr.bin/xlint/lint1/scan.l:1.118 Sat Jan 16 02:40:02 2021 +++ src/usr.bin/xlint/lint1/scan.l Sun Jan 17 15:06:54 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.118 2021/01/16 02:40:02 rillig Exp $ */ +/* $NetBSD: scan.l,v 1.119 2021/01/17 15:06:54 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: scan.l,v 1.118 2021/01/16 02:40:02 rillig Exp $"); +__RCSID("$NetBSD: scan.l,v 1.119 2021/01/17 15:06:54 rillig Exp $"); #endif #include @@ -124,9 +124,9 @@ TL ([fFlL]?[i]?) "|="return operator(T_OPASS, ORASS); "||"return operator(T_LOGOR, LOGOR); "&&"return operator(T_LOGAND, LOGAND); -"|"return operator(T_OR, OR); -"&"return operator(T_AND, AND); -"^"return operator(T_XOR, XOR); +"|"return operator(T_OR, BITOR); +"&"return operator(T_AND, BITAND); +"^"return operator(T_XOR, BITXOR); "=="return operator(T_EQOP, EQ); "!="return operator(T_EQOP, NE); "<"return operator(T_RELOP, LT); Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.170 src/usr.bin/xlint/lint1/tree.c:1.171 --- src/usr.bin/xlint/lint1/tree.c:1.170 Sun Jan 17 14:55:22 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:06:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.171 2021/01/17 15:06:54 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.171 2021/01/17 15:06:54 rillig Exp $"); #endif #include @@ -737,7 +737,7 @@ is_strict_bool(const tnode_t *tn) return true; /*
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 14:55:22 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y ops.def tree.c Log Message: lint: rename operator STAR to INDIR C99 calls this operator the "indirection operator". The word "star" does not occur in the index of that standard. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/ops.def cvs rdiff -u -r1.169 -r1.170 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.142 src/usr.bin/xlint/lint1/cgram.y:1.143 --- src/usr.bin/xlint/lint1/cgram.y:1.142 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 14:55:22 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.143 2021/01/17 14:55:22 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.142 2021/01/17 14:50:11 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.143 2021/01/17 14:55:22 rillig Exp $"); #endif #include @@ -1900,7 +1900,7 @@ term: $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL); } | T_ASTERISK term { - $$ = build(STAR, $2, NULL); + $$ = build(INDIR, $2, NULL); } | T_AND term { $$ = build(ADDR, $2, NULL); @@ -1916,7 +1916,7 @@ term: $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL); } | term T_LBRACK expr T_RBRACK { - $$ = build(STAR, build(PLUS, $1, $3), NULL); + $$ = build(INDIR, build(PLUS, $1, $3), NULL); } | term T_LPAREN T_RPAREN { $$ = new_function_call_node($1, NULL); Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.13 src/usr.bin/xlint/lint1/ops.def:1.14 --- src/usr.bin/xlint/lint1/ops.def:1.13 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/ops.def Sun Jan 17 14:55:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.def,v 1.13 2021/01/17 14:50:11 rillig Exp $ */ +/* $NetBSD: ops.def,v 1.14 2021/01/17 14:55:22 rillig Exp $ */ begin_ops() @@ -18,7 +18,7 @@ op( INCAFT, "x++", , , , , , , ,1, , , op( DECAFT, "x--", , , , , , , ,1, , , , ,1, , , , , ,1, ,1) op( UPLUS, "+", , , , , , ,1, ,1,1, , , , , , , , ,1,1,1) op( UMINUS, "-", , , , , , ,1, ,1,1, , , ,1, , , , ,1,1,1) -op( STAR, "*", , , , , , , , , ,1, , , , , , , , , , ,1) +op( INDIR, "*", , , , , , , , , ,1, , , , , , , , , , ,1) op( ADDR, "&", , ,1, , , , , , , , , , , , , , , , , ,1) /* name repr b l b o i c a s f v t b s l r p c e e = act */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.169 src/usr.bin/xlint/lint1/tree.c:1.170 --- src/usr.bin/xlint/lint1/tree.c:1.169 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:55:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.169 2021/01/17 14:50:11 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.169 2021/01/17 14:50:11 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 rillig Exp $"); #endif #include @@ -588,8 +588,8 @@ build(op_t op, tnode_t *ln, tnode_t *rn) case ADDR: ntn = build_address(ln, 0); break; - case STAR: - ntn = new_tnode(STAR, ln->tn_type->t_subt, ln, NULL); + case INDIR: + ntn = new_tnode(INDIR, ln->tn_type->t_subt, ln, NULL); break; case PLUS: case MINUS: @@ -1287,7 +1287,7 @@ typeok_op(op_t op, const mod_t *mp, int if (!typeok_amper(mp, ln, ltp, lt)) return false; break; - case STAR: + case INDIR: if (!typeok_star(lt)) return false; break; @@ -1806,7 +1806,7 @@ new_tnode(op_t op, type_t *type, tnode_t ntn->tn_type->t_tspec = t; break; #endif - case STAR: + case INDIR: case FSEL: lint_assert(ln->tn_type->t_tspec == PTR); t = ln->tn_type->t_subt->t_tspec; @@ -2636,7 +2636,7 @@ build_struct_access(op_t op, tnode_t *ln if (rn->tn_type->t_bitfield) { ntn = new_tnode(FSEL, ntn->tn_type->t_subt, ntn, NULL); } else { - ntn = new_tnode(STAR, ntn->tn_type->t_subt, ntn, NULL); + ntn = new_tnode(INDIR, ntn->tn_type->t_subt, ntn, NULL); } if (nolval) @@ -2713,7 +2713,7 @@ build_address(tnode_t *tn, bool noign) } /* eliminate &* */ - if (tn->tn_op == STAR && + if (tn->tn_op == INDIR && tn->tn_left->tn_type->t_tspec == PTR && tn->tn_left->tn_type->t_subt == tn->tn_type) { return tn->tn_left; @@ -3904,12 +3904,12 @@ check_expr_misc(const tnode_t *tn, bool mark_as_set(ln->tn_sym); mark_as_used(ln->tn_sym, fcall, szof); } - if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS) + if
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 14:50:11 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y emit1.c func.c ops.def tree.c Log Message: lint: rename operator AMPER to ADDR There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/ops.def cvs rdiff -u -r1.168 -r1.169 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.141 src/usr.bin/xlint/lint1/cgram.y:1.142 --- src/usr.bin/xlint/lint1/cgram.y:1.141 Sat Jan 16 16:03:46 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 14:50:11 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.141 2021/01/16 16:03:46 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 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.141 2021/01/16 16:03:46 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 rillig Exp $"); #endif #include @@ -1903,7 +1903,7 @@ term: $$ = build(STAR, $2, NULL); } | T_AND term { - $$ = build(AMPER, $2, NULL); + $$ = build(ADDR, $2, NULL); } | T_UNOP term { $$ = build($1, $2, NULL); Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.38 src/usr.bin/xlint/lint1/emit1.c:1.39 --- src/usr.bin/xlint/lint1/emit1.c:1.38 Sat Jan 16 16:53:23 2021 +++ src/usr.bin/xlint/lint1/emit1.c Sun Jan 17 14:50:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.38 2021/01/16 16:53:23 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.39 2021/01/17 14:50: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.38 2021/01/16 16:53:23 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.39 2021/01/17 14:50:11 rillig Exp $"); #endif #include @@ -460,7 +460,7 @@ outcall(const tnode_t *tn, bool rvused, } outint(n); } - } else if (arg->tn_op == AMPER && + } else if (arg->tn_op == ADDR && arg->tn_left->tn_op == STRING && arg->tn_left->tn_string->st_tspec == CHAR) { /* constant string, write all format specifiers */ Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.61 src/usr.bin/xlint/lint1/func.c:1.62 --- src/usr.bin/xlint/lint1/func.c:1.61 Sun Jan 17 11:28:01 2021 +++ src/usr.bin/xlint/lint1/func.c Sun Jan 17 14:50:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $ */ +/* $NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $"); #endif #include @@ -1010,7 +1010,7 @@ doreturn(tnode_t *tn) rn = tn->tn_right; while ((op = rn->tn_op) == CVT || op == PLUS) rn = rn->tn_left; - if (rn->tn_op == AMPER && rn->tn_left->tn_op == NAME && + if (rn->tn_op == ADDR && rn->tn_left->tn_op == NAME && rn->tn_left->tn_sym->s_scl == AUTO) { /* %s returns pointer to automatic object */ warning(302, funcsym->s_name); Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.12 src/usr.bin/xlint/lint1/ops.def:1.13 --- src/usr.bin/xlint/lint1/ops.def:1.12 Sat Jan 16 19:03:47 2021 +++ src/usr.bin/xlint/lint1/ops.def Sun Jan 17 14:50:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ops.def,v 1.12 2021/01/16 19:03:47 rillig Exp $ */ +/* $NetBSD: ops.def,v 1.13 2021/01/17 14:50:11 rillig Exp $ */ begin_ops() @@ -19,7 +19,7 @@ op( DECAFT, "x--", , , , , , , ,1, , , op( UPLUS, "+", , , , , , ,1, ,1,1, , , , , , , , ,1,1,1) op( UMINUS, "-", , , , , , ,1, ,1,1, , , ,1, , , , ,1,1,1) op( STAR, "*", , , , , , , , , ,1, , , , , , , , , , ,1) -op( AMPER, "&", , ,1, , , , , , , , , , , , , , , , , ,1) +op( ADDR, "&", , ,1, , , , , , , , , , , , , , , , , ,1) /* name repr b l b o i c a s f v t b s l r p c e e = act */ op( MULT, "*", 1, , , , , ,1, ,1,1, ,1, , ,1, , , ,1,1,1) Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.168 src/usr.bin/xlint/lint1/tree.c:1.169 --- src/usr.bin/xlint/lint1/tree.c:1.168 Sun Jan 17 14:45:21 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:50:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 14:45:21 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_204.c src/usr.bin/xlint/lint1: tree.c Log Message: lint: rename build_ampersand to build_address At that stage of analysis, the ampersand is no longer ambiguous, it has already been resolved as the address-of operator, instead of the bitwise-and operator. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_204.c cvs rdiff -u -r1.167 -r1.168 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/tests/usr.bin/xlint/lint1/msg_204.c diff -u src/tests/usr.bin/xlint/lint1/msg_204.c:1.3 src/tests/usr.bin/xlint/lint1/msg_204.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_204.c:1.3 Fri Jan 8 02:11:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_204.c Sun Jan 17 14:45:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_204.c,v 1.3 2021/01/08 02:11:45 rillig Exp $ */ +/* $NetBSD: msg_204.c,v 1.4 2021/01/17 14:45:21 rillig Exp $ */ # 3 "msg_204.c" // Test for message: controlling expressions must have scalar type [204] @@ -21,7 +21,7 @@ bug_between_2020_12_31_and_2021_01_08(vo /* * FIXME: For some reason, the ampersand is discarded in - * build_ampersand. This only has a visible effect if the + * build_address. This only has a visible effect if the * t_spec in check_controlling_expression is evaluated too early, * as has been the case before func.c 1.52 from 2021-01-08. */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.167 src/usr.bin/xlint/lint1/tree.c:1.168 --- src/usr.bin/xlint/lint1/tree.c:1.167 Sun Jan 17 14:37:48 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:45:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.167 2021/01/17 14:37:48 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.168 2021/01/17 14:45:21 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.167 2021/01/17 14:37:48 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.168 2021/01/17 14:45:21 rillig Exp $"); #endif #include @@ -78,7 +78,7 @@ static void check_pointer_conversion(op_ static tnode_t *build_struct_access(op_t, tnode_t *, tnode_t *); static tnode_t *build_prepost_incdec(op_t, tnode_t *); static tnode_t *build_real_imag(op_t, tnode_t *); -static tnode_t *build_ampersand(tnode_t *, bool); +static tnode_t *build_address(tnode_t *, bool); static tnode_t *build_plus_minus(op_t, tnode_t *, tnode_t *); static tnode_t *build_bit_shift(op_t, tnode_t *, tnode_t *); static tnode_t *build_colon(tnode_t *, tnode_t *); @@ -586,7 +586,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) ntn = build_prepost_incdec(op, ln); break; case AMPER: - ntn = build_ampersand(ln, 0); + ntn = build_address(ln, 0); break; case STAR: ntn = new_tnode(STAR, ln->tn_type->t_subt, ln, NULL); @@ -704,7 +704,7 @@ cconv(tnode_t *tn) * of type T) */ if (tn->tn_type->t_tspec == FUNC) - tn = build_ampersand(tn, 1); + tn = build_address(tn, 1); /* lvalue to rvalue */ if (tn->tn_lvalue) { @@ -780,7 +780,7 @@ typeok_amper(const mod_t *mp, const tnode_t *tn, const type_t *tp, tspec_t t) { if (t == ARRAY || t == FUNC) { - /* ok, a warning comes later (in build_ampersand()) */ + /* ok, a warning comes later (in build_address()) */ } else if (!tn->tn_lvalue) { if (tn->tn_op == CVT && tn->tn_cast && tn->tn_left->tn_op == LOAD) { @@ -2614,7 +2614,7 @@ build_struct_access(op_t op, tnode_t *ln nolval = op == POINT && !ln->tn_lvalue; if (op == POINT) { - ln = build_ampersand(ln, 1); + ln = build_address(ln, 1); } else if (ln->tn_type->t_tspec != PTR) { lint_assert(tflag); lint_assert(is_integer(ln->tn_type->t_tspec)); @@ -2700,7 +2700,7 @@ build_real_imag(op_t op, tnode_t *ln) * Create a tree node for the & operator */ static tnode_t * -build_ampersand(tnode_t *tn, bool noign) +build_address(tnode_t *tn, bool noign) { tnode_t *ntn; tspec_t t;
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 14:37:49 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: extract fallback_symbol from new_name_node The code was too close to the right margin, causing unnatural line breaks. Furthermore it was getting too long and detailed. To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 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.166 src/usr.bin/xlint/lint1/tree.c:1.167 --- src/usr.bin/xlint/lint1/tree.c:1.166 Sun Jan 17 14:26:31 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:37:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.166 2021/01/17 14:26:31 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.167 2021/01/17 14:37:48 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.166 2021/01/17 14:26:31 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.167 2021/01/17 14:37:48 rillig Exp $"); #endif #include @@ -204,6 +204,50 @@ new_integer_constant_node(tspec_t t, int return n; } +static void +fallback_symbol(sym_t *sym) +{ + + if (Tflag && strcmp(sym->s_name, "__lint_false") == 0) { + sym->s_scl = CTCONST; /* close enough */ + sym->s_type = gettyp(BOOL); + sym->s_value.v_tspec = BOOL; + sym->s_value.v_ansiu = false; + sym->s_value.v_quad = 0; + return; + } + + if (Tflag && strcmp(sym->s_name, "__lint_true") == 0) { + sym->s_scl = CTCONST; /* close enough */ + sym->s_type = gettyp(BOOL); + sym->s_value.v_tspec = BOOL; + sym->s_value.v_ansiu = false; + sym->s_value.v_quad = 1; + return; + } + + if (blklev > 0 && (strcmp(sym->s_name, "__FUNCTION__") == 0 || + strcmp(sym->s_name, "__PRETTY_FUNCTION__") == 0)) { + /* __FUNCTION__/__PRETTY_FUNCTION__ is a GCC extension */ + gnuism(316); + sym->s_type = incref(gettyp(CHAR), PTR); + sym->s_type->t_const = true; + return; + } + + if (blklev > 0 && strcmp(sym->s_name, "__func__") == 0) { + if (!Sflag) + /* __func__ is a C9X feature */ + warning(317); + sym->s_type = incref(gettyp(CHAR), PTR); + sym->s_type->t_const = true; + return; + } + + /* %s undefined */ + error(99, sym->s_name); +} + /* * Create a node for a name (symbol table entry). * ntok is the token which follows the name. @@ -227,45 +271,7 @@ new_name_node(sym_t *sym, int ntok) */ sym->s_type = incref(sym->s_type, FUNC); } else { - if (Tflag && strcmp(sym->s_name, "__lint_false") == 0) { -sym->s_scl = CTCONST; /* close enough */ -sym->s_type = gettyp(BOOL); -sym->s_value.v_tspec = BOOL; -sym->s_value.v_ansiu = false; -sym->s_value.v_quad = 0; - } else if (Tflag && - strcmp(sym->s_name, "__lint_true") == 0) { -sym->s_scl = CTCONST; /* close enough */ -sym->s_type = gettyp(BOOL); -sym->s_value.v_tspec = BOOL; -sym->s_value.v_ansiu = false; -sym->s_value.v_quad = 1; - } else if (blklev == 0) { -/* %s undefined */ -error(99, sym->s_name); - } else { -bool fixtype; -if (strcmp(sym->s_name, "__FUNCTION__") == 0 || -strcmp(sym->s_name, "__PRETTY_FUNCTION__") -== 0) { - /* __FUNCTION__/__PRETTY_FUNCTION... */ - gnuism(316); - fixtype = true; -} else if (strcmp(sym->s_name, "__func__") == 0) { - if (!Sflag) - /* __func__ is a C9X feature */ - warning(317); - fixtype = true; -} else { - /* %s undefined */ - error(99, sym->s_name); - fixtype = false; -} -if (fixtype) { - sym->s_type = incref(gettyp(CHAR), PTR); - sym->s_type->t_const = true; -} - } + fallback_symbol(sym); } }
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: jmcneill Date: Sun Jan 17 14:28:25 UTC 2021 Modified Files: src/sys/arch/arm/fdt: arm_simplefb.c Log Message: fix build without VCONS_DRAW_INTR To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/fdt/arm_simplefb.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/fdt/arm_simplefb.c diff -u src/sys/arch/arm/fdt/arm_simplefb.c:1.4 src/sys/arch/arm/fdt/arm_simplefb.c:1.5 --- src/sys/arch/arm/fdt/arm_simplefb.c:1.4 Wed Oct 21 11:06:13 2020 +++ src/sys/arch/arm/fdt/arm_simplefb.c Sun Jan 17 14:28:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arm_simplefb.c,v 1.4 2020/10/21 11:06:13 rin Exp $ */ +/* $NetBSD: arm_simplefb.c,v 1.5 2021/01/17 14:28:25 jmcneill Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -31,9 +31,10 @@ #include "pci.h" #include "opt_pci.h" +#include "opt_vcons.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.4 2020/10/21 11:06:13 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.5 2021/01/17 14:28:25 jmcneill Exp $"); #include #include @@ -254,9 +255,11 @@ arm_simplefb_preattach(void) vcons_init(_simplefb_vcons_data, sc, _simplefb_stdscreen, _simplefb_accessops); arm_simplefb_vcons_data.init_screen = arm_simplefb_init_screen; +#ifdef VCONS_DRAW_INTR arm_simplefb_vcons_data.use_intr = 0; +#endif vcons_init_screen(_simplefb_vcons_data, _simplefb_screen, 1, ); - arm_simplefb_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; + arm_simplefb_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; if (ri->ri_rows < 1 || ri->ri_cols < 1) return;
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 14:26:31 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: flatten check_pointer_integer_conversion To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 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.165 src/usr.bin/xlint/lint1/tree.c:1.166 --- src/usr.bin/xlint/lint1/tree.c:1.165 Sun Jan 17 13:50:32 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:26:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.165 2021/01/17 13:50:32 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.166 2021/01/17 14:26:31 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.165 2021/01/17 13:50:32 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.166 2021/01/17 14:26:31 rillig Exp $"); #endif #include @@ -2150,20 +2150,17 @@ check_pointer_integer_conversion(op_t op if (tn->tn_op == CON) return; - - if (op != CVT) { - /* We got already an error. */ + if (op != CVT) + return; /* We got already an error. */ + if (psize(nt) >= psize(PTR)) return; - } - if (psize(nt) < psize(PTR)) { - if (pflag && size(nt) >= size(PTR)) { - /* conversion of pointer to '%s' may lose bits */ - warning(134, type_name(tp)); - } else { - /* conversion of pointer to '%s' loses bits */ - warning(133, type_name(tp)); - } + if (pflag && size(nt) >= size(PTR)) { + /* conversion of pointer to '%s' may lose bits */ + warning(134, type_name(tp)); + } else { + /* conversion of pointer to '%s' loses bits */ + warning(133, type_name(tp)); } } @@ -2219,7 +2216,7 @@ check_pointer_conversion(op_t op, tnode_ } /* - * Converts a typed constant in a constant of another type. + * Converts a typed constant to a constant of another type. * * op operator which requires conversion * arg if op is FARG, # of argument
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 17 13:50:33 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict.exp src/usr.bin/xlint/common: inittyp.c src/usr.bin/xlint/lint1: tree.c Log Message: lint: in strict bool mode, don't treat bool as arithmetic type To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.12 -r1.13 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/common/inittyp.c cvs rdiff -u -r1.164 -r1.165 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/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.14 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.15 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.14 Sun Jan 17 13:15:03 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sun Jan 17 13:50:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.14 2021/01/17 13:15:03 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.15 2021/01/17 13:50:33 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -167,19 +167,19 @@ enum strict_bool_constant_expressions { */ Q2 = (13 > 12 ? 1 : 7) ? 100 : 101, /* expect: 331 */ - BINAND_BOOL = __lint_false & __lint_true, + BINAND_BOOL = __lint_false & __lint_true, /* expect: 55 */ BINAND_INT = 0 & 1, - BINXOR_BOOL = __lint_false ^ __lint_true, + BINXOR_BOOL = __lint_false ^ __lint_true, /* expect: 55 */ BINXOR_INT = 0 ^ 1, - BINOR_BOOL = __lint_false | __lint_true, + BINOR_BOOL = __lint_false | __lint_true, /* expect: 55 */ BINOR_INT = 0 | 1, - LOGOR_BOOL = __lint_false || __lint_true, + LOGOR_BOOL = __lint_false || __lint_true, /* expect: 55 */ LOGOR_INT = 0 || 1, /* expect: 331, 332 */ - LOGAND_BOOL = __lint_false && __lint_true, + LOGAND_BOOL = __lint_false && __lint_true, /* expect: 55 */ LOGAND_INT = 0 && 1, /* expect: 331, 332 */ }; @@ -221,7 +221,7 @@ strict_bool_bit_fields_operand_conversio struct s s = { 0 }; s.ordinary = s.ordinary | s.ordinary; - s.bit_field = s.bit_field | s.bit_field; /* FIXME *//* expect: 107 */ + s.bit_field = s.bit_field | s.bit_field; } /* @@ -716,27 +716,6 @@ strict_bool_operator_eq_bool_int(void) (void)(strict_bool_conversion_return_false() == 0); /* expect: 107 */ } -/* - * When building the NE node, the following steps happen: - * - * ln is promoted from BOOL:1 to INT:1 since it is a bit field and C90 says - * that bit fields must always be promoted to int. - * - * rn is promoted from BOOL. promote() does not handle BOOL explicitly, - * therefore it is kept as-is. That may or may not have been an oversight - * in the initial implementation of supporting BOOL. - * - * After that, the two nodes are balanced. At this point, their types are - * INT:1 and BOOL. INT is considered the larger of the two types, even - * though it is a bit field in this case. Therefore BOOL is converted to - * INT now, and since it is a constant, the converted node loses all - * information about its previous type. - * - * During these conversions and promotions, the code asks whether BOOL - * is an arithmetic type. If that isn't the case, no conversion or - * promotion takes place. Since strict bool mode explicitly treats BOOL - * as non-arithmetic, changing is_arithmetic sounds like the way to go. - */ void strict_bool_assign_bit_field_then_compare(void) { @@ -746,6 +725,5 @@ strict_bool_assign_bit_field_then_compar struct s s = { __lint_false }; - /* FIXME: The __lint_false is converted irreversibly to an INT. */ - (void)((s.flag = s.flag) != __lint_false); /* expect: 107 */ + (void)((s.flag = s.flag) != __lint_false); } Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.12 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.13 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.12 Sun Jan 17 13:15:03 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sun Jan 17 13:50:33 2021 @@ -8,15 +8,19 @@ d_c99_bool_strict.c(148): left operand o d_c99_bool_strict.c(158): left operand of '?' must be bool, not 'int' [331] d_c99_bool_strict.c(159): left operand of '?' must be bool, not 'int' [331] d_c99_bool_strict.c(168): left operand of '?' must be bool, not 'int' [331] +d_c99_bool_strict.c(170): integral constant expression expected [55] +d_c99_bool_strict.c(173): integral constant expression expected [55] +d_c99_bool_strict.c(176): integral constant expression expected [55] +d_c99_bool_strict.c(179): integral constant expression expected [55] d_c99_bool_strict.c(180): left operand of '||' must be bool, not 'int' [331] d_c99_bool_strict.c(180): right operand of '||' must be bool, not
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 13:15:03 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict.exp Log Message: lint: explain failing test case in strict bool mode To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.11 -r1.12 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.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_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.13 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.14 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.13 Sun Jan 17 11:32:06 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sun Jan 17 13:15:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.13 2021/01/17 11:32:06 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.14 2021/01/17 13:15:03 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -716,6 +716,27 @@ strict_bool_operator_eq_bool_int(void) (void)(strict_bool_conversion_return_false() == 0); /* expect: 107 */ } +/* + * When building the NE node, the following steps happen: + * + * ln is promoted from BOOL:1 to INT:1 since it is a bit field and C90 says + * that bit fields must always be promoted to int. + * + * rn is promoted from BOOL. promote() does not handle BOOL explicitly, + * therefore it is kept as-is. That may or may not have been an oversight + * in the initial implementation of supporting BOOL. + * + * After that, the two nodes are balanced. At this point, their types are + * INT:1 and BOOL. INT is considered the larger of the two types, even + * though it is a bit field in this case. Therefore BOOL is converted to + * INT now, and since it is a constant, the converted node loses all + * information about its previous type. + * + * During these conversions and promotions, the code asks whether BOOL + * is an arithmetic type. If that isn't the case, no conversion or + * promotion takes place. Since strict bool mode explicitly treats BOOL + * as non-arithmetic, changing is_arithmetic sounds like the way to go. + */ void strict_bool_assign_bit_field_then_compare(void) { Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.11 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.12 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.11 Sun Jan 17 11:32:06 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sun Jan 17 13:15:03 2021 @@ -142,4 +142,4 @@ d_c99_bool_strict.c(670): operands of '= d_c99_bool_strict.c(677): operands of '=' have incompatible types (_Bool != int) [107] d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool_bitwise_and_enum [231] d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107] -d_c99_bool_strict.c(729): operands of '!=' have incompatible types (_Bool != int) [107] +d_c99_bool_strict.c(750): operands of '!=' have incompatible types (_Bool != int) [107]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 12:23:01 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: op.h tree.c Log Message: lint: rename mod_t members To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/op.h cvs rdiff -u -r1.163 -r1.164 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/op.h diff -u src/usr.bin/xlint/lint1/op.h:1.12 src/usr.bin/xlint/lint1/op.h:1.13 --- src/usr.bin/xlint/lint1/op.h:1.12 Tue Jan 12 20:42:01 2021 +++ src/usr.bin/xlint/lint1/op.h Sun Jan 17 12:23:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: op.h,v 1.12 2021/01/12 20:42:01 rillig Exp $ */ +/* $NetBSD: op.h,v 1.13 2021/01/17 12:23:01 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,27 +37,27 @@ * Various information about operators */ typedef struct { - bool m_binary : 1; /* binary operator */ - bool m_returns_bool : 1; /* logical operator, result is 0 or 1 */ - bool m_takes_bool : 1; /* only in strict bool mode */ - bool m_takes_only_bool : 1; /* only in strict bool mode */ - bool m_requires_integer : 1; - bool m_requires_integer_or_complex : 1; - bool m_requires_arith : 1; - bool m_requires_scalar : 1; - bool m_fold : 1; /* operands should be folded */ - bool m_vctx : 1; /* value context for left operand */ - bool m_tctx : 1; /* test context for left operand */ - bool m_balance : 1; /* operator requires balancing */ - bool m_sideeff : 1; /* operator has side effect */ - bool m_tlansiu : 1; /* warn if left op. is unsign. in ANSI C */ - bool m_transiu : 1; /* warn if right op. is unsign. in ANSI C */ - bool m_possible_precedence_confusion : 1; - bool m_comp : 1; /* operator performs comparison */ - bool m_valid_on_enum : 1; /* valid operation on enums */ - bool m_bad_on_enum : 1; /* dubious operation on enums */ - bool m_eqwarn : 1; /* warning if on operand stems from == */ - const char *m_name; /* name of op. */ + bool m_binary: 1; + bool m_returns_bool: 1; + bool m_takes_bool: 1; + bool m_requires_bool: 1; + bool m_requires_integer: 1; + bool m_requires_integer_or_complex: 1; + bool m_requires_arith: 1; + bool m_requires_scalar: 1; + bool m_fold_constant_operands: 1; + bool m_left_value_context: 1; + bool m_left_test_context: 1; + bool m_balance_operands: 1; + bool m_has_side_effect: 1; + bool m_warn_if_left_unsigned_in_c90: 1; + bool m_warn_if_right_unsigned_in_c90: 1; + bool m_possible_precedence_confusion: 1; + bool m_comparison: 1; + bool m_valid_on_enum: 1; + bool m_bad_on_enum: 1; + bool m_warn_if_operand_eq: 1; + const char *m_name; } mod_t; extern mod_t modtab[]; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.163 src/usr.bin/xlint/lint1/tree.c:1.164 --- src/usr.bin/xlint/lint1/tree.c:1.163 Sat Jan 16 19:11:36 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 12:23:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.163 2021/01/16 19:11:36 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.164 2021/01/17 12:23:01 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.163 2021/01/16 19:11:36 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.164 2021/01/17 12:23:01 rillig Exp $"); #endif #include @@ -505,7 +505,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * Apply class conversions to the left operand, but only if its * value is needed or it is compared with null. */ - if (mp->m_vctx || mp->m_tctx) + if (mp->m_left_value_context || mp->m_left_test_context) ln = cconv(ln); /* * The right operand is almost always in a test or value context, @@ -521,13 +521,13 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * short would be promoted to int. Also types are tested to be * CHAR, which would also become int. */ - if (mp->m_comp) + if (mp->m_comparison) check_integer_comparison(op, ln, rn); /* * Promote the left operand if it is in a test or value context */ - if (mp->m_vctx || mp->m_tctx) + if (mp->m_left_value_context || mp->m_left_test_context) ln = promote(op, 0, ln); /* * Promote the right operand, but only if it is no struct or @@ -543,19 +543,21 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * unsigned operands and one of the operands is signed only in * ANSI C, print a warning. */ - if (mp->m_tlansiu && ln->tn_op == CON && ln->tn_val->v_ansiu) { + if (mp->m_warn_if_left_unsigned_in_c90 && + ln->tn_op == CON && ln->tn_val->v_ansiu) { /* ANSI C treats constant as unsigned, op %s */ warning(218, mp->m_name); ln->tn_val->v_ansiu = false; } - if (mp->m_transiu && rn->tn_op == CON && rn->tn_val->v_ansiu) { + if (mp->m_warn_if_right_unsigned_in_c90 && + rn->tn_op == CON && rn->tn_val->v_ansiu) { /* ANSI C treats constant as unsigned, op %s */ warning(218, mp->m_name); rn->tn_val->v_ansiu
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 11:55:55 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: err.c Log Message: lint: rename local variables in lbasename To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 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/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.67 src/usr.bin/xlint/lint1/err.c:1.68 --- src/usr.bin/xlint/lint1/err.c:1.67 Thu Jan 14 07:42:31 2021 +++ src/usr.bin/xlint/lint1/err.c Sun Jan 17 11:55:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.67 2021/01/14 07:42:31 rillig Exp $ */ +/* $NetBSD: err.c,v 1.68 2021/01/17 11:55:55 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.67 2021/01/14 07:42:31 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.68 2021/01/17 11:55:55 rillig Exp $"); #endif #include @@ -418,19 +418,19 @@ msglist(void) static const char * lbasename(const char *path) { - const char *cp, *cp1, *cp2; + const char *p, *base, *dir; if (Fflag) return path; - cp = cp1 = cp2 = path; - while (*cp != '\0') { - if (*cp++ == '/') { - cp2 = cp1; - cp1 = cp; + p = base = dir = path; + while (*p != '\0') { + if (*p++ == '/') { + dir = base; + base = p; } } - return *cp1 == '\0' ? cp2 : cp1; + return *base != '\0' ? base : dir; } static void
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 11:32:06 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c d_c99_bool_strict.exp Log Message: lint: demonstrate wrong error message in strict bool mode To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c cvs rdiff -u -r1.10 -r1.11 \ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.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_c99_bool_strict.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.12 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.13 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.12 Sat Jan 16 18:48:52 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Sun Jan 17 11:32:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_bool_strict.c,v 1.12 2021/01/16 18:48:52 rillig Exp $ */ +/* $NetBSD: d_c99_bool_strict.c,v 1.13 2021/01/17 11:32:06 rillig Exp $ */ # 3 "d_c99_bool_strict.c" /* @@ -715,3 +715,16 @@ strict_bool_operator_eq_bool_int(void) { (void)(strict_bool_conversion_return_false() == 0); /* expect: 107 */ } + +void +strict_bool_assign_bit_field_then_compare(void) +{ + struct s { + bool flag: 1; + }; + + struct s s = { __lint_false }; + + /* FIXME: The __lint_false is converted irreversibly to an INT. */ + (void)((s.flag = s.flag) != __lint_false); /* expect: 107 */ +} Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.10 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.11 --- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.10 Sat Jan 16 18:58:21 2021 +++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sun Jan 17 11:32:06 2021 @@ -142,3 +142,4 @@ d_c99_bool_strict.c(670): operands of '= d_c99_bool_strict.c(677): operands of '=' have incompatible types (_Bool != int) [107] d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool_bitwise_and_enum [231] d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107] +d_c99_bool_strict.c(729): operands of '!=' have incompatible types (_Bool != int) [107]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 17 11:28:02 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: decl.c func.c Log Message: lint: fix type mismatch for strict bool mode No functional change. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.60 -r1.61 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.124 src/usr.bin/xlint/lint1/decl.c:1.125 --- src/usr.bin/xlint/lint1/decl.c:1.124 Sat Jan 16 16:53:23 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Jan 17 11:28:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.124 2021/01/16 16:53:23 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.125 2021/01/17 11:28:01 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.124 2021/01/16 16:53:23 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.125 2021/01/17 11:28:01 rillig Exp $"); #endif #include @@ -2187,7 +2187,7 @@ eqargs(const type_t *tp1, const type_t * while (a1 != NULL && a2 != NULL) { - if (eqtype(a1->s_type, a2->s_type, true, false, dowarn) == 0) + if (!eqtype(a1->s_type, a2->s_type, true, false, dowarn)) return false; a1 = a1->s_next; Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.60 src/usr.bin/xlint/lint1/func.c:1.61 --- src/usr.bin/xlint/lint1/func.c:1.60 Sat Jan 16 16:53:23 2021 +++ src/usr.bin/xlint/lint1/func.c Sun Jan 17 11:28:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.60 2021/01/16 16:53:23 rillig Exp $ */ +/* $NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.60 2021/01/16 16:53:23 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $"); #endif #include @@ -639,7 +639,7 @@ switch1(tnode_t *tn) tp = xcalloc(1, sizeof (type_t)); if (tn != NULL) { tp->t_tspec = tn->tn_type->t_tspec; - if ((tp->t_isenum = tn->tn_type->t_isenum) != 0) + if ((tp->t_isenum = tn->tn_type->t_isenum) != false) tp->t_enum = tn->tn_type->t_enum; } else { tp->t_tspec = INT;
CVS commit: src/sys/compat/netbsd32
Module Name:src Committed By: simonb Date: Sun Jan 17 10:50:01 UTC 2021 Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h Log Message: Handle the SIOCGNBRINFO_IN6 ioctl for compat32. ndp -a works with compat32 now. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/compat/netbsd32/netbsd32_ioctl.c cvs rdiff -u -r1.76 -r1.77 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.117 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.118 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.117 Thu Jan 14 23:30:50 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Sun Jan 17 10:50:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $"); #if defined(_KERNEL_OPT) #include "opt_ntp.h" @@ -86,6 +86,9 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc #include #include +#include +#include + #include #include @@ -177,6 +180,20 @@ netbsd32_to_ifmediareq(struct netbsd32_i } static inline void +netbsd32_to_in6_nbrinfo(struct netbsd32_in6_nbrinfo *s32p, struct in6_nbrinfo *p, +u_long cmd) +{ + + memcpy(p->ifname, s32p->ifname, sizeof p->ifname); + memcpy(>addr, >addr, sizeof p->addr); + p->asked = s32p->asked; + p->isrouter = s32p->isrouter; + p->state = s32p->state; + p->expire = s32p->expire; + +} + +static inline void netbsd32_to_pppoediscparms(struct netbsd32_pppoediscparms *s32p, struct pppoediscparms *p, u_long cmd) { @@ -698,6 +715,19 @@ netbsd32_from_ifmediareq(struct ifmediar } static inline void +netbsd32_from_in6_nbrinfo(struct in6_nbrinfo *p, struct netbsd32_in6_nbrinfo *s32p, +u_long cmd) +{ + + memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname); + memcpy(>addr, >addr, sizeof s32p->addr); + s32p->asked = p->asked; + s32p->isrouter = p->isrouter; + s32p->state = p->state; + s32p->expire = p->expire; +} + +static inline void netbsd32_from_pppoediscparms(struct pppoediscparms *p, struct netbsd32_pppoediscparms *s32p, u_long cmd) { @@ -1495,6 +1525,9 @@ netbsd32_ioctl(struct lwp *l, case SIOCGIFMEDIA32: IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq); + case SIOCGNBRINFO_IN632: + IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO_IN6, in6_nbrinfo); + case SIOCGIFGENERIC32: IOCTL_STRUCT_CONV_TO(SIOCGIFGENERIC, ifreq); case SIOCSIFGENERIC32: Index: src/sys/compat/netbsd32/netbsd32_ioctl.h diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.76 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.77 --- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.76 Thu Jan 14 08:22:51 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.h Sun Jan 17 10:50:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.76 2021/01/14 08:22:51 simonb Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.77 2021/01/17 10:50:01 simonb Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -480,6 +480,18 @@ struct netbsd32_sioc_vif_req { /* from */ #define SIOCGETVIFCNT32 _IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */ +/* from */ +struct netbsd32_in6_nbrinfo { + char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ + struct in6_addr addr; /* IPv6 address of the neighbor */ + netbsd32_long asked; /* number of queries already sent for this addr */ + int isrouter; /* if it acts as a router */ + int state; /* reachability state */ + int expire; /* lifetime for NDP state transition */ +}; +/* from */ +#define SIOCGNBRINFO_IN632 _IOWR('i', 78, struct netbsd32_in6_nbrinfo) + struct netbsd32_sioc_sg_req { struct in_addr src; struct in_addr grp;