CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jan 16 00:37:59 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: fix typo in comment To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.3 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.4 --- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.3 Sun Jan 15 13:55:06 2023 +++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c Mon Jan 16 00:37:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: expr_sizeof.c,v 1.3 2023/01/15 13:55:06 rillig Exp $ */ +/* $NetBSD: expr_sizeof.c,v 1.4 2023/01/16 00:37:59 rillig Exp $ */ # 3 "expr_sizeof.c" /* @@ -65,7 +65,7 @@ variable_length_array(int n) /* * Since the array length is not constant, it cannot be used in a - * typedef. Code like this are already rejected by the compiler. For + * typedef. Code like this is already rejected by the compiler. For * simplicity, lint assumes that the array has length 1. */ /* expect+1: error: negative array dimension (-4) [20] */
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jan 16 00:37:59 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: fix typo in comment To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/expr_sizeof.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: rillig Date: Mon Jan 16 00:23:55 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi Log Message: distrib/sets: add missing directory for xlint tests To generate a diff of this commit: cvs rdiff -u -r1.1242 -r1.1243 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1242 src/distrib/sets/lists/tests/mi:1.1243 --- src/distrib/sets/lists/tests/mi:1.1242 Sun Jan 15 23:18:05 2023 +++ src/distrib/sets/lists/tests/mi Mon Jan 16 00:23:55 2023 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1242 2023/01/15 23:18:05 rillig Exp $ +# $NetBSD: mi,v 1.1243 2023/01/16 00:23:55 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7424,6 +7424,7 @@ ./usr/tests/usr.bin/xlint/lint2/read_printf.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint2/read_printf.ln tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint2/t_lint2 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/xlinttests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/xlint/Atffile tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/xlint/t_xlint tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztesttests-usr.bin-tests compattestfile,atf
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: rillig Date: Mon Jan 16 00:23:55 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi Log Message: distrib/sets: add missing directory for xlint tests To generate a diff of this commit: cvs rdiff -u -r1.1242 -r1.1243 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/gpl3/binutils/dist/bfd
Module Name:src Committed By: christos Date: Mon Jan 16 00:11:50 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/bfd: elf32-m68k.c elf32-vax.c elf64-mips.c elf64-ppc.c Log Message: fix compilation issues. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/gpl3/binutils/dist/bfd/elf32-m68k.c cvs rdiff -u -r1.19 -r1.20 src/external/gpl3/binutils/dist/bfd/elf32-vax.c cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/bfd/elf64-mips.c cvs rdiff -u -r1.17 -r1.18 src/external/gpl3/binutils/dist/bfd/elf64-ppc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils/dist/bfd/elf32-m68k.c diff -u src/external/gpl3/binutils/dist/bfd/elf32-m68k.c:1.14 src/external/gpl3/binutils/dist/bfd/elf32-m68k.c:1.15 --- src/external/gpl3/binutils/dist/bfd/elf32-m68k.c:1.14 Sat Dec 24 15:17:04 2022 +++ src/external/gpl3/binutils/dist/bfd/elf32-m68k.c Sun Jan 15 19:11:50 2023 @@ -2804,7 +2804,7 @@ elf_m68k_check_relocs (bfd *abfd, || ELF32_R_TYPE (rel->r_info) == R_68K_PC16 || ELF32_R_TYPE (rel->r_info) == R_68K_PC32)) { - if (info->warn_shared_textrel) + if (bfd_link_textrel_check(info)) (*_bfd_error_handler) (_("warning: dynamic relocation to `%s' in readonly section `%s'"), h->root.root.string, sec->name); @@ -3258,7 +3258,7 @@ elf_m68k_discard_copies (struct elf_link s = s->next) if ((s->section->flags & SEC_READONLY) != 0) { - if (info->warn_shared_textrel) + if (bfd_link_textrel_check(info)) (*_bfd_error_handler) (_("warning: dynamic relocation to `%s' in readonly section `%s'"), h->root.root.string, s->section->name); Index: src/external/gpl3/binutils/dist/bfd/elf32-vax.c diff -u src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.19 src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.20 --- src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.19 Sat Dec 24 15:17:04 2022 +++ src/external/gpl3/binutils/dist/bfd/elf32-vax.c Sun Jan 15 19:11:50 2023 @@ -497,21 +497,21 @@ elf32_vax_set_private_flags (bfd *abfd, } /* Copy vax-specific data from one module to another */ -static bfd_boolean +static bool elf32_vax_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword in_flags; if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) -return TRUE; +return true; in_flags = elf_elfheader (ibfd)->e_flags; elf_elfheader (obfd)->e_flags = in_flags; - elf_flags_init (obfd) = TRUE; + elf_flags_init (obfd) = true; - return TRUE; + return true; } /* Merge backend specific data from an object file to the output @@ -752,7 +752,7 @@ elf_vax_check_relocs (bfd *abfd, struct if (sec->flags & SEC_READONLY) { - if (info->warn_shared_textrel) + if (bfd_link_textrel_check(info)) (*_bfd_error_handler) (_("warning: dynamic relocation to `%s' in readonly section `%s'"), h ? h->root.root.string : "?", sec->name); Index: src/external/gpl3/binutils/dist/bfd/elf64-mips.c diff -u src/external/gpl3/binutils/dist/bfd/elf64-mips.c:1.11 src/external/gpl3/binutils/dist/bfd/elf64-mips.c:1.12 --- src/external/gpl3/binutils/dist/bfd/elf64-mips.c:1.11 Sat Dec 24 15:17:04 2022 +++ src/external/gpl3/binutils/dist/bfd/elf64-mips.c Sun Jan 15 19:11:50 2023 @@ -111,7 +111,7 @@ static bfd_reloc_status_type mips_elf64_ (bfd *, asymbol *, bool, char **, bfd_vma *); static bool mips_elf64_object_p (bfd *); -static bfd_boolean mips_elf64_is_local_label_name +static bool mips_elf64_is_local_label_name (bfd *, const char *); static irix_compat_t elf64_mips_irix_compat (bfd *); @@ -3370,7 +3370,7 @@ mips_elf64_be_swap_reloca_out (bfd *abfd (Elf64_Mips_External_Rela *) dst); } -/* Set the GP value for OUTPUT_BFD. Returns FALSE if this is a +/* Set the GP value for OUTPUT_BFD. Returns false if this is a dangerous relocation. */ static bool @@ -4520,11 +4520,11 @@ mips_elf64_object_p (bfd *abfd) } /* MIPS ELF local labels start with "$L". */ -static bfd_boolean +static bool mips_elf64_is_local_label_name (bfd *abfd, const char *name) { if (name[0] == '$' && name[1] == 'L') -return TRUE; +return true; /* We accept the generic ELF local label syntax as well. */ return _bfd_elf_is_local_label_name (abfd, name); Index: src/external/gpl3/binutils/dist/bfd/elf64-ppc.c diff -u src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.17 src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.18 --- src/external/gpl3/binutils/dist/bfd/elf64-ppc.c:1.17 Sat Dec 24 15:17:04 2022 +++ src/external/gpl3/binutils/dist/bfd/elf64-ppc.c Sun Jan 15 19:11:50 2023 @@ -8099,7 +8099,7 @@ ppc64_elf_tls_setup (struct bfd_link_inf return true; } -/* Return TRUE iff REL is a branch reloc with a global symbol matching +/* Return t
CVS commit: src/external/gpl3/binutils/dist/bfd
Module Name:src Committed By: christos Date: Mon Jan 16 00:11:50 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/bfd: elf32-m68k.c elf32-vax.c elf64-mips.c elf64-ppc.c Log Message: fix compilation issues. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/gpl3/binutils/dist/bfd/elf32-m68k.c cvs rdiff -u -r1.19 -r1.20 src/external/gpl3/binutils/dist/bfd/elf32-vax.c cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/bfd/elf64-mips.c cvs rdiff -u -r1.17 -r1.18 src/external/gpl3/binutils/dist/bfd/elf64-ppc.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 23:32:11 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: xlint: fix null pointer dereference for lint -V (since today) Building the argument lists further away from the vfork call in xlint.c 1.100 had the side effect that the trailing null pointer was added outside run_child. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 23:32:11 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: xlint: fix null pointer dereference for lint -V (since today) Building the argument lists further away from the vfork call in xlint.c 1.100 had the side effect that the trailing null pointer was added outside run_child. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.103 src/usr.bin/xlint/xlint/xlint.c:1.104 --- src/usr.bin/xlint/xlint/xlint.c:1.103 Sun Jan 15 22:26:49 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 23:32:10 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.104 2023/01/15 23:32:10 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.104 2023/01/15 23:32:10 rillig Exp $"); #endif #include @@ -750,7 +750,7 @@ run_child(const char *path, list *args, if (Vflag) { print_sh_quoted(args->items[0]); - for (size_t i = 1; i < args->len; i++) { + for (size_t i = 1; i < args->len - 1; i++) { (void)printf(" "); print_sh_quoted(args->items[i]); }
CVS commit: src/external/gpl3/binutils/dist/ld
Module Name:src Committed By: christos Date: Sun Jan 15 23:31:51 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/ld: configure.tgt Log Message: put back all our mips stuff. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/external/gpl3/binutils/dist/ld/configure.tgt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils/dist/ld/configure.tgt diff -u src/external/gpl3/binutils/dist/ld/configure.tgt:1.39 src/external/gpl3/binutils/dist/ld/configure.tgt:1.40 --- src/external/gpl3/binutils/dist/ld/configure.tgt:1.39 Fri Jan 6 10:47:38 2023 +++ src/external/gpl3/binutils/dist/ld/configure.tgt Sun Jan 15 18:31:51 2023 @@ -541,10 +541,6 @@ mips*-sgi-irix5*) targ_emul=elf32bsmip mips*-sgi-irix6*) targ_emul=elf32bmipn32 targ_extra_emuls="elf32bsmip elf64bmip" targ_extra_libpath=$targ_extra_emuls ;; -mips64*el-*-netbsd*) targ_emul=elf32ltsmipn32 - targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; mips*el-*-haiku*) targ_emul=elf_mipsel_haiku targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" ;; @@ -556,16 +552,22 @@ mips64*-*-netbsd*) targ_emul=elf32btsmip targ_extra_emuls="elf64ltsmip elf64btsmip elf32btsmip elf32ltsmipn32 elf32ltsmip" targ_extra_libpath=$targ_extra_emuls ;; +mipsn64*-*-netbsd*) targ_emul=elf64btsmip + targ_extra_emuls="elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32" + targ_extra_libpath=$targ_extra_emuls + ;; +mips*el-*-netbsd*) targ_emul=elf32ltsmip + targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip" + ;; +mips*-*-netbsd*) targ_emul=elf32btsmip + targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip" + ;; mips64el-*-openbsd*) targ_emul=elf64ltsmip targ_extra_emuls=elf64btsmip ;; mips64-*-openbsd*) targ_emul=elf64btsmip targ_extra_emuls=elf64ltsmip ;; -mipsn64*-*-netbsd*) targ_emul=elf64btsmip - targ_extra_emuls="elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32" - targ_extra_libpath=$targ_extra_emuls - ;; mips*vr4300el-*-elf*) targ_emul=elf32l4300 ;; mips*vr4300-*-elf*) targ_emul=elf32b4300
CVS commit: src/external/gpl3/binutils/dist/ld
Module Name:src Committed By: christos Date: Sun Jan 15 23:31:51 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/ld: configure.tgt Log Message: put back all our mips stuff. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/external/gpl3/binutils/dist/ld/configure.tgt 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: Sun Jan 15 23:18:05 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/usr.bin/xlint: Makefile Added Files: src/tests/usr.bin/xlint/xlint: Makefile t_xlint.sh Log Message: tests/lint: add basic tests for lint (not lint1 or lint2) To generate a diff of this commit: cvs rdiff -u -r1.1241 -r1.1242 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.197 -r1.198 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/xlint/Makefile \ src/tests/usr.bin/xlint/xlint/t_xlint.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1241 src/distrib/sets/lists/tests/mi:1.1242 --- src/distrib/sets/lists/tests/mi:1.1241 Sun Jan 15 00:53:19 2023 +++ src/distrib/sets/lists/tests/mi Sun Jan 15 23:18:05 2023 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1241 2023/01/15 00:53:19 rillig Exp $ +# $NetBSD: mi,v 1.1242 2023/01/15 23:18:05 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7424,6 +7424,8 @@ ./usr/tests/usr.bin/xlint/lint2/read_printf.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint2/read_printf.ln tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint2/t_lint2 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/xlint/Atffile tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/xlint/t_xlint tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztesttests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztest/Atffile tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztest/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.197 src/etc/mtree/NetBSD.dist.tests:1.198 --- src/etc/mtree/NetBSD.dist.tests:1.197 Mon Nov 21 22:01:33 2022 +++ src/etc/mtree/NetBSD.dist.tests Sun Jan 15 23:18:05 2023 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.197 2022/11/21 22:01:33 christos Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.198 2023/01/15 23:18:05 rillig Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -479,6 +479,7 @@ ./usr/tests/usr.bin/xlint ./usr/tests/usr.bin/xlint/lint1 ./usr/tests/usr.bin/xlint/lint2 +./usr/tests/usr.bin/xlint/xlint ./usr/tests/usr.bin/ztest ./usr/tests/usr.sbin ./usr/tests/usr.sbin/cpuctl Index: src/tests/usr.bin/xlint/Makefile diff -u src/tests/usr.bin/xlint/Makefile:1.2 src/tests/usr.bin/xlint/Makefile:1.3 --- src/tests/usr.bin/xlint/Makefile:1.2 Thu Aug 5 22:36:08 2021 +++ src/tests/usr.bin/xlint/Makefile Sun Jan 15 23:18:05 2023 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.2 2021/08/05 22:36:08 rillig Exp $ +# $NetBSD: Makefile,v 1.3 2023/01/15 23:18:05 rillig Exp $ .include TESTSDIR= ${TESTSBASE}/usr.bin/xlint -TESTS_SUBDIRS= lint1 lint2 +TESTS_SUBDIRS= lint1 lint2 xlint .include Added files: Index: src/tests/usr.bin/xlint/xlint/Makefile diff -u /dev/null src/tests/usr.bin/xlint/xlint/Makefile:1.1 --- /dev/null Sun Jan 15 23:18:05 2023 +++ src/tests/usr.bin/xlint/xlint/Makefile Sun Jan 15 23:18:05 2023 @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1 2023/01/15 23:18:05 rillig Exp $ + +NOMAN= yes +TESTSDIR= ${TESTSBASE}/usr.bin/xlint/xlint +TESTS_SH= t_xlint +FILESDIR= ${TESTSDIR} + +.include Index: src/tests/usr.bin/xlint/xlint/t_xlint.sh diff -u /dev/null src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.1 --- /dev/null Sun Jan 15 23:18:05 2023 +++ src/tests/usr.bin/xlint/xlint/t_xlint.sh Sun Jan 15 23:18:05 2023 @@ -0,0 +1,120 @@ +# $NetBSD: t_xlint.sh,v 1.1 2023/01/15 23:18:05 rillig Exp $ +# +# Copyright (c) 2023 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jan 15 23:18:05 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/usr.bin/xlint: Makefile Added Files: src/tests/usr.bin/xlint/xlint: Makefile t_xlint.sh Log Message: tests/lint: add basic tests for lint (not lint1 or lint2) To generate a diff of this commit: cvs rdiff -u -r1.1241 -r1.1242 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.197 -r1.198 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/xlint/Makefile \ src/tests/usr.bin/xlint/xlint/t_xlint.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/gpl3/binutils/dist
Module Name:src Committed By: christos Date: Sun Jan 15 23:10:53 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/bfd: configure warning.m4 src/external/gpl3/binutils/dist/binutils: configure src/external/gpl3/binutils/dist/gas: configure src/external/gpl3/binutils/dist/gold: configure src/external/gpl3/binutils/dist/gprof: configure src/external/gpl3/binutils/dist/ld: configure src/external/gpl3/binutils/dist/opcodes: configure Log Message: disable -Wstack-check since vax does not have it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/binutils/dist/bfd/configure cvs rdiff -u -r1.1.1.7 -r1.2 src/external/gpl3/binutils/dist/bfd/warning.m4 cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/binutils/configure cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/gas/configure cvs rdiff -u -r1.1.1.9 -r1.2 src/external/gpl3/binutils/dist/gold/configure cvs rdiff -u -r1.1.1.10 -r1.2 src/external/gpl3/binutils/dist/gprof/configure cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/binutils/dist/ld/configure cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/binutils/dist/opcodes/configure Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils/dist/bfd/configure diff -u src/external/gpl3/binutils/dist/bfd/configure:1.18 src/external/gpl3/binutils/dist/bfd/configure:1.19 --- src/external/gpl3/binutils/dist/bfd/configure:1.18 Fri Jan 6 10:47:38 2023 +++ src/external/gpl3/binutils/dist/bfd/configure Sun Jan 15 18:10:52 2023 @@ -12086,17 +12086,17 @@ rm -f conftest* # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__GNUC__ -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : - -else - GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" -fi -rm -f conftest* +#cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__GNUC__ +#_ACEOF +#if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +# $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +# +#else +# GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" +#fi +#rm -f conftest* # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. @@ -12131,17 +12131,17 @@ rm -f conftest* # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__GNUC__ -_ACEOF -if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | - $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : - -else - GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144" -fi -rm -f conftest* +#cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__GNUC__ +#_ACEOF +#if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 | +# $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : +# +#else +# GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144" +#fi +#rm -f conftest* # Check whether --enable-werror was given. Index: src/external/gpl3/binutils/dist/bfd/warning.m4 diff -u src/external/gpl3/binutils/dist/bfd/warning.m4:1.1.1.7 src/external/gpl3/binutils/dist/bfd/warning.m4:1.2 --- src/external/gpl3/binutils/dist/bfd/warning.m4:1.1.1.7 Fri Dec 23 14:01:34 2022 +++ src/external/gpl3/binutils/dist/bfd/warning.m4 Sun Jan 15 18:10:52 2023 @@ -50,7 +50,7 @@ GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wst AC_EGREP_CPP([(^[0-3]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow") # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -AC_EGREP_CPP([(^[0-4]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144") +#AC_EGREP_CPP([(^[0-4]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144") # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" Index: src/external/gpl3/binutils/dist/binutils/configure diff -u src/external/gpl3/binutils/dist/binutils/configure:1.11 src/external/gpl3/binutils/dist/binutils/configure:1.12 --- src/external/gpl3/binutils/dist/binutils/configure:1.11 Sat Dec 24 15:17:05 2022 +++ src/external/gpl3/binutils/dist/binutils/configure Sun Jan 15 18:10:52 2023 @@ -12107,17 +12107,17 @@ rm -f conftest* # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -__GNUC__ -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then : - -else - GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144" -fi -rm -f conftest* +#cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#/* end confdefs.h. */ +#__GNUC__ +#_ACEOF +#if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +# $EGREP "(^[0-4]$|^__GN
CVS commit: src/external/gpl3/binutils/dist
Module Name:src Committed By: christos Date: Sun Jan 15 23:10:53 UTC 2023 Modified Files: src/external/gpl3/binutils/dist/bfd: configure warning.m4 src/external/gpl3/binutils/dist/binutils: configure src/external/gpl3/binutils/dist/gas: configure src/external/gpl3/binutils/dist/gold: configure src/external/gpl3/binutils/dist/gprof: configure src/external/gpl3/binutils/dist/ld: configure src/external/gpl3/binutils/dist/opcodes: configure Log Message: disable -Wstack-check since vax does not have it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/binutils/dist/bfd/configure cvs rdiff -u -r1.1.1.7 -r1.2 src/external/gpl3/binutils/dist/bfd/warning.m4 cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/binutils/configure cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/gas/configure cvs rdiff -u -r1.1.1.9 -r1.2 src/external/gpl3/binutils/dist/gold/configure cvs rdiff -u -r1.1.1.10 -r1.2 src/external/gpl3/binutils/dist/gprof/configure cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/binutils/dist/ld/configure cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/binutils/dist/opcodes/configure 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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 22:26:49 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: clean up main function No functional change. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.102 src/usr.bin/xlint/xlint/xlint.c:1.103 --- src/usr.bin/xlint/xlint/xlint.c:1.102 Sun Jan 15 22:06:37 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 22:26:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.102 2023/01/15 22:06:37 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.102 2023/01/15 22:06:37 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.103 2023/01/15 22:26:49 rillig Exp $"); #endif #include @@ -127,7 +127,7 @@ static const char *currfn; #endif static const char target_prefix[] = TARGET_PREFIX; -static void fname(const char *); +static void handle_filename(const char *); static void run_child(const char *, list *, const char *, int); static void find_libs(const list *); static bool file_is_readable(const char *); @@ -270,6 +270,17 @@ lbasename(const char *strg, int delim) return base; } +static void +set_tmpdir(void) +{ + const char *tmp; + size_t len; + + tmpdir = (tmp = getenv("TMPDIR")) != NULL && (len = strlen(tmp)) != 0 + ? concat2(tmp, tmp[len - 1] == '/' ? "" : "/") + : xstrdup(_PATH_TMP); +} + static void __attribute__((__noreturn__, __format__(__printf__, 1, 2))) usage(const char *fmt, ...) { @@ -378,18 +389,9 @@ run_lint2(void) int main(int argc, char *argv[]) { - int c; - char *tmp; - size_t len; - const char *ks; setprogname(argv[0]); - - if ((tmp = getenv("TMPDIR")) == NULL || (len = strlen(tmp)) == 0) { - tmpdir = xstrdup(_PATH_TMP); - } else { - tmpdir = concat2(tmp, tmp[len - 1] == '/' ? "" : "/"); - } + set_tmpdir(); cpp.outfile = concat2(tmpdir, "lint0.XX"); cpp.outfd = mkstemp(cpp.outfile); @@ -408,7 +410,7 @@ main(int argc, char *argv[]) pass_to_cpp("-Wp,-CC"); pass_to_cpp("-Wcomment"); pass_to_cpp("-D__LINT__"); - pass_to_cpp("-Dlint"); /* XXX don't def. with -s */ + pass_to_cpp("-Dlint"); /* XXX don't define with -s */ pass_to_cpp("-D__lint"); pass_to_cpp("-D__lint__"); @@ -419,6 +421,8 @@ main(int argc, char *argv[]) (void)signal(SIGINT, terminate); (void)signal(SIGQUIT, terminate); (void)signal(SIGTERM, terminate); + + int c; while ((c = getopt(argc, argv, "abcd:eghil:no:pq:rstuvwxzA:B:C:D:FHI:L:M:PR:STU:VW:X:Z:")) != -1) { switch (c) { @@ -595,36 +599,30 @@ main(int argc, char *argv[]) * In particular, only -l and -L (and these with a space * after -l or -L) are allowed. */ - while (argc > 0) { + for (; argc > 0; argc--, argv++) { const char *arg = argv[0]; if (arg[0] == '-') { list *lp; - /* option */ if (arg[1] == 'l') lp = &libs; else if (arg[1] == 'L') lp = &libsrchpath; - else { + else usage("Unknown late option '%s'", arg); -/* NOTREACHED */ - } if (arg[2] != '\0') list_add_unique(lp, arg + 2); else if (argc > 1) { -argc--; -list_add_unique(lp, *++argv); +argc--, argv++; +list_add_unique(lp, argv[0]); } else usage("Missing argument for l or L"); } else { - /* filename */ - fname(arg); + handle_filename(arg); first = false; } - argc--; - argv++; } if (first) @@ -634,7 +632,8 @@ main(int argc, char *argv[]) terminate(0); if (!oflag) { - if ((ks = getenv("LIBDIR")) == NULL || strlen(ks) == 0) + const char *ks = getenv("LIBDIR"); + if (ks == NULL || ks[0] == '\0') ks = PATH_LINTLIB; list_add(&libsrchpath, ks); find_libs(&libs); @@ -658,7 +657,7 @@ main(int argc, char *argv[]) * and pass it through lint1 if it is a C source. */ static void -fname(const char *name) +handle_filename(const char *name) { const char *bn, *suff; char *ofn; @@ -804,7 +803,7 @@ run_child(const char *path, list *args, } static void -findlib(const char *lib) +find_lib(const char *lib) { char *lfn; @@ -834,7 +833,7 @@ find_libs(const list *l) { for (size_t i = 0; i < l->len; i++) - findlib(l->items[i]); + find_lib(l->items[i]); } static bool
CVS commit: src/usr.bin/xlint/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 22:26:49 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: clean up main function No functional change. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 22:06:38 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: extract run_cpp and run_lint1 to separate functions Move run_lint2 further to the top, to save a forward declaration. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 22:06:38 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: extract run_cpp and run_lint1 to separate functions Move run_lint2 further to the top, to save a forward declaration. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.101 src/usr.bin/xlint/xlint/xlint.c:1.102 --- src/usr.bin/xlint/xlint/xlint.c:1.101 Sun Jan 15 21:46:15 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 22:06:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.101 2023/01/15 21:46:15 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.102 2023/01/15 22:06:37 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.101 2023/01/15 21:46:15 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.102 2023/01/15 22:06:37 rillig Exp $"); #endif #include @@ -131,7 +131,6 @@ static void fname(const char *); static void run_child(const char *, list *, const char *, int); static void find_libs(const list *); static bool file_is_readable(const char *); -static void run_lint2(void); static void cat(const list *, const char *); static void @@ -301,6 +300,80 @@ usage(const char *fmt, ...) terminate(-1); } +static void +run_cpp(const char *name) +{ + + const char *cc = getenv("CC"); + if (cc == NULL) + cc = DEFAULT_CC; + + char *abs_cc = findcc(cc); + if (abs_cc == NULL && setenv("PATH", DEFAULT_PATH, 1) == 0) + abs_cc = findcc(cc); + if (abs_cc == NULL) { + (void)fprintf(stderr, "%s: %s: not found\n", getprogname(), cc); + exit(EXIT_FAILURE); + } + + list args = { NULL, 0, 0 }; + list_add_ref(&args, abs_cc); + list_add_all(&args, &cpp.flags); + list_add_all(&args, &cpp.lcflags); + list_add(&args, name); + list_add_ref(&args, NULL); + + /* we reuse the same tmp file for cpp output, so rewind and truncate */ + if (lseek(cpp.outfd, 0, SEEK_SET) != 0) { + warn("lseek"); + terminate(-1); + } + if (ftruncate(cpp.outfd, 0) != 0) { + warn("ftruncate"); + terminate(-1); + } + + run_child(abs_cc, &args, cpp.outfile, cpp.outfd); + list_clear(&args); +} + +static void +run_lint1(const char *out_fname) +{ + + char *abs_lint1 = libexec_dir != NULL + ? concat2(libexec_dir, "/lint1") + : xasprintf("%s/%slint1", PATH_LIBEXEC, target_prefix); + + list args = { NULL, 0, 0 }; + list_add_ref(&args, abs_lint1); + list_add_all(&args, &lint1.flags); + list_add(&args, cpp.outfile); + list_add(&args, out_fname); + list_add_ref(&args, NULL); + + run_child(abs_lint1, &args, out_fname, -1); + list_clear(&args); +} + +static void +run_lint2(void) +{ + + char *abs_lint2 = libexec_dir != NULL + ? concat2(libexec_dir, "/lint2") + : xasprintf("%s/%slint2", PATH_LIBEXEC, target_prefix); + + list args = { NULL, 0, 0 }; + list_add_ref(&args, abs_lint2); + list_add_all(&args, &lint2.flags); + list_add_all(&args, &lint2.inlibs); + list_add_all(&args, &lint2.infiles); + list_add_ref(&args, NULL); + + run_child(abs_lint2, &args, lint2.outlib, -1); + list_clear(&args); +} int main(int argc, char *argv[]) @@ -587,8 +660,8 @@ main(int argc, char *argv[]) static void fname(const char *name) { - const char *bn, *suff, *CC; - char *ofn, *pathname; + const char *bn, *suff; + char *ofn; size_t len; int fd; @@ -631,58 +704,8 @@ fname(const char *name) if (!iflag) list_add(&lint1.outfiles, ofn); - /* run cc */ - if ((CC = getenv("CC")) == NULL) - CC = DEFAULT_CC; - if ((pathname = findcc(CC)) == NULL) - if (setenv("PATH", DEFAULT_PATH, 1) == 0) - pathname = findcc(CC); - if (pathname == NULL) { - (void)fprintf(stderr, "%s: %s: not found\n", getprogname(), CC); - exit(EXIT_FAILURE); - } - - list args = { NULL, 0, 0 }; - list_add_ref(&args, pathname); - list_add_all(&args, &cpp.flags); - list_add_all(&args, &cpp.lcflags); - list_add(&args, name); - list_add_ref(&args, NULL); - - /* we reuse the same tmp file for cpp output, so rewind and truncate */ - if (lseek(cpp.outfd, 0, SEEK_SET) != 0) { - warn("lseek"); - terminate(-1); - } - if (ftruncate(cpp.outfd, 0) != 0) { - warn("ftruncate"); - terminate(-1); - } - - run_child(pathname, &args, cpp.outfile, cpp.outfd); - list_clear(&args); - - /* run lint1 */ - - if (libexec_dir == NULL) { - pathname = xasprintf("%s/%slint1", - PATH_LIBEXEC, target_prefix); - } else { - /* - * XXX Unclear whether we should be using target_prefix - * XXX here. --thor...@wasabisystems.com - */ - pathname = concat2(libexec_dir, "/lint1"); - } - - list_add_ref(&args, pathname); - list_add_all(&args, &lint1.flags); - list_add(&args, cpp.outfile); - list_add(&args, ofn); - list_add_ref(&args, NULL); - - run_chil
CVS commit: src/usr.bin/xlint/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 21:46:15 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: reduce number of local variables in lbasename No functional change. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 21:46:15 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: reduce number of local variables in lbasename No functional change. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.100 src/usr.bin/xlint/xlint/xlint.c:1.101 --- src/usr.bin/xlint/xlint/xlint.c:1.100 Sun Jan 15 21:27:36 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 21:46:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.100 2023/01/15 21:27:36 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.101 2023/01/15 21:46:15 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.100 2023/01/15 21:27:36 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.101 2023/01/15 21:46:15 rillig Exp $"); #endif #include @@ -226,9 +226,7 @@ concat2(const char *s1, const char *s2) return s; } -/* - * Clean up after a signal. - */ +/* Clean up after a signal or at the regular end. */ static void __attribute__((__noreturn__)) terminate(int signo) { @@ -264,16 +262,13 @@ terminate(int signo) static const char * lbasename(const char *strg, int delim) { - const char *cp, *cp1, *cp2; - cp = cp1 = cp2 = strg; - while (*cp != '\0') { - if (*cp++ == delim) { - cp2 = cp1; - cp1 = cp; - } + const char *base = strg; + for (const char *p = strg; *p != '\0'; p++) { + if (p[0] == delim && p[1] != '\0') + base = p + 1; } - return *cp1 == '\0' ? cp2 : cp1; + return base; } static void __attribute__((__noreturn__, __format__(__printf__, 1, 2)))
CVS commit: src/usr.bin/xlint/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 21:27:37 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: move argument list modification further away from vfork Just to be on the safe side. While here, don't allocate argument strings needlessly. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.99 src/usr.bin/xlint/xlint/xlint.c:1.100 --- src/usr.bin/xlint/xlint/xlint.c:1.99 Sun Jan 15 15:20:18 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 21:27:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.99 2023/01/15 15:20:18 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.100 2023/01/15 21:27:36 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.99 2023/01/15 15:20:18 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.100 2023/01/15 21:27:36 rillig Exp $"); #endif #include @@ -648,10 +648,11 @@ fname(const char *name) } list args = { NULL, 0, 0 }; - list_add(&args, pathname); + list_add_ref(&args, pathname); list_add_all(&args, &cpp.flags); list_add_all(&args, &cpp.lcflags); list_add(&args, name); + list_add_ref(&args, NULL); /* we reuse the same tmp file for cpp output, so rewind and truncate */ if (lseek(cpp.outfd, 0, SEEK_SET) != 0) { @@ -664,7 +665,6 @@ fname(const char *name) } run_child(pathname, &args, cpp.outfile, cpp.outfd); - free(pathname); list_clear(&args); /* run lint1 */ @@ -680,13 +680,13 @@ fname(const char *name) pathname = concat2(libexec_dir, "/lint1"); } - list_add(&args, pathname); + list_add_ref(&args, pathname); list_add_all(&args, &lint1.flags); list_add(&args, cpp.outfile); list_add(&args, ofn); + list_add_ref(&args, NULL); run_child(pathname, &args, ofn, -1); - free(pathname); list_clear(&args); list_add(&lint2.infiles, ofn); @@ -760,9 +760,7 @@ run_child(const char *path, list *args, (void)dup2(fdout, STDOUT_FILENO); (void)close(fdout); } - list_add_ref(args, NULL); (void)execvp(path, args->items); - args->len--; warn("cannot exec %s", path); _exit(1); /* NOTREACHED */ @@ -851,13 +849,13 @@ run_lint2(void) } list args = { NULL, 0, 0 }; - list_add(&args, path); + list_add_ref(&args, path); list_add_all(&args, &lint2.flags); list_add_all(&args, &lint2.inlibs); list_add_all(&args, &lint2.infiles); + list_add_ref(&args, NULL); run_child(path, &args, lint2.outlib, -1); - free(path); list_clear(&args); }
CVS commit: src/usr.bin/xlint/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 21:27:37 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: move argument list modification further away from vfork Just to be on the safe side. While here, don't allocate argument strings needlessly. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/xlint/xlint.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Detecting typos in makefiles (was: Re: CVS commit: src/share/mk)
On Sun, 15 Jan 2023 19:14:14 +0100, Roland Illig writes: >It is really unfortunate that make didn't catch this typo by itself. > >.if ${MACHINE_ARCH} =3D=3D "x86_64" || \ > ${MACHINE_ARCH} =3D=3D "i386" || \ > ${MACHINE_ARCH} =3D=3D "alpha" || \\ > !empty(MACHINE_ARCH:Maarch64*) || \ > !empty(MACHINE_ARCH:Msparc*) > >(The 'alpha' line has a trailing '\\' instead of the usual '\'.) Yes warnings would be good I think. FWIW the above is why I encouage use of :N to reduce the complexity of conditionals (eaier to extend without screwing up) as in: .if ${MACHINE_ARCH:Nalpha:Ni386:Nx86_64} == "" is equivalent to the first 3 lines above.
Detecting typos in makefiles (was: Re: CVS commit: src/share/mk)
Am 15.01.2023 um 11:51 schrieb Nick Hudson: Module Name:src Committed By: skrll Date: Sun Jan 15 10:51:04 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: Really switch aarch64 and sparc binutils to 2.39 To generate a diff of this commit: cvs rdiff -u -r1.1293 -r1.1294 src/share/mk/bsd.own.mk It is really unfortunate that make didn't catch this typo by itself. .if ${MACHINE_ARCH} == "x86_64" || \ ${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "alpha" || \\ !empty(MACHINE_ARCH:Maarch64*) || \ !empty(MACHINE_ARCH:Msparc*) (The 'alpha' line has a trailing '\\' instead of the usual '\'.) Here is what happened: 1. In the condition '${SOMETHING} || \\', the trailing '\\' is a bare word, which in the case of a simple '.if' directive is interpreted as 'defined(\\)'. So if there had been a variable named '\\', the branch would have been taken. 2. If the branch is not taken, make ignores all text until the next '.elif' or '.else' or '.endif' line. 3. If the branch is taken, the line below the '.if' line is indented with a few spaces and then starts with '!'. This line is interpreted as a dependency using the dependency operator '!'. The left-hand side of the dependency line is empty, saying 'nothing depends on these sources'. Except for the case of automatically generated makefiles, this doesn't make sense. 4. The '!' dependency has 3 sources: 4a. The first and third sources are archive members. In the first source, the archive is named 'empty' and the member is named 'MACHINE_ARCH:Maarch64*'. 4b. The second source is '||'. There are a few things that make could warn about: * The variable name '\\' is very rare. * The bare word '\\' occurs in a condition that otherwise uses "proper expressions". * The dependency line starts with spaces. * The dependency line has no targets, only sources. * The dependency line contains an archive member. Archive members, while required by POSIX, are seldom used. * The archive filename is 'empty', which is missing the typical archive filename suffix '.a'. * The archive member contains a ':', which is uncommon for filenames. * The dependency source '||' has a name that is neither a usual filename nor a usual variable name. None of these things generates any warning right now. Should they? Roland
CVS commit: src/share/mk
Module Name:src Committed By: rillig Date: Sun Jan 15 18:43:49 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: bsd.own.mk: replace '!empty' with direct expression The variables MACHINE and MACHINE_ARCH are guaranteed to be defined, therefore they don't need to be wrapped in '!empty(...)'. This is simpler to read and, in case of typos, is more likely to lead to an error message from make, as a line starting with '!' is interpreted as a dependency line, while a line using only '==' but not '!=' leads to a syntax error of the form 'Invalid line type'. To generate a diff of this commit: cvs rdiff -u -r1.1295 -r1.1296 src/share/mk/bsd.own.mk 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.own.mk diff -u src/share/mk/bsd.own.mk:1.1295 src/share/mk/bsd.own.mk:1.1296 --- src/share/mk/bsd.own.mk:1.1295 Sun Jan 15 10:54:56 2023 +++ src/share/mk/bsd.own.mk Sun Jan 15 18:43:49 2023 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1295 2023/01/15 10:54:56 skrll Exp $ +# $NetBSD: bsd.own.mk,v 1.1296 2023/01/15 18:43:49 rillig Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -28,8 +28,8 @@ MACHINE_MIPS64= 0 # # Subdirectory used below ${RELEASEDIR} when building a release # -.if !empty(MACHINE:Mevbarm) || !empty(MACHINE:Mevbmips) \ - || !empty(MACHINE:Mevbsh3) +.if ${MACHINE:Mevbarm} || ${MACHINE:Mevbmips} \ + || ${MACHINE:Mevbsh3} RELEASEMACHINEDIR?= ${MACHINE}-${MACHINE_ARCH} .else RELEASEMACHINEDIR?= ${MACHINE} @@ -99,10 +99,10 @@ MKGCCCMDS?= no # What binutils is used? # .if \ -!empty(MACHINE_ARCH:Maarch64*) || \ +${MACHINE_ARCH:Maarch64*} || \ ${MACHINE_ARCH} == "alpha" || \ ${MACHINE_ARCH} == "i386" || \ -!empty(MACHINE_ARCH:Msparc*) || \ +${MACHINE_ARCH:Msparc*} || \ ${MACHINE_ARCH} == "x86_64" HAVE_BINUTILS?= 239 .else @@ -149,7 +149,7 @@ EXTERNAL_OPENSSL_SUBDIR=/does/not/exist .if ${MACHINE} == "i386" || \ ${MACHINE} == "amd64" || \ ${MACHINE} == "ia64" || \ -!empty(MACHINE_ARCH:Maarch64*) +${MACHINE_ARCH:Maarch64*} HAVE_ACPI= yes .else HAVE_ACPI= no @@ -161,8 +161,8 @@ HAVE_ACPI= no .if ${MACHINE} == "i386" || \ ${MACHINE} == "amd64" || \ ${MACHINE} == "ia64" || \ -!empty(MACHINE_ARCH:Mearmv7*) || \ -!empty(MACHINE_ARCH:Maarch64*) || \ +${MACHINE_ARCH:Mearmv7*} || \ +${MACHINE_ARCH:Maarch64*} || \ ${MACHINE_ARCH} == "riscv64" HAVE_UEFI= yes .else @@ -179,7 +179,7 @@ HAVE_NVMM= no .endif -.if !empty(MACHINE_ARCH:Mearm*) +.if ${MACHINE_ARCH:Mearm*} _LIBC_COMPILER_RT.${MACHINE_ARCH}= yes .endif @@ -200,7 +200,7 @@ HAVE_LIBGCC?= yes # Should libgcc have unwinding code? -.if ${HAVE_LLVM:Uno} == "yes" || !empty(MACHINE_ARCH:Mearm*) +.if ${HAVE_LLVM:Uno} == "yes" || ${MACHINE_ARCH:Mearm*} HAVE_LIBGCC_EH?= no .else HAVE_LIBGCC_EH?= yes @@ -952,7 +952,7 @@ MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_AR # In order to identify NetBSD to GNU packages, we sometimes need # an "elf" tag for historically a.out platforms. # -.if (!empty(MACHINE_ARCH:Mearm*)) +.if (${MACHINE_ARCH:Mearm*}) MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsdelf-${MACHINE_ARCH:C/eb//:C/v[4-7]//:S/earm/eabi/} .elif (${MACHINE_GNU_ARCH} == "arm" || \ ${MACHINE_GNU_ARCH} == "armeb" || \ @@ -967,7 +967,7 @@ MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd .endif -.if !empty(MACHINE_ARCH:M*arm*) +.if ${MACHINE_ARCH:M*arm*} # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand. ARM_APCS_FLAGS= -mabi=apcs-gnu -mfloat-abi=soft -marm ARM_APCS_FLAGS+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -mno-thumb-interwork :} @@ -1056,7 +1056,7 @@ MK${var}:= yes ${MACHINE_ARCH} == "powerpc64" || \ (${MACHINE_ARCH} == "aarch64" && ${HAVE_GCC:U0} == 0) || \ ${MACHINE_ARCH} == "riscv64" || \ -!empty(MACHINE_ARCH:Mearm*) +${MACHINE_ARCH:Mearm*} MKCOMPAT?= yes .else # Don't let this build where it really isn't supported. @@ -1100,7 +1100,7 @@ SOFTFLOAT_BITS= 32 # .if ${MACHINE} == "amd64" || \ ${MACHINE} == "sparc64" || \ -!empty(MACHINE_ARCH:Maarch64*) +${MACHINE_ARCH:Maarch64*} MKZFS?= yes .endif @@ -1110,7 +1110,7 @@ MKZFS?= yes .if ${MACHINE} == "i386" || \ ${MACHINE} == "amd64" || \ ${MACHINE_ARCH} == "aarch64" || \ -!empty(MACHINE_ARCH:Mearm*) +${MACHINE_ARCH:Mearm*} MKDTRACE?= yes MKCTF?= yes .endif @@ -1122,7 +1122,7 @@ MKCTF?= yes .if !defined(COVERITY_TOP_CONFIG) && \ (${MACHINE_ARCH} == "i386" || \ ${MACHINE_ARCH} == "x86_64" || \ -!empty(MACHINE_ARCH:Maarch64*) || \ +${MACHINE_ARCH:Maarch64*} || \ ${MACHINE_CPU} == "arm" || \ ${MACHINE_CPU} == "m68k" || \ ${MACHINE_CPU} == "mips" || \ @@ -1138,7 +1138,7 @@ MKPIE?= no # .if ${MACHINE} == "i386" || \ ${MACHINE} == "amd64" || \ -!
CVS commit: src/share/mk
Module Name:src Committed By: rillig Date: Sun Jan 15 18:43:49 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: bsd.own.mk: replace '!empty' with direct expression The variables MACHINE and MACHINE_ARCH are guaranteed to be defined, therefore they don't need to be wrapped in '!empty(...)'. This is simpler to read and, in case of typos, is more likely to lead to an error message from make, as a line starting with '!' is interpreted as a dependency line, while a line using only '==' but not '!=' leads to a syntax error of the form 'Invalid line type'. To generate a diff of this commit: cvs rdiff -u -r1.1295 -r1.1296 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Detecting typos in makefiles (was: Re: CVS commit: src/share/mk)
That's very funny. Yes I think we should warn. I don't think that \\ should be a valid variable name. Best, christos > On Jan 15, 2023, at 1:14 PM, Roland Illig wrote: > > Am 15.01.2023 um 11:51 schrieb Nick Hudson: >> Module Name: src >> Committed By:skrll >> Date:Sun Jan 15 10:51:04 UTC 2023 >> >> Modified Files: >> src/share/mk: bsd.own.mk >> >> Log Message: >> Really switch aarch64 and sparc binutils to 2.39 >> >> >> To generate a diff of this commit: >> cvs rdiff -u -r1.1293 -r1.1294 src/share/mk/bsd.own.mk > > It is really unfortunate that make didn't catch this typo by itself. > > .if ${MACHINE_ARCH} == "x86_64" || \ >${MACHINE_ARCH} == "i386" || \ >${MACHINE_ARCH} == "alpha" || \\ >!empty(MACHINE_ARCH:Maarch64*) || \ >!empty(MACHINE_ARCH:Msparc*) > > (The 'alpha' line has a trailing '\\' instead of the usual '\'.) > > Here is what happened: > > 1. In the condition '${SOMETHING} || \\', the trailing '\\' is a bare > word, which in the case of a simple '.if' directive is interpreted as > 'defined(\\)'. So if there had been a variable named '\\', the branch > would have been taken. > > 2. If the branch is not taken, make ignores all text until the next > '.elif' or '.else' or '.endif' line. > > 3. If the branch is taken, the line below the '.if' line is indented > with a few spaces and then starts with '!'. This line is interpreted as > a dependency using the dependency operator '!'. The left-hand side of > the dependency line is empty, saying 'nothing depends on these sources'. > Except for the case of automatically generated makefiles, this doesn't > make sense. > > 4. The '!' dependency has 3 sources: > > 4a. The first and third sources are archive members. In the first > source, the archive is named 'empty' and the member is named > 'MACHINE_ARCH:Maarch64*'. > > 4b. The second source is '||'. > > > There are a few things that make could warn about: > > * The variable name '\\' is very rare. > > * The bare word '\\' occurs in a condition that otherwise uses "proper > expressions". > > * The dependency line starts with spaces. > > * The dependency line has no targets, only sources. > > * The dependency line contains an archive member. Archive members, > while required by POSIX, are seldom used. > > * The archive filename is 'empty', which is missing the typical archive > filename suffix '.a'. > > * The archive member contains a ':', which is uncommon for filenames. > > * The dependency source '||' has a name that is neither a usual filename > nor a usual variable name. > > > None of these things generates any warning right now. Should they? > > Roland signature.asc Description: Message signed with OpenPGP
CVS commit: src/external/gpl3/binutils
Module Name:src Committed By: christos Date: Sun Jan 15 18:30:59 UTC 2023 Modified Files: src/external/gpl3/binutils/lib/libbfd/arch/hppa: bfd.h bfdver.h config.h src/external/gpl3/binutils/lib/libbfd/arch/riscv32: bfd.h bfdver.h config.h defs.mk src/external/gpl3/binutils/lib/libbfd/arch/riscv64: bfd.h bfdver.h config.h defs.mk src/external/gpl3/binutils/lib/libgnuctf/arch/hppa: config.h defs.mk src/external/gpl3/binutils/lib/libgnuctf/arch/riscv32: config.h defs.mk src/external/gpl3/binutils/lib/libgnuctf/arch/riscv64: config.h defs.mk src/external/gpl3/binutils/lib/libiberty/arch/hppa: defs.mk src/external/gpl3/binutils/lib/libiberty/arch/riscv32: defs.mk src/external/gpl3/binutils/lib/libiberty/arch/riscv64: defs.mk src/external/gpl3/binutils/lib/libopcodes/arch/hppa: config.h src/external/gpl3/binutils/lib/libopcodes/arch/riscv32: config.h src/external/gpl3/binutils/lib/libopcodes/arch/riscv64: config.h src/external/gpl3/binutils/usr.bin/common/arch/hppa: config.h defs.mk src/external/gpl3/binutils/usr.bin/common/arch/riscv32: config.h defs.mk src/external/gpl3/binutils/usr.bin/common/arch/riscv64: config.h defs.mk src/external/gpl3/binutils/usr.bin/gas/arch/hppa: config.h defs.mk src/external/gpl3/binutils/usr.bin/gas/arch/riscv32: config.h defs.mk src/external/gpl3/binutils/usr.bin/gas/arch/riscv64: config.h defs.mk src/external/gpl3/binutils/usr.bin/gprof/arch/hppa: gconfig.h src/external/gpl3/binutils/usr.bin/gprof/arch/riscv32: gconfig.h src/external/gpl3/binutils/usr.bin/gprof/arch/riscv64: gconfig.h src/external/gpl3/binutils/usr.bin/ld/arch/hppa: config.h src/external/gpl3/binutils/usr.bin/ld/arch/riscv32: config.h defs.mk ldemul-list.h src/external/gpl3/binutils/usr.bin/ld/arch/riscv64: config.h defs.mk ldemul-list.h Log Message: regen riskv and hppa for Nick To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/external/gpl3/binutils/lib/libbfd/arch/hppa/bfd.h cvs rdiff -u -r1.12 -r1.13 \ src/external/gpl3/binutils/lib/libbfd/arch/hppa/bfdver.h cvs rdiff -u -r1.8 -r1.9 \ src/external/gpl3/binutils/lib/libbfd/arch/hppa/config.h cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/lib/libbfd/arch/riscv32/bfd.h \ src/external/gpl3/binutils/lib/libbfd/arch/riscv32/bfdver.h \ src/external/gpl3/binutils/lib/libbfd/arch/riscv32/config.h cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/lib/libbfd/arch/riscv32/defs.mk cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/lib/libbfd/arch/riscv64/bfd.h cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/lib/libbfd/arch/riscv64/bfdver.h \ src/external/gpl3/binutils/lib/libbfd/arch/riscv64/config.h \ src/external/gpl3/binutils/lib/libbfd/arch/riscv64/defs.mk cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl3/binutils/lib/libgnuctf/arch/hppa/config.h \ src/external/gpl3/binutils/lib/libgnuctf/arch/hppa/defs.mk cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl3/binutils/lib/libgnuctf/arch/riscv32/config.h \ src/external/gpl3/binutils/lib/libgnuctf/arch/riscv32/defs.mk cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl3/binutils/lib/libgnuctf/arch/riscv64/config.h \ src/external/gpl3/binutils/lib/libgnuctf/arch/riscv64/defs.mk cvs rdiff -u -r1.6 -r1.7 \ src/external/gpl3/binutils/lib/libiberty/arch/hppa/defs.mk cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/lib/libiberty/arch/riscv32/defs.mk cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/lib/libiberty/arch/riscv64/defs.mk cvs rdiff -u -r1.8 -r1.9 \ src/external/gpl3/binutils/lib/libopcodes/arch/hppa/config.h cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/lib/libopcodes/arch/riscv32/config.h cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/lib/libopcodes/arch/riscv64/config.h cvs rdiff -u -r1.9 -r1.10 \ src/external/gpl3/binutils/usr.bin/common/arch/hppa/config.h cvs rdiff -u -r1.10 -r1.11 \ src/external/gpl3/binutils/usr.bin/common/arch/hppa/defs.mk cvs rdiff -u -r1.6 -r1.7 \ src/external/gpl3/binutils/usr.bin/common/arch/riscv32/config.h cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/usr.bin/common/arch/riscv32/defs.mk cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/usr.bin/common/arch/riscv64/config.h cvs rdiff -u -r1.4 -r1.5 \ src/external/gpl3/binutils/usr.bin/common/arch/riscv64/defs.mk cvs rdiff -u -r1.8 -r1.9 \ src/external/gpl3/binutils/usr.bin/gas/arch/hppa/config.h cvs rdiff -u -r1.2 -r1.3 \ src/external/gpl3/binutils/usr.bin/gas/arch/hppa/defs.mk cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/binutils/usr.bin/gas/arch/riscv32/config.h cvs rdiff -u -r1.1 -r1.2 \ src/external/gpl3/binutils/usr.bin/gas/arch/riscv32/defs.mk cvs rdiff -u -r1.4
CVS commit: src/lib/libc/time
Module Name:src Committed By: christos Date: Sun Jan 15 18:12:37 UTC 2023 Modified Files: src/lib/libc/time: NEWS localtime.c private.h zdump.c zic.c Log Message: Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance. Requested by Jan-Benedict Glaw. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/NEWS cvs rdiff -u -r1.136 -r1.137 src/lib/libc/time/localtime.c cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/private.h cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/zdump.c cvs rdiff -u -r1.87 -r1.88 src/lib/libc/time/zic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/time
Module Name:src Committed By: christos Date: Sun Jan 15 18:12:37 UTC 2023 Modified Files: src/lib/libc/time: NEWS localtime.c private.h zdump.c zic.c Log Message: Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance. Requested by Jan-Benedict Glaw. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/NEWS cvs rdiff -u -r1.136 -r1.137 src/lib/libc/time/localtime.c cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/private.h cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/zdump.c cvs rdiff -u -r1.87 -r1.88 src/lib/libc/time/zic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/time/NEWS diff -u src/lib/libc/time/NEWS:1.40 src/lib/libc/time/NEWS:1.41 --- src/lib/libc/time/NEWS:1.40 Sun Dec 11 12:57:23 2022 +++ src/lib/libc/time/NEWS Sun Jan 15 13:12:37 2023 @@ -85,6 +85,11 @@ Release 2022g - 2022-11-29 08:58:31 -080 lines are in the file 'backward'. (Inspired by a suggestion from Stephen Colebourne.) +On C23-compatible platforms tzcode no longer uses syntax like +'static [[noreturn]] void usage(void);'. Instead, it uses +'[[noreturn]] static void usage(void);' as strict C23 requires. +(Problem reported by Houge Langley.) + Release 2022f - 2022-10-28 18:04:57 -0700 Index: src/lib/libc/time/localtime.c diff -u src/lib/libc/time/localtime.c:1.136 src/lib/libc/time/localtime.c:1.137 --- src/lib/libc/time/localtime.c:1.136 Sun Dec 11 12:57:23 2022 +++ src/lib/libc/time/localtime.c Sun Jan 15 13:12:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: localtime.c,v 1.136 2022/12/11 17:57:23 christos Exp $ */ +/* $NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 christos Exp $ */ /* Convert timestamp from time_t to struct tm. */ @@ -12,7 +12,7 @@ #if 0 static char elsieid[] = "@(#)localtime.c 8.17"; #else -__RCSID("$NetBSD: localtime.c,v 1.136 2022/12/11 17:57:23 christos Exp $"); +__RCSID("$NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -894,7 +894,7 @@ is_digit(char c) ** Return a pointer to that character. */ -static ATTRIBUTE_REPRODUCIBLE const char * +ATTRIBUTE_REPRODUCIBLE static const char * getzname(register const char *strp) { register char c; @@ -915,7 +915,7 @@ getzname(register const char *strp) ** We don't do any checking here; checking is done later in common-case code. */ -static ATTRIBUTE_REPRODUCIBLE const char * +ATTRIBUTE_REPRODUCIBLE static const char * getqzname(register const char *strp, const int delim) { register int c; Index: src/lib/libc/time/private.h diff -u src/lib/libc/time/private.h:1.64 src/lib/libc/time/private.h:1.65 --- src/lib/libc/time/private.h:1.64 Sun Dec 11 12:57:23 2022 +++ src/lib/libc/time/private.h Sun Jan 15 13:12:37 2023 @@ -1,6 +1,6 @@ /* Private header for tzdb code. */ -/* $NetBSD: private.h,v 1.64 2022/12/11 17:57:23 christos Exp $ */ +/* $NetBSD: private.h,v 1.65 2023/01/15 18:12:37 christos Exp $ */ #ifndef PRIVATE_H #define PRIVATE_H @@ -646,7 +646,7 @@ char *asctime(struct tm const *); char *asctime_r(struct tm const *restrict, char *restrict); char *ctime(time_t const *); char *ctime_r(time_t const *, char *); -double difftime(time_t, time_t) ATTRIBUTE_UNSEQUENCED; +ATTRIBUTE_UNSEQUENCED double difftime(time_t, time_t); size_t strftime(char *restrict, size_t, char const *restrict, struct tm const *restrict); # if HAVE_STRFTIME_L @@ -762,10 +762,10 @@ timezone_t tzalloc(char const *); void tzfree(timezone_t); # ifdef STD_INSPIRED # if TZ_TIME_T || !defined posix2time_z -time_t posix2time_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE time_t posix2time_z(timezone_t __restrict, time_t); # endif # if TZ_TIME_T || !defined time2posix_z -time_t time2posix_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE time_t time2posix_z(timezone_t __restrict, time_t); # endif # endif #endif Index: src/lib/libc/time/zdump.c diff -u src/lib/libc/time/zdump.c:1.60 src/lib/libc/time/zdump.c:1.61 --- src/lib/libc/time/zdump.c:1.60 Tue Dec 13 14:08:42 2022 +++ src/lib/libc/time/zdump.c Sun Jan 15 13:12:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $ */ +/* $NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $ */ /* Dump time zone data in a textual format. */ /* @@ -8,7 +8,7 @@ #include #ifndef lint -__RCSID("$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $"); +__RCSID("$NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $"); #endif /* !defined lint */ #ifndef NETBSD_INSPIRED @@ -94,7 +94,7 @@ static bool warned; static bool errout; static char const *abbr(struct tm const *); -static intmax_t delta(struct tm *, struct tm *) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE static intmax_t delta(struct tm *, struct tm *); static void dumptime
CVS commit: src/etc/etc.next68k
Module Name:src Committed By: tsutsui Date: Sun Jan 15 16:45:32 UTC 2023 Modified Files: src/etc/etc.next68k: MAKEDEV.conf Log Message: Remove obsolete bpf entries not neceerary for clonified bpf(4). Fixes "MAKEDEV: bpf8: unknown device" errors. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/etc/etc.next68k/MAKEDEV.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/etc.next68k/MAKEDEV.conf diff -u src/etc/etc.next68k/MAKEDEV.conf:1.5 src/etc/etc.next68k/MAKEDEV.conf:1.6 --- src/etc/etc.next68k/MAKEDEV.conf:1.5 Sun Jul 9 05:58:13 2017 +++ src/etc/etc.next68k/MAKEDEV.conf Sun Jan 15 16:45:32 2023 @@ -1,10 +1,9 @@ -# $NetBSD: MAKEDEV.conf,v 1.5 2017/07/09 05:58:13 tsutsui Exp $ +# $NetBSD: MAKEDEV.conf,v 1.6 2023/01/15 16:45:32 tsutsui Exp $ all_md) makedev wscons sd0 sd1 sd2 sd3 tty0 tty1 makedev st0 st1 ch0 cd0 cd1 makedev ss0 uk0 uk1 - makedev bpf8 bpf9 bpf10 bpf11 makedev scsibus0 scsibus1 scsibus2 scsibus3 makedev ses0 ses1 ses2 ses3 ;;
CVS commit: src/etc/etc.next68k
Module Name:src Committed By: tsutsui Date: Sun Jan 15 16:45:32 UTC 2023 Modified Files: src/etc/etc.next68k: MAKEDEV.conf Log Message: Remove obsolete bpf entries not neceerary for clonified bpf(4). Fixes "MAKEDEV: bpf8: unknown device" errors. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/etc/etc.next68k/MAKEDEV.conf 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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 15:20:18 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: turn O(n^2) to O(n) for list of arguments to lint child processes Previously, adding an argument to the lint child processes (cpp, lint1, lint2) each time searched the list of arguments for the terminating null pointer and then reallocated the memory for storing the strings. Replace the above with a standard resizable array implementation and give it a proper name, to avoid 'char ***' in the code. The terminating null pointer in the lists is only required when passing the list to execvp. In all other cases it's not needed, so drop it. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.98 src/usr.bin/xlint/xlint/xlint.c:1.99 --- src/usr.bin/xlint/xlint/xlint.c:1.98 Sun Jan 15 14:43:39 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 15:20:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.98 2023/01/15 14:43:39 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.99 2023/01/15 15:20:18 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.98 2023/01/15 14:43:39 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.99 2023/01/15 15:20:18 rillig Exp $"); #endif #include @@ -62,25 +62,31 @@ __RCSID("$NetBSD: xlint.c,v 1.98 2023/01 #define DEFAULT_PATH _PATH_DEFPATH +typedef struct { + char **items; + size_t len; + size_t cap; +} list; + /* Parameters for the C preprocessor. */ static struct { - char **flags; /* flags always passed */ - char **lcflags; /* flags, controlled by sflag/tflag */ + list flags; /* flags always passed */ + list lcflags; /* flags, controlled by sflag/tflag */ char *outfile; /* path name for preprocessed C source */ int outfd; /* file descriptor for outfile */ -} cpp = { NULL, NULL, NULL, -1 }; +} cpp = { .outfd = -1 }; /* Parameters for lint1, which checks an isolated translation unit. */ static struct { - char **flags; - char **outfiles; + list flags; + list outfiles; } lint1; /* Parameters for lint2, which performs cross-translation-unit checks. */ static struct { - char **flags; - char **infiles; /* input files (without libraries) */ - char **inlibs; /* input libraries */ + list flags; + list infiles; /* input files (without libraries) */ + list inlibs; /* input libraries */ char *outlib; /* output library that will be created */ } lint2; @@ -88,13 +94,13 @@ static struct { static const char *tmpdir; /* default libraries */ -static char **deflibs; +static list deflibs; /* additional libraries */ -static char **libs; +static list libs; /* search path for libraries */ -static char **libsrchpath; +static list libsrchpath; static const char *libexec_dir; @@ -122,84 +128,54 @@ static const char *currfn; static const char target_prefix[] = TARGET_PREFIX; static void fname(const char *); -static void run_child(const char *, char *const *, const char *, int); -static void find_libs(char *const *); +static void run_child(const char *, list *, const char *, int); +static void find_libs(const list *); static bool file_is_readable(const char *); static void run_lint2(void); -static void cat(char *const *, const char *); - -static char ** -list_new(void) -{ - char **list; - - list = xcalloc(1, sizeof(*list)); - return list; -} +static void cat(const list *, const char *); static void -list_add_ref(char ***lstp, char *s) +list_add_ref(list *l, char *s) { - char **lst, **olst; - int i; - olst = *lstp; - for (i = 0; olst[i] != NULL; i++) - continue; - lst = xrealloc(olst, (i + 2) * sizeof(*lst)); - lst[i] = s; - lst[i + 1] = NULL; - *lstp = lst; + if (l->len >= l->cap) { + l->cap = 2 * l->len + 16; + l->items = xrealloc(l->items, sizeof(*l->items) * l->cap); + } + l->items[l->len++] = s; } static void -list_add(char ***lstp, const char *s) +list_add(list *l, const char *s) { - list_add_ref(lstp, xstrdup(s)); + list_add_ref(l, xstrdup(s)); } static void -list_add_unique(char ***lstp, const char *s) +list_add_unique(list *l, const char *s) { - for (char **p = *lstp; *p != NULL; p++) - if (strcmp(*p, s) == 0) + for (size_t i = 0; i < l->len; i++) + if (strcmp(l->items[i], s) == 0) return; - list_add(lstp, s); + list_add(l, s); } static void -list_add_all(char ***destp, char *const *src) +list_add_all(list *dst, const list *src) { - int i, k; - char **dest, **odest; - odest = *destp; - for (i = 0; odest[i] != NULL; i++) - continue; - for (k = 0; src[k] != NULL; k++) - continue; - dest = xrealloc(odest, (i + k + 1) * sizeof(*dest)); - for (k = 0; src[k] != NULL; k++) -
CVS commit: src/usr.bin/xlint/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 15:20:18 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: turn O(n^2) to O(n) for list of arguments to lint child processes Previously, adding an argument to the lint child processes (cpp, lint1, lint2) each time searched the list of arguments for the terminating null pointer and then reallocated the memory for storing the strings. Replace the above with a standard resizable array implementation and give it a proper name, to avoid 'char ***' in the code. The terminating null pointer in the lists is only required when passing the list to execvp. In all other cases it's not needed, so drop it. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 14:43:39 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: rename local functions to be more readable No functional change. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/usr.bin/xlint/xlint/xlint.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/xlint
Module Name:src Committed By: rillig Date: Sun Jan 15 14:43:39 UTC 2023 Modified Files: src/usr.bin/xlint/xlint: xlint.c Log Message: lint: rename local functions to be more readable No functional change. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.97 src/usr.bin/xlint/xlint/xlint.c:1.98 --- src/usr.bin/xlint/xlint/xlint.c:1.97 Sat Jan 14 10:38:36 2023 +++ src/usr.bin/xlint/xlint/xlint.c Sun Jan 15 14:43:39 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.97 2023/01/14 10:38:36 rillig Exp $ */ +/* $NetBSD: xlint.c,v 1.98 2023/01/15 14:43:39 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: xlint.c,v 1.97 2023/01/14 10:38:36 rillig Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.98 2023/01/15 14:43:39 rillig Exp $"); #endif #include @@ -122,9 +122,9 @@ static const char *currfn; static const char target_prefix[] = TARGET_PREFIX; static void fname(const char *); -static void runchild(const char *, char *const *, const char *, int); -static void findlibs(char *const *); -static bool rdok(const char *); +static void run_child(const char *, char *const *, const char *, int); +static void find_libs(char *const *); +static bool file_is_readable(const char *); static void run_lint2(void); static void cat(char *const *, const char *); @@ -203,6 +203,13 @@ list_clear(char ***lstp) } static void +pass_to_cpp(const char *opt) +{ + + list_add(&cpp.flags, opt); +} + +static void pass_to_lint1(const char *opt) { @@ -212,12 +219,8 @@ pass_to_lint1(const char *opt) static void pass_flag_to_lint1(int flag) { - char buf[3]; - buf[0] = '-'; - buf[1] = (char)flag; - buf[2] = '\0'; - pass_to_lint1(buf); + pass_to_lint1((const char[3]){ '-', (char)flag, '\0' }); } static void @@ -230,29 +233,19 @@ pass_to_lint2(const char *opt) static void pass_flag_to_lint2(int flag) { - char buf[3]; - buf[0] = '-'; - buf[1] = (char)flag; - buf[2] = '\0'; - pass_to_lint2(buf); -} - -static void -pass_to_cpp(const char *opt) -{ - - list_add(&cpp.flags, opt); + pass_to_lint2((const char[3]){ '-', (char)flag, '\0' }); } static char * concat2(const char *s1, const char *s2) { - char *s; - s = xmalloc(strlen(s1) + strlen(s2) + 1); - (void)strcpy(s, s1); - (void)strcat(s, s2); + size_t len1 = strlen(s1); + size_t len2 = strlen(s2); + char *s = xmalloc(len1 + len2 + 1); + memcpy(s, s1, len1); + memcpy(s + len1, s2, len2 + 1); return s; } @@ -614,8 +607,8 @@ main(int argc, char *argv[]) if ((ks = getenv("LIBDIR")) == NULL || strlen(ks) == 0) ks = PATH_LINTLIB; list_add(&libsrchpath, ks); - findlibs(libs); - findlibs(deflibs); + find_libs(libs); + find_libs(deflibs); } run_lint2(); @@ -710,7 +703,7 @@ fname(const char *name) terminate(-1); } - runchild(pathname, args, cpp.outfile, cpp.outfd); + run_child(pathname, args, cpp.outfile, cpp.outfd); free(pathname); list_clear(&args); @@ -732,7 +725,7 @@ fname(const char *name) list_add(&args, cpp.outfile); list_add(&args, ofn); - runchild(pathname, args, ofn, -1); + run_child(pathname, args, ofn, -1); free(pathname); list_clear(&args); @@ -776,7 +769,7 @@ needs_quoting: } static void -runchild(const char *path, char *const *args, const char *crfn, int fdout) +run_child(const char *path, char *const *args, const char *crfn, int fdout) { int status, rv, signo, i; @@ -842,12 +835,12 @@ findlib(const char *lib) for (dir = libsrchpath; *dir != NULL; dir++) { lfn = xasprintf("%s/llib-l%s.ln", *dir, lib); - if (rdok(lfn)) + if (file_is_readable(lfn)) goto found; free(lfn); lfn = xasprintf("%s/lint/llib-l%s.ln", *dir, lib); - if (rdok(lfn)) + if (file_is_readable(lfn)) goto found; free(lfn); } @@ -861,7 +854,7 @@ found: } static void -findlibs(char *const *liblst) +find_libs(char *const *liblst) { char *const *p; @@ -870,7 +863,7 @@ findlibs(char *const *liblst) } static bool -rdok(const char *path) +file_is_readable(const char *path) { struct stat sbuf; @@ -905,7 +898,7 @@ run_lint2(void) list_add_all(&args, lint2.inlibs); list_add_all(&args, lint2.infiles); - runchild(path, args, lint2.outlib, -1); + run_child(path, args, lint2.outlib, -1); free(path); list_clear(&args); free(args);
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 15 14:00:09 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: queries.c Log Message: tests/lint: document conversion from void pointer To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/queries.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/queries.c diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.8 src/tests/usr.bin/xlint/lint1/queries.c:1.9 --- src/tests/usr.bin/xlint/lint1/queries.c:1.8 Sun Jan 8 18:37:12 2023 +++ src/tests/usr.bin/xlint/lint1/queries.c Sun Jan 15 14:00:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: queries.c,v 1.8 2023/01/08 18:37:12 rillig Exp $ */ +/* $NetBSD: queries.c,v 1.9 2023/01/15 14:00:09 rillig Exp $ */ # 3 "queries.c" /* @@ -247,6 +247,12 @@ Q7(void) c64 = (c64_t)f32; + /* + * Converting a void pointer type to an object pointer type requires + * an explicit cast in C++, as it is a narrowing conversion. In C, + * that conversion is done implicitly. + */ + /* expect+1: redundant cast from 'pointer to void' to 'pointer to char' before assignment [Q7] */ str = (char *)allocate(); /* expect+1: redundant cast from 'pointer to void' to 'pointer to const char' before assignment [Q7] */
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 15 14:00:09 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: queries.c Log Message: tests/lint: document conversion from void pointer To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/queries.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: Sun Jan 15 13:55:06 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: fix test for sizeof with variable-length array To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.2 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.3 --- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.2 Sun Jan 15 13:30:04 2023 +++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c Sun Jan 15 13:55:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: expr_sizeof.c,v 1.2 2023/01/15 13:30:04 rillig Exp $ */ +/* $NetBSD: expr_sizeof.c,v 1.3 2023/01/15 13:55:06 rillig Exp $ */ # 3 "expr_sizeof.c" /* @@ -62,7 +62,12 @@ void variable_length_array(int n) { int local_arr[n + 5]; - /* FIXME: sizeof(local_arr) must be 20, not 4. */ + + /* + * Since the array length is not constant, it cannot be used in a + * typedef. Code like this are already rejected by the compiler. For + * simplicity, lint assumes that the array has length 1. + */ /* expect+1: error: negative array dimension (-4) [20] */ typedef int sizeof_local_arr[-(int)sizeof(local_arr)]; }
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 15 13:55:06 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: fix test for sizeof with variable-length array To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/expr_sizeof.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: Sun Jan 15 13:30:04 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: add more tests for sizeof To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.1 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.2 --- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.1 Sun Jan 15 00:53:19 2023 +++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c Sun Jan 15 13:30:04 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: expr_sizeof.c,v 1.1 2023/01/15 00:53:19 rillig Exp $ */ +/* $NetBSD: expr_sizeof.c,v 1.2 2023/01/15 13:30:04 rillig Exp $ */ # 3 "expr_sizeof.c" /* @@ -42,10 +42,27 @@ typedef int sizeof_paren_global_var[-(in /* * Even though 'sizeof(s)' may look like a function call expression, the * parentheses around 's' are ordinary parentheses and do not influence the - * associativity. Therefore, the '.' following the '(s)' takes precedence - * over the 'sizeof'. Same for the '->' following the '(ps)'. + * precedence. + * + * Therefore, the '.' following the '(s)' takes precedence over the 'sizeof'. + * Same for the '->' following the '(ps)'. Same for the '[0]' following the + * '(arr)'. */ /* expect+1: error: negative array dimension (-4) [20] */ typedef int sizeof_paren_global_struct_member[-(int)sizeof(s).member]; /* expect+1: error: negative array dimension (-4) [20] */ typedef int sizeof_paren_global_ptr_struct_member[-(int)sizeof(ps)->member]; +int arr[] = { 1, 2, 3 }; +/* expect+1: error: negative array dimension (-3) [20] */ +typedef int arr_count[-(int)sizeof(arr) / (int)sizeof(arr)[0]]; + +/* FIXME: 'n' is actually used, for the variable length array. */ +/* expect+2: warning: argument 'n' unused in function 'variable_length_array' [231] */ +void +variable_length_array(int n) +{ + int local_arr[n + 5]; + /* FIXME: sizeof(local_arr) must be 20, not 4. */ + /* expect+1: error: negative array dimension (-4) [20] */ + typedef int sizeof_local_arr[-(int)sizeof(local_arr)]; +}
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jan 15 13:30:04 UTC 2023 Modified Files: src/tests/usr.bin/xlint/lint1: expr_sizeof.c Log Message: tests/lint: add more tests for sizeof To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/expr_sizeof.c 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: skrll Date: Sun Jan 15 10:54:56 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: Sort in the binutils version selection To generate a diff of this commit: cvs rdiff -u -r1.1294 -r1.1295 src/share/mk/bsd.own.mk 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.own.mk diff -u src/share/mk/bsd.own.mk:1.1294 src/share/mk/bsd.own.mk:1.1295 --- src/share/mk/bsd.own.mk:1.1294 Sun Jan 15 10:51:04 2023 +++ src/share/mk/bsd.own.mk Sun Jan 15 10:54:56 2023 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1294 2023/01/15 10:51:04 skrll Exp $ +# $NetBSD: bsd.own.mk,v 1.1295 2023/01/15 10:54:56 skrll Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -98,11 +98,12 @@ MKGCCCMDS?= no # # What binutils is used? # -.if ${MACHINE_ARCH} == "x86_64" || \ -${MACHINE_ARCH} == "i386" || \ -${MACHINE_ARCH} == "alpha" || \ +.if \ !empty(MACHINE_ARCH:Maarch64*) || \ -!empty(MACHINE_ARCH:Msparc*) +${MACHINE_ARCH} == "alpha" || \ +${MACHINE_ARCH} == "i386" || \ +!empty(MACHINE_ARCH:Msparc*) || \ +${MACHINE_ARCH} == "x86_64" HAVE_BINUTILS?= 239 .else HAVE_BINUTILS?= 234
CVS commit: src/share/mk
Module Name:src Committed By: skrll Date: Sun Jan 15 10:54:56 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: Sort in the binutils version selection To generate a diff of this commit: cvs rdiff -u -r1.1294 -r1.1295 src/share/mk/bsd.own.mk 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: skrll Date: Sun Jan 15 10:51:04 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: Really switch aarch64 and sparc binutils to 2.39 To generate a diff of this commit: cvs rdiff -u -r1.1293 -r1.1294 src/share/mk/bsd.own.mk 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: skrll Date: Sun Jan 15 10:51:04 UTC 2023 Modified Files: src/share/mk: bsd.own.mk Log Message: Really switch aarch64 and sparc binutils to 2.39 To generate a diff of this commit: cvs rdiff -u -r1.1293 -r1.1294 src/share/mk/bsd.own.mk 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.own.mk diff -u src/share/mk/bsd.own.mk:1.1293 src/share/mk/bsd.own.mk:1.1294 --- src/share/mk/bsd.own.mk:1.1293 Sat Jan 14 14:46:24 2023 +++ src/share/mk/bsd.own.mk Sun Jan 15 10:51:04 2023 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1293 2023/01/14 14:46:24 christos Exp $ +# $NetBSD: bsd.own.mk,v 1.1294 2023/01/15 10:51:04 skrll Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -100,7 +100,7 @@ MKGCCCMDS?= no # .if ${MACHINE_ARCH} == "x86_64" || \ ${MACHINE_ARCH} == "i386" || \ -${MACHINE_ARCH} == "alpha" || \\ +${MACHINE_ARCH} == "alpha" || \ !empty(MACHINE_ARCH:Maarch64*) || \ !empty(MACHINE_ARCH:Msparc*) HAVE_BINUTILS?= 239
CVS commit: src/doc
Module Name:src Committed By: wiz Date: Sun Jan 15 09:00:05 UTC 2023 Modified Files: src/doc: 3RDPARTY Log Message: doc: update binutils entry to include 2.39 Note that 2.40 is out. To generate a diff of this commit: cvs rdiff -u -r1.1907 -r1.1908 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: wiz Date: Sun Jan 15 09:00:05 UTC 2023 Modified Files: src/doc: 3RDPARTY Log Message: doc: update binutils entry to include 2.39 Note that 2.40 is out. To generate a diff of this commit: cvs rdiff -u -r1.1907 -r1.1908 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1907 src/doc/3RDPARTY:1.1908 --- src/doc/3RDPARTY:1.1907 Thu Jan 12 10:22:19 2023 +++ src/doc/3RDPARTY Sun Jan 15 09:00:05 2023 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1907 2023/01/12 10:22:19 wiz Exp $ +# $NetBSD: 3RDPARTY,v 1.1908 2023/01/15 09:00:05 wiz Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -498,12 +498,12 @@ When updating GDB, it is imperative to t ("options KGDB") works correctly. Package: binutils -Version: 2.34 -Current Vers: 2.39 +Version: 2.34/2.39 +Current Vers: 2.40 Maintainer: FSF Archive Site: ftp://ftp.gnu.org/gnu/binutils/ Home Page: https://www.gnu.org/software/binutils/ -Date: 2022-08-06 +Date: 2023-01-15 Mailing List: bug-gnu-ut...@gnu.org Responsible: thorpej, mrg License: GPLv3, LGPLv3, GPLv2, LGPLv2, BSD
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sun Jan 15 08:43:04 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix strnlen with a large maxlen argument by using unsigned comparison conditions - from mlelstv. I had a similar, but not quite as good patch. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/strlen_arm.S 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/arch/arm/string/strlen_arm.S diff -u src/common/lib/libc/arch/arm/string/strlen_arm.S:1.10 src/common/lib/libc/arch/arm/string/strlen_arm.S:1.11 --- src/common/lib/libc/arch/arm/string/strlen_arm.S:1.10 Sat Dec 3 11:34:38 2022 +++ src/common/lib/libc/arch/arm/string/strlen_arm.S Sun Jan 15 08:43:03 2023 @@ -29,7 +29,7 @@ #include -RCSID("$NetBSD: strlen_arm.S,v 1.10 2022/12/03 11:34:38 skrll Exp $") +RCSID("$NetBSD: strlen_arm.S,v 1.11 2023/01/15 08:43:03 skrll Exp $") #if defined(__thumb__) && !defined(_ARM_ARCH_T2) #error Only Thumb2 or ARM supported @@ -102,7 +102,7 @@ ENTRY(FUNCNAME) .Lmain_loop: #ifdef STRNLEN cmp r0, r5 /* gone too far? */ - bge .Lmaxed_out /* yes, return maxlen */ + bhs .Lmaxed_out /* yes, return maxlen */ #endif ldr r3, [r0], #4 /* load next word */ #if defined(_ARM_ARCH_6) @@ -164,9 +164,9 @@ ENTRY(FUNCNAME) #ifdef STRNLEN cmp r0, r4 /* is it larger than maxlen? */ #ifdef __thumb__ - it gt + it hi #endif - movgt r0, r4 /* yes, return maxlen */ + movhi r0, r4 /* yes, return maxlen */ pop {r4, r5} /* restore registers */ #endif RET/* return */
CVS commit: src/common/lib/libc/arch/arm/string
Module Name:src Committed By: skrll Date: Sun Jan 15 08:43:04 UTC 2023 Modified Files: src/common/lib/libc/arch/arm/string: strlen_arm.S Log Message: Fix strnlen with a large maxlen argument by using unsigned comparison conditions - from mlelstv. I had a similar, but not quite as good patch. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/arm/string/strlen_arm.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.