CVS commit: src
Module Name:src Committed By: rillig Date: Thu May 26 20:17:40 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not warn about 'uint32_t = uint64_t >> 32' If all possible values fit into the destination type, there is no possibility of losing accuracy. Enhances PR 36668. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.448 -r1.449 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_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.12 src/tests/usr.bin/xlint/lint1/msg_132.c:1.13 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.12 Thu May 26 19:55:57 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 20:17:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_132.c,v 1.12 2022/05/26 19:55:57 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.13 2022/05/26 20:17:40 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] @@ -187,7 +187,6 @@ u32_t test_ic_shr(u64_t x) { if (x > 3) - /* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */ return x >> 32; if (x > 2) /* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */ Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.11 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.12 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.11 Thu May 26 19:55:57 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 20:17:40 2022 @@ -25,6 +25,5 @@ msg_132.c(99): warning: conversion from msg_132.c(125): error: operands of '+' have incompatible types (pointer != double) [107] msg_132.c(125): warning: function 'cover_build_plus_minus' expects to return value [214] msg_132.c(141): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] -msg_132.c(191): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] -msg_132.c(194): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] -msg_132.c(196): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] +msg_132.c(193): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] +msg_132.c(195): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.448 src/usr.bin/xlint/lint1/tree.c:1.449 --- src/usr.bin/xlint/lint1/tree.c:1.448 Thu May 26 18:08:33 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 20:17:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.448 2022/05/26 18:08:33 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.449 2022/05/26 20:17:40 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.448 2022/05/26 18:08:33 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.449 2022/05/26 20:17:40 rillig Exp $"); #endif #include @@ -105,6 +105,14 @@ static void check_precedence_confusion(t extern sig_atomic_t fpe; +static bool +ic_maybe_signed(const type_t *tp, const integer_constraints *ic) +{ + + return !is_uinteger(tp->t_tspec) && + (ic->bclr & ((uint64_t)1 << 63)) == 0; +} + static integer_constraints ic_any(const type_t *tp) { @@ -192,6 +200,9 @@ ic_shl(const type_t *tp, integer_constra integer_constraints c; unsigned int amount; + if (ic_maybe_signed(tp, )) + return ic_any(tp); + if (b.smin == b.smax && b.smin >= 0 && b.smin < 64) amount = (unsigned int)b.smin; else if (b.umin == b.umax && b.umin < 64) @@ -209,6 +220,31 @@ ic_shl(const type_t *tp, integer_constra } static integer_constraints +ic_shr(const type_t *tp, integer_constraints a, integer_constraints b) +{ + integer_constraints c; + unsigned int amount; + + if (ic_maybe_signed(tp, )) + return ic_any(tp); + + if (b.smin == b.smax && b.smin >= 0 && b.smin < 64) + amount = (unsigned int)b.smin; + else if (b.umin == b.umax && b.umin < 64) + amount = (unsigned int)b.umin; + else + return ic_any(tp); + + c.smin = INT64_MIN; + c.smax = INT64_MAX; + c.umin = 0; + c.umax = UINT64_MAX; + c.bset = a.bset >> amount; + c.bclr = a.bclr >> amount | ~(~(uint64_t)0 >> amount); + return c; +} + +static integer_constraints ic_expr(const tnode_t *tn) { integer_constraints lc, rc; @@ -223,6 +259,10 @@ ic_expr(const tnode_t *tn) lc = ic_expr(tn->tn_left); rc = ic_expr(tn->tn_right); return ic_shl(tn->tn_type, lc, rc); + case SHR: + lc = ic_expr(tn->tn_left); + rc = ic_expr(tn->tn_right); + return
CVS commit: src
Module Name:src Committed By: rillig Date: Thu May 26 20:17:40 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not warn about 'uint32_t = uint64_t >> 32' If all possible values fit into the destination type, there is no possibility of losing accuracy. Enhances PR 36668. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.448 -r1.449 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.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 19:55:57 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp Log Message: tests/lint: demonstrate wrong warnings about loss of accuracy To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_132.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 19:55:57 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp Log Message: tests/lint: demonstrate wrong warnings about loss of accuracy To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_132.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_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.11 src/tests/usr.bin/xlint/lint1/msg_132.c:1.12 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.11 Thu May 26 09:26:00 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 19:55:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_132.c,v 1.11 2022/05/26 09:26:00 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.12 2022/05/26 19:55:57 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] @@ -182,3 +182,16 @@ be32enc(void *buf, u32_t u) p[2] = u >> 8 & 0xff; p[3] = u & 0xff; } + +u32_t +test_ic_shr(u64_t x) +{ + if (x > 3) + /* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */ + return x >> 32; + if (x > 2) + /* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */ + return x >> 31; + /* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */ + return x; +} Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.10 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.11 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.10 Thu May 26 09:26:00 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 19:55:57 2022 @@ -25,3 +25,6 @@ msg_132.c(99): warning: conversion from msg_132.c(125): error: operands of '+' have incompatible types (pointer != double) [107] msg_132.c(125): warning: function 'cover_build_plus_minus' expects to return value [214] msg_132.c(141): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] +msg_132.c(191): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] +msg_132.c(194): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] +msg_132.c(196): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 18:08:33 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not pre-multiply pointer expressions 'ptr + int' In the AST, it is confusing to see that 'stderr == __sF + 304', it should rather be 'stderr == __sF + 2'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 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.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 18:08:33 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not pre-multiply pointer expressions 'ptr + int' In the AST, it is confusing to see that 'stderr == __sF + 304', it should rather be 'stderr == __sF + 2'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 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.447 src/usr.bin/xlint/lint1/tree.c:1.448 --- src/usr.bin/xlint/lint1/tree.c:1.447 Thu May 26 17:23:09 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 18:08:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.447 2022/05/26 17:23:09 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.448 2022/05/26 18:08:33 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.447 2022/05/26 17:23:09 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.448 2022/05/26 18:08:33 rillig Exp $"); #endif #include @@ -3102,12 +3102,7 @@ build_plus_minus(op_t op, bool sys, tnod tnode_t *elsz = subt_size_in_bytes(ln->tn_type); if (rn->tn_type->t_tspec != elsz->tn_type->t_tspec) rn = convert(NOOP, 0, elsz->tn_type, rn); - - tnode_t *prod = new_tnode(MULT, sys, rn->tn_type, rn, elsz); - if (rn->tn_op == CON) - prod = fold(prod); - - return new_tnode(op, sys, ln->tn_type, ln, prod); + return new_tnode(op, sys, ln->tn_type, ln, rn); } /* pointer - pointer */ @@ -3116,14 +3111,10 @@ build_plus_minus(op_t op, bool sys, tnod lint_assert(op == MINUS); type_t *ptrdiff = gettyp(PTRDIFF_TSPEC); - tnode_t *raw_diff = new_tnode(op, sys, ptrdiff, ln, rn); + tnode_t *diff = new_tnode(MINUS, sys, ptrdiff, ln, rn); if (ln->tn_op == CON && rn->tn_op == CON) - raw_diff = fold(raw_diff); - - tnode_t *elsz = subt_size_in_bytes(ln->tn_type); - balance(NOOP, _diff, ); - - return new_tnode(DIV, sys, ptrdiff, raw_diff, elsz); + diff = fold(diff); + return diff; } return new_tnode(op, sys, ln->tn_type, ln, rn); @@ -4391,13 +4382,8 @@ check_expr_misc(const tnode_t *tn, bool static void check_array_index(tnode_t *tn, bool amper) { - int dim; - tnode_t *ln, *rn; - int elsz; - int64_t con; - - ln = tn->tn_left; - rn = tn->tn_right; + tnode_t *ln = tn->tn_left; + tnode_t *rn = tn->tn_right; /* We can only check constant indices. */ if (rn->tn_op != CON) @@ -4418,19 +4404,8 @@ check_array_index(tnode_t *tn, bool ampe if (is_incomplete(ln->tn_left->tn_type) && rn->tn_val->v_quad >= 0) return; - /* Get the size of one array element */ - if ((elsz = length_in_bits(ln->tn_type->t_subt, NULL)) == 0) - return; - elsz /= CHAR_SIZE; - - /* Change the unit of the index from bytes to element size. */ - if (is_uinteger(rn->tn_type->t_tspec)) { - con = (uint64_t)rn->tn_val->v_quad / elsz; - } else { - con = rn->tn_val->v_quad / elsz; - } - - dim = ln->tn_left->tn_type->t_dim + (amper ? 1 : 0); + int64_t con = rn->tn_val->v_quad; + int dim = ln->tn_left->tn_type->t_dim + (amper ? 1 : 0); if (!is_uinteger(rn->tn_type->t_tspec) && con < 0) { /* array subscript cannot be negative: %ld */
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 17:23:09 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: improve local variable and function names No functional change. To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 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.446 src/usr.bin/xlint/lint1/tree.c:1.447 --- src/usr.bin/xlint/lint1/tree.c:1.446 Thu May 26 16:52:30 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 17:23:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.446 2022/05/26 16:52:30 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.447 2022/05/26 17:23:09 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.446 2022/05/26 16:52:30 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.447 2022/05/26 17:23:09 rillig Exp $"); #endif #include @@ -92,7 +92,7 @@ static tnode_t *build_plus_minus(op_t, b static tnode_t *build_bit_shift(op_t, bool, tnode_t *, tnode_t *); static tnode_t *build_colon(bool, tnode_t *, tnode_t *); static tnode_t *build_assignment(op_t, bool, tnode_t *, tnode_t *); -static tnode_t *plength(type_t *); +static tnode_t *subt_size_in_bytes(type_t *); static tnode_t *fold(tnode_t *); static tnode_t *fold_bool(tnode_t *); static tnode_t *fold_float(tnode_t *); @@ -2999,7 +2999,7 @@ build_prepost_incdec(op_t op, bool sys, lint_assert(ln != NULL); if (ln->tn_type->t_tspec == PTR) { - cn = plength(ln->tn_type); + cn = subt_size_in_bytes(ln->tn_type); } else { cn = build_integer_constant(INT, (int64_t)1); } @@ -3092,31 +3092,38 @@ build_plus_minus(op_t op, bool sys, tnod rn = tmp; } + /* pointer +- integer */ if (ln->tn_type->t_tspec == PTR && rn->tn_type->t_tspec != PTR) { lint_assert(is_integer(rn->tn_type->t_tspec)); check_ctype_macro_invocation(ln, rn); check_enum_array_index(ln, rn); - tnode_t *ctn = plength(ln->tn_type); - if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec) - rn = convert(NOOP, 0, ctn->tn_type, rn); - rn = new_tnode(MULT, sys, rn->tn_type, rn, ctn); - if (rn->tn_left->tn_op == CON) - rn = fold(rn); - return new_tnode(op, sys, ln->tn_type, ln, rn); + tnode_t *elsz = subt_size_in_bytes(ln->tn_type); + if (rn->tn_type->t_tspec != elsz->tn_type->t_tspec) + rn = convert(NOOP, 0, elsz->tn_type, rn); + + tnode_t *prod = new_tnode(MULT, sys, rn->tn_type, rn, elsz); + if (rn->tn_op == CON) + prod = fold(prod); + + return new_tnode(op, sys, ln->tn_type, ln, prod); } + /* pointer - pointer */ if (rn->tn_type->t_tspec == PTR) { lint_assert(ln->tn_type->t_tspec == PTR); lint_assert(op == MINUS); - type_t *tp = gettyp(PTRDIFF_TSPEC); - tnode_t *ntn = new_tnode(op, sys, tp, ln, rn); + + type_t *ptrdiff = gettyp(PTRDIFF_TSPEC); + tnode_t *raw_diff = new_tnode(op, sys, ptrdiff, ln, rn); if (ln->tn_op == CON && rn->tn_op == CON) - ntn = fold(ntn); - tnode_t *ctn = plength(ln->tn_type); - balance(NOOP, , ); - return new_tnode(DIV, sys, tp, ntn, ctn); + raw_diff = fold(raw_diff); + + tnode_t *elsz = subt_size_in_bytes(ln->tn_type); + balance(NOOP, _diff, ); + + return new_tnode(DIV, sys, ptrdiff, raw_diff, elsz); } return new_tnode(op, sys, ln->tn_type, ln, rn); @@ -3219,7 +3226,7 @@ build_assignment(op_t op, bool sys, tnod if ((op == ADDASS || op == SUBASS) && lt == PTR) { lint_assert(is_integer(rt)); - ctn = plength(ln->tn_type); + ctn = subt_size_in_bytes(ln->tn_type); if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec) rn = convert(NOOP, 0, ctn->tn_type, rn); rn = new_tnode(MULT, sys, rn->tn_type, rn, ctn); @@ -3265,11 +3272,11 @@ build_assignment(op_t op, bool sys, tnod } /* - * Get length_in_bits of type tp->t_subt, as a constant expression of type + * Get the size in bytes of type tp->t_subt, as a constant expression of type * ptrdiff_t as seen from the target platform. */ static tnode_t * -plength(type_t *tp) +subt_size_in_bytes(type_t *tp) { int elem, elsz_in_bits;
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 17:23:09 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: improve local variable and function names No functional change. To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 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.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu May 26 17:11:05 UTC 2022 Modified Files: src/sys/arch/aarch64/aarch64: db_interface.c Log Message: In ddb, fixed "trace/u" and user process memory read/write to work correctly. In the softint context, curlwp points the kernel lwp, so to get the pmap of a user process, we had to use curcpu()->ci_onproc->l_proc instead of curproc (curlwp->l_proc). Adviced by ad@. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/db_interface.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_interface.c diff -u src/sys/arch/aarch64/aarch64/db_interface.c:1.16 src/sys/arch/aarch64/aarch64/db_interface.c:1.17 --- src/sys/arch/aarch64/aarch64/db_interface.c:1.16 Wed May 19 12:16:01 2021 +++ src/sys/arch/aarch64/aarch64/db_interface.c Thu May 26 17:11:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.16 2021/05/19 12:16:01 skrll Exp $ */ +/* $NetBSD: db_interface.c,v 1.17 2022/05/26 17:11:05 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.16 2021/05/19 12:16:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.17 2022/05/26 17:11:05 ryo Exp $"); #include #include @@ -60,7 +60,7 @@ db_regs_t ddb_regs; static int db_validate_address(vaddr_t addr) { - struct proc *p = curproc; + struct proc *p = curcpu()->ci_onproc->l_proc; struct pmap *pmap; if (!p || !p->p_vmspace || !p->p_vmspace->vm_map.pmap ||
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu May 26 17:11:05 UTC 2022 Modified Files: src/sys/arch/aarch64/aarch64: db_interface.c Log Message: In ddb, fixed "trace/u" and user process memory read/write to work correctly. In the softint context, curlwp points the kernel lwp, so to get the pmap of a user process, we had to use curcpu()->ci_onproc->l_proc instead of curproc (curlwp->l_proc). Adviced by ad@. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/db_interface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 16:52:30 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: reduce scope of local variables in build_plus_minus No functional change. To generate a diff of this commit: cvs rdiff -u -r1.445 -r1.446 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.445 src/usr.bin/xlint/lint1/tree.c:1.446 --- src/usr.bin/xlint/lint1/tree.c:1.445 Thu May 26 10:48:47 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 16:52:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.445 2022/05/26 10:48:47 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.446 2022/05/26 16:52:30 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.445 2022/05/26 10:48:47 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.446 2022/05/26 16:52:30 rillig Exp $"); #endif #include @@ -3084,14 +3084,12 @@ build_address(bool sys, tnode_t *tn, boo static tnode_t * build_plus_minus(op_t op, bool sys, tnode_t *ln, tnode_t *rn) { - tnode_t *ntn, *ctn; - type_t *tp; /* If pointer and integer, then pointer to the lhs. */ if (rn->tn_type->t_tspec == PTR && is_integer(ln->tn_type->t_tspec)) { - ntn = ln; + tnode_t *tmp = ln; ln = rn; - rn = ntn; + rn = tmp; } if (ln->tn_type->t_tspec == PTR && rn->tn_type->t_tspec != PTR) { @@ -3100,32 +3098,28 @@ build_plus_minus(op_t op, bool sys, tnod check_ctype_macro_invocation(ln, rn); check_enum_array_index(ln, rn); - ctn = plength(ln->tn_type); + tnode_t *ctn = plength(ln->tn_type); if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec) rn = convert(NOOP, 0, ctn->tn_type, rn); rn = new_tnode(MULT, sys, rn->tn_type, rn, ctn); if (rn->tn_left->tn_op == CON) rn = fold(rn); - ntn = new_tnode(op, sys, ln->tn_type, ln, rn); - - } else if (rn->tn_type->t_tspec == PTR) { + return new_tnode(op, sys, ln->tn_type, ln, rn); + } + if (rn->tn_type->t_tspec == PTR) { lint_assert(ln->tn_type->t_tspec == PTR); lint_assert(op == MINUS); - tp = gettyp(PTRDIFF_TSPEC); - ntn = new_tnode(op, sys, tp, ln, rn); + type_t *tp = gettyp(PTRDIFF_TSPEC); + tnode_t *ntn = new_tnode(op, sys, tp, ln, rn); if (ln->tn_op == CON && rn->tn_op == CON) ntn = fold(ntn); - ctn = plength(ln->tn_type); + tnode_t *ctn = plength(ln->tn_type); balance(NOOP, , ); - ntn = new_tnode(DIV, sys, tp, ntn, ctn); - - } else { - - ntn = new_tnode(op, sys, ln->tn_type, ln, rn); - + return new_tnode(DIV, sys, tp, ntn, ctn); } - return ntn; + + return new_tnode(op, sys, ln->tn_type, ln, rn); } /*
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 16:52:30 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: reduce scope of local variables in build_plus_minus No functional change. To generate a diff of this commit: cvs rdiff -u -r1.445 -r1.446 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.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 16:45:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: fix spacing and line breaks in debug logging The spacing between function arguments in a declaration info was too big, it was the indentation level instead of a single space. The function debug_sym is used for two purposes: own-line and in-line, which coincidentally are distinguished by whether the suffix string is "\n". To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/debug.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/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.20 src/usr.bin/xlint/lint1/debug.c:1.21 --- src/usr.bin/xlint/lint1/debug.c:1.20 Thu May 26 12:04:56 2022 +++ src/usr.bin/xlint/lint1/debug.c Thu May 26 16:45:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.21 2022/05/26 16:45:25 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.21 2022/05/26 16:45:25 rillig Exp $"); #endif #include @@ -264,7 +264,8 @@ void debug_sym(const char *prefix, const sym_t *sym, const char *suffix) { - debug_print_indent(); + if (suffix[0] == '\n') + debug_print_indent(); debug_printf("%s%s", prefix, sym->s_name); if (sym->s_type != NULL) debug_printf(" type='%s'", type_name(sym->s_type));
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 16:45:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: fix spacing and line breaks in debug logging The spacing between function arguments in a declaration info was too big, it was the indentation level instead of a single space. The function debug_sym is used for two purposes: own-line and in-line, which coincidentally are distinguished by whether the suffix string is "\n". To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: rillig Date: Thu May 26 15:23:33 UTC 2022 Modified Files: src/common/lib/libc/gen: ptree.c Log Message: libc/ptree: remove CONSTCOND comments Since 2021-01-31, lint does not need them anymore. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/common/lib/libc/gen/ptree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gen/ptree.c diff -u src/common/lib/libc/gen/ptree.c:1.11 src/common/lib/libc/gen/ptree.c:1.12 --- src/common/lib/libc/gen/ptree.c:1.11 Tue May 24 20:50:17 2022 +++ src/common/lib/libc/gen/ptree.c Thu May 26 15:23:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ptree.c,v 1.11 2022/05/24 20:50:17 andvar Exp $ */ +/* $NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include #include -__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.11 2022/05/24 20:50:17 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $"); #else #include #include @@ -51,9 +51,9 @@ __KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1. #include #define KASSERT(e) assert(e) #else -#define KASSERT(e) do { } while (/*CONSTCOND*/ 0) +#define KASSERT(e) do { } while (0) #endif -__RCSID("$NetBSD: ptree.c,v 1.11 2022/05/24 20:50:17 andvar Exp $"); +__RCSID("$NetBSD: ptree.c,v 1.12 2022/05/26 15:23:33 rillig Exp $"); #endif /* _KERNEL || _STANDALONE */ #ifdef _LIBC @@ -115,7 +115,7 @@ bool ptree_check(const pt_tree_t *); #if PTCHECK > 1 #define PTREE_CHECK(pt) ptree_check(pt) #else -#define PTREE_CHECK(pt) do { } while (/*CONSTCOND*/ 0) +#define PTREE_CHECK(pt) do { } while (0) #endif static inline bool
CVS commit: src/common/lib/libc/gen
Module Name:src Committed By: rillig Date: Thu May 26 15:23:33 UTC 2022 Modified Files: src/common/lib/libc/gen: ptree.c Log Message: libc/ptree: remove CONSTCOND comments Since 2021-01-31, lint does not need them anymore. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/common/lib/libc/gen/ptree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 15:05:11 UTC 2022 Modified Files: src/sys/arch/x68k/dev: ite.c Log Message: Remove duplicated function declarations. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x68k/dev/ite.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 15:05:11 UTC 2022 Modified Files: src/sys/arch/x68k/dev: ite.c Log Message: Remove duplicated function declarations. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x68k/dev/ite.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/x68k/dev/ite.c diff -u src/sys/arch/x68k/dev/ite.c:1.66 src/sys/arch/x68k/dev/ite.c:1.67 --- src/sys/arch/x68k/dev/ite.c:1.66 Thu May 26 14:33:29 2022 +++ src/sys/arch/x68k/dev/ite.c Thu May 26 15:05:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.66 2022/05/26 14:33:29 tsutsui Exp $ */ +/* $NetBSD: ite.c,v 1.67 2022/05/26 15:05:11 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.66 2022/05/26 14:33:29 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.67 2022/05/26 15:05:11 tsutsui Exp $"); #include "ite.h" #if NITE > 0 @@ -118,10 +118,7 @@ static int ite_argnum(struct ite_softc * static int ite_zargnum(struct ite_softc *); static void ite_sendstr(struct ite_softc *, const char *); inline static int atoi(const char *); -void ite_reset(struct ite_softc *); struct ite_softc *getitesp(dev_t); -int iteon(dev_t, int); -void iteoff(dev_t, int); struct itesw itesw[] = { {0, tv_init, tv_deinit, 0,
CVS commit: src/share/man/man9
Module Name:src Committed By: rillig Date: Thu May 26 14:39:30 UTC 2022 Modified Files: src/share/man/man9: altq.9 Log Message: altq.9: remove CONSTCOND comment from example code Since 2021-01-31, lint no longer needs CONSTCOND in a do-while loop. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/altq.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man9
Module Name:src Committed By: rillig Date: Thu May 26 14:39:30 UTC 2022 Modified Files: src/share/man/man9: altq.9 Log Message: altq.9: remove CONSTCOND comment from example code Since 2021-01-31, lint no longer needs CONSTCOND in a do-while loop. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/altq.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/altq.9 diff -u src/share/man/man9/altq.9:1.17 src/share/man/man9/altq.9:1.18 --- src/share/man/man9/altq.9:1.17 Wed Mar 21 10:21:17 2018 +++ src/share/man/man9/altq.9 Thu May 26 14:39:30 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: altq.9,v 1.17 2018/03/21 10:21:17 wiz Exp $ +.\" $NetBSD: altq.9,v 1.18 2022/05/26 14:39:30 rillig Exp $ .\" $OpenBSD: altq.9,v 1.4 2001/07/12 12:41:42 itojun Exp $ .\" .\" Copyright (C) 2001 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 20, 2018 +.Dd May 26, 2022 .Dt ALTQ 9 .Os .\" @@ -228,7 +228,7 @@ do { } \e if ((err))\e (ifq)->ifq_drops++; \e -} while (/*CONSTCOND*/ 0) +} while (false) .Ed .Pp .Fn IFQ_ENQUEUE
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:33:29 UTC 2022 Modified Files: src/sys/arch/x68k/dev: bmd.c grf.c grf_machdep.c intio.c ite.c kbd.c mha.c par.c powsw.c sram.c vs.c Log Message: Explicitly include "ioconf.h" for struct cfdriver. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/x68k/dev/bmd.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x68k/dev/grf.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x68k/dev/grf_machdep.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x68k/dev/intio.c cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x68k/dev/ite.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x68k/dev/kbd.c cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x68k/dev/mha.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x68k/dev/par.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x68k/dev/powsw.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x68k/dev/sram.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x68k/dev/vs.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/x68k/dev/bmd.c diff -u src/sys/arch/x68k/dev/bmd.c:1.25 src/sys/arch/x68k/dev/bmd.c:1.26 --- src/sys/arch/x68k/dev/bmd.c:1.25 Thu Jul 7 06:55:39 2016 +++ src/sys/arch/x68k/dev/bmd.c Thu May 26 14:33:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bmd.c,v 1.25 2016/07/07 06:55:39 msaitoh Exp $ */ +/* $NetBSD: bmd.c,v 1.26 2022/05/26 14:33:29 tsutsui Exp $ */ /* * Copyright (c) 2002 Tetsuya Isaki. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.25 2016/07/07 06:55:39 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.26 2022/05/26 14:33:29 tsutsui Exp $"); #include #include @@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.25 #include +#include "ioconf.h" + #define BMD_ADDR1 (0xece3f0) #define BMD_ADDR2 (0xecebf0) @@ -91,8 +93,6 @@ static int bmd_match(device_t, cfdata_t static void bmd_attach(device_t, device_t, void *); static int bmd_getdisklabel(struct bmd_softc *, dev_t); -extern struct cfdriver bmd_cd; - CFATTACH_DECL_NEW(bmd, sizeof(struct bmd_softc), bmd_match, bmd_attach, NULL, NULL); Index: src/sys/arch/x68k/dev/grf.c diff -u src/sys/arch/x68k/dev/grf.c:1.45 src/sys/arch/x68k/dev/grf.c:1.46 --- src/sys/arch/x68k/dev/grf.c:1.45 Sun Dec 14 23:48:58 2014 +++ src/sys/arch/x68k/dev/grf.c Thu May 26 14:33:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: grf.c,v 1.45 2014/12/14 23:48:58 chs Exp $ */ +/* $NetBSD: grf.c,v 1.46 2022/05/26 14:33:29 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.45 2014/12/14 23:48:58 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.46 2022/05/26 14:33:29 tsutsui Exp $"); #include #include @@ -66,6 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.45 #include +#include "ioconf.h" + #include "ite.h" #if NITE == 0 #define iteon(u,f) 0 @@ -87,8 +89,6 @@ static off_t grfaddr(struct grf_softc *, static int grfmap(dev_t, void **, struct proc *); static int grfunmap(dev_t, void *, struct proc *); -extern struct cfdriver grf_cd; - dev_type_open(grfopen); dev_type_close(grfclose); dev_type_ioctl(grfioctl); Index: src/sys/arch/x68k/dev/grf_machdep.c diff -u src/sys/arch/x68k/dev/grf_machdep.c:1.34 src/sys/arch/x68k/dev/grf_machdep.c:1.35 --- src/sys/arch/x68k/dev/grf_machdep.c:1.34 Sat Aug 7 16:19:07 2021 +++ src/sys/arch/x68k/dev/grf_machdep.c Thu May 26 14:33:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: grf_machdep.c,v 1.34 2021/08/07 16:19:07 thorpej Exp $ */ +/* $NetBSD: grf_machdep.c,v 1.35 2022/05/26 14:33:29 tsutsui Exp $ */ /* * Copyright (c) 1991 University of Utah. @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: grf_machdep.c,v 1.34 2021/08/07 16:19:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_machdep.c,v 1.35 2022/05/26 14:33:29 tsutsui Exp $"); #include "locators.h" @@ -57,6 +57,8 @@ __KERNEL_RCSID(0, "$NetBSD: grf_machdep. #include #include +#include "ioconf.h" + /* grfbus: is this necessary? */ int grfbusprint(void *, const char *); int grfbusmatch(device_t, cfdata_t, void *); @@ -76,8 +78,6 @@ CFATTACH_DECL_NEW(grfbus, 0, CFATTACH_DECL_NEW(grf, sizeof(struct grf_softc), grfmatch, grfattach, NULL, NULL); -extern struct cfdriver grfbus_cd; - int grfbusmatch(device_t parent, cfdata_t cf, void *aux) { Index: src/sys/arch/x68k/dev/intio.c diff -u src/sys/arch/x68k/dev/intio.c:1.51 src/sys/arch/x68k/dev/intio.c:1.52 --- src/sys/arch/x68k/dev/intio.c:1.51 Fri Dec 17 06:28:20 2021 +++ src/sys/arch/x68k/dev/intio.c Thu May 26 14:33:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: intio.c,v 1.51 2021/12/17 06:28:20 skrll Exp $ */ +/* $NetBSD: intio.c,v 1.52 2022/05/26 14:33:29 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.51 2021/12/17 06:28:20 skrll Exp $"); +__KERNEL_RCSID(0,
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:33:29 UTC 2022 Modified Files: src/sys/arch/x68k/dev: bmd.c grf.c grf_machdep.c intio.c ite.c kbd.c mha.c par.c powsw.c sram.c vs.c Log Message: Explicitly include "ioconf.h" for struct cfdriver. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/x68k/dev/bmd.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x68k/dev/grf.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x68k/dev/grf_machdep.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x68k/dev/intio.c cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x68k/dev/ite.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x68k/dev/kbd.c cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x68k/dev/mha.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x68k/dev/par.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x68k/dev/powsw.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x68k/dev/sram.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x68k/dev/vs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:30:36 UTC 2022 Modified Files: src/sys/arch/x68k/dev: event.c Log Message: KNF a bit. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/dev/event.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/x68k/dev/event.c diff -u src/sys/arch/x68k/dev/event.c:1.19 src/sys/arch/x68k/dev/event.c:1.20 --- src/sys/arch/x68k/dev/event.c:1.19 Sun Sep 26 16:36:19 2021 +++ src/sys/arch/x68k/dev/event.c Thu May 26 14:30:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: event.c,v 1.19 2021/09/26 16:36:19 thorpej Exp $ */ +/* $NetBSD: event.c,v 1.20 2022/05/26 14:30:36 tsutsui Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.19 2021/09/26 16:36:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: event.c,v 1.20 2022/05/26 14:30:36 tsutsui Exp $"); #include #include @@ -101,18 +101,18 @@ ev_read(struct evvar *ev, struct uio *ui * Make sure we can return at least 1. */ if (uio->uio_resid < sizeof(struct firm_event)) - return (EMSGSIZE); /* ??? */ + return EMSGSIZE; /* ??? */ mutex_enter(ev->ev_lock); while (ev->ev_get == ev->ev_put) { if (flags & IO_NDELAY) { mutex_exit(ev->ev_lock); - return (EWOULDBLOCK); + return EWOULDBLOCK; } ev->ev_wanted = true; error = cv_wait_sig(>ev_cv, ev->ev_lock); if (error != 0) { mutex_exit(ev->ev_lock); - return (error); + return error; } } /* @@ -138,13 +138,13 @@ ev_read(struct evvar *ev, struct uio *ui */ if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 || n == 0 || error || (cnt = put) == 0) - return (error); + return error; if (cnt > n) cnt = n; error = uiomove((void *)>ev_q[0], cnt * sizeof(struct firm_event), uio); ev->ev_get = cnt; - return (error); + return error; } int @@ -161,7 +161,7 @@ ev_poll(struct evvar *ev, int events, st } revents |= events & (POLLOUT | POLLWRNORM); mutex_exit(ev->ev_lock); - return (revents); + return revents; } void @@ -233,7 +233,7 @@ ev_kqfilter(struct evvar *ev, struct kno break; default: - return (EINVAL); + return EINVAL; } kn->kn_hook = ev; @@ -242,5 +242,5 @@ ev_kqfilter(struct evvar *ev, struct kno selrecord_knote(>ev_sel, kn); mutex_exit(ev->ev_lock); - return (0); + return 0; }
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:30:36 UTC 2022 Modified Files: src/sys/arch/x68k/dev: event.c Log Message: KNF a bit. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/dev/event.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:30:11 UTC 2022 Modified Files: src/sys/arch/x68k/dev: zs.c Log Message: Make a readonly array const. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x68k/dev/zs.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/x68k/dev/zs.c diff -u src/sys/arch/x68k/dev/zs.c:1.47 src/sys/arch/x68k/dev/zs.c:1.48 --- src/sys/arch/x68k/dev/zs.c:1.47 Sat Sep 11 20:28:05 2021 +++ src/sys/arch/x68k/dev/zs.c Thu May 26 14:30:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: zs.c,v 1.47 2021/09/11 20:28:05 andvar Exp $ */ +/* $NetBSD: zs.c,v 1.48 2022/05/26 14:30:11 tsutsui Exp $ */ /*- * Copyright (c) 1998 Minoura Makoto @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.47 2021/09/11 20:28:05 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.48 2022/05/26 14:30:11 tsutsui Exp $"); #include #include @@ -89,7 +89,7 @@ int zscn_def_cflag = (CREAD | CS8 | HUPC /* Default physical addresses. */ #define ZS_MAXDEV 5 -static bus_addr_t zs_physaddr[ZS_MAXDEV] = { +static const bus_addr_t zs_physaddr[ZS_MAXDEV] = { 0x00e98000, 0x00eafc00, 0x00eafc10,
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:30:11 UTC 2022 Modified Files: src/sys/arch/x68k/dev: zs.c Log Message: Make a readonly array const. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x68k/dev/zs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:28:56 UTC 2022 Modified Files: src/sys/arch/x68k/dev: kbdmap.c kbdmap.c.ascii kbdmap.h Log Message: Make readonly keymap data const. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/dev/kbdmap.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/dev/kbdmap.c.ascii \ src/sys/arch/x68k/dev/kbdmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x68k/dev/kbdmap.c diff -u src/sys/arch/x68k/dev/kbdmap.c:1.7 src/sys/arch/x68k/dev/kbdmap.c:1.8 --- src/sys/arch/x68k/dev/kbdmap.c:1.7 Wed Oct 17 19:58:02 2007 +++ src/sys/arch/x68k/dev/kbdmap.c Thu May 26 14:28:56 2022 @@ -1,10 +1,10 @@ -/* $NetBSD: kbdmap.c,v 1.7 2007/10/17 19:58:02 garbled Exp $ */ +/* $NetBSD: kbdmap.c,v 1.8 2022/05/26 14:28:56 tsutsui Exp $ */ /* from: arch/amiga/dev/kbdmap.c */ /* modified for X680x0 by Masaru Oki and Makoto MINOURA */ #include -__KERNEL_RCSID(0, "$NetBSD: kbdmap.c,v 1.7 2007/10/17 19:58:02 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbdmap.c,v 1.8 2022/05/26 14:28:56 tsutsui Exp $"); #include "kbdmap.h" @@ -22,7 +22,7 @@ __KERNEL_RCSID(0, "$NetBSD: kbdmap.c,v 1 #define D KBD_MODE_DEAD struct kbdmap kbdmap; -struct kbdmap ascii_kbdmap = { +const struct kbdmap ascii_kbdmap = { /* normal map */ { {0, 0}, /* 0x00 */ Index: src/sys/arch/x68k/dev/kbdmap.c.ascii diff -u src/sys/arch/x68k/dev/kbdmap.c.ascii:1.4 src/sys/arch/x68k/dev/kbdmap.c.ascii:1.5 --- src/sys/arch/x68k/dev/kbdmap.c.ascii:1.4 Wed Oct 17 19:58:02 2007 +++ src/sys/arch/x68k/dev/kbdmap.c.ascii Thu May 26 14:28:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kbdmap.c.ascii,v 1.4 2007/10/17 19:58:02 garbled Exp $ */ +/* $NetBSD: kbdmap.c.ascii,v 1.5 2022/05/26 14:28:56 tsutsui Exp $ */ /* from: arch/amiga/dev/kbdmap.c */ /* modified for X680x0 by Masaru Oki */ @@ -18,7 +18,7 @@ #define K KBD_MODE_KPAD struct kbdmap kbdmap; -struct kbdmap ascii_kbdmap = { +const struct kbdmap ascii_kbdmap = { /* normal map */ { 0, 0, /* 0x00 */ Index: src/sys/arch/x68k/dev/kbdmap.h diff -u src/sys/arch/x68k/dev/kbdmap.h:1.4 src/sys/arch/x68k/dev/kbdmap.h:1.5 --- src/sys/arch/x68k/dev/kbdmap.h:1.4 Sun Dec 11 12:19:37 2005 +++ src/sys/arch/x68k/dev/kbdmap.h Thu May 26 14:28:56 2022 @@ -1,9 +1,10 @@ -/* $NetBSD: kbdmap.h,v 1.4 2005/12/11 12:19:37 christos Exp $ */ +/* $NetBSD: kbdmap.h,v 1.5 2022/05/26 14:28:56 tsutsui Exp $ */ #include #ifdef _KERNEL /* XXX: ITE interface */ -extern struct kbdmap kbdmap, ascii_kbdmap; +extern struct kbdmap kbdmap; +extern const struct kbdmap ascii_kbdmap; extern unsigned char acctable[KBD_NUM_ACC][64]; #endif
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:28:56 UTC 2022 Modified Files: src/sys/arch/x68k/dev: kbdmap.c kbdmap.c.ascii kbdmap.h Log Message: Make readonly keymap data const. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/dev/kbdmap.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/dev/kbdmap.c.ascii \ src/sys/arch/x68k/dev/kbdmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:27:43 UTC 2022 Modified Files: src/sys/arch/x68k/dev: fd.c Log Message: Make local functions and variable static. To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x68k/dev/fd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x68k/dev
Module Name:src Committed By: tsutsui Date: Thu May 26 14:27:43 UTC 2022 Modified Files: src/sys/arch/x68k/dev: fd.c Log Message: Make local functions and variable static. To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x68k/dev/fd.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/x68k/dev/fd.c diff -u src/sys/arch/x68k/dev/fd.c:1.126 src/sys/arch/x68k/dev/fd.c:1.127 --- src/sys/arch/x68k/dev/fd.c:1.126 Mon May 23 16:58:37 2022 +++ src/sys/arch/x68k/dev/fd.c Thu May 26 14:27:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.126 2022/05/23 16:58:37 tsutsui Exp $ */ +/* $NetBSD: fd.c,v 1.127 2022/05/26 14:27:43 tsutsui Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.126 2022/05/23 16:58:37 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.127 2022/05/26 14:27:43 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_m68k_arch.h" @@ -160,13 +160,13 @@ struct fdc_softc { uint8_t sc_status[7]; /* copy of registers */ }; -int fdcintr(void *); -void fdcreset(struct fdc_softc *); +static int fdcintr(void *); +static void fdcreset(struct fdc_softc *); /* controller driver configuration */ -int fdcprobe(device_t, cfdata_t, void *); -void fdcattach(device_t, device_t, void *); -int fdprint(void *, const char *); +static int fdcprobe(device_t, cfdata_t, void *); +static void fdcattach(device_t, device_t, void *); +static int fdprint(void *, const char *); CFATTACH_DECL_NEW(fdc, sizeof(struct fdc_softc), fdcprobe, fdcattach, NULL, NULL); @@ -194,7 +194,7 @@ struct fd_type { }; /* The order of entries in the following table is important -- BEWARE! */ -struct fd_type fd_types[] = { +static struct fd_type fd_types[] = { { 8,2,16,3,0xff,0xdf,0x35,0x74,77,1232,1,FDC_500KBPS, 0xf6, 1, "1.2MB/[1024bytes/sector]"}, /* 1.2 MB japanese format */ { 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS, 0xf6, 1, @@ -257,18 +257,18 @@ struct fd_softc { }; /* floppy driver configuration */ -int fdprobe(device_t, cfdata_t, void *); -void fdattach(device_t, device_t, void *); +static int fdprobe(device_t, cfdata_t, void *); +static void fdattach(device_t, device_t, void *); CFATTACH_DECL_NEW(fd, sizeof(struct fd_softc), fdprobe, fdattach, NULL, NULL); -dev_type_open(fdopen); -dev_type_close(fdclose); -dev_type_read(fdread); -dev_type_write(fdwrite); -dev_type_ioctl(fdioctl); -dev_type_strategy(fdstrategy); +static dev_type_open(fdopen); +static dev_type_close(fdclose); +static dev_type_read(fdread); +static dev_type_write(fdwrite); +static dev_type_ioctl(fdioctl); +static dev_type_strategy(fdstrategy); const struct bdevsw fd_bdevsw = { .d_open = fdopen, @@ -296,32 +296,34 @@ const struct cdevsw fd_cdevsw = { .d_flag = D_DISK }; -void fdstart(struct fd_softc *); +static void fdstart(struct fd_softc *); struct dkdriver fddkdriver = { .d_strategy = fdstrategy }; -void fd_set_motor(struct fdc_softc *, int); -void fd_motor_off(void *); +static void fd_set_motor(struct fdc_softc *, int); +static void fd_motor_off(void *); #if 0 -void fd_motor_on(void *); +static void fd_motor_on(void *); #endif -int fdcresult(struct fdc_softc *); -int out_fdc(bus_space_tag_t, bus_space_handle_t, uint8_t); -void fdcstart(struct fdc_softc *); -void fdcstatus(device_t, int, const char *); -void fdctimeout(void *); -void fdcpseudointr(void *); -void fdcretry(struct fdc_softc *); -void fdfinish(struct fd_softc *, struct buf *); +static int fdcresult(struct fdc_softc *); +static int out_fdc(bus_space_tag_t, bus_space_handle_t, uint8_t); +static void fdcstart(struct fdc_softc *); +static void fdcstatus(device_t, int, const char *); +static void fdctimeout(void *); +#if 0 +static void fdcpseudointr(void *); +#endif +static void fdcretry(struct fdc_softc *); +static void fdfinish(struct fd_softc *, struct buf *); static struct fd_type *fd_dev_to_type(struct fd_softc *, dev_t); -int fdformat(dev_t, struct ne7_fd_formb *, struct lwp *); +static int fdformat(dev_t, struct ne7_fd_formb *, struct lwp *); static int fdcpoll(struct fdc_softc *); static int fdgetdisklabel(struct fd_softc *, dev_t); static void fd_do_eject(struct fdc_softc *, int); -void fd_mountroot_hook(device_t); +static void fd_mountroot_hook(device_t); /* DMA transfer routines */ inline static void fdc_dmastart(struct fdc_softc *, int, void *, vsize_t); @@ -400,7 +402,7 @@ fdcdmaerrintr(void *dummy) } /* ARGSUSED */ -int +static int fdcprobe(device_t parent, cfdata_t cf, void *aux) { struct intio_attach_args *ia = aux; @@ -443,7 +445,7 @@ struct fdc_attach_args { * Return QUIET (config_find ignores this if the device was configured) to * avoid printing `fdN not configured' messages. */ -int +static int fdprint(void *aux, const char *fdc) { struct
CVS commit: src/share/man/man5
Module Name:src Committed By: uwe Date: Thu May 26 14:24:42 UTC 2022 Modified Files: src/share/man/man5: mk.conf.5 Log Message: mk.conf(5): Don't make "experimental" comment stand out. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/share/man/man5/mk.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man5
Module Name:src Committed By: uwe Date: Thu May 26 14:24:42 UTC 2022 Modified Files: src/share/man/man5: mk.conf.5 Log Message: mk.conf(5): Don't make "experimental" comment stand out. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/share/man/man5/mk.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man5/mk.conf.5 diff -u src/share/man/man5/mk.conf.5:1.89 src/share/man/man5/mk.conf.5:1.90 --- src/share/man/man5/mk.conf.5:1.89 Thu May 26 06:33:03 2022 +++ src/share/man/man5/mk.conf.5 Thu May 26 14:24:42 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: mk.conf.5,v 1.89 2022/05/26 06:33:03 nia Exp $ +.\" $NetBSD: mk.conf.5,v 1.90 2022/05/26 14:24:42 uwe Exp $ .\" .\" Copyright (c) 1999-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -182,7 +182,7 @@ unless run in .Sq expert mode . -.It Sy KERNEL_DIR (EXPERIMENTAL) +.It Sy KERNEL_DIR No Pq experimental .YorN Indicates if a top-level directory .Sy /netbsd/
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 13:40:49 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c func.c lint1.h Log Message: lint: rename olwarn and LWARN_BAD to be more expressive No functional change. To generate a diff of this commit: cvs rdiff -u -r1.418 -r1.419 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.281 -r1.282 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.137 -r1.138 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.153 -r1.154 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.418 src/usr.bin/xlint/lint1/cgram.y:1.419 --- src/usr.bin/xlint/lint1/cgram.y:1.418 Thu May 26 12:47:20 2022 +++ src/usr.bin/xlint/lint1/cgram.y Thu May 26 13:40:49 2022 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.418 2022/05/26 12:47:20 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.419 2022/05/26 13:40:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.418 2022/05/26 12:47:20 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.419 2022/05/26 13:40:49 rillig Exp $"); #endif #include @@ -64,7 +64,8 @@ size_t mem_block_level; * Save the no-warns state and restore it to avoid the problem where * if (expr) { stmt } / * NOLINT * / stmt; */ -static int olwarn = LWARN_BAD; +#define LWARN_NOTHING_SAVED (-3) +static int saved_lwarn = LWARN_NOTHING_SAVED; static void cgram_declare(sym_t *, bool, sbuf_t *); static void read_until_rparen(void); @@ -77,7 +78,7 @@ clear_warning_flags_loc(const char *file { debug_step("%s:%zu: clearing flags", file, line); clear_warn_flags(); - olwarn = LWARN_BAD; + saved_lwarn = LWARN_NOTHING_SAVED; } /* ARGSUSED */ @@ -85,8 +86,9 @@ static void save_warning_flags_loc(const char *file, size_t line) { /* - * There used to be an assertion for 'olwarn == LWARN_BAD' here, - * but that triggered for the following code: + * There used to be an assertion that saved_lwarn is + * LWARN_NOTHING_SAVED here, but that triggered for the following + * code: * * void function(int x) { if (x > 0) if (x > 1) return; } * @@ -96,19 +98,19 @@ save_warning_flags_loc(const char *file, * warnings. */ debug_step("%s:%zu: saving flags %d", file, line, lwarn); - olwarn = lwarn; + saved_lwarn = lwarn; } /* ARGSUSED */ static void restore_warning_flags_loc(const char *file, size_t line) { - if (olwarn != LWARN_BAD) { - lwarn = olwarn; + if (saved_lwarn != LWARN_NOTHING_SAVED) { + lwarn = saved_lwarn; debug_step("%s:%zu: restoring flags %d", file, line, lwarn); /* - * Do not set 'olwarn = LWARN_BAD' here, to avoid triggering - * the assertion in save_warning_flags_loc. + * Do not set 'saved_lwarn = LWARN_NOTHING_SAVED' here, to + * avoid triggering the assertion in save_warning_flags_loc. */ } else clear_warning_flags_loc(file, line); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.281 src/usr.bin/xlint/lint1/decl.c:1.282 --- src/usr.bin/xlint/lint1/decl.c:1.281 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/decl.c Thu May 26 13:40:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.281 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.282 2022/05/26 13:40:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: decl.c,v 1.281 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.282 2022/05/26 13:40:49 rillig Exp $"); #endif #include @@ -3048,16 +3048,16 @@ void check_usage(dinfo_t *di) { sym_t *sym; - int mklwarn; + int saved_lwarn; /* for this warning LINTED has no effect */ - mklwarn = lwarn; + saved_lwarn = lwarn; lwarn = LWARN_ALL; debug_step("begin lwarn %d", lwarn); for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_level_next) check_usage_sym(di->d_asm, sym); - lwarn = mklwarn; + lwarn = saved_lwarn; debug_step("end lwarn %d", lwarn); } Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.137 src/usr.bin/xlint/lint1/func.c:1.138 --- src/usr.bin/xlint/lint1/func.c:1.137 Sun May 22 13:58:59 2022 +++ src/usr.bin/xlint/lint1/func.c Thu May 26 13:40:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.137 2022/05/22 13:58:59 rillig Exp $ */ +/* $NetBSD: func.c,v 1.138 2022/05/26 13:40:49 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: func.c,v 1.137 2022/05/22 13:58:59 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.138 2022/05/26 13:40:49 rillig Exp $"); #endif #include @@ -122,18 +122,19 @@ bool plibflg; bool constcond_flag; /* - * llibflg is set if a lint library
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 13:40:49 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c func.c lint1.h Log Message: lint: rename olwarn and LWARN_BAD to be more expressive No functional change. To generate a diff of this commit: cvs rdiff -u -r1.418 -r1.419 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.281 -r1.282 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.137 -r1.138 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.153 -r1.154 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/tprof
Module Name:src Committed By: msaitoh Date: Thu May 26 13:02:04 UTC 2022 Modified Files: src/sys/dev/tprof: tprof_x86_intel.c Log Message: Use CPUID_PERF_* macros defined in specialreg.h. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/tprof/tprof_x86_intel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/tprof
Module Name:src Committed By: msaitoh Date: Thu May 26 13:02:04 UTC 2022 Modified Files: src/sys/dev/tprof: tprof_x86_intel.c Log Message: Use CPUID_PERF_* macros defined in specialreg.h. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/tprof/tprof_x86_intel.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/tprof/tprof_x86_intel.c diff -u src/sys/dev/tprof/tprof_x86_intel.c:1.3 src/sys/dev/tprof/tprof_x86_intel.c:1.4 --- src/sys/dev/tprof/tprof_x86_intel.c:1.3 Fri Jun 14 11:50:35 2019 +++ src/sys/dev/tprof/tprof_x86_intel.c Thu May 26 13:02:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_x86_intel.c,v 1.3 2019/06/14 11:50:35 msaitoh Exp $ */ +/* $NetBSD: tprof_x86_intel.c,v 1.4 2022/05/26 13:02:04 msaitoh Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.3 2019/06/14 11:50:35 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.4 2022/05/26 13:02:04 msaitoh Exp $"); #include #include @@ -90,10 +90,6 @@ __KERNEL_RCSID(0, "$NetBSD: tprof_x86_in #define PERFEVTSEL_INV __BIT(23) #define PERFEVTSEL_COUNTER_MASK __BITS(24, 31) -#define CPUID_0A_VERSION __BITS(0, 7) -#define CPUID_0A_NCOUNTERS __BITS(8, 15) -#define CPUID_0A_BITWIDTH __BITS(16, 23) - static uint64_t counter_bitwidth; static uint64_t counter_val = 500; static uint64_t counter_reset_val; @@ -195,14 +191,14 @@ tprof_intel_ident(void) return TPROF_IDENT_NONE; } x86_cpuid(0x0A, descs); - if ((descs[0] & CPUID_0A_VERSION) == 0) { + if ((descs[0] & CPUID_PERF_VERSION) == 0) { return TPROF_IDENT_NONE; } - if ((descs[0] & CPUID_0A_NCOUNTERS) == 0) { + if ((descs[0] & CPUID_PERF_NGPPC) == 0) { return TPROF_IDENT_NONE; } - counter_bitwidth = __SHIFTOUT(descs[0], CPUID_0A_BITWIDTH); + counter_bitwidth = __SHIFTOUT(descs[0], CPUID_PERF_NBWGPPC); return TPROF_IDENT_INTEL_GENERIC; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:47:20 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: merge debug and non-debug code for saving and restoring warnings No functional change. To generate a diff of this commit: cvs rdiff -u -r1.417 -r1.418 src/usr.bin/xlint/lint1/cgram.y 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.417 src/usr.bin/xlint/lint1/cgram.y:1.418 --- src/usr.bin/xlint/lint1/cgram.y:1.417 Thu May 26 12:27:25 2022 +++ src/usr.bin/xlint/lint1/cgram.y Thu May 26 12:47:20 2022 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.418 2022/05/26 12:47:20 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.418 2022/05/26 12:47:20 rillig Exp $"); #endif #include @@ -71,48 +71,52 @@ static void read_until_rparen(void); static sym_t *symbolrename(sym_t *, sbuf_t *); -#ifdef DEBUG +/* ARGSUSED */ static void -CLEAR_WARN_FLAGS(const char *file, size_t line) +clear_warning_flags_loc(const char *file, size_t line) { debug_step("%s:%zu: clearing flags", file, line); clear_warn_flags(); olwarn = LWARN_BAD; } +/* ARGSUSED */ static void -SAVE_WARN_FLAGS(const char *file, size_t line) +save_warning_flags_loc(const char *file, size_t line) { /* * There used to be an assertion for 'olwarn == LWARN_BAD' here, * but that triggered for the following code: * * void function(int x) { if (x > 0) if (x > 1) return; } + * + * It didn't trigger if the inner 'if' was enclosed in braces though. + * + * TODO: If actually needed, add support for nested suppression of + * warnings. */ debug_step("%s:%zu: saving flags %d", file, line, lwarn); olwarn = lwarn; } +/* ARGSUSED */ static void -RESTORE_WARN_FLAGS(const char *file, size_t line) +restore_warning_flags_loc(const char *file, size_t line) { if (olwarn != LWARN_BAD) { lwarn = olwarn; debug_step("%s:%zu: restoring flags %d", file, line, lwarn); - olwarn = LWARN_BAD; + /* + * Do not set 'olwarn = LWARN_BAD' here, to avoid triggering + * the assertion in save_warning_flags_loc. + */ } else - CLEAR_WARN_FLAGS(file, line); + clear_warning_flags_loc(file, line); } -#else -#define CLEAR_WARN_FLAGS(f, l) clear_warn_flags(), olwarn = LWARN_BAD -#define SAVE_WARN_FLAGS(f, l) olwarn = lwarn -#define RESTORE_WARN_FLAGS(f, l) \ - (void)(olwarn == LWARN_BAD ? (clear_warn_flags(), 0) : (lwarn = olwarn)) -#endif -#define clear_warning_flags() CLEAR_WARN_FLAGS(__FILE__, __LINE__) -#define save_warning_flags() SAVE_WARN_FLAGS(__FILE__, __LINE__) -#define restore_warning_flags() RESTORE_WARN_FLAGS(__FILE__, __LINE__) +#define clear_warning_flags() clear_warning_flags_loc(__FILE__, __LINE__) +#define save_warning_flags() save_warning_flags_loc(__FILE__, __LINE__) +#define restore_warning_flags() restore_warning_flags_loc(__FILE__, __LINE__) /* unbind the anonymous struct members from the struct */ static void
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:47:20 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: merge debug and non-debug code for saving and restoring warnings No functional change. To generate a diff of this commit: cvs rdiff -u -r1.417 -r1.418 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:27:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove assertion about saving and restoring warning flags The assertion only triggers in debug mode, which is generally not used as it adds lots of debug logging. In production mode, the assumption didn't hold for many years now, so remove the assertion. To generate a diff of this commit: cvs rdiff -u -r1.416 -r1.417 src/usr.bin/xlint/lint1/cgram.y 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.416 src/usr.bin/xlint/lint1/cgram.y:1.417 --- src/usr.bin/xlint/lint1/cgram.y:1.416 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/cgram.y Thu May 26 12:27:25 2022 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.416 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.416 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.417 2022/05/26 12:27:25 rillig Exp $"); #endif #include @@ -83,7 +83,12 @@ CLEAR_WARN_FLAGS(const char *file, size_ static void SAVE_WARN_FLAGS(const char *file, size_t line) { - lint_assert(olwarn == LWARN_BAD); + /* + * There used to be an assertion for 'olwarn == LWARN_BAD' here, + * but that triggered for the following code: + * + * void function(int x) { if (x > 0) if (x > 1) return; } + */ debug_step("%s:%zu: saving flags %d", file, line, lwarn); olwarn = lwarn; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:27:25 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove assertion about saving and restoring warning flags The assertion only triggers in debug mode, which is generally not used as it adds lots of debug logging. In production mode, the assumption didn't hold for many years now, so remove the assertion. To generate a diff of this commit: cvs rdiff -u -r1.416 -r1.417 src/usr.bin/xlint/lint1/cgram.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:04:56 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: improve debug logging for NAME expressions In a NAME expression, the name is an essential part, so put it to the front, in natural reading order. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint1/debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 12:04:56 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: improve debug logging for NAME expressions In a NAME expression, the name is an essential part, so put it to the front, in natural reading order. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint1/debug.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/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.19 src/usr.bin/xlint/lint1/debug.c:1.20 --- src/usr.bin/xlint/lint1/debug.c:1.19 Thu May 26 11:54:33 2022 +++ src/usr.bin/xlint/lint1/debug.c Thu May 26 12:04:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $"); #endif #include @@ -118,15 +118,24 @@ debug_node(const tnode_t *tn) // NOLINT( op = tn->tn_op; debug_print_indent(); - debug_printf("'%s' with type '%s'%s%s%s", - op == CVT && !tn->tn_cast ? "convert" : modtab[op].m_name, - type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "", - tn->tn_parenthesized ? ", parenthesized" : "", - tn->tn_sys ? ", sys" : ""); - + debug_printf("'%s'", + op == CVT && !tn->tn_cast ? "convert" : modtab[op].m_name); if (op == NAME) - debug_printf(" %s %s\n", tn->tn_sym->s_name, + debug_printf(" '%s' with %s", + tn->tn_sym->s_name, storage_class_name(tn->tn_sym->s_scl)); + else + debug_printf(" type"); + debug_printf(" '%s'", type_name(tn->tn_type)); + if (tn->tn_lvalue) + debug_printf(", lvalue"); + if (tn->tn_parenthesized) + debug_printf(", parenthesized"); + if (tn->tn_sys) + debug_printf(", sys"); + + if (op == NAME) + debug_printf("\n"); else if (op == CON && is_floating(tn->tn_type->t_tspec)) debug_printf(", value %Lg\n", tn->tn_val->v_ldbl); else if (op == CON && is_uinteger(tn->tn_type->t_tspec))
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 11:54:33 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: add missing newlines in debug_node To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint1/debug.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/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.18 src/usr.bin/xlint/lint1/debug.c:1.19 --- src/usr.bin/xlint/lint1/debug.c:1.18 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/debug.c Thu May 26 11:54:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.18 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.18 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $"); #endif #include @@ -128,7 +128,7 @@ debug_node(const tnode_t *tn) // NOLINT( debug_printf(" %s %s\n", tn->tn_sym->s_name, storage_class_name(tn->tn_sym->s_scl)); else if (op == CON && is_floating(tn->tn_type->t_tspec)) - debug_printf(", value %Lg", tn->tn_val->v_ldbl); + debug_printf(", value %Lg\n", tn->tn_val->v_ldbl); else if (op == CON && is_uinteger(tn->tn_type->t_tspec)) debug_printf(", value %llu\n", (unsigned long long)tn->tn_val->v_quad); @@ -148,7 +148,7 @@ debug_node(const tnode_t *tn) // NOLINT( size_t n = MB_CUR_MAX * (tn->tn_string->st_len + 1); char *s = xmalloc(n); (void)wcstombs(s, tn->tn_string->st_mem, n); - debug_printf(", length %zu, L\"%s\"", + debug_printf(", length %zu, L\"%s\"\n", tn->tn_string->st_len, s); free(s);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 11:54:33 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: debug.c Log Message: lint: add missing newlines in debug_node To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint1/debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Thu May 26 11:06:14 UTC 2022 Modified Files: src/sys/arch/xen/x86: pintr.c Log Message: aprint_debug(): if a hypercall fail, print the return code. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/pintr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/pintr.c diff -u src/sys/arch/xen/x86/pintr.c:1.23 src/sys/arch/xen/x86/pintr.c:1.24 --- src/sys/arch/xen/x86/pintr.c:1.23 Tue May 24 15:51:10 2022 +++ src/sys/arch/xen/x86/pintr.c Thu May 26 11:06:14 2022 @@ -103,7 +103,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.23 2022/05/24 15:51:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.24 2022/05/26 11:06:14 bouyer Exp $"); #include "opt_multiprocessor.h" #include "opt_xen.h" @@ -208,7 +208,7 @@ xen_map_msi_pirq(struct pic *pic, int co } aprint_debug("\n"); } else { - aprint_debug(" fail\n"); + aprint_debug(" fail %d\n", ret); } return ret; } @@ -246,7 +246,7 @@ xen_map_msix_pirq(struct pic *pic, int c aprint_debug(" map %d", i); ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, _irq); if (ret) { - aprint_debug(" fail\n"); + aprint_debug(" fail %d\n", ret); goto fail; } msi_i->mp_xen_pirq[i] = map_irq.pirq;
CVS commit: src/sys/arch/xen/x86
Module Name:src Committed By: bouyer Date: Thu May 26 11:06:14 UTC 2022 Modified Files: src/sys/arch/xen/x86: pintr.c Log Message: aprint_debug(): if a hypercall fail, print the return code. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/pintr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 10:48:47 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: re-order conditions for lossy conversions Now that can_represent does more work, put it at the end of the conditions. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.444 -r1.445 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.444 src/usr.bin/xlint/lint1/tree.c:1.445 --- src/usr.bin/xlint/lint1/tree.c:1.444 Thu May 26 09:26:00 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 10:48:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.444 2022/05/26 09:26:00 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.445 2022/05/26 10:48:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.444 2022/05/26 09:26:00 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.445 2022/05/26 10:48:47 rillig Exp $"); #endif #include @@ -2404,9 +2404,9 @@ check_integer_conversion(op_t op, int ar if (aflag > 0 && portable_size_in_bits(nt) < portable_size_in_bits(ot) && - !can_represent(tp, tn) && (ot == LONG || ot == ULONG || ot == QUAD || ot == UQUAD || - aflag > 1)) { + aflag > 1) && + !can_represent(tp, tn)) { if (op == FARG) { /* conversion from '%s' to '%s' may lose ... */ warning(298,
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 10:48:47 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: re-order conditions for lossy conversions Now that can_represent does more work, put it at the end of the conditions. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.444 -r1.445 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.
CVS commit: src/sys/sys
Module Name:src Committed By: rillig Date: Thu May 26 09:55:31 UTC 2022 Modified Files: src/sys/sys: common_int_const.h Log Message: sys/common_int_const.h: fix typo in error message To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/sys/common_int_const.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/sys/common_int_const.h diff -u src/sys/sys/common_int_const.h:1.1 src/sys/sys/common_int_const.h:1.2 --- src/sys/sys/common_int_const.h:1.1 Fri Jul 25 21:43:13 2014 +++ src/sys/sys/common_int_const.h Thu May 26 09:55:31 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: common_int_const.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ */ +/* $NetBSD: common_int_const.h,v 1.2 2022/05/26 09:55:31 rillig Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _SYS_COMMON_INT_CONST_H_ #ifndef __INTMAX_C_SUFFIX__ -#error Your compiler does not provide inter constant suffix macros. +#error Your compiler does not provide integer constant suffix macros. #endif #define __int_join_(c,suffix) c ## suffix
CVS commit: src/sys/sys
Module Name:src Committed By: rillig Date: Thu May 26 09:55:31 UTC 2022 Modified Files: src/sys/sys: common_int_const.h Log Message: sys/common_int_const.h: fix typo in error message To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/sys/common_int_const.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Thu May 26 09:26:00 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not warn about loss in accuracy if the actual value fits The expression 'any & 0xff' can always be assigned to 'uint8_t' without loss of any value bits. In the same way, '(any & 0xff) << 8' can always be assigned to 'uint16_t'. Previously, lint warned about these cases. Fix these wrong warnings by tracking the possible values of integer expressions across a single expression. Fixes PR 36668, so that does not need to be cluttered with useless casts anymore. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.443 -r1.444 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_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.10 src/tests/usr.bin/xlint/lint1/msg_132.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.10 Thu May 26 07:03:03 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 09:26:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_132.c,v 1.10 2022/05/26 07:03:03 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.11 2022/05/26 09:26:00 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] @@ -148,15 +148,23 @@ typedef unsigned long long u64_t; /* * PR 36668 notices that lint wrongly complains about the possible loss. - * The expression 'uint8_t << 8' is guaranteed to fit into an 'unsigned short'. - * 'unsigned short | unsigned char' is guaranteed to fit into 'unsigned short' + * + * The expression 'u8_t << 8' is guaranteed to fit into an 'u16_t', and its + * lower 8 bits are guaranteed to be clear. 'u16_t | u8_t' is guaranteed to + * fit into 'u16_t'. + * + * Since tree.c 1.444 from 2022-05-26, lint tracks simple bitwise and + * arithmetic constraints across a single expression. */ static inline u16_t be16dec(const void *buf) { const u8_t *p = buf; - /* expect+1: warning: conversion from 'int' to 'unsigned short' may lose accuracy [132] */ + /* + * Before tree.c 1.444 from 2022-05-26, lint complained that the + * conversion from 'int' to 'unsigned short' may lose accuracy. + */ return ((u16_t)p[0]) << 8 | p[1]; } Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.9 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.10 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.9 Thu May 26 07:03:03 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 09:26:00 2022 @@ -25,4 +25,3 @@ msg_132.c(99): warning: conversion from msg_132.c(125): error: operands of '+' have incompatible types (pointer != double) [107] msg_132.c(125): warning: function 'cover_build_plus_minus' expects to return value [214] msg_132.c(141): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] -msg_132.c(160): warning: conversion from 'int' to 'unsigned short' may lose accuracy [132] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.443 src/usr.bin/xlint/lint1/tree.c:1.444 --- src/usr.bin/xlint/lint1/tree.c:1.443 Thu May 26 06:43:58 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 09:26:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.443 2022/05/26 06:43:58 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.444 2022/05/26 09:26:00 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.443 2022/05/26 06:43:58 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.444 2022/05/26 09:26:00 rillig Exp $"); #endif #include @@ -50,6 +50,15 @@ __RCSID("$NetBSD: tree.c,v 1.443 2022/05 #include "lint1.h" #include "cgram.h" +typedef struct integer_constraints { + int64_t smin; /* signed minimum */ + int64_t smax; /* signed maximum */ + uint64_t umin; /* unsigned minimum */ + uint64_t umax; /* unsigned maximum */ + uint64_t bset; /* bits that are definitely set */ + uint64_t bclr; /* bits that are definitely clear */ +} integer_constraints; + static tnode_t *build_integer_constant(tspec_t, int64_t); static void check_pointer_comparison(op_t, const tnode_t *, const tnode_t *); @@ -96,6 +105,137 @@ static void check_precedence_confusion(t extern sig_atomic_t fpe; +static integer_constraints +ic_any(const type_t *tp) +{ + integer_constraints c; + + lint_assert(is_integer(tp->t_tspec)); + unsigned int sz = type_size_in_bits(tp); + uint64_t vbits = value_bits(sz); + if (is_uinteger(tp->t_tspec)) { + c.smin = INT64_MIN; + c.smax = INT64_MAX; + c.umin = 0; + c.umax = vbits; + c.bset = 0; + c.bclr = ~c.umax; + } else { + c.smin = (int64_t)-1 -
CVS commit: src
Module Name:src Committed By: rillig Date: Thu May 26 09:26:00 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: do not warn about loss in accuracy if the actual value fits The expression 'any & 0xff' can always be assigned to 'uint8_t' without loss of any value bits. In the same way, '(any & 0xff) << 8' can always be assigned to 'uint16_t'. Previously, lint warned about these cases. Fix these wrong warnings by tracking the possible values of integer expressions across a single expression. Fixes PR 36668, so that does not need to be cluttered with useless casts anymore. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_132.exp cvs rdiff -u -r1.443 -r1.444 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.
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: mlelstv Date: Thu May 26 08:06:58 UTC 2022 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: Literal backslashes need to be quoted for roff. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/bc/dist/bc.1 diff -u src/external/bsd/bc/dist/bc.1:1.10 src/external/bsd/bc/dist/bc.1:1.11 --- src/external/bsd/bc/dist/bc.1:1.10 Fri Jan 8 01:17:55 2021 +++ src/external/bsd/bc/dist/bc.1 Thu May 26 08:06:58 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: bc.1,v 1.10 2021/01/08 01:17:55 uwe Exp $ +.\" $NetBSD: bc.1,v 1.11 2022/05/26 08:06:58 mlelstv Exp $ .\" .\" bc.1 - the bc manual .\" @@ -913,8 +913,8 @@ is placed between the key word and the function name. For example, consider the following session. .Bd -literal -offset indent -define py (y) { print "--->", y, "<---", "\n"; } -define void px (x) { print "--->", x, "<---", "\n"; } +define py (y) { print "--->", y, "<---", "\en"; } +define void px (x) { print "--->", x, "<---", "\en"; } py(1) --->1<--- 0
CVS commit: src/external/bsd/bc/dist
Module Name:src Committed By: mlelstv Date: Thu May 26 08:06:58 UTC 2022 Modified Files: src/external/bsd/bc/dist: bc.1 Log Message: Literal backslashes need to be quoted for roff. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/bsd/bc/dist/bc.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 07:03:03 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp Log Message: tests/lint: demonstrate wrong 'may lose accuracy' warning Reported in PR 36668, fixed in sys/sys/endian.h 1.26 from 2007-07-20, unfixed in sys/sys/endian.h 1.29 from 2014-03-18. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_132.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_132.c diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.9 src/tests/usr.bin/xlint/lint1/msg_132.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_132.c:1.9 Thu Apr 21 19:48:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 07:03:03 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_132.c,v 1.9 2022/04/21 19:48:18 rillig Exp $ */ +/* $NetBSD: msg_132.c,v 1.10 2022/05/26 07:03:03 rillig Exp $ */ # 3 "msg_132.c" // Test for message: conversion from '%s' to '%s' may lose accuracy [132] @@ -140,3 +140,37 @@ non_constant_expression(void) /* expect+1: warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] */ return not_a_constant * 8ULL; } + +typedef unsigned char u8_t; +typedef unsigned short u16_t; +typedef unsigned int u32_t; +typedef unsigned long long u64_t; + +/* + * PR 36668 notices that lint wrongly complains about the possible loss. + * The expression 'uint8_t << 8' is guaranteed to fit into an 'unsigned short'. + * 'unsigned short | unsigned char' is guaranteed to fit into 'unsigned short' + */ +static inline u16_t +be16dec(const void *buf) +{ + const u8_t *p = buf; + + /* expect+1: warning: conversion from 'int' to 'unsigned short' may lose accuracy [132] */ + return ((u16_t)p[0]) << 8 | p[1]; +} + +/* + * Since tree.c 1.434 from 2022-04-19, lint infers the possible values of + * expressions of the form 'integer & constant', see can_represent. + */ +static inline void +be32enc(void *buf, u32_t u) +{ + u8_t *p = buf; + + p[0] = u >> 24 & 0xff; + p[1] = u >> 16 & 0xff; + p[2] = u >> 8 & 0xff; + p[3] = u & 0xff; +} Index: src/tests/usr.bin/xlint/lint1/msg_132.exp diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.9 --- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.8 Thu Apr 21 19:48:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 07:03:03 2022 @@ -25,3 +25,4 @@ msg_132.c(99): warning: conversion from msg_132.c(125): error: operands of '+' have incompatible types (pointer != double) [107] msg_132.c(125): warning: function 'cover_build_plus_minus' expects to return value [214] msg_132.c(141): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132] +msg_132.c(160): warning: conversion from 'int' to 'unsigned short' may lose accuracy [132]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 07:03:03 UTC 2022 Modified Files: src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp Log Message: tests/lint: demonstrate wrong 'may lose accuracy' warning Reported in PR 36668, fixed in sys/sys/endian.h 1.26 from 2007-07-20, unfixed in sys/sys/endian.h 1.29 from 2014-03-18. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_132.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_132.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/w
Module Name:src Committed By: wiz Date: Thu May 26 06:48:36 UTC 2022 Modified Files: src/usr.bin/w: w.c Log Message: w: add -A to usage To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/usr.bin/w/w.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/w/w.c diff -u src/usr.bin/w/w.c:1.92 src/usr.bin/w/w.c:1.93 --- src/usr.bin/w/w.c:1.92 Thu May 26 02:24:00 2022 +++ src/usr.bin/w/w.c Thu May 26 06:48:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: w.c,v 1.92 2022/05/26 02:24:00 mrg Exp $ */ +/* $NetBSD: w.c,v 1.93 2022/05/26 06:48:36 wiz Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94"; #else -__RCSID("$NetBSD: w.c,v 1.92 2022/05/26 02:24:00 mrg Exp $"); +__RCSID("$NetBSD: w.c,v 1.93 2022/05/26 06:48:36 wiz Exp $"); #endif #endif /* not lint */ @@ -702,7 +702,7 @@ usage(int wcmd) if (wcmd) (void)fprintf(stderr, - "Usage: %s [-hinw] [-M core] [-N system] [user]\n", + "Usage: %s [-Ahinw] [-M core] [-N system] [user]\n", getprogname()); else (void)fprintf(stderr, "Usage: %s\n", getprogname());
CVS commit: src/usr.bin/w
Module Name:src Committed By: wiz Date: Thu May 26 06:48:36 UTC 2022 Modified Files: src/usr.bin/w: w.c Log Message: w: add -A to usage To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/usr.bin/w/w.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 06:43:58 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: remove long list of node types in switch statement No functional change. To generate a diff of this commit: cvs rdiff -u -r1.442 -r1.443 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.442 src/usr.bin/xlint/lint1/tree.c:1.443 --- src/usr.bin/xlint/lint1/tree.c:1.442 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint1/tree.c Thu May 26 06:43:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.442 2022/05/20 21:18:55 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.443 2022/05/26 06:43:58 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.442 2022/05/20 21:18:55 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.443 2022/05/26 06:43:58 rillig Exp $"); #endif #include @@ -4166,44 +4166,7 @@ check_expr_op(const tnode_t *tn, op_t op case NAME: case STRING: return false; - /* LINTED206: (enumeration values not handled in switch) */ - case BITOR: - case BITXOR: - case NE: - case GE: - case GT: - case LE: - case LT: - case SHR: - case SHL: - case MINUS: - case PLUS: - case MOD: - case DIV: - case MULT: - case INDIR: - case UMINUS: - case UPLUS: - case DEC: - case INC: - case COMPL: - case NOT: - case POINT: - case ARROW: - case NOOP: - case BITAND: - case FARG: - case CASE: - case INIT: - case RETURN: - case ICALL: - case CVT: - case COMMA: - case FSEL: - case COLON: - case QUEST: - case LOGOR: - case LOGAND: + default: break; } return true;
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Thu May 26 06:43:58 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: remove long list of node types in switch statement No functional change. To generate a diff of this commit: cvs rdiff -u -r1.442 -r1.443 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.
CVS commit: src/share/man/man5
Module Name:src Committed By: nia Date: Thu May 26 06:33:03 UTC 2022 Modified Files: src/share/man/man5: mk.conf.5 Log Message: Document some more build options. Delint. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/share/man/man5/mk.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man5/mk.conf.5 diff -u src/share/man/man5/mk.conf.5:1.88 src/share/man/man5/mk.conf.5:1.89 --- src/share/man/man5/mk.conf.5:1.88 Wed May 25 21:25:47 2022 +++ src/share/man/man5/mk.conf.5 Thu May 26 06:33:03 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: mk.conf.5,v 1.88 2022/05/25 21:25:47 nia Exp $ +.\" $NetBSD: mk.conf.5,v 1.89 2022/05/26 06:33:03 nia Exp $ .\" .\" Copyright (c) 1999-2003 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 23, 2022 +.Dd May 26, 2022 .Dt MK.CONF 5 .Os .\" turn off hyphenation @@ -406,7 +406,7 @@ will be included in the build toolchain. . .It Sy MKDHCPD .YorN -Indicates whether +Indicates whether .Xr dhcpd 8 will be built and installed. .DFLTy @@ -643,7 +643,7 @@ Indicates whether the mDNS (Multicast DN .It Sy MKMROUITNG .YorN Indicates whether multicast routing applications will be built and -installed, i.e. +installed, i.e. .Xr map-mbone 8 , .Xr mrinfo 8 , .Xr mrouted 8 , @@ -660,6 +660,14 @@ Indicates whether Native Language System built and installed. .DFLTy . +.It Sy MKNOUVEAUFIRMWARE +.YorN +Indicates whether to install the +.Pa /libdata/firmware/nouveau +directory, which is necessary for the nvidia DRM driver. +.DFLT +Platform dependent. +. .It Sy MKNPF .YorN Indicates whether the NPF packet filter is to be built and installed. @@ -751,7 +759,8 @@ used to generate shared libraries. .It Sy MKPIE Indicates whether Position Independent Executables (PIE) are built and installed. -.DFLTn +.DFLT +Platform dependent. . .It Sy MKPIGZGZIP .YorN @@ -788,6 +797,24 @@ two builds from the same source tree wil results. .DFLTn . +.It Sy MKRADEONFIRMWARE +.YorN +Indicates whether to install the +.Pa /libdata/firmware/radeon +directory, which is necessary for the radeon DRM driver. +.DFLT +Platform dependent. +. +.It Sy MKRELRO +If +.Dq partial , +set the non-PLT GOT to read-only. +If +.Dq full , +also force immediate symbol binding. +.DFLT +Platform dependent. +. .It Sy MKRUMP .YorN Indicates whether the
CVS commit: src/share/man/man5
Module Name:src Committed By: nia Date: Thu May 26 06:33:03 UTC 2022 Modified Files: src/share/man/man5: mk.conf.5 Log Message: Document some more build options. Delint. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/share/man/man5/mk.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu May 26 06:23:57 UTC 2022 Modified Files: src/share/mk: bsd.README Log Message: mk: Document that some options were enabled by default on aarch64 To generate a diff of this commit: cvs rdiff -u -r1.432 -r1.433 src/share/mk/bsd.README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.README diff -u src/share/mk/bsd.README:1.432 src/share/mk/bsd.README:1.433 --- src/share/mk/bsd.README:1.432 Wed May 25 21:25:47 2022 +++ src/share/mk/bsd.README Thu May 26 06:23:57 2022 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.README,v 1.432 2022/05/25 21:25:47 nia Exp $ +# $NetBSD: bsd.README,v 1.433 2022/05/26 06:23:57 nia Exp $ # @(#)bsd.README 8.2 (Berkeley) 4/2/94 This is the README file for the make "include" files for the NetBSD @@ -387,7 +387,7 @@ MKNLS If "no", don't build or install t MKNOUVEAUFIRMWARE If "yes", install the /libdata/firmware/nouveau directory, which is necessary for the nouveau DRM driver. - Default: yes on amd64 and i386, no elsewhere. + Default: yes on x86 and aarch64, no elsewhere. MKNPF If "no", don't build or install the NPF and its modules. Default: yes @@ -429,7 +429,7 @@ MKPICLIB If "no", don't build *_pic.a li MKPIE If "no", create regular executables. Otherwise create PIE (Position Independent Executables). - Default: no + Default: depends on CPU architecture NOPIE Don't create PIE (Position Independent Executables) It is set internally for standalone programs. @@ -445,11 +445,11 @@ MKPROFILE If "no", don't build or instal MKRADEONFIRMWARE If "yes", install the /libdata/firmware/radeon directory, which is necessary for the radeon DRM driver. - Default: yes on amd64 and i386, no elsewhere. + Default: yes on x86 and aarch64, no elsewhere. MKRELRO If "partial", set the non-PLT GOT to read-only. If "full" also force immediate symbol binding. - Default: no + Default: partial on x86 and aarch64, no elsewhere. NOFULLRELRO Don't compile with immediate symbol binding during build. It is set internally for standalone programs.
CVS commit: src/share/mk
Module Name:src Committed By: nia Date: Thu May 26 06:23:57 UTC 2022 Modified Files: src/share/mk: bsd.README Log Message: mk: Document that some options were enabled by default on aarch64 To generate a diff of this commit: cvs rdiff -u -r1.432 -r1.433 src/share/mk/bsd.README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.