CVS commit: src/sys/kern
Module Name:src Committed By: thorpej Date: Sun Sep 26 03:42:54 UTC 2021 Modified Files: src/sys/kern: sys_eventfd.c sys_timerfd.c Log Message: eventfd and timerfd have MPSAFE kq filterops. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/kern/sys_eventfd.c cvs rdiff -u -r1.4 -r1.5 src/sys/kern/sys_timerfd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/sys_eventfd.c diff -u src/sys/kern/sys_eventfd.c:1.5 src/sys/kern/sys_eventfd.c:1.6 --- src/sys/kern/sys_eventfd.c:1.5 Sun Sep 26 01:16:10 2021 +++ src/sys/kern/sys_eventfd.c Sun Sep 26 03:42:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_eventfd.c,v 1.5 2021/09/26 01:16:10 thorpej Exp $ */ +/* $NetBSD: sys_eventfd.c,v 1.6 2021/09/26 03:42:54 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.5 2021/09/26 01:16:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_eventfd.c,v 1.6 2021/09/26 03:42:54 thorpej Exp $"); /* * eventfd @@ -425,7 +425,7 @@ eventfd_filt_read(struct knote * const k } static const struct filterops eventfd_read_filterops = { - .f_flags = FILTEROP_ISFD, + .f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE, .f_detach = eventfd_filt_read_detach, .f_event = eventfd_filt_read, }; @@ -462,7 +462,7 @@ eventfd_filt_write(struct knote * const } static const struct filterops eventfd_write_filterops = { - .f_flags = FILTEROP_ISFD, + .f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE, .f_detach = eventfd_filt_write_detach, .f_event = eventfd_filt_write, }; Index: src/sys/kern/sys_timerfd.c diff -u src/sys/kern/sys_timerfd.c:1.4 src/sys/kern/sys_timerfd.c:1.5 --- src/sys/kern/sys_timerfd.c:1.4 Sun Sep 26 01:16:10 2021 +++ src/sys/kern/sys_timerfd.c Sun Sep 26 03:42:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_timerfd.c,v 1.4 2021/09/26 01:16:10 thorpej Exp $ */ +/* $NetBSD: sys_timerfd.c,v 1.5 2021/09/26 03:42:54 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.4 2021/09/26 01:16:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_timerfd.c,v 1.5 2021/09/26 03:42:54 thorpej Exp $"); /* * timerfd @@ -421,7 +421,7 @@ timerfd_filt_read(struct knote * const k } static const struct filterops timerfd_read_filterops = { - .f_flags = FILTEROP_ISFD, + .f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE, .f_detach = timerfd_filt_read_detach, .f_event = timerfd_filt_read, };
CVS commit: src/sys/kern
Module Name:src Committed By: thorpej Date: Sun Sep 26 03:42:54 UTC 2021 Modified Files: src/sys/kern: sys_eventfd.c sys_timerfd.c Log Message: eventfd and timerfd have MPSAFE kq filterops. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/kern/sys_eventfd.c cvs rdiff -u -r1.4 -r1.5 src/sys/kern/sys_timerfd.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/make
Module Name:src Committed By: rillig Date: Sun Sep 26 03:23:06 UTC 2021 Modified Files: src/usr.bin/make: cond.c Log Message: make: fix lint warning on i386 cond.c(800): warning: argument #3 is converted from 'unsigned char' to 'unsigned int' due to prototype [259] To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/cond.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.279 src/usr.bin/make/cond.c:1.280 --- src/usr.bin/make/cond.c:1.279 Tue Sep 21 23:06:18 2021 +++ src/usr.bin/make/cond.c Sun Sep 26 03:23:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.279 2021/09/21 23:06:18 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.280 2021/09/26 03:23:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -95,7 +95,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.279 2021/09/21 23:06:18 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.280 2021/09/26 03:23:06 rillig Exp $"); /* * The parsing of conditional expressions is based on this grammar: @@ -189,9 +189,9 @@ static unsigned int cond_min_depth = 0; static const char opname[][3] = { "<", "<=", ">", ">=", "==", "!=" }; static bool -is_token(const char *str, const char *tok, size_t len) +is_token(const char *str, const char *tok, unsigned char len) { - return strncmp(str, tok, len) == 0 && !ch_isalpha(str[len]); + return strncmp(str, tok, (size_t)len) == 0 && !ch_isalpha(str[len]); } static Token
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Sep 26 03:23:06 UTC 2021 Modified Files: src/usr.bin/make: cond.c Log Message: make: fix lint warning on i386 cond.c(800): warning: argument #3 is converted from 'unsigned char' to 'unsigned int' due to prototype [259] To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/cond.c 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 Sep 26 03:18:00 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh Added Files: src/tests/usr.bin/xlint/lint1: platform_ilp32.c platform_ilp32.exp platform_int.c platform_int.exp platform_ldbl128.c platform_ldbl128.exp platform_ldbl64.c platform_ldbl64.exp platform_ldbl96.c platform_ldbl96.exp platform_long.c platform_long.exp platform_lp64.c platform_lp64.exp platform_schar.c platform_schar.exp platform_uchar.c platform_uchar.exp Log Message: tests/lint: add tests for platform characteristics Running lint in usr.bin/make on i386 fails due to this warning: cond.c(800): warning: argument #3 is converted from 'unsigned char' to 'unsigned int' due to prototype [259] This warning only occurred on i386 but not on sparc or x86_64. Try to reproduce the test situation in platform_int. The platform code in t_integration.sh was not strict enough, it didn't check for multiple conditions, such as in msg_132_ilp32. That test was only supposed to run on ILP32 platforms where size_t is unsigned int. It also ran on sparc, even though size_t is long there. To generate a diff of this commit: cvs rdiff -u -r1.1129 -r1.1130 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.112 -r1.113 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/platform_ilp32.c \ src/tests/usr.bin/xlint/lint1/platform_ilp32.exp \ src/tests/usr.bin/xlint/lint1/platform_int.c \ src/tests/usr.bin/xlint/lint1/platform_int.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl128.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl64.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl64.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl96.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl96.exp \ src/tests/usr.bin/xlint/lint1/platform_long.c \ src/tests/usr.bin/xlint/lint1/platform_long.exp \ src/tests/usr.bin/xlint/lint1/platform_lp64.c \ src/tests/usr.bin/xlint/lint1/platform_lp64.exp \ src/tests/usr.bin/xlint/lint1/platform_schar.c \ src/tests/usr.bin/xlint/lint1/platform_schar.exp \ src/tests/usr.bin/xlint/lint1/platform_uchar.c \ src/tests/usr.bin/xlint/lint1/platform_uchar.exp cvs rdiff -u -r1.70 -r1.71 src/tests/usr.bin/xlint/lint1/t_integration.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Sep 26 03:18:00 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh Added Files: src/tests/usr.bin/xlint/lint1: platform_ilp32.c platform_ilp32.exp platform_int.c platform_int.exp platform_ldbl128.c platform_ldbl128.exp platform_ldbl64.c platform_ldbl64.exp platform_ldbl96.c platform_ldbl96.exp platform_long.c platform_long.exp platform_lp64.c platform_lp64.exp platform_schar.c platform_schar.exp platform_uchar.c platform_uchar.exp Log Message: tests/lint: add tests for platform characteristics Running lint in usr.bin/make on i386 fails due to this warning: cond.c(800): warning: argument #3 is converted from 'unsigned char' to 'unsigned int' due to prototype [259] This warning only occurred on i386 but not on sparc or x86_64. Try to reproduce the test situation in platform_int. The platform code in t_integration.sh was not strict enough, it didn't check for multiple conditions, such as in msg_132_ilp32. That test was only supposed to run on ILP32 platforms where size_t is unsigned int. It also ran on sparc, even though size_t is long there. To generate a diff of this commit: cvs rdiff -u -r1.1129 -r1.1130 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.112 -r1.113 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/platform_ilp32.c \ src/tests/usr.bin/xlint/lint1/platform_ilp32.exp \ src/tests/usr.bin/xlint/lint1/platform_int.c \ src/tests/usr.bin/xlint/lint1/platform_int.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl128.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl128.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl64.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl64.exp \ src/tests/usr.bin/xlint/lint1/platform_ldbl96.c \ src/tests/usr.bin/xlint/lint1/platform_ldbl96.exp \ src/tests/usr.bin/xlint/lint1/platform_long.c \ src/tests/usr.bin/xlint/lint1/platform_long.exp \ src/tests/usr.bin/xlint/lint1/platform_lp64.c \ src/tests/usr.bin/xlint/lint1/platform_lp64.exp \ src/tests/usr.bin/xlint/lint1/platform_schar.c \ src/tests/usr.bin/xlint/lint1/platform_schar.exp \ src/tests/usr.bin/xlint/lint1/platform_uchar.c \ src/tests/usr.bin/xlint/lint1/platform_uchar.exp cvs rdiff -u -r1.70 -r1.71 src/tests/usr.bin/xlint/lint1/t_integration.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1129 src/distrib/sets/lists/tests/mi:1.1130 --- src/distrib/sets/lists/tests/mi:1.1129 Sat Sep 25 13:06:05 2021 +++ src/distrib/sets/lists/tests/mi Sun Sep 26 03:17:59 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1129 2021/09/25 13:06:05 rillig Exp $ +# $NetBSD: mi,v 1.1130 2021/09/26 03:17:59 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7056,6 +7056,24 @@ ./usr/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_type_name.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_type_name.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ilp32.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ilp32.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_int.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_int.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl128.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl128.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl64.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl64.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl96.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_ldbl96.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_long.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_long.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_lp64.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_lp64.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_schar.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_schar.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/platform_uchar.c tests-usr.bin-tests compattestfile,atf
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Sep 26 03:12:50 UTC 2021 Modified Files: src/sys/kern: kern_event.c src/sys/sys: event.h Log Message: - Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements. No functional change, since no filterops yet define FILTEROP_MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/kern/kern_event.c cvs rdiff -u -r1.41 -r1.42 src/sys/sys/event.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/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.121 src/sys/kern/kern_event.c:1.122 --- src/sys/kern/kern_event.c:1.121 Sun Sep 26 01:16:10 2021 +++ src/sys/kern/kern_event.c Sun Sep 26 03:12:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.121 2021/09/26 01:16:10 thorpej Exp $ */ +/* $NetBSD: kern_event.c,v 1.122 2021/09/26 03:12:50 thorpej Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.121 2021/09/26 01:16:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.122 2021/09/26 03:12:50 thorpej Exp $"); #include #include @@ -143,6 +143,12 @@ static const struct filterops proc_filto .f_event = filt_proc, }; +/* + * file_filtops is not marked MPSAFE because it's going to call + * fileops::fo_kqfilter(), which might not be. That function, + * however, will override the knote's filterops, and thus will + * inherit the MPSAFE-ness of the back-end at that time. + */ static const struct filterops file_filtops = { .f_flags = FILTEROP_ISFD, .f_attach = filt_fileattach, @@ -241,6 +247,69 @@ static size_t user_kfiltersz; /* size static krwlock_t kqueue_filter_lock; /* lock on filter lists */ static kmutex_t kqueue_misc_lock; /* miscellaneous */ +static int +filter_attach(struct knote *kn) +{ + int rv; + + KASSERT(kn->kn_fop != NULL); + KASSERT(kn->kn_fop->f_attach != NULL); + + /* + * N.B. that kn->kn_fop may change as the result of calling + * f_attach(). + */ + if (kn->kn_fop->f_flags & FILTEROP_MPSAFE) { + rv = kn->kn_fop->f_attach(kn); + } else { + KERNEL_LOCK(1, NULL); + rv = kn->kn_fop->f_attach(kn); + KERNEL_UNLOCK_ONE(NULL); + } + + return rv; +} + +static void +filter_detach(struct knote *kn) +{ + KASSERT(kn->kn_fop != NULL); + KASSERT(kn->kn_fop->f_detach != NULL); + + if (kn->kn_fop->f_flags & FILTEROP_MPSAFE) { + kn->kn_fop->f_detach(kn); + } else { + KERNEL_LOCK(1, NULL); + kn->kn_fop->f_detach(kn); + KERNEL_UNLOCK_ONE(NULL); + } +} + +static int +filter_event(struct knote *kn, long hint) +{ + int rv; + + KASSERT(kn->kn_fop != NULL); + KASSERT(kn->kn_fop->f_event != NULL); + + if (kn->kn_fop->f_flags & FILTEROP_MPSAFE) { + rv = kn->kn_fop->f_event(kn, hint); + } else { + KERNEL_LOCK(1, NULL); + rv = kn->kn_fop->f_event(kn, hint); + KERNEL_UNLOCK_ONE(NULL); + } + + return rv; +} + +static void +filter_touch(struct knote *kn, struct kevent *kev, long type) +{ + kn->kn_fop->f_touch(kn, kev, type); +} + static kauth_listener_t kqueue_listener; static int @@ -1233,9 +1302,11 @@ kqueue_register(struct kqueue *kq, struc } SLIST_INSERT_HEAD(list, kn, kn_link); - KERNEL_LOCK(1, NULL); /* XXXSMP */ - error = (*kfilter->filtops->f_attach)(kn); - KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */ + /* + * N.B. kn->kn_fop may change as the result + * of filter_attach()! + */ + error = filter_attach(kn); if (error != 0) { #ifdef DEBUG struct proc *p = curlwp->l_proc; @@ -1277,7 +1348,7 @@ kqueue_register(struct kqueue *kq, struc if (!(kn->kn_fop->f_flags & FILTEROP_ISFD) && kn->kn_fop->f_touch != NULL) { mutex_spin_enter(>kq_lock); - (*kn->kn_fop->f_touch)(kn, kev, EVENT_REGISTER); + filter_touch(kn, kev, EVENT_REGISTER); mutex_spin_exit(>kq_lock); } else { kn->kn_sfflags = kev->fflags; @@ -1291,11 +1362,7 @@ kqueue_register(struct kqueue *kq, struc * broken and does not return an error. */ done_ev_add: - KASSERT(kn->kn_fop != NULL); - KASSERT(kn->kn_fop->f_event != NULL); - KERNEL_LOCK(1, NULL); /* XXXSMP */ - rv = (*kn->kn_fop->f_event)(kn, 0); - KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */ + rv = filter_event(kn, 0); if (rv) knote_activate(kn); @@ -1507,12 +1574,8 @@ relock: } if ((kn->kn_flags & EV_ONESHOT) == 0) { mutex_spin_exit(>kq_lock); - KASSERT(kn->kn_fop != NULL); - KASSERT(kn->kn_fop->f_event != NULL); - KERNEL_LOCK(1, NULL); /* XXXSMP */ KASSERT(mutex_owned(>fd_lock)); - rv = (*kn->kn_fop->f_event)(kn, 0); - KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */ + rv = filter_event(kn, 0); mutex_spin_enter(>kq_lock); /* Re-poll if note was re-enqueued. */ if ((kn->kn_status & KN_QUEUED) != 0) { @@ -1538,7
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Sep 26 03:12:50 UTC 2021 Modified Files: src/sys/kern: kern_event.c src/sys/sys: event.h Log Message: - Define a new filterops flag FILTEROP_MPSAFE, which states that the kqueue filter does not require the KERNEL_LOCK to be held. - Add wrappers around the calls into the filterops that take care of the locking requirements. No functional change, since no filterops yet define FILTEROP_MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/kern/kern_event.c cvs rdiff -u -r1.41 -r1.42 src/sys/sys/event.h 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: Sun Sep 26 01:28:43 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix Bison warnings cgram.y:998.11-35: warning: type clash on default action: != <> [-Wother] No functional change. To generate a diff of this commit: cvs rdiff -u -r1.366 -r1.367 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: Sun Sep 26 01:28:43 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix Bison warnings cgram.y:998.11-35: warning: type clash on default action: != <> [-Wother] No functional change. To generate a diff of this commit: cvs rdiff -u -r1.366 -r1.367 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.366 src/usr.bin/xlint/lint1/cgram.y:1.367 --- src/usr.bin/xlint/lint1/cgram.y:1.366 Fri Sep 17 21:06:04 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Sep 26 01:28:43 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.366 2021/09/17 21:06:04 christos Exp $ */ +/* $NetBSD: cgram.y,v 1.367 2021/09/26 01:28:43 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.366 2021/09/17 21:06:04 christos Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.367 2021/09/26 01:28:43 rillig Exp $"); #endif #include @@ -995,7 +995,9 @@ struct_declaration: /* C99 6.7.2.1 */ $$ = NULL; } } - | static_assert_declaration + | static_assert_declaration { + $$ = NULL; + } | error T_SEMI { symtyp = FVFT; $$ = NULL;
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Sep 26 01:16:11 UTC 2021 Modified Files: src/sys/arch/amiga/dev: event.c src/sys/arch/arc/dev: opms.c src/sys/arch/arm/xscale: pxa2x0_apm.c src/sys/arch/atari/dev: event.c src/sys/arch/landisk/dev: button.c src/sys/arch/mac68k/dev: aed.c src/sys/arch/macppc/dev: aed.c apm.c src/sys/arch/mips/ralink: ralink_gpio.c src/sys/arch/sandpoint/sandpoint: satmgr.c src/sys/arch/sparc/dev: tctrl.c src/sys/arch/x68k/dev: event.c src/sys/coda: coda_psdev.c src/sys/dev: midi.c sequencer.c src/sys/dev/apm: apm.c src/sys/dev/audio: audio.c src/sys/dev/hpc/apm: apmdev.c src/sys/dev/ir: irframe_tty.c src/sys/dev/pci: oboe.c vio9p.c xmm7360.c src/sys/dev/putter: putter.c src/sys/dev/qbus: qd.c src/sys/dev/sbus: bpp.c src/sys/dev/scsipi: ch.c src/sys/dev/sun: event.c src/sys/dev/sysmon: sysmon_power.c src/sys/dev/usb: udsir.c ugen.c uhid.c uirda.c usb.c ustir.c src/sys/dev/wscons: wsevent.c src/sys/external/bsd/drm2/drm: drm_cdevsw.c src/sys/kern: kern_entropy.c kern_event.c kern_sig.c subr_log.c sys_eventfd.c sys_pipe.c sys_timerfd.c tty.c tty_pty.c uipc_socket.c src/sys/miscfs/fifofs: fifo_vnops.c src/sys/miscfs/genfs: genfs_vnops.c src/sys/net: bpf.c if_tap.c if_tun.c src/sys/nfs: nfs_kq.c src/sys/sys: event.h param.h Log Message: Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD. This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed. NetBSD 9.99.89 To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amiga/dev/event.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arc/dev/opms.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/xscale/pxa2x0_apm.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/dev/event.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/landisk/dev/button.c cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/dev/aed.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/aed.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/apm.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/ralink/ralink_gpio.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/sandpoint/satmgr.c cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sparc/dev/tctrl.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/dev/event.c cvs rdiff -u -r1.59 -r1.60 src/sys/coda/coda_psdev.c cvs rdiff -u -r1.94 -r1.95 src/sys/dev/midi.c cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sequencer.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/apm/apm.c cvs rdiff -u -r1.107 -r1.108 src/sys/dev/audio/audio.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/hpc/apm/apmdev.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/ir/irframe_tty.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/oboe.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/vio9p.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/xmm7360.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/putter/putter.c cvs rdiff -u -r1.58 -r1.59 src/sys/dev/qbus/qd.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/bpp.c cvs rdiff -u -r1.93 -r1.94 src/sys/dev/scsipi/ch.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sun/event.c cvs rdiff -u -r1.66 -r1.67 src/sys/dev/sysmon/sysmon_power.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/udsir.c cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.117 -r1.118 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/uirda.c cvs rdiff -u -r1.196 -r1.197 src/sys/dev/usb/usb.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/ustir.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsevent.c cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/drm/drm_cdevsw.c cvs rdiff -u -r1.31 -r1.32 src/sys/kern/kern_entropy.c cvs rdiff -u -r1.120 -r1.121 src/sys/kern/kern_event.c cvs rdiff -u -r1.397 -r1.398 src/sys/kern/kern_sig.c cvs rdiff -u -r1.60 -r1.61 src/sys/kern/subr_log.c cvs rdiff -u -r1.4 -r1.5 src/sys/kern/sys_eventfd.c cvs rdiff -u -r1.153 -r1.154 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.3 -r1.4 src/sys/kern/sys_timerfd.c cvs rdiff -u -r1.295 -r1.296 src/sys/kern/tty.c src/sys/kern/uipc_socket.c cvs rdiff -u -r1.146 -r1.147 src/sys/kern/tty_pty.c cvs rdiff -u -r1.83 -r1.84 src/sys/miscfs/fifofs/fifo_vnops.c cvs rdiff -u -r1.211 -r1.212 src/sys/miscfs/genfs/genfs_vnops.c cvs rdiff -u -r1.242 -r1.243 src/sys/net/bpf.c cvs rdiff -u -r1.122 -r1.123 src/sys/net/if_tap.c cvs rdiff -u -r1.162 -r1.163 src/sys/net/if_tun.c cvs rdiff -u -r1.27 -r1.28 src/sys/nfs/nfs_kq.c cvs rdiff -u -r1.40 -r1.41 src/sys/sys/event.h cvs rdiff -u -r1.701 -r1.702 src/sys/sys/param.h Please note that diffs are
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Sun Sep 26 01:16:11 UTC 2021 Modified Files: src/sys/arch/amiga/dev: event.c src/sys/arch/arc/dev: opms.c src/sys/arch/arm/xscale: pxa2x0_apm.c src/sys/arch/atari/dev: event.c src/sys/arch/landisk/dev: button.c src/sys/arch/mac68k/dev: aed.c src/sys/arch/macppc/dev: aed.c apm.c src/sys/arch/mips/ralink: ralink_gpio.c src/sys/arch/sandpoint/sandpoint: satmgr.c src/sys/arch/sparc/dev: tctrl.c src/sys/arch/x68k/dev: event.c src/sys/coda: coda_psdev.c src/sys/dev: midi.c sequencer.c src/sys/dev/apm: apm.c src/sys/dev/audio: audio.c src/sys/dev/hpc/apm: apmdev.c src/sys/dev/ir: irframe_tty.c src/sys/dev/pci: oboe.c vio9p.c xmm7360.c src/sys/dev/putter: putter.c src/sys/dev/qbus: qd.c src/sys/dev/sbus: bpp.c src/sys/dev/scsipi: ch.c src/sys/dev/sun: event.c src/sys/dev/sysmon: sysmon_power.c src/sys/dev/usb: udsir.c ugen.c uhid.c uirda.c usb.c ustir.c src/sys/dev/wscons: wsevent.c src/sys/external/bsd/drm2/drm: drm_cdevsw.c src/sys/kern: kern_entropy.c kern_event.c kern_sig.c subr_log.c sys_eventfd.c sys_pipe.c sys_timerfd.c tty.c tty_pty.c uipc_socket.c src/sys/miscfs/fifofs: fifo_vnops.c src/sys/miscfs/genfs: genfs_vnops.c src/sys/net: bpf.c if_tap.c if_tun.c src/sys/nfs: nfs_kq.c src/sys/sys: event.h param.h Log Message: Change the kqueue filterops::f_isfd field to filterops::f_flags, and define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd. Field and flag name aligned with OpenBSD. This does not constitute a functional or ABI change, as the field location and size, and the value placed in that field, are the same as the previous code, but we're bumping __NetBSD_Version__ so 3rd-party module source code can adapt, as needed. NetBSD 9.99.89 To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amiga/dev/event.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arc/dev/opms.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/xscale/pxa2x0_apm.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/dev/event.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/landisk/dev/button.c cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mac68k/dev/aed.c cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/aed.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/apm.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/ralink/ralink_gpio.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/sandpoint/satmgr.c cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sparc/dev/tctrl.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/dev/event.c cvs rdiff -u -r1.59 -r1.60 src/sys/coda/coda_psdev.c cvs rdiff -u -r1.94 -r1.95 src/sys/dev/midi.c cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sequencer.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/apm/apm.c cvs rdiff -u -r1.107 -r1.108 src/sys/dev/audio/audio.c cvs rdiff -u -r1.33 -r1.34 src/sys/dev/hpc/apm/apmdev.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/ir/irframe_tty.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/oboe.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/vio9p.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/xmm7360.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/putter/putter.c cvs rdiff -u -r1.58 -r1.59 src/sys/dev/qbus/qd.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/sbus/bpp.c cvs rdiff -u -r1.93 -r1.94 src/sys/dev/scsipi/ch.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sun/event.c cvs rdiff -u -r1.66 -r1.67 src/sys/dev/sysmon/sysmon_power.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/udsir.c cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.117 -r1.118 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/uirda.c cvs rdiff -u -r1.196 -r1.197 src/sys/dev/usb/usb.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/ustir.c cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsevent.c cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/drm/drm_cdevsw.c cvs rdiff -u -r1.31 -r1.32 src/sys/kern/kern_entropy.c cvs rdiff -u -r1.120 -r1.121 src/sys/kern/kern_event.c cvs rdiff -u -r1.397 -r1.398 src/sys/kern/kern_sig.c cvs rdiff -u -r1.60 -r1.61 src/sys/kern/subr_log.c cvs rdiff -u -r1.4 -r1.5 src/sys/kern/sys_eventfd.c cvs rdiff -u -r1.153 -r1.154 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.3 -r1.4 src/sys/kern/sys_timerfd.c cvs rdiff -u -r1.295 -r1.296 src/sys/kern/tty.c src/sys/kern/uipc_socket.c cvs rdiff -u -r1.146 -r1.147 src/sys/kern/tty_pty.c cvs rdiff -u -r1.83 -r1.84 src/sys/miscfs/fifofs/fifo_vnops.c cvs rdiff -u -r1.211 -r1.212 src/sys/miscfs/genfs/genfs_vnops.c cvs rdiff -u -r1.242 -r1.243 src/sys/net/bpf.c cvs rdiff -u -r1.122 -r1.123 src/sys/net/if_tap.c cvs rdiff -u -r1.162 -r1.163 src/sys/net/if_tun.c cvs rdiff -u -r1.27 -r1.28 src/sys/nfs/nfs_kq.c cvs rdiff -u -r1.40 -r1.41 src/sys/sys/event.h cvs rdiff -u -r1.701 -r1.702 src/sys/sys/param.h Please note that diffs are
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Sep 26 00:57:28 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: handle special options separately Handling the special options separately removes the need for several macro definitions. It saves a bit of memory since without the option '--version', the option names are shorter. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/indent/args.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.31 src/usr.bin/indent/args.c:1.32 --- src/usr.bin/indent/args.c:1.31 Sat Sep 25 23:38:45 2021 +++ src/usr.bin/indent/args.c Sun Sep 26 00:57:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.31 2021/09/25 23:38:45 rillig Exp $ */ +/* $NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.31 2021/09/25 23:38:45 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #include #include #include -#include #include #include #include @@ -65,53 +64,34 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #define INDENT_VERSION "2.0" -/* profile types */ -#define PRO_SPECIAL 1 /* special case */ -#define PRO_BOOL 2 /* boolean */ -#define PRO_INT 3 /* integer */ - -/* profile specials for specials */ -#define IGN 1 /* ignore it */ -#define CLI 2 /* case label indent (float) */ -#define STDIN 3 /* use stdin */ -#define KEY 4 /* type (keyword) */ -#define KEY_FILE 5 /* only used for args */ -#define VERSION 6 /* only used for args */ - static void scan_profile(FILE *); - -const char *option_source = "?"; - void add_typedefs_from_file(const char *); +static const char *option_source = "?"; + #if __STDC_VERSION__ >= 201112L #define assert_type(expr, type) _Generic((expr), type : (expr)) #else #define assert_type(expr, type) (expr) #endif #define bool_option(name, value, var) \ - {name, PRO_BOOL, /*CONSTCOND*/(value) ? 1 : 0, \ - assert_type(&(var), bool *)} + {name, true, value, assert_type(&(var), bool *)} #define int_option(name, var) \ - {name, PRO_INT, 0, assert_type(&(var), int *)} -#define special_option(name, value) \ - {name, PRO_SPECIAL, assert_type(value, int), NULL} + {name, false, false, assert_type(&(var), int *)} /* * N.B.: because of the way the table here is scanned, options whose names are * a prefix of other options must occur later; that is, with -lp vs -l, -lp * must be first and -l must be last. + * + * See also set_special_option. */ static const struct pro { -const char p_name[9]; /* name, e.g. "bl", "cli" */ -uint8_t p_type; /* type (int, bool, special) */ -int p_special; /* depends on type */ +const char p_name[6]; /* name, e.g. "bl", "cli" */ +bool p_is_bool; +bool p_bool_value; void*p_obj; /* the associated variable (bool, int) */ } pro[] = { -special_option("T", KEY), -special_option("U", KEY_FILE), -special_option("-version", VERSION), -special_option("P", IGN), bool_option("bacc", true, opt.blanklines_around_conditional_compilation), bool_option("badp", true, opt.blanklines_after_declarations_at_proctop), bool_option("bad", true, opt.blanklines_after_declarations), @@ -125,7 +105,6 @@ static const struct pro { int_option("cd", opt.decl_comment_column), bool_option("ce", true, opt.cuddle_else), int_option("ci", opt.continuation_indent), -special_option("cli", CLI), bool_option("cs", true, opt.space_after_cast), int_option("c", opt.comment_column), int_option("di", opt.decl_indent), @@ -163,7 +142,6 @@ static const struct pro { bool_option("nlpl", false, opt.lineup_to_parens_always), bool_option("nlp", false, opt.lineup_to_parens), bool_option("npcs", false, opt.proc_calls_space), -special_option("npro", IGN), bool_option("npsl", false, opt.procnames_start_line), bool_option("nsc", false, opt.star_comment_cont), bool_option("nsob", false, opt.swallow_optional_blanklines), @@ -173,13 +151,10 @@ static const struct pro { bool_option("psl", true, opt.procnames_start_line), bool_option("sc", true, opt.star_comment_cont), bool_option("sob", true, opt.swallow_optional_blanklines), -special_option("st", STDIN), bool_option("ta", true, opt.auto_typedefs), int_option("ts", opt.tabsize), bool_option("ut", true, opt.use_tabs), bool_option("v", true, opt.verbose), -/* whew! */ -{"", 0, 0, 0} };
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sun Sep 26 00:57:28 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: handle special options separately Handling the special options separately removes the need for several macro definitions. It saves a bit of memory since without the option '--version', the option names are shorter. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/indent/args.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 23:38:45 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: reduce abstraction layer for defining boolean options When initializing a boolean option, the most natural values are true and false. Replace the previous values ON and OFF with them. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/args.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.30 src/usr.bin/indent/args.c:1.31 --- src/usr.bin/indent/args.c:1.30 Sat Sep 25 22:16:58 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 23:38:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.30 2021/09/25 22:16:58 rillig Exp $ */ +/* $NetBSD: args.c,v 1.31 2021/09/25 23:38:45 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.30 2021/09/25 22:16:58 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.31 2021/09/25 23:38:45 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -70,21 +70,16 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #define PRO_BOOL 2 /* boolean */ #define PRO_INT 3 /* integer */ -/* profile specials for booleans */ -#define ON 1 /* turn it on */ -#define OFF 0 /* turn it off */ - /* profile specials for specials */ #define IGN 1 /* ignore it */ #define CLI 2 /* case label indent (float) */ #define STDIN 3 /* use stdin */ #define KEY 4 /* type (keyword) */ - -static void scan_profile(FILE *); - #define KEY_FILE 5 /* only used for args */ #define VERSION 6 /* only used for args */ +static void scan_profile(FILE *); + const char *option_source = "?"; void add_typedefs_from_file(const char *); @@ -95,9 +90,10 @@ void add_typedefs_from_file(const char * #define assert_type(expr, type) (expr) #endif #define bool_option(name, value, var) \ - {name, PRO_BOOL, value, assert_type(&(var), bool *)} -#define int_option(name, value, var) \ - {name, PRO_INT, value, assert_type(&(var), int *)} + {name, PRO_BOOL, /*CONSTCOND*/(value) ? 1 : 0, \ + assert_type(&(var), bool *)} +#define int_option(name, var) \ + {name, PRO_INT, 0, assert_type(&(var), int *)} #define special_option(name, value) \ {name, PRO_SPECIAL, assert_type(value, int), NULL} @@ -116,72 +112,72 @@ static const struct pro { special_option("U", KEY_FILE), special_option("-version", VERSION), special_option("P", IGN), -bool_option("bacc", ON, opt.blanklines_around_conditional_compilation), -bool_option("badp", ON, opt.blanklines_after_declarations_at_proctop), -bool_option("bad", ON, opt.blanklines_after_declarations), -bool_option("bap", ON, opt.blanklines_after_procs), -bool_option("bbb", ON, opt.blanklines_before_blockcomments), -bool_option("bc", OFF, opt.leave_comma), -bool_option("bl", OFF, opt.btype_2), -bool_option("br", ON, opt.btype_2), -bool_option("bs", ON, opt.blank_after_sizeof), -bool_option("cdb", ON, opt.comment_delimiter_on_blankline), -int_option("cd", 0, opt.decl_comment_column), -bool_option("ce", ON, opt.cuddle_else), -int_option("ci", 0, opt.continuation_indent), +bool_option("bacc", true, opt.blanklines_around_conditional_compilation), +bool_option("badp", true, opt.blanklines_after_declarations_at_proctop), +bool_option("bad", true, opt.blanklines_after_declarations), +bool_option("bap", true, opt.blanklines_after_procs), +bool_option("bbb", true, opt.blanklines_before_blockcomments), +bool_option("bc", false, opt.leave_comma), +bool_option("bl", false, opt.btype_2), +bool_option("br", true, opt.btype_2), +bool_option("bs", true, opt.blank_after_sizeof), +bool_option("cdb", true, opt.comment_delimiter_on_blankline), +int_option("cd", opt.decl_comment_column), +bool_option("ce", true, opt.cuddle_else), +int_option("ci", opt.continuation_indent), special_option("cli", CLI), -bool_option("cs", ON, opt.space_after_cast), -int_option("c", 0, opt.comment_column), -int_option("di", 0, opt.decl_indent), -bool_option("dj", ON, opt.ljust_decl), -int_option("d", 0, opt.unindent_displace), -bool_option("eei", ON, opt.extra_expression_indent), -bool_option("ei", ON, opt.else_if), -bool_option("fbs", ON, opt.function_brace_split), -bool_option("fc1", ON, opt.format_col1_comments), -bool_option("fcb", ON, opt.format_block_comments), -bool_option("ip", ON, opt.indent_parameters), -int_option("i", 0, opt.indent_size), -int_option("lc", 0, opt.block_comment_max_line_length), -int_option("ldi", 0, opt.local_decl_indent), -bool_option("lpl", ON,
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 23:38:45 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: reduce abstraction layer for defining boolean options When initializing a boolean option, the most natural values are true and false. Replace the previous values ON and OFF with them. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/args.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:57:05 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: misc cleanup No functional change. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/indent/indent.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.65 -r1.66 src/usr.bin/indent/io.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:57:05 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: misc cleanup No functional change. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/indent/indent.c cvs rdiff -u -r1.36 -r1.37 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.65 -r1.66 src/usr.bin/indent/io.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.83 src/usr.bin/indent/indent.c:1.84 --- src/usr.bin/indent/indent.c:1.83 Sat Sep 25 22:54:32 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 22:57:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -529,7 +529,7 @@ process_comment_in_code(token_type ttype } ps.in_stmt = true; /* turn on flag which causes an extra level of - * indentation. this is turned off by a ; or + * indentation. this is turned off by a ';' or * '}' */ if (com.s != com.e) { /* the turkey has embedded a comment * in a line. fix it */ @@ -1210,7 +1210,7 @@ main_loop(void) int squest; /* when this is positive, we have seen a '?' * without the matching ':' in a ?: * construct */ -bool scase; /* set to true when we see a case, so we will +bool scase; /* set to true when we see a 'case', so we * know what to do with the following colon */ sp_sw = force_nl = false; Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.36 src/usr.bin/indent/indent_globs.h:1.37 --- src/usr.bin/indent/indent_globs.h:1.36 Sat Sep 25 22:54:32 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 22:57:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.36 2021/09/25 22:54:32 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.37 2021/09/25 22:57:04 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -137,7 +137,7 @@ extern struct options { * will be lined up to the open paren */ bool proc_calls_space; /* whether procedure calls look like: * foo (bar) rather than foo(bar) */ -bool procnames_start_line; /* whether, the names of procedures +bool procnames_start_line; /* whether the names of procedures * being defined get placed in column 1 (i.e. * a newline is placed between the type of * the procedure and its name) */ @@ -208,11 +208,11 @@ extern struct parser_state { int not_cast_mask; /* indicates which close parens definitely * close off something else than casts */ bool block_init; /* whether inside a block initialization */ -int block_init_level; /* The level of brace nesting in an - * initialization */ -bool last_nl; /* this is true if the last thing scanned was +int block_init_level; /* The level of brace nesting in an + * initialization */ +bool last_nl; /* whether the last thing scanned was * a newline */ -bool in_or_st; /* Will be true iff there has been a +bool in_or_st; /* true iff there has been a * declarator (e.g. int or char) and no left * paren since the last semicolon. When true, * a '{' is starting a structure definition or @@ -229,7 +229,7 @@ extern struct parser_state { bool in_decl; /* whether we are in a declaration stmt. * The processing of braces is then slightly * different */ -bool in_stmt; /* whether in a stmt */ +bool in_stmt; int ind_level; /* the current indentation level */ bool ind_stmt; /* whether the next line should have an extra * indentation level because we are in the Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.65 src/usr.bin/indent/io.c:1.66 --- src/usr.bin/indent/io.c:1.65 Sat Sep 25 22:54:32 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 22:57:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $ */ +/* $NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,21 +43,19 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:54:32 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: convert found_err to bool That variable had slipped through the migration since it consequently used int for the declaration, the definition and all assignments. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/indent/indent.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.64 -r1.65 src/usr.bin/indent/io.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.82 src/usr.bin/indent/indent.c:1.83 --- src/usr.bin/indent/indent.c:1.82 Sat Sep 25 22:24:35 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 22:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -105,7 +105,7 @@ char *sc_end; char *bp_save; char *be_save; -int found_err; +boolfound_err; int n_real_blanklines; boolprefix_blankline_requested; boolpostfix_blankline_requested; @@ -376,7 +376,7 @@ buf_expand(struct buffer *buf, size_t de static void main_init_globals(void) { -found_err = 0; +found_err = false; ps.p_stack[0] = stmt; /* this is the parser's stack */ ps.last_nl = true; /* this is true if the last thing scanned was @@ -510,7 +510,7 @@ process_end_of_file(void) } fflush(output); -exit(found_err); +exit(found_err ? EXIT_FAILURE : EXIT_SUCCESS); } static void Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.35 src/usr.bin/indent/indent_globs.h:1.36 --- src/usr.bin/indent/indent_globs.h:1.35 Sat Sep 25 20:56:53 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 22:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.35 2021/09/25 20:56:53 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.36 2021/09/25 22:54:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -173,7 +173,7 @@ enum rwcode { }; -extern int found_err; +extern boolfound_err; extern int n_real_blanklines; extern boolprefix_blankline_requested; extern boolpostfix_blankline_requested; Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.64 src/usr.bin/indent/io.c:1.65 --- src/usr.bin/indent/io.c:1.64 Sat Sep 25 20:56:53 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 22:54:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.64 2021/09/25 20:56:53 rillig Exp $ */ +/* $NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.64 2021/09/25 20:56:53 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -466,7 +466,7 @@ diag(int level, const char *msg, ...) const char *s, *e; if (level != 0) - found_err = 1; + found_err = true; if (output == stdout) { s = "/**INDENT** ";
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:54:32 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: convert found_err to bool That variable had slipped through the migration since it consequently used int for the declaration, the definition and all assignments. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/indent/indent.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.64 -r1.65 src/usr.bin/indent/io.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:24:35 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: use strlen instead of own implementation The two loops looks similar but differ in a crucial detail that makes up for a '+ 1'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/usr.bin/indent/indent.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:24:35 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: use strlen instead of own implementation The two loops looks similar but differ in a crucial detail that makes up for a '+ 1'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.81 src/usr.bin/indent/indent.c:1.82 --- src/usr.bin/indent/indent.c:1.81 Sat Sep 25 22:14:21 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 22:24:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.81 2021/09/25 22:14:21 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.81 2021/09/25 22:14:21 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -53,14 +53,14 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #include #include #endif +#include #include #include #include -#include #include #include #include -#include +#include #include "indent.h" @@ -658,15 +658,7 @@ process_unary_op(int dec_ind, bool tabs_ if (!ps.dumped_decl_indent && ps.in_decl && !ps.block_init && ps.procname[0] == '\0' && ps.paren_level == 0) { /* pointer declarations */ - - /* - * if this is a unary op in a declaration, we should indent - * this token - */ - int i; - for (i = 0; token.s[i] != '\0'; ++i) - /* find length of token */; - indent_declaration(dec_ind - i, tabs_to_var); + indent_declaration(dec_ind - (int)strlen(token.s), tabs_to_var); ps.dumped_decl_indent = true; } else if (ps.want_blank) *code.e++ = ' '; @@ -968,18 +960,13 @@ process_decl(int *out_dec_ind, bool *out if ( /* !ps.in_or_st && */ ps.decl_nest <= 0) ps.just_saw_decl = 2; prefix_blankline_requested = false; -int i; -for (i = 0; token.s[i++] != '\0';); /* get length of token */ -if (ps.ind_level == 0 || ps.decl_nest > 0) { - /* global variable or struct member in local variable */ - *out_dec_ind = opt.decl_indent > 0 ? opt.decl_indent : i; - *out_tabs_to_var = opt.use_tabs ? opt.decl_indent > 0 : false; -} else { - /* local variable */ - *out_dec_ind = opt.local_decl_indent > 0 ? opt.local_decl_indent : i; - *out_tabs_to_var = opt.use_tabs ? opt.local_decl_indent > 0 : false; -} +int len = (int)strlen(token.s) + 1; +int ind = ps.ind_level == 0 || ps.decl_nest > 0 + ? opt.decl_indent /* global variable or local member */ + : opt.local_decl_indent; /* local variable */ +*out_dec_ind = ind > 0 ? ind : len; +*out_tabs_to_var = opt.use_tabs ? ind > 0 : false; } static void
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:16:58 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: clean up argument handling No functional change. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/args.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.29 src/usr.bin/indent/args.c:1.30 --- src/usr.bin/indent/args.c:1.29 Sat Sep 25 21:42:43 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 22:16:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.29 2021/09/25 21:42:43 rillig Exp $ */ +/* $NetBSD: args.c,v 1.30 2021/09/25 22:16:58 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.29 2021/09/25 21:42:43 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.30 2021/09/25 22:16:58 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -87,7 +87,7 @@ static void scan_profile(FILE *); const char *option_source = "?"; -void add_typedefs_from_file(const char *str); +void add_typedefs_from_file(const char *); #if __STDC_VERSION__ >= 201112L #define assert_type(expr, type) _Generic((expr), type : (expr)) @@ -247,13 +247,13 @@ scan_profile(FILE *f) } static const char * -eqin(const char *s1, const char *s2) +skip_over(const char *s, const char *prefix) { -while (*s1 != '\0') { - if (*s1++ != *s2++) +while (*prefix != '\0') { + if (*prefix++ != *s++) return NULL; } -return s2; +return s; } void @@ -264,9 +264,11 @@ set_option(const char *arg) arg++; /* ignore leading "-" */ for (p = pro; p->p_name[0] != '\0'; p++) - if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) - goto found; + if (p->p_name[0] == arg[0]) + if ((param_start = skip_over(arg, p->p_name)) != NULL) + goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1); + found: switch (p->p_type) { @@ -277,7 +279,7 @@ found: break; case CLI: - if (*param_start == 0) + if (param_start[0] == '\0') goto need_param; opt.case_indent = atof(param_start); break; @@ -290,13 +292,13 @@ found: break; case KEY: - if (*param_start == 0) + if (param_start[0] == '\0') goto need_param; add_typename(param_start); break; case KEY_FILE: - if (*param_start == 0) + if (param_start[0] == '\0') goto need_param; add_typedefs_from_file(param_start); break; @@ -329,13 +331,13 @@ found: } void -add_typedefs_from_file(const char *str) +add_typedefs_from_file(const char *fname) { FILE *file; char line[BUFSIZ]; -if ((file = fopen(str, "r")) == NULL) { - fprintf(stderr, "indent: cannot open file %s\n", str); +if ((file = fopen(fname, "r")) == NULL) { + fprintf(stderr, "indent: cannot open file %s\n", fname); exit(1); } while ((fgets(line, BUFSIZ, file)) != NULL) {
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:16:58 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: clean up argument handling No functional change. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/args.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:14:21 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c pr_comment.c Log Message: indent: merge duplicate code for token buffers No functional change. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/usr.bin/indent/indent.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/indent.h cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.45 -r1.46 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.80 src/usr.bin/indent/indent.c:1.81 --- src/usr.bin/indent/indent.c:1.80 Sat Sep 25 21:42:43 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 22:14:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.80 2021/09/25 21:42:43 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.81 2021/09/25 22:14:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.80 2021/09/25 21:42:43 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.81 2021/09/25 22:14:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -137,29 +137,15 @@ charbakfile[MAXPATHLEN] = ""; static void check_size_code(size_t desired_size) { -if (code.e + desired_size < code.l) -return; - -size_t nsize = code.l - code.s + 400 + desired_size; -size_t code_len = code.e - code.s; -code.buf = xrealloc(code.buf, nsize); -code.e = code.buf + code_len + 1; -code.l = code.buf + nsize - 5; -code.s = code.buf + 1; +if (code.e + desired_size >= code.l) + buf_expand(, desired_size); } static void check_size_label(size_t desired_size) { -if (lab.e + (desired_size) < lab.l) -return; - -size_t nsize = lab.l - lab.s + 400 + desired_size; -size_t label_len = lab.e - lab.s; -lab.buf = xrealloc(lab.buf, nsize); -lab.e = lab.buf + label_len + 1; -lab.l = lab.buf + nsize - 5; -lab.s = lab.buf + 1; +if (lab.e + desired_size >= lab.l) + buf_expand(, desired_size); } #if HAVE_CAPSICUM @@ -376,6 +362,17 @@ buf_init(struct buffer *buf) buf->l = buf->buf + bufsize - 5; /* safety margin, though unreliable */ } +void +buf_expand(struct buffer *buf, size_t desired_size) +{ +size_t nsize = buf->l - buf->s + 400 + desired_size; +size_t code_len = buf->e - buf->s; +buf->buf = xrealloc(buf->buf, nsize); +buf->e = buf->buf + code_len + 1; +buf->l = buf->buf + nsize - 5; +buf->s = buf->buf + 1; +} + static void main_init_globals(void) { Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.24 src/usr.bin/indent/indent.h:1.25 --- src/usr.bin/indent/indent.h:1.24 Sat Sep 25 21:42:43 2021 +++ src/usr.bin/indent/indent.h Sat Sep 25 22:14:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.24 2021/09/25 21:42:43 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.25 2021/09/25 22:14:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -70,3 +70,5 @@ void set_profile(const char *); void *xmalloc(size_t); void *xrealloc(void *, size_t); char *xstrdup(const char *); + +void buf_expand(struct buffer *, size_t); Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.57 src/usr.bin/indent/lexi.c:1.58 --- src/usr.bin/indent/lexi.c:1.57 Sat Sep 25 20:05:55 2021 +++ src/usr.bin/indent/lexi.c Sat Sep 25 22:14:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.57 2021/09/25 20:05:55 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.58 2021/09/25 22:14:21 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.57 2021/09/25 20:05:55 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.58 2021/09/25 22:14:21 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -205,15 +205,8 @@ inbuf_next(void) static void check_size_token(size_t desired_size) { -if (token.e + (desired_size) < token.l) -return; - -size_t nsize = token.l - token.s + 400 + desired_size; -size_t token_len = token.e - token.s; -token.buf = xrealloc(token.buf, nsize); -token.e = token.buf + token_len + 1; -token.l = token.buf + nsize - 5; -token.s = token.buf + 1; +if (token.e + desired_size >= token.l) + buf_expand(, desired_size); } static int Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.45 src/usr.bin/indent/pr_comment.c:1.46 --- src/usr.bin/indent/pr_comment.c:1.45 Sat Sep 25 20:23:42 2021 +++ src/usr.bin/indent/pr_comment.c Sat Sep 25 22:14:21 2021
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 22:14:21 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c pr_comment.c Log Message: indent: merge duplicate code for token buffers No functional change. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/usr.bin/indent/indent.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/indent.h cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.45 -r1.46 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 21:42:43 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h Log Message: indent: clean up argument handling No functional change. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/args.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/indent/indent.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/indent.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.28 src/usr.bin/indent/args.c:1.29 --- src/usr.bin/indent/args.c:1.28 Sat Sep 25 21:20:59 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 21:42:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.28 2021/09/25 21:20:59 rillig Exp $ */ +/* $NetBSD: args.c,v 1.29 2021/09/25 21:42:43 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.28 2021/09/25 21:20:59 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.29 2021/09/25 21:42:43 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #include #include #include +#include #include #include #include @@ -102,14 +103,14 @@ void add_typedefs_from_file(const char * /* * N.B.: because of the way the table here is scanned, options whose names are - * substrings of other options must occur later; that is, with -lp vs -l, -lp - * must be first. + * a prefix of other options must occur later; that is, with -lp vs -l, -lp + * must be first and -l must be last. */ -const struct pro { +static const struct pro { const char p_name[9]; /* name, e.g. "bl", "cli" */ -int p_type; /* type (int, bool, special) */ +uint8_t p_type; /* type (int, bool, special) */ int p_special; /* depends on type */ -void*p_obj; /* the associated variable */ +void*p_obj; /* the associated variable (bool, int) */ } pro[] = { special_option("T", KEY), special_option("U", KEY_FILE), @@ -256,7 +257,7 @@ eqin(const char *s1, const char *s2) } void -set_option(char *arg) +set_option(const char *arg) { const struct pro *p; const char *param_start; @@ -311,10 +312,7 @@ found: break; case PRO_BOOL: - if (p->p_special == OFF) - *(bool *)p->p_obj = false; - else - *(bool *)p->p_obj = true; + *(bool *)p->p_obj = p->p_special == ON; break; case PRO_INT: Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.79 src/usr.bin/indent/indent.c:1.80 --- src/usr.bin/indent/indent.c:1.79 Sat Sep 25 20:56:53 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 21:42:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.79 2021/09/25 20:56:53 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.80 2021/09/25 21:42:43 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.79 2021/09/25 20:56:53 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.80 2021/09/25 21:42:43 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -427,32 +427,27 @@ main_parse_command_line(int argc, char * set_profile(profile_name); for (i = 1; i < argc; ++i) { + if (argv[i][0] == '-') { + set_option(argv[i]); + + } else if (input == NULL) { + in_name = argv[i]; + input = fopen(in_name, "r"); + if (input == NULL) + err(1, "%s", in_name); + + } else if (output == NULL) { + out_name = argv[i]; + if (strcmp(in_name, out_name) == 0) + errx(1, "input and output files must be different"); + output = fopen(out_name, "w"); + if (output == NULL) + err(1, "%s", out_name); - /* - * look thru args (if any) for changes to defaults - */ - if (argv[i][0] != '-') {/* no flag on parameter */ - if (input == NULL) { /* we must have the input file */ - in_name = argv[i]; /* remember name of input file */ - input = fopen(in_name, "r"); - if (input == NULL) /* check for open error */ - err(1, "%s", in_name); - continue; - } else if (output == NULL) { /* we have the output file */ - out_name = argv[i]; /* remember name of output file */ - if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite - * the file */ - errx(1, "input and output files must be different"); - } - output = fopen(out_name, "w"); - if (output == NULL) /* check for create error */ - err(1, "%s", out_name); - continue; - } - errx(1, "unknown parameter: %s", argv[i]); } else - set_option(argv[i]); -}/* end of for */ + errx(1, "unknown
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 21:42:43 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h Log Message: indent: clean up argument handling No functional change. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/args.c cvs rdiff -u -r1.79 -r1.80 src/usr.bin/indent/indent.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/indent.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib
Module Name:src Committed By: maya Date: Sat Sep 25 21:26:04 UTC 2021 Modified Files: src/distrib/common/bootimage: Makefile.installimage src/distrib/sets: sets.subr src/distrib/sets/lists/gpufw: mi Log Message: Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional Simplifies logic. Restoring MK* requested by mrg on tech-kern discussion https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/distrib/common/bootimage/Makefile.installimage cvs rdiff -u -r1.196 -r1.197 src/distrib/sets/sets.subr cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/gpufw/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/common/bootimage/Makefile.installimage diff -u src/distrib/common/bootimage/Makefile.installimage:1.9 src/distrib/common/bootimage/Makefile.installimage:1.10 --- src/distrib/common/bootimage/Makefile.installimage:1.9 Sat Sep 25 08:54:29 2021 +++ src/distrib/common/bootimage/Makefile.installimage Sat Sep 25 21:26:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.installimage,v 1.9 2021/09/25 08:54:29 maya Exp $ +# $NetBSD: Makefile.installimage,v 1.10 2021/09/25 21:26:03 maya Exp $ # # Common Makefile to create a bootable installation image for USB flash etc. # @@ -32,10 +32,7 @@ IMAGEMB= ${INSTIMAGEMB} SWAPMB= 0 # no swap KERN_SET?= kern-GENERIC -SETS?= modules base etc -.if ${MKGPUFIRMWARE:Uno} != "no" -SETS+= gpufw -.endif +SETS?= gpufw modules base etc FSTAB_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/fstab.install.in Index: src/distrib/sets/sets.subr diff -u src/distrib/sets/sets.subr:1.196 src/distrib/sets/sets.subr:1.197 --- src/distrib/sets/sets.subr:1.196 Sat Sep 25 08:54:30 2021 +++ src/distrib/sets/sets.subr Sat Sep 25 21:26:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: sets.subr,v 1.196 2021/09/25 08:54:30 maya Exp $ +# $NetBSD: sets.subr,v 1.197 2021/09/25 21:26:03 maya Exp $ # # @@ -143,11 +143,6 @@ else module=yes modset="modules" fi -if [ "${MKGPUFIRMWARE}" = "no" ]; then - gpufwset="" -else - gpufwset="gpufw" -fi if [ "${MKATF}" = "no" ]; then testset="" else @@ -176,7 +171,7 @@ stlib=$shlib if [ "${MKPIC}" = "no" ]; then shlib=no fi -nlists="base comp $debugset $dtbset etc games $gpufwset man misc $modset rescue $testset text" +nlists="base comp $debugset $dtbset etc games gpufw man misc $modset rescue $testset text" xlists="xbase xcomp $xdebugset xetc xfont xserver" extlists="extbase extcomp extetc" @@ -197,7 +192,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g # In each file, a record consists of a path and a System Package name, # separated by whitespace. E.g., # -# # $NetBSD: sets.subr,v 1.196 2021/09/25 08:54:30 maya Exp $ +# # $NetBSD: sets.subr,v 1.197 2021/09/25 21:26:03 maya Exp $ # . base-sys-root [keyword[,...]] # ./altroot base-sys-root # ./bin base-sys-root Index: src/distrib/sets/lists/gpufw/mi diff -u src/distrib/sets/lists/gpufw/mi:1.2 src/distrib/sets/lists/gpufw/mi:1.3 --- src/distrib/sets/lists/gpufw/mi:1.2 Sat Sep 25 21:18:22 2021 +++ src/distrib/sets/lists/gpufw/mi Sat Sep 25 21:26:04 2021 @@ -1,171 +1,171 @@ -# $NetBSD: mi,v 1.2 2021/09/25 21:18:22 maya Exp $ +# $NetBSD: mi,v 1.3 2021/09/25 21:26:04 maya Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # ./etc/mtree/set.gpufwbase-gpufw -./libdata/firmware/nouveau/nvidia/LICENCE.nvidiabase-gpufw gpufirmware -./libdata/firmware/nouveau/nvidia/gm206/fecs_data.bin base-gpufw gpufirmware -./libdata/firmware/nouveau/nvidia/gm206/fecs_inst.bin base-gpufw gpufirmware -./libdata/firmware/nouveau/nvidia/gm206/gpccs_data.bin base-gpufw gpufirmware -./libdata/firmware/nouveau/nvidia/gm206/gpccs_inst.bin base-gpufw gpufirmware -./libdata/firmware/radeon/ARUBA_me.bin base-gpufw gpufirmware -./libdata/firmware/radeon/ARUBA_pfp.bin base-gpufw gpufirmware -./libdata/firmware/radeon/ARUBA_rlc.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BARTS_mc.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BARTS_me.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BARTS_pfp.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BARTS_smc.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_ce.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_mc.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_mc2.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_me.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_mec.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_pfp.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_rlc.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_sdma.bin base-gpufw gpufirmware -./libdata/firmware/radeon/BONAIRE_smc.bin base-gpufw gpufirmware
CVS commit: src/distrib
Module Name:src Committed By: maya Date: Sat Sep 25 21:26:04 UTC 2021 Modified Files: src/distrib/common/bootimage: Makefile.installimage src/distrib/sets: sets.subr src/distrib/sets/lists/gpufw: mi Log Message: Restore MKNOUVEAUFIRMWARE and MKRADEONFIRMWARE and make gpufw set unconditional Simplifies logic. Restoring MK* requested by mrg on tech-kern discussion https://mail-index.netbsd.org/tech-kern/2021/09/25/msg027695.html To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/distrib/common/bootimage/Makefile.installimage cvs rdiff -u -r1.196 -r1.197 src/distrib/sets/sets.subr cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/gpufw/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 21:21:00 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: reduce binary size No functional change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/args.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.27 src/usr.bin/indent/args.c:1.28 --- src/usr.bin/indent/args.c:1.27 Sat Sep 25 18:49:03 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 21:20:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.27 2021/09/25 18:49:03 rillig Exp $ */ +/* $NetBSD: args.c,v 1.28 2021/09/25 21:20:59 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.27 2021/09/25 18:49:03 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.28 2021/09/25 21:20:59 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -106,7 +106,7 @@ void add_typedefs_from_file(const char * * must be first. */ const struct pro { -const char *p_name; /* name, e.g. -bl, -cli */ +const char p_name[9]; /* name, e.g. "bl", "cli" */ int p_type; /* type (int, bool, special) */ int p_special; /* depends on type */ void*p_obj; /* the associated variable */ @@ -182,7 +182,7 @@ const struct pro { bool_option("ut", ON, opt.use_tabs), bool_option("v", ON, opt.verbose), /* whew! */ -{0, 0, 0, 0} +{"", 0, 0, 0} }; /* @@ -262,7 +262,7 @@ set_option(char *arg) const char *param_start; arg++; /* ignore leading "-" */ -for (p = pro; p->p_name != NULL; p++) +for (p = pro; p->p_name[0] != '\0'; p++) if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL) goto found; errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1);
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 21:21:00 UTC 2021 Modified Files: src/usr.bin/indent: args.c Log Message: indent: reduce binary size No functional change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/args.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/gpufw
Module Name:src Committed By: maya Date: Sat Sep 25 21:18:22 UTC 2021 Modified Files: src/distrib/sets/lists/gpufw: mi Log Message: Remove duplicate line - also appears in base/mi. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/gpufw/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/gpufw/mi diff -u src/distrib/sets/lists/gpufw/mi:1.1 src/distrib/sets/lists/gpufw/mi:1.2 --- src/distrib/sets/lists/gpufw/mi:1.1 Sat Sep 25 08:54:30 2021 +++ src/distrib/sets/lists/gpufw/mi Sat Sep 25 21:18:22 2021 @@ -1,10 +1,9 @@ -# $NetBSD: mi,v 1.1 2021/09/25 08:54:30 maya Exp $ +# $NetBSD: mi,v 1.2 2021/09/25 21:18:22 maya Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # ./etc/mtree/set.gpufwbase-gpufw ./libdata/firmware/nouveau/nvidia/LICENCE.nvidiabase-gpufw gpufirmware -./libdata/firmware/nouveau/nvidia/gm206 base-gpufw ./libdata/firmware/nouveau/nvidia/gm206/fecs_data.bin base-gpufw gpufirmware ./libdata/firmware/nouveau/nvidia/gm206/fecs_inst.bin base-gpufw gpufirmware ./libdata/firmware/nouveau/nvidia/gm206/gpccs_data.bin base-gpufw gpufirmware
CVS commit: src/distrib/sets/lists/gpufw
Module Name:src Committed By: maya Date: Sat Sep 25 21:18:22 UTC 2021 Modified Files: src/distrib/sets/lists/gpufw: mi Log Message: Remove duplicate line - also appears in base/mi. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/gpufw/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:56:53 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c parse.c Log Message: indent: un-abbreviate a few parser_state members, clean up comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/indent/indent.c cvs rdiff -u -r1.34 -r1.35 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.63 -r1.64 src/usr.bin/indent/io.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/parse.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.78 src/usr.bin/indent/indent.c:1.79 --- src/usr.bin/indent/indent.c:1.78 Sat Sep 25 20:23:42 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 20:56:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.79 2021/09/25 20:56:53 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.79 2021/09/25 20:56:53 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -498,7 +498,7 @@ main_prepare_parsing(void) p++; } if (col > opt.indent_size) - ps.ind_level = ps.i_l_follow = col / opt.indent_size; + ps.ind_level = ps.ind_level_follow = col / opt.indent_size; } static void __attribute__((__noreturn__)) @@ -769,7 +769,7 @@ process_semicolon(bool *inout_scase, int token_type hd_type, bool *inout_force_nl) { -if (ps.dec_nest == 0) +if (ps.decl_nest == 0) ps.in_or_st = false; /* we are not in an initialization or * structure declaration */ *inout_scase = false; /* these will only need resetting in an error */ @@ -789,7 +789,7 @@ process_semicolon(bool *inout_scase, int ps.dumped_decl_indent = true; } -ps.in_decl = (ps.dec_nest > 0); /* if we were in a first level +ps.in_decl = (ps.decl_nest > 0); /* if we were in a first level * structure declaration, we * arent any more */ @@ -837,7 +837,7 @@ process_lbrace(bool *inout_force_nl, boo dump_line(); ps.want_blank = false; } else if (ps.in_parameter_declaration && !ps.in_or_st) { - ps.i_l_follow = 0; + ps.ind_level_follow = 0; if (opt.function_brace_split) { /* dump the line prior * to the brace ... */ dump_line(); @@ -856,7 +856,7 @@ process_lbrace(bool *inout_force_nl, boo if (*inout_sp_sw) { /* check for unclosed if, for, etc. */ *inout_sp_sw = false; parse(hd_type); - ps.ind_level = ps.i_l_follow; + ps.ind_level = ps.ind_level_follow; } } if (code.s == code.e) @@ -864,11 +864,11 @@ process_lbrace(bool *inout_force_nl, boo * with '{' */ if (ps.in_decl && ps.in_or_st) { /* this is either a structure * declaration or an init */ - di_stack[ps.dec_nest] = *inout_dec_ind; - if (++ps.dec_nest == di_stack_cap) { + di_stack[ps.decl_nest] = *inout_dec_ind; + if (++ps.decl_nest == di_stack_cap) { diag(0, "Reached internal limit of %d struct levels", di_stack_cap); - ps.dec_nest--; + ps.decl_nest--; } /* ? dec_ind = 0; */ } else { @@ -913,9 +913,9 @@ process_rbrace(bool *inout_sp_sw, int *i *code.e++ = '}'; ps.want_blank = true; ps.in_stmt = ps.ind_stmt = false; -if (ps.dec_nest > 0) { /* we are in multi-level structure declaration */ - *inout_dec_ind = di_stack[--ps.dec_nest]; - if (ps.dec_nest == 0 && !ps.in_parameter_declaration) +if (ps.decl_nest > 0) { /* we are in multi-level structure declaration */ + *inout_dec_ind = di_stack[--ps.decl_nest]; + if (ps.decl_nest == 0 && !ps.in_parameter_declaration) ps.just_saw_decl = 2; ps.in_decl = true; } @@ -924,7 +924,7 @@ process_rbrace(bool *inout_sp_sw, int *i ps.search_brace = opt.cuddle_else && ps.p_stack[ps.tos] == if_expr_stmt && ps.il[ps.tos] >= ps.ind_level; -if (ps.tos <= 1 && opt.blanklines_after_procs && ps.dec_nest <= 0) +if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_nest <= 0) postfix_blankline_requested = true; } @@ -965,20 +965,21 @@ process_decl(int *out_dec_ind, bool *out ps.want_blank = false; } } -if (ps.in_parameter_declaration && opt.indent_parameters && ps.dec_nest == 0) { - ps.ind_level = ps.i_l_follow = 1; +if (ps.in_parameter_declaration && opt.indent_parameters && + ps.decl_nest == 0) { + ps.ind_level = ps.ind_level_follow = 1; ps.ind_stmt = false; } ps.in_or_st = true; /* this might be a structure or initialization * declaration */ ps.in_decl = ps.decl_on_line = ps.last_token != type_def; -if ( /* !ps.in_or_st
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:56:53 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c parse.c Log Message: indent: un-abbreviate a few parser_state members, clean up comments No functional change. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/usr.bin/indent/indent.c cvs rdiff -u -r1.34 -r1.35 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.63 -r1.64 src/usr.bin/indent/io.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/parse.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:23:42 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c pr_comment.c Log Message: indent: remove dead code for printing comments after empty lines This code has been commented out for at least 29 years. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/indent.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.62 -r1.63 src/usr.bin/indent/io.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.77 src/usr.bin/indent/indent.c:1.78 --- src/usr.bin/indent/indent.c:1.77 Sat Sep 25 19:49:13 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 20:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.77 2021/09/25 19:49:13 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.77 2021/09/25 19:49:13 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -398,7 +398,6 @@ main_init_globals(void) line_no = 1; had_eof = ps.in_decl = ps.decl_on_line = (break_comma = false); ps.in_or_st = false; -ps.bl_line = true; ps.want_blank = ps.in_stmt = ps.ind_stmt = false; ps.pcase = false; Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.33 src/usr.bin/indent/indent_globs.h:1.34 --- src/usr.bin/indent/indent_globs.h:1.33 Sat Sep 25 18:49:03 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 20:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.33 2021/09/25 18:49:03 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.34 2021/09/25 20:23:42 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -217,7 +217,6 @@ extern struct parser_state { * paren since the last semicolon. When true, * a '{' is starting a structure definition or * an initialization list */ -bool bl_line; /* set to 1 by dump_line if the line is blank */ bool col_1; /* set to true if the last token started in * column 1 */ int com_col; /* this is the column in which the current Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.62 src/usr.bin/indent/io.c:1.63 --- src/usr.bin/indent/io.c:1.62 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 20:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.62 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: io.c,v 1.63 2021/09/25 20:23:42 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.62 2021/09/25 17:36:51 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.63 2021/09/25 20:23:42 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -122,13 +122,10 @@ dump_line(void) if (code.s == code.e && lab.s == lab.e && com.s == com.e) { if (suppress_blanklines > 0) suppress_blanklines--; - else { - ps.bl_line = true; + else n_real_blanklines++; - } } else if (!inhibit_formatting) { suppress_blanklines = 0; - ps.bl_line = false; if (prefix_blankline_requested && not_first_line) { if (opt.swallow_optional_blanklines) { if (n_real_blanklines == 1) Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.44 src/usr.bin/indent/pr_comment.c:1.45 --- src/usr.bin/indent/pr_comment.c:1.44 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/pr_comment.c Sat Sep 25 20:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.44 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.45 2021/09/25 20:23:42 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c #include #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.44 2021/09/25 17:36:51 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.45 2021/09/25 20:23:42 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -124,12 +124,7 @@ process_comment(void) * is nonzero (the default). */ break_delim = false; } - if ( /* ps.bl_line && */ lab.s == lab.e && code.s == code.e) { - /* klg: check only if this line is blank */ - /* - * If this (*and previous lines are*) blank, dont put comment way - * out
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:23:42 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c pr_comment.c Log Message: indent: remove dead code for printing comments after empty lines This code has been commented out for at least 29 years. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/indent.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.62 -r1.63 src/usr.bin/indent/io.c cvs rdiff -u -r1.44 -r1.45 src/usr.bin/indent/pr_comment.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/alpha
Module Name:src Committed By: thorpej Date: Sat Sep 25 20:16:17 UTC 2021 Modified Files: src/sys/arch/alpha/eisa: eisa_machdep.c src/sys/arch/alpha/include: eisa_machdep.h Log Message: Make all of the EISA chipset functions call through real functions, rather the macros. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/eisa/eisa_machdep.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/eisa_machdep.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/alpha/eisa/eisa_machdep.c diff -u src/sys/arch/alpha/eisa/eisa_machdep.c:1.13 src/sys/arch/alpha/eisa/eisa_machdep.c:1.14 --- src/sys/arch/alpha/eisa/eisa_machdep.c:1.13 Wed Nov 18 02:04:29 2020 +++ src/sys/arch/alpha/eisa/eisa_machdep.c Sat Sep 25 20:16:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.c,v 1.13 2020/11/18 02:04:29 thorpej Exp $ */ +/* $NetBSD: eisa_machdep.c,v 1.14 2021/09/25 20:16:17 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.13 2020/11/18 02:04:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.14 2021/09/25 20:16:17 thorpej Exp $"); #include #include @@ -45,6 +45,51 @@ __KERNEL_RCSID(0, "$NetBSD: eisa_machdep #include #include +void +eisa_attach_hook(device_t parent, device_t self, +struct eisabus_attach_args *eba) +{ + eba->eba_ec->ec_attach_hook(parent, self, eba); +} + +int +eisa_maxslots(eisa_chipset_tag_t ec) +{ + return ec->ec_maxslots(ec->ec_v); +} + +int +eisa_intr_map(eisa_chipset_tag_t ec, u_int irq, eisa_intr_handle_t *ihp) +{ + return ec->ec_intr_map(ec->ec_v, irq, ihp); +} + +const char * +eisa_intr_string(eisa_chipset_tag_t ec, eisa_intr_handle_t ih, char *buf, +size_t len) +{ + return ec->ec_intr_string(ec->ec_v, ih, buf, len); +} + +const struct evcnt * +eisa_intr_evcnt(eisa_chipset_tag_t ec, eisa_intr_handle_t ih) +{ + return ec->ec_intr_evcnt(ec->ec_v, ih); +} + +void * +eisa_intr_establish(eisa_chipset_tag_t ec, eisa_intr_handle_t ih, +int type, int level, int (*func)(void *), void *arg) +{ + return ec->ec_intr_establish(ec->ec_v, ih, type, level, func, arg); +} + +void +eisa_intr_disestablish(eisa_chipset_tag_t ec, void *cookie) +{ + return ec->ec_intr_disestablish(ec->ec_v, cookie); +} + #define EISA_SLOT_HEADER_SIZE 31 #define EISA_SLOT_INFO_OFFSET 20 Index: src/sys/arch/alpha/include/eisa_machdep.h diff -u src/sys/arch/alpha/include/eisa_machdep.h:1.12 src/sys/arch/alpha/include/eisa_machdep.h:1.13 --- src/sys/arch/alpha/include/eisa_machdep.h:1.12 Sat Mar 29 19:28:25 2014 +++ src/sys/arch/alpha/include/eisa_machdep.h Sat Sep 25 20:16:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.h,v 1.12 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: eisa_machdep.h,v 1.13 2021/09/25 20:16:17 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -51,29 +51,25 @@ struct alpha_eisa_chipset { /* * Functions provided to machine-independent EISA code. */ -#define eisa_attach_hook(p, s, a) \ -(*(a)->eba_ec->ec_attach_hook)((p), (s), (a)) -#define eisa_maxslots(c) \ -(*(c)->ec_maxslots)((c)->ec_v) -#define eisa_intr_map(c, i, hp) \ -(*(c)->ec_intr_map)((c)->ec_v, (i), (hp)) -#define eisa_intr_string(c, h, buf, len)\ -(*(c)->ec_intr_string)((c)->ec_v, (h), (buf), (len)) -#define eisa_intr_evcnt(c, h) \ -(*(c)->ec_intr_evcnt)((c)->ec_v, (h)) -#define eisa_intr_establish(c, h, t, l, f, a)\ -(*(c)->ec_intr_establish)((c)->ec_v, (h), (t), (l), (f), (a)) -#define eisa_intr_disestablish(c, h) \ -(*(c)->ec_intr_disestablish)((c)->ec_v, (h)) - -int eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int, - struct eisa_cfg_mem *); -int eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int, - struct eisa_cfg_irq *); -int eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int, - struct eisa_cfg_dma *); -int eisa_conf_read_io(eisa_chipset_tag_t, int, int, int, - struct eisa_cfg_io *); +void eisa_attach_hook(device_t, device_t, + struct eisabus_attach_args *); +int eisa_maxslots(eisa_chipset_tag_t); +int eisa_intr_map(eisa_chipset_tag_t, u_int, eisa_intr_handle_t *); +const char * eisa_intr_string(eisa_chipset_tag_t, eisa_intr_handle_t, + char *, size_t); +const struct evcnt *eisa_intr_evcnt(eisa_chipset_tag_t, eisa_intr_handle_t); +void * eisa_intr_establish(eisa_chipset_tag_t, eisa_intr_handle_t, + int, int, int (*)(void *), void *); +void eisa_intr_disestablish(eisa_chipset_tag_t, void *); + +int eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_mem *); +int eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_irq *); +int eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_dma *); +int eisa_conf_read_io(eisa_chipset_tag_t,
CVS commit: src/sys/arch/alpha
Module Name:src Committed By: thorpej Date: Sat Sep 25 20:16:17 UTC 2021 Modified Files: src/sys/arch/alpha/eisa: eisa_machdep.c src/sys/arch/alpha/include: eisa_machdep.h Log Message: Make all of the EISA chipset functions call through real functions, rather the macros. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/eisa/eisa_machdep.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/eisa_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:05:55 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: extract probably_typedef into separate function This condition is complicated enough that it warrants being split into several clauses, maybe even with an explanation. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/indent/lexi.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/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.56 src/usr.bin/indent/lexi.c:1.57 --- src/usr.bin/indent/lexi.c:1.56 Sat Sep 25 19:49:13 2021 +++ src/usr.bin/indent/lexi.c Sat Sep 25 20:05:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.56 2021/09/25 19:49:13 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.57 2021/09/25 20:05:55 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.56 2021/09/25 19:49:13 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.57 2021/09/25 20:05:55 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -336,6 +336,20 @@ lex_char_or_string(void) } } +/* + * This hack attempts to guess whether the current token is in fact a + * declaration keyword -- one that has been defined by typedef. + */ +static bool +probably_typedef(const struct parser_state *state) +{ +return state->p_l_follow == 0 && !state->block_init && !state->in_stmt && + ((*buf_ptr == '*' && buf_ptr[1] != '=') || + isalpha((unsigned char)*buf_ptr)) && + (state->last_token == semicolon || state->last_token == lbrace || + state->last_token == rbrace); +} + /* Reads the next token, placing it in the global variable "token". */ token_type lexi(struct parser_state *state) @@ -460,18 +474,7 @@ lexi(struct parser_state *state) state->in_parameter_declaration = true; return lexi_end(funcname); not_proc:; - } - /* - * The following hack attempts to guess whether or not the current - * token is in fact a declaration keyword -- one that has been - * typedefd - */ - else if (state->p_l_follow == 0 && !state->block_init && - !state->in_stmt && - ((*buf_ptr == '*' && buf_ptr[1] != '=') || - isalpha((unsigned char)*buf_ptr)) && - (state->last_token == semicolon || state->last_token == lbrace || - state->last_token == rbrace)) { + } else if (probably_typedef(state)) { state->keyword = rw_type; state->last_u_d = true; return lexi_end(decl);
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 20:05:55 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: extract probably_typedef into separate function This condition is complicated enough that it warrants being split into several clauses, maybe even with an explanation. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/usr.bin/indent/lexi.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 19:49:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c Log Message: indent: reduce code and data size for lexing of numbers Instead of having a table of strings (121 pointers + 121 data relocations), reduce that table to the actual character data and use a secondary table for looking up the correct row in the main table. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/indent.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/indent/indent.h cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/lexi.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.76 src/usr.bin/indent/indent.c:1.77 --- src/usr.bin/indent/indent.c:1.76 Sat Sep 25 18:49:03 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 19:49:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.76 2021/09/25 18:49:03 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.77 2021/09/25 19:49:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.76 2021/09/25 18:49:03 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.77 2021/09/25 19:49:13 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -390,7 +390,6 @@ main_init_globals(void) buf_init(); buf_init(); alloc_typenames(); -init_constant_tt(); opt.else_if = true; /* XXX: redundant? */ in_buffer = xmalloc(10); Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.22 src/usr.bin/indent/indent.h:1.23 --- src/usr.bin/indent/indent.h:1.22 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/indent.h Sat Sep 25 19:49:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.22 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.23 2021/09/25 19:49:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -47,7 +47,6 @@ int compute_code_indent(void); int compute_label_indent(void); int indentation_after_range(int, const char *, const char *); int indentation_after(int, const char *); -void init_constant_tt(void); #ifdef debug void debug_vis_range(const char *, const char *, const char *, const char *); Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.55 src/usr.bin/indent/lexi.c:1.56 --- src/usr.bin/indent/lexi.c:1.55 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/lexi.c Sat Sep 25 19:49:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.55 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.56 2021/09/25 19:49:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.55 2021/09/25 17:36:51 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.56 2021/09/25 19:49:13 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/ #include #include #include +#include #include #include #include @@ -133,7 +134,7 @@ int typename_top = -1; * HP H* "." H+ P FS? -> $float;"0" O* IS? -> $int; * HP H+ "."P FS -> $float;BP B+ IS? -> $int; */ -static char const *table[] = { +static const char num_lex_state[][26] = { /*examples: 00 s 0xx @@ -142,40 +143,42 @@ static char const *table[] = { r 11ee0001101lbuuxx.a.pp t.01.e+008bLuxll0Ll.aa.p+0 states: ABCDEFGHIJKLMNOPQRSTUVWXYZ */ -['0'] = "CEIDEHHHIJQ U Q VUVVZZZ", -['1'] = "DEIDEHHHIJQ U Q VUVVZZZ", -['7'] = "DEIDEHHHIJ U VUVVZZZ", -['9'] = "DEJDEHHHJJ U VUVVZZZ", -['a'] = " U VUVV ", -['b'] = " K U VUVV ", -['e'] = " FFF FF U VUVV ", -['f'] = "f f U VUVV f", -['u'] = " MMM i iiM M ", -['x'] = " N ", -['p'] = "FFX ", -['L'] = " LLf fL PR Li Lf", -['l'] = " OOf fO S P O i Of", -['+'] = " G Y ", -['.'] = "B EEEE T W ", +[0] = "uuiifuufiuuiiuiuiu", +[1] = "CEIDEHHHIJQ U Q VUVVZZZ", +[2] = "DEIDEHHHIJQ U Q VUVVZZZ", +[3] = "DEIDEHHHIJ U VUVVZZZ", +[4] = "DEJDEHHHJJ U VUVVZZZ", +[5] = " U VUVV ", +[6] = " K U VUVV ", +[7] = " FFF FF U VUVV ", +[8] =
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 19:49:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h lexi.c Log Message: indent: reduce code and data size for lexing of numbers Instead of having a table of strings (121 pointers + 121 data relocations), reduce that table to the actual character data and use a secondary table for looking up the correct row in the main table. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/usr.bin/indent/indent.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/indent/indent.h cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/lexi.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
Module Name:src Committed By: tsutsui Date: Sat Sep 25 19:16:32 UTC 2021 Modified Files: src/sys/arch/atari/atari: trap.c src/sys/arch/cesfic/cesfic: trap.c src/sys/arch/hp300/hp300: trap.c src/sys/arch/luna68k/luna68k: trap.c src/sys/arch/mac68k/mac68k: trap.c src/sys/arch/mvme68k/mvme68k: trap.c src/sys/arch/news68k/news68k: trap.c src/sys/arch/next68k/next68k: trap.c src/sys/arch/x68k/x68k: trap.c Log Message: Call cnpollc(9) before cngetc(9) as the cons(9) man page says. Affects only inside #ifdef DEBUG part on "trap during panic" in trap.c derived from hp300. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/arch/atari/atari/trap.c cvs rdiff -u -r1.60 -r1.61 src/sys/arch/cesfic/cesfic/trap.c cvs rdiff -u -r1.154 -r1.155 src/sys/arch/hp300/hp300/trap.c cvs rdiff -u -r1.72 -r1.73 src/sys/arch/luna68k/luna68k/trap.c cvs rdiff -u -r1.151 -r1.152 src/sys/arch/mac68k/mac68k/trap.c cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mvme68k/mvme68k/trap.c cvs rdiff -u -r1.72 -r1.73 src/sys/arch/news68k/news68k/trap.c cvs rdiff -u -r1.91 -r1.92 src/sys/arch/next68k/next68k/trap.c cvs rdiff -u -r1.109 -r1.110 src/sys/arch/x68k/x68k/trap.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/atari/atari/trap.c diff -u src/sys/arch/atari/atari/trap.c:1.116 src/sys/arch/atari/atari/trap.c:1.117 --- src/sys/arch/atari/atari/trap.c:1.116 Thu Nov 21 19:23:59 2019 +++ src/sys/arch/atari/atari/trap.c Sat Sep 25 19:16:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.116 2019/11/21 19:23:59 ad Exp $ */ +/* $NetBSD: trap.c,v 1.117 2021/09/25 19:16:31 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.116 2019/11/21 19:23:59 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.117 2021/09/25 19:16:31 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -277,7 +277,10 @@ kgdb_cont: printf("Double panic\n"); #ifdef DEBUG /* XXX Should be a machine dependent hook */ - printf("(press a key)\n"); (void)cngetc(); + printf("(press a key)\n"); + cnpollc(1); + (void)cngetc(); + cnpollc(0); #endif } Index: src/sys/arch/cesfic/cesfic/trap.c diff -u src/sys/arch/cesfic/cesfic/trap.c:1.60 src/sys/arch/cesfic/cesfic/trap.c:1.61 --- src/sys/arch/cesfic/cesfic/trap.c:1.60 Thu Nov 21 19:23:59 2019 +++ src/sys/arch/cesfic/cesfic/trap.c Sat Sep 25 19:16:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.60 2019/11/21 19:23:59 ad Exp $ */ +/* $NetBSD: trap.c,v 1.61 2021/09/25 19:16:31 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.60 2019/11/21 19:23:59 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.61 2021/09/25 19:16:31 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -307,7 +307,10 @@ trap(struct frame *fp, int type, unsigne printf("trap during panic!\n"); #ifdef DEBUG /* XXX should be a machine-dependent hook */ - printf("(press a key)\n"); (void)cngetc(); + printf("(press a key)\n"); + cnpollc(1); + (void)cngetc(); + cnpollc(0); #endif } regdump((struct trapframe *)fp, 128); Index: src/sys/arch/hp300/hp300/trap.c diff -u src/sys/arch/hp300/hp300/trap.c:1.154 src/sys/arch/hp300/hp300/trap.c:1.155 --- src/sys/arch/hp300/hp300/trap.c:1.154 Thu Nov 21 19:24:00 2019 +++ src/sys/arch/hp300/hp300/trap.c Sat Sep 25 19:16:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.154 2019/11/21 19:24:00 ad Exp $ */ +/* $NetBSD: trap.c,v 1.155 2021/09/25 19:16:31 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.154 2019/11/21 19:24:00 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.155 2021/09/25 19:16:31 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -304,7 +304,10 @@ trap(struct frame *fp, int type, u_int c printf("trap during panic!\n"); #ifdef DEBUG /* XXX should be a machine-dependent hook */ - printf("(press a key)\n"); (void)cngetc(); + printf("(press a key)\n"); + cnpollc(1); + (void)cngetc(); + cnpollc(0); #endif } regdump((struct trapframe *)fp, 128); Index: src/sys/arch/luna68k/luna68k/trap.c diff -u src/sys/arch/luna68k/luna68k/trap.c:1.72 src/sys/arch/luna68k/luna68k/trap.c:1.73 --- src/sys/arch/luna68k/luna68k/trap.c:1.72 Thu Nov 21 19:24:00 2019 +++ src/sys/arch/luna68k/luna68k/trap.c Sat Sep 25 19:16:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.72 2019/11/21 19:24:00 ad Exp $ */ +/* $NetBSD: trap.c,v 1.73 2021/09/25 19:16:31 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.72 2019/11/21 19:24:00 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD:
CVS commit: src/sys/arch
Module Name:src Committed By: tsutsui Date: Sat Sep 25 19:16:32 UTC 2021 Modified Files: src/sys/arch/atari/atari: trap.c src/sys/arch/cesfic/cesfic: trap.c src/sys/arch/hp300/hp300: trap.c src/sys/arch/luna68k/luna68k: trap.c src/sys/arch/mac68k/mac68k: trap.c src/sys/arch/mvme68k/mvme68k: trap.c src/sys/arch/news68k/news68k: trap.c src/sys/arch/next68k/next68k: trap.c src/sys/arch/x68k/x68k: trap.c Log Message: Call cnpollc(9) before cngetc(9) as the cons(9) man page says. Affects only inside #ifdef DEBUG part on "trap during panic" in trap.c derived from hp300. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/arch/atari/atari/trap.c cvs rdiff -u -r1.60 -r1.61 src/sys/arch/cesfic/cesfic/trap.c cvs rdiff -u -r1.154 -r1.155 src/sys/arch/hp300/hp300/trap.c cvs rdiff -u -r1.72 -r1.73 src/sys/arch/luna68k/luna68k/trap.c cvs rdiff -u -r1.151 -r1.152 src/sys/arch/mac68k/mac68k/trap.c cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mvme68k/mvme68k/trap.c cvs rdiff -u -r1.72 -r1.73 src/sys/arch/news68k/news68k/trap.c cvs rdiff -u -r1.91 -r1.92 src/sys/arch/next68k/next68k/trap.c cvs rdiff -u -r1.109 -r1.110 src/sys/arch/x68k/x68k/trap.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 18:49:03 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent_globs.h Log Message: indent: rename option variable to be more expressive No functional change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/args.c cvs rdiff -u -r1.75 -r1.76 src/usr.bin/indent/indent.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/indent_globs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 18:49:03 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent_globs.h Log Message: indent: rename option variable to be more expressive No functional change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/args.c cvs rdiff -u -r1.75 -r1.76 src/usr.bin/indent/indent.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/indent_globs.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.26 src/usr.bin/indent/args.c:1.27 --- src/usr.bin/indent/args.c:1.26 Sat Sep 25 17:20:02 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 18:49:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.26 2021/09/25 17:20:02 rillig Exp $ */ +/* $NetBSD: args.c,v 1.27 2021/09/25 18:49:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.26 2021/09/25 17:20:02 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.27 2021/09/25 18:49:03 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -123,7 +123,7 @@ const struct pro { bool_option("bc", OFF, opt.leave_comma), bool_option("bl", OFF, opt.btype_2), bool_option("br", ON, opt.btype_2), -bool_option("bs", ON, opt.Bill_Shannon), +bool_option("bs", ON, opt.blank_after_sizeof), bool_option("cdb", ON, opt.comment_delimiter_on_blankline), int_option("cd", 0, opt.decl_comment_column), bool_option("ce", ON, opt.cuddle_else), @@ -152,7 +152,7 @@ const struct pro { bool_option("nbap", OFF, opt.blanklines_after_procs), bool_option("nbbb", OFF, opt.blanklines_before_blockcomments), bool_option("nbc", ON, opt.leave_comma), -bool_option("nbs", OFF, opt.Bill_Shannon), +bool_option("nbs", OFF, opt.blank_after_sizeof), bool_option("ncdb", OFF, opt.comment_delimiter_on_blankline), bool_option("nce", OFF, opt.cuddle_else), bool_option("ncs", OFF, opt.space_after_cast), Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.75 src/usr.bin/indent/indent.c:1.76 --- src/usr.bin/indent/indent.c:1.75 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 18:49:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.75 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.76 2021/09/25 18:49:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.75 2021/09/25 17:36:51 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.76 2021/09/25 18:49:03 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -594,7 +594,7 @@ process_lparen_or_lbracket(int dec_ind, } else if (ps.want_blank && ((ps.last_token != ident && ps.last_token != funcname) || opt.proc_calls_space || - (ps.keyword == rw_sizeof ? opt.Bill_Shannon : + (ps.keyword == rw_sizeof ? opt.blank_after_sizeof : ps.keyword != rw_0 && ps.keyword != rw_offsetof))) *code.e++ = ' '; ps.want_blank = false; Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.32 src/usr.bin/indent/indent_globs.h:1.33 --- src/usr.bin/indent/indent_globs.h:1.32 Sat Sep 25 17:36:51 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 18:49:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.32 2021/09/25 17:36:51 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.33 2021/09/25 18:49:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -93,7 +93,7 @@ extern struct options { * commas */ bool btype_2; /* whether brace should be on same line * as if, while, etc */ -bool Bill_Shannon; /* whether a blank should always be +bool blank_after_sizeof; /* whether a blank should always be * inserted after sizeof */ bool comment_delimiter_on_blankline; int decl_comment_column; /* the column in which comments after
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 18:02:49 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt-fc1.0 opt-fc1.0.stdout opt-nfc1.0 opt-nfc1.0.stdout Log Message: tests/indent: demonstrate mergin of comments This may or may not have been intended. Especially with the option '-nfc1' the result looks confusing. It's not a case that occurs every day, though. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt-fc1.0 \ src/tests/usr.bin/indent/opt-fc1.0.stdout \ src/tests/usr.bin/indent/opt-nfc1.0 \ src/tests/usr.bin/indent/opt-nfc1.0.stdout 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/indent/opt-fc1.0 diff -u src/tests/usr.bin/indent/opt-fc1.0:1.3 src/tests/usr.bin/indent/opt-fc1.0:1.4 --- src/tests/usr.bin/indent/opt-fc1.0:1.3 Fri Sep 24 17:37:55 2021 +++ src/tests/usr.bin/indent/opt-fc1.0 Sat Sep 25 18:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-fc1.0,v 1.3 2021/09/24 17:37:55 rillig Exp $ */ +/* $NetBSD: opt-fc1.0,v 1.4 2021/09/25 18:02:48 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -23,3 +23,10 @@ /* $ Both comment texts get surrounded by spaces. */ /*block1*//*block2*/ + +/* + * A multi-line comment that starts + * in column 1. + *//* followed by another multi-line comment + * that starts in column 4. + */ Index: src/tests/usr.bin/indent/opt-fc1.0.stdout diff -u src/tests/usr.bin/indent/opt-fc1.0.stdout:1.3 src/tests/usr.bin/indent/opt-fc1.0.stdout:1.4 --- src/tests/usr.bin/indent/opt-fc1.0.stdout:1.3 Fri Sep 24 17:37:55 2021 +++ src/tests/usr.bin/indent/opt-fc1.0.stdout Sat Sep 25 18:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-fc1.0.stdout,v 1.3 2021/09/24 17:37:55 rillig Exp $ */ +/* $NetBSD: opt-fc1.0.stdout,v 1.4 2021/09/25 18:02:48 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -22,3 +22,10 @@ /* $ Both comment texts got surrounded by spaces. */ /* block1 *//* block2 */ + +/* + * A multi-line comment that starts in column 1. + * + * followed by another multi-line comment that starts in column 4. + */ +/* $ XXX: The two comments have been merged into a single comment. */ Index: src/tests/usr.bin/indent/opt-nfc1.0 diff -u src/tests/usr.bin/indent/opt-nfc1.0:1.3 src/tests/usr.bin/indent/opt-nfc1.0:1.4 --- src/tests/usr.bin/indent/opt-nfc1.0:1.3 Fri Sep 24 17:37:55 2021 +++ src/tests/usr.bin/indent/opt-nfc1.0 Sat Sep 25 18:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-nfc1.0,v 1.3 2021/09/24 17:37:55 rillig Exp $ */ +/* $NetBSD: opt-nfc1.0,v 1.4 2021/09/25 18:02:48 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -23,3 +23,10 @@ /* $ Both comment texts get surrounded by spaces. */ /*block1*//*block2*/ + +/* + * A multi-line comment that starts + * in column 1. + *//* followed by another multi-line comment + * that starts in column 4. + */ Index: src/tests/usr.bin/indent/opt-nfc1.0.stdout diff -u src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.3 src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.4 --- src/tests/usr.bin/indent/opt-nfc1.0.stdout:1.3 Fri Sep 24 17:37:55 2021 +++ src/tests/usr.bin/indent/opt-nfc1.0.stdout Sat Sep 25 18:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt-nfc1.0.stdout,v 1.3 2021/09/24 17:37:55 rillig Exp $ */ +/* $NetBSD: opt-nfc1.0.stdout,v 1.4 2021/09/25 18:02:48 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -13,17 +13,34 @@ /*narrow*/ /* $ The indentation of a single space was preserved. */ -/* $ FIXME: The line must not start with a space. */ +/* $ If the comment were moved to column 1, it would change from the area */ +/* $ of 'comments that may be formatted' to the area of 'comments that must */ +/* $ not be formatted. The indentation of a single space prevents this. */ /* space */ /* $ The indentation was changed from a single tab to a single space. */ -/* $ FIXME: The line must not start with a space. */ /* tab */ -/* $ FIXME: The line must not start with a space. */ +/* $ The space between these two comments got removed. */ +/* $ XXX: The option '-nfc1' says that comments in column 1 do not get */ +/* $ formatted, but the comment 'block1' was moved from column 1 to 2. */ +/* $ This is probably because there is a second comment in the same line. */ /* block1 *//* block2 */ -/* $ FIXME: The line must not start with a space. */ -/* $ FIXME: It's inconsistent that the first comment gets no spaces. */ -/* $ FIXME: It's inconsistent that the second comment gets spaces. */ +/* $ It may seem strange at first that the left comment is not touched */ +/* $ but the right comment gets spaces added. This difference is the */ +/* $ exact purpose of the option '-nfc1', which says "do not touch comments */ +/* $ that start in column 1. The first comment starts in column 1, the */ +/* $ second comment doesn't. */ +/* $ XXX: The option '-nfc1' says that comments in column 1 do not get */ +/* $ formatted, but the comment 'block1' was moved from column 1 to 2. */ +/* $ This is
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 18:02:49 UTC 2021 Modified Files: src/tests/usr.bin/indent: opt-fc1.0 opt-fc1.0.stdout opt-nfc1.0 opt-nfc1.0.stdout Log Message: tests/indent: demonstrate mergin of comments This may or may not have been intended. Especially with the option '-nfc1' the result looks confusing. It's not a case that occurs every day, though. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/opt-fc1.0 \ src/tests/usr.bin/indent/opt-fc1.0.stdout \ src/tests/usr.bin/indent/opt-nfc1.0 \ src/tests/usr.bin/indent/opt-nfc1.0.stdout 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: maya Date: Sat Sep 25 17:55:37 UTC 2021 Modified Files: src/distrib/sets/lists/debug: module.md.amd64 module.md.i386 src/distrib/sets/lists/modules: md.amd64 md.i386 src/sys/modules: Makefile Log Message: Disable drmkms module builds. They haven't been functional (and won't be before fixing genfb abi). In a new drm update, we haven't prioritized fixing the build either. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/debug/module.md.amd64 cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/debug/module.md.i386 cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/lists/modules/md.amd64 cvs rdiff -u -r1.90 -r1.91 src/distrib/sets/lists/modules/md.i386 cvs rdiff -u -r1.255 -r1.256 src/sys/modules/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/debug/module.md.amd64 diff -u src/distrib/sets/lists/debug/module.md.amd64:1.5 src/distrib/sets/lists/debug/module.md.amd64:1.6 --- src/distrib/sets/lists/debug/module.md.amd64:1.5 Thu Mar 25 21:37:10 2021 +++ src/distrib/sets/lists/debug/module.md.amd64 Sat Sep 25 17:55:37 2021 @@ -1,4 +1,4 @@ -# $NetBSD: module.md.amd64,v 1.5 2021/03/25 21:37:10 nia Exp $ +# $NetBSD: module.md.amd64,v 1.6 2021/09/25 17:55:37 maya Exp $ ./usr/libdata/debug/@MODULEDIR@/acpiacadmodules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/acpibatmodules-base-kernel kmod,debug @@ -105,14 +105,14 @@ ./usr/libdata/debug/@MODULEDIR@/cxdtv/cxdtv.kmod.debug modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/drmmodules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/drm/drm.kmod.debug modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkmsmodules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms/drmkms.kmod.debug modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_agp modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_agp/drmkms_agp.kmod.debug modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_linux modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_linux/drmkms_linux.kmod.debug modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_pci modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/drmkms_pci/drmkms_pci.kmod.debug modules-base-kernel kmod,debug +./usr/libdata/debug/@MODULEDIR@/drmkmsmodules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms/drmkms.kmod.debug modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_agp modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_agp/drmkms_agp.kmod.debug modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_linux modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_linux/drmkms_linux.kmod.debug modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_pci modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/drmkms_pci/drmkms_pci.kmod.debug modules-obsolete obsolete ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux modules-base-kernel kmod,dtrace,debug ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux/dtrace_syscall_linux.kmod.debug modules-base-kernel kmod,dtrace,debug ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux32 modules-base-kernel kmod,dtrace,debug @@ -149,8 +149,8 @@ ./usr/libdata/debug/@MODULEDIR@/hpqlb/hpqlb.kmod.debug modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/i915drmmodules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/i915drm/i915drm.kmod.debug modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/i915drmkms modules-base-kernel kmod,debug -./usr/libdata/debug/@MODULEDIR@/i915drmkms/i915drmkms.kmod.debug modules-base-kernel kmod,debug +./usr/libdata/debug/@MODULEDIR@/i915drmkms modules-obsolete obsolete +./usr/libdata/debug/@MODULEDIR@/i915drmkms/i915drmkms.kmod.debug modules-obsolete obsolete ./usr/libdata/debug/@MODULEDIR@/ichsmbmodules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/ichsmb/ichsmb.kmod.debug modules-base-kernel kmod,debug ./usr/libdata/debug/@MODULEDIR@/if_iavfmodules-base-kernel kmod,debug Index: src/distrib/sets/lists/debug/module.md.i386 diff -u src/distrib/sets/lists/debug/module.md.i386:1.3 src/distrib/sets/lists/debug/module.md.i386:1.4 --- src/distrib/sets/lists/debug/module.md.i386:1.3 Thu Mar 25 21:37:10 2021 +++ src/distrib/sets/lists/debug/module.md.i386 Sat Sep 25 17:55:37 2021 @@ -1,4 +1,4 @@ -# $NetBSD: module.md.i386,v 1.3 2021/03/25 21:37:10 nia Exp $ +# $NetBSD: module.md.i386,v 1.4 2021/09/25 17:55:37 maya Exp $ ./usr/libdata/debug/@MODULEDIR@/acpiacadmodules-base-kernel kmod,debug
CVS commit: src
Module Name:src Committed By: maya Date: Sat Sep 25 17:55:37 UTC 2021 Modified Files: src/distrib/sets/lists/debug: module.md.amd64 module.md.i386 src/distrib/sets/lists/modules: md.amd64 md.i386 src/sys/modules: Makefile Log Message: Disable drmkms module builds. They haven't been functional (and won't be before fixing genfb abi). In a new drm update, we haven't prioritized fixing the build either. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/debug/module.md.amd64 cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/debug/module.md.i386 cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/lists/modules/md.amd64 cvs rdiff -u -r1.90 -r1.91 src/distrib/sets/lists/modules/md.i386 cvs rdiff -u -r1.255 -r1.256 src/sys/modules/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:36:51 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: convert remaining ibool to bool No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/usr.bin/indent/indent.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/indent/indent.h cvs rdiff -u -r1.31 -r1.32 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.61 -r1.62 src/usr.bin/indent/io.c cvs rdiff -u -r1.54 -r1.55 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/parse.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.74 src/usr.bin/indent/indent.c:1.75 --- src/usr.bin/indent/indent.c:1.74 Sat Sep 25 17:29:13 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 17:36:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.74 2021/09/25 17:29:13 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.75 2021/09/25 17:36:51 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.74 2021/09/25 17:29:13 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.75 2021/09/25 17:36:51 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -107,13 +107,13 @@ char *be_save; int found_err; int n_real_blanklines; -ibool prefix_blankline_requested; -ibool postfix_blankline_requested; -ibool break_comma; +boolprefix_blankline_requested; +boolpostfix_blankline_requested; +boolbreak_comma; float case_ind; -ibool had_eof; +boolhad_eof; int line_no; -ibool inhibit_formatting; +boolinhibit_formatting; int suppress_blanklines; int ifdef_level; @@ -124,7 +124,7 @@ FILE *input; FILE *output; static void bakcopy(void); -static void indent_declaration(int, ibool); +static void indent_declaration(int, bool); const char *in_name = "Standard Input"; /* will always point to name of input * file */ @@ -181,8 +181,8 @@ init_capsicum(void) #endif static void -search_brace(token_type *inout_ttype, ibool *inout_force_nl, - ibool *inout_comment_buffered, ibool *inout_last_else) +search_brace(token_type *inout_ttype, bool *inout_force_nl, + bool *inout_comment_buffered, bool *inout_last_else) { while (ps.search_brace) { switch (*inout_ttype) { @@ -263,7 +263,7 @@ search_brace(token_type *inout_ttype, ib /* FALLTHROUGH */ default: /* it is the start of a normal statement */ { - ibool remove_newlines; + bool remove_newlines; remove_newlines = /* "} else" */ @@ -524,7 +524,7 @@ process_end_of_file(void) } static void -process_comment_in_code(token_type ttype, ibool *inout_force_nl) +process_comment_in_code(token_type ttype, bool *inout_force_nl) { if (*inout_force_nl && ttype != semicolon && @@ -576,7 +576,7 @@ process_newline(void) } static void -process_lparen_or_lbracket(int dec_ind, ibool tabs_to_var, ibool sp_sw) +process_lparen_or_lbracket(int dec_ind, bool tabs_to_var, bool sp_sw) { /* count parens to make Healy happy */ if (++ps.p_l_follow == nitems(ps.paren_indents)) { @@ -626,8 +626,8 @@ process_lparen_or_lbracket(int dec_ind, } static void -process_rparen_or_rbracket(ibool *inout_sp_sw, ibool *inout_force_nl, - token_type hd_type) +process_rparen_or_rbracket(bool *inout_sp_sw, bool *inout_force_nl, + token_type hd_type) { if ((ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) != 0) { ps.last_u_d = true; @@ -663,7 +663,7 @@ process_rparen_or_rbracket(ibool *inout_ } static void -process_unary_op(int dec_ind, ibool tabs_to_var) +process_unary_op(int dec_ind, bool tabs_to_var) { if (!ps.dumped_decl_indent && ps.in_decl && !ps.block_init && ps.procname[0] == '\0' && ps.paren_level == 0) { @@ -726,7 +726,7 @@ process_question(int *inout_squest) } static void -process_colon(int *inout_squest, ibool *inout_force_nl, ibool *inout_scase) +process_colon(int *inout_squest, bool *inout_force_nl, bool *inout_scase) { if (*inout_squest > 0) { /* it is part of the ?: construct */ --*inout_squest; @@ -766,10 +766,10 @@ process_colon(int *inout_squest, ibool * } static void -process_semicolon(ibool *inout_scase, int *inout_squest, int dec_ind, - ibool tabs_to_var, ibool *inout_sp_sw, +process_semicolon(bool *inout_scase, int *inout_squest, int dec_ind, + bool tabs_to_var, bool *inout_sp_sw, token_type hd_type, - ibool *inout_force_nl) + bool
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:36:51 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: convert remaining ibool to bool No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/usr.bin/indent/indent.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/indent/indent.h cvs rdiff -u -r1.31 -r1.32 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.61 -r1.62 src/usr.bin/indent/io.c cvs rdiff -u -r1.54 -r1.55 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/parse.c cvs rdiff -u -r1.43 -r1.44 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:29:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: convert parser_state from ibool to bool indent.c:400:5: error: suggest parentheses around assignment used as truth value io.c:271:32: error: ‘~’ on a boolean expression No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/indent/indent.c cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.60 -r1.61 src/usr.bin/indent/io.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.73 src/usr.bin/indent/indent.c:1.74 --- src/usr.bin/indent/indent.c:1.73 Sat Sep 25 17:11:23 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 17:29:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.73 2021/09/25 17:11:23 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.74 2021/09/25 17:29:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.73 2021/09/25 17:11:23 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.74 2021/09/25 17:29:13 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -397,7 +397,7 @@ main_init_globals(void) in_buffer_limit = in_buffer + 8; buf_ptr = buf_end = in_buffer; line_no = 1; -had_eof = ps.in_decl = ps.decl_on_line = break_comma = false; +had_eof = ps.in_decl = ps.decl_on_line = (break_comma = false); ps.in_or_st = false; ps.bl_line = true; ps.want_blank = ps.in_stmt = ps.ind_stmt = false; Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.30 src/usr.bin/indent/indent_globs.h:1.31 --- src/usr.bin/indent/indent_globs.h:1.30 Sat Sep 25 17:20:02 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 17:29:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.30 2021/09/25 17:20:02 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.31 2021/09/25 17:29:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -194,7 +194,7 @@ extern struct parser_state { token_type p_stack[STACKSIZE]; /* this is the parsers stack */ int il[STACKSIZE]; /* this stack stores indentation levels */ float cstk[STACKSIZE];/* used to store case stmt indentation levels */ -ibool box_com; /* whether we are in a "boxed" comment. In +bool box_com; /* whether we are in a "boxed" comment. In * that case, the first non-blank char should * be lined up with the '/' in '/' + '*' */ int comment_delta; /* used to set up indentation for all lines @@ -207,35 +207,35 @@ extern struct parser_state { * close off casts */ int not_cast_mask; /* indicates which close parens definitely * close off something else than casts */ -ibool block_init; /* whether inside a block initialization */ +bool block_init; /* whether inside a block initialization */ int block_init_level; /* The level of brace nesting in an * initialization */ -ibool last_nl; /* this is true if the last thing scanned was +bool last_nl; /* this is true if the last thing scanned was * a newline */ -ibool in_or_st; /* Will be true iff there has been a +bool in_or_st; /* Will be true iff there has been a * declarator (e.g. int or char) and no left * paren since the last semicolon. When true, * a '{' is starting a structure definition or * an initialization list */ -ibool bl_line; /* set to 1 by dump_line if the line is blank */ -ibool col_1; /* set to true if the last token started in +bool bl_line; /* set to 1 by dump_line if the line is blank */ +bool col_1; /* set to true if the last token started in * column 1 */ int com_col; /* this is the column in which the current * comment should start */ int dec_nest; /* current nesting level for structure or init */ -ibool decl_on_line; /* set to true if this line of code has part +bool decl_on_line; /* set to true if this line of code has part * of a declaration on it */ int i_l_follow; /* the level to which ind_level should be set * after the current line is printed */ -ibool in_decl; /* set to true when we are in a declaration +bool in_decl; /* set to true when we are in a declaration * stmt. The processing of braces is then * slightly different */ -ibool in_stmt; /* set to 1 while in a stmt */ +bool in_stmt; /* set to 1 while in a stmt */ int ind_level; /* the current indentation level */ -ibool ind_stmt; /* set to 1 if next line should have
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:29:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c Log Message: indent: convert parser_state from ibool to bool indent.c:400:5: error: suggest parentheses around assignment used as truth value io.c:271:32: error: ‘~’ on a boolean expression No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/indent/indent.c cvs rdiff -u -r1.30 -r1.31 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.60 -r1.61 src/usr.bin/indent/io.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:20:02 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent_globs.h Log Message: indent: convert options from ibool to bool No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/args.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/indent_globs.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.25 src/usr.bin/indent/args.c:1.26 --- src/usr.bin/indent/args.c:1.25 Sat Sep 25 17:11:23 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 17:20:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.25 2021/09/25 17:11:23 rillig Exp $ */ +/* $NetBSD: args.c,v 1.26 2021/09/25 17:20:02 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.25 2021/09/25 17:11:23 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.26 2021/09/25 17:20:02 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -94,7 +94,7 @@ void add_typedefs_from_file(const char * #define assert_type(expr, type) (expr) #endif #define bool_option(name, value, var) \ - {name, PRO_BOOL, value, assert_type(&(var), ibool *)} + {name, PRO_BOOL, value, assert_type(&(var), bool *)} #define int_option(name, value, var) \ {name, PRO_INT, value, assert_type(&(var), int *)} #define special_option(name, value) \ @@ -312,9 +312,9 @@ found: case PRO_BOOL: if (p->p_special == OFF) - *(ibool *)p->p_obj = false; + *(bool *)p->p_obj = false; else - *(ibool *)p->p_obj = true; + *(bool *)p->p_obj = true; break; case PRO_INT: Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.29 src/usr.bin/indent/indent_globs.h:1.30 --- src/usr.bin/indent/indent_globs.h:1.29 Sat Sep 25 17:11:23 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 17:20:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.29 2021/09/25 17:11:23 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.30 2021/09/25 17:20:02 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -78,27 +78,27 @@ extern char *be_save; /* similarl extern struct options { -ibool blanklines_around_conditional_compilation; -ibool blanklines_after_declarations_at_proctop; /* this is vaguely +bool blanklines_around_conditional_compilation; +bool blanklines_after_declarations_at_proctop; /* this is vaguely * similar to blanklines_after_declarations * except that it only applies to the first * set of declarations in a procedure (just * after the first '{') and it causes a blank * line to be generated even if there are no * declarations */ -ibool blanklines_after_declarations; -ibool blanklines_after_procs; -ibool blanklines_before_blockcomments; -ibool leave_comma; /* if true, never break declarations after +bool blanklines_after_declarations; +bool blanklines_after_procs; +bool blanklines_before_blockcomments; +bool leave_comma; /* if true, never break declarations after * commas */ -ibool btype_2; /* whether brace should be on same line +bool btype_2; /* whether brace should be on same line * as if, while, etc */ -ibool Bill_Shannon; /* whether a blank should always be +bool Bill_Shannon; /* whether a blank should always be * inserted after sizeof */ -ibool comment_delimiter_on_blankline; +bool comment_delimiter_on_blankline; int decl_comment_column; /* the column in which comments after * declarations should be put */ -ibool cuddle_else; /* whether 'else' should cuddle up to '}' */ +bool cuddle_else; /* whether 'else' should cuddle up to '}' */ int continuation_indent; /* set to the indentation between the * edge of code and continuation lines */ float case_indent; /* The distance (measured in tabsize) to @@ -107,52 +107,52 @@ extern struct options { int comment_column; /* the column in which comments to the right * of code should start */ int decl_indent; /* indentation of identifier in declaration */ -ibool ljust_decl; /* true if declarations should be left +bool ljust_decl; /* true if declarations should be left * justified */ int unindent_displace; /* comments not to the right of code * will be placed this many * indentation levels to the left of * code */ -ibool extra_expression_indent; /* whether continuation lines from +bool extra_expression_indent; /* whether continuation lines from * the expression part of "if(e)", * "while(e)", "for(e;e;e)" should be
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:20:02 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent_globs.h Log Message: indent: convert options from ibool to bool No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/args.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/indent/indent_globs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:11:24 UTC 2021 Modified Files: src/usr.bin/indent: Makefile args.c indent.c indent.h indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: prepare for lint's strict bool mode Before C99, C had no boolean type. Instead, indent used int for that, just like many other programs. Even with C99, bool and int can be used interchangeably in many situations, such as querying '!i' or '!ptr' or 'cond == 0'. Since January 2021, lint provides the strict bool mode, which makes bool a non-arithmetic type that is incompatible with any other type. Having clearly separate types helps in understanding the code. To migrate indent to strict bool mode, the first step is to apply all changes that keep the resulting binary the same. Since sizeof(bool) is 1 and sizeof(int) is 4, the type ibool serves as an intermediate type. For now it is defined to int, later it will become bool. The current code compiles cleanly in C99 and C11 mode, as well as in lint's strict bool mode. There are a few tricky places: In args.c in 'struct pro', there are two types of options: boolean and integer. Boolean options point to a bool variable, integer options point to an int variable. To keep the current structure of the code, the pointer has been changed to 'void *'. To ensure type safety, the definition of the options is done via preprocessor magic, which in C11 mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the very bottom of the Makefile.) In indent.c in process_preprocessing, a boolean variable is post-incremented. That variable is only assigned to another variable, and that variable is only used in a boolean context. To provoke a different behavior between the '++' and the '= true', the source code to be indented would need 1 << 32 preprocessing directives, which is unlikely to happen in practice. In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever get the values 0 and 1. For these values, the expressions 'a & ~b' and 'a && !b' are equivalent, in all versions of C. The compiler may generate different code for them, though. In io.c in parse_indent_comment, the assignment to inhibit_formatting takes place in integer context. If the compiler is smart enough to detect the possible values of on_off, it may generate the same code before and after the change, but that is rather unlikely. The second step of the migration will be to replace ibool with bool, step by step, just in case there are any hidden gotchas in the code, such as sizeof or pointer casts. No change to the resulting binary. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/indent/Makefile cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/args.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/indent/indent.c cvs rdiff -u -r1.20 -r1.21 src/usr.bin/indent/indent.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.59 -r1.60 src/usr.bin/indent/io.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/parse.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/indent/pr_comment.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/indent/Makefile diff -u src/usr.bin/indent/Makefile:1.12 src/usr.bin/indent/Makefile:1.13 --- src/usr.bin/indent/Makefile:1.12 Fri Mar 26 22:27:43 2021 +++ src/usr.bin/indent/Makefile Sat Sep 25 17:11:23 2021 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.12 2021/03/26 22:27:43 rillig Exp $ +# $NetBSD: Makefile,v 1.13 2021/09/25 17:11:23 rillig Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= indent SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c CPPFLAGS+= ${DEBUG:D-Ddebug} -LINTFLAGS+= -e -w +LINTFLAGS+= -e -w -T .include Index: src/usr.bin/indent/args.c diff -u src/usr.bin/indent/args.c:1.24 src/usr.bin/indent/args.c:1.25 --- src/usr.bin/indent/args.c:1.24 Sat Sep 25 14:16:06 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 17:11:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.24 2021/09/25 14:16:06 rillig Exp $ */ +/* $NetBSD: args.c,v 1.25 2021/09/25 17:11:23 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.24 2021/09/25 14:16:06 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.25 2021/09/25 17:11:23 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -88,88 +88,99 @@ const char *option_source = "?"; void add_typedefs_from_file(const char *str); +#if __STDC_VERSION__ >= 201112L +#define assert_type(expr, type) _Generic((expr), type : (expr)) +#else +#define assert_type(expr, type) (expr) +#endif +#define bool_option(name, value, var) \ + {name, PRO_BOOL, value, assert_type(&(var), ibool
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 17:11:24 UTC 2021 Modified Files: src/usr.bin/indent: Makefile args.c indent.c indent.h indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: prepare for lint's strict bool mode Before C99, C had no boolean type. Instead, indent used int for that, just like many other programs. Even with C99, bool and int can be used interchangeably in many situations, such as querying '!i' or '!ptr' or 'cond == 0'. Since January 2021, lint provides the strict bool mode, which makes bool a non-arithmetic type that is incompatible with any other type. Having clearly separate types helps in understanding the code. To migrate indent to strict bool mode, the first step is to apply all changes that keep the resulting binary the same. Since sizeof(bool) is 1 and sizeof(int) is 4, the type ibool serves as an intermediate type. For now it is defined to int, later it will become bool. The current code compiles cleanly in C99 and C11 mode, as well as in lint's strict bool mode. There are a few tricky places: In args.c in 'struct pro', there are two types of options: boolean and integer. Boolean options point to a bool variable, integer options point to an int variable. To keep the current structure of the code, the pointer has been changed to 'void *'. To ensure type safety, the definition of the options is done via preprocessor magic, which in C11 mode ensures the correct pointer types. (Add CFLAGS+=-std=gnu11 at the very bottom of the Makefile.) In indent.c in process_preprocessing, a boolean variable is post-incremented. That variable is only assigned to another variable, and that variable is only used in a boolean context. To provoke a different behavior between the '++' and the '= true', the source code to be indented would need 1 << 32 preprocessing directives, which is unlikely to happen in practice. In io.c in dump_line, the variables ps.in_stmt and ps.in_decl only ever get the values 0 and 1. For these values, the expressions 'a & ~b' and 'a && !b' are equivalent, in all versions of C. The compiler may generate different code for them, though. In io.c in parse_indent_comment, the assignment to inhibit_formatting takes place in integer context. If the compiler is smart enough to detect the possible values of on_off, it may generate the same code before and after the change, but that is rather unlikely. The second step of the migration will be to replace ibool with bool, step by step, just in case there are any hidden gotchas in the code, such as sizeof or pointer casts. No change to the resulting binary. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/indent/Makefile cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/args.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/indent/indent.c cvs rdiff -u -r1.20 -r1.21 src/usr.bin/indent/indent.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.59 -r1.60 src/usr.bin/indent/io.c cvs rdiff -u -r1.53 -r1.54 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/parse.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/indent/pr_comment.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/luna68k
Module Name:src Committed By: tsutsui Date: Sat Sep 25 15:18:38 UTC 2021 Modified Files: src/sys/arch/luna68k/dev: lunaws.c sio.c sioreg.h siotty.c siovar.h src/sys/arch/luna68k/luna68k: machdep.c Added Files: src/sys/arch/luna68k/dev: siottyvar.h Removed Files: src/sys/arch/luna68k/dev: syscn.h Log Message: Refactor and cleanup sio (uPD7201) drivers. - remove confusing syscn*() functions (and its header) and prepare explicit siottycninit(), siottycnget() and siottycnput() functions - use exported struct consdev and cn_tab to initialize siotty console - enable and handle E/S interrupts to make BREAK signal detected properly - make CSR (status regsiters) access functions inline static - make single byte read/write (i.e. cnputc() and cngetc()) functions static inline and take struct sio_register rather than sio channel - use proper integer type (uint16_t) for getsiocsr() as siotty.c - handle channel dependent CR2A and CR2B registers properly - use more explicit definitions for RR_* macro used by getsiocsr() - define and use proper RR0 (read register) values (there is no isStatusReg(r) macro used on 4.4BSD/luna68k) Tested on LUNA with both wscons console and serial console. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunaws.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/dev/sio.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/sioreg.h cvs rdiff -u -r1.50 -r1.51 src/sys/arch/luna68k/dev/siotty.c cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/siottyvar.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/siovar.h cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/syscn.h cvs rdiff -u -r1.106 -r1.107 src/sys/arch/luna68k/luna68k/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/luna68k/dev/lunaws.c diff -u src/sys/arch/luna68k/dev/lunaws.c:1.38 src/sys/arch/luna68k/dev/lunaws.c:1.39 --- src/sys/arch/luna68k/dev/lunaws.c:1.38 Mon Sep 20 08:31:09 2021 +++ src/sys/arch/luna68k/dev/lunaws.c Sat Sep 25 15:18:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $ */ +/* $NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $"); #include "opt_wsdisplay_compat.h" #include "wsmouse.h" @@ -50,7 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1 #include #include #include -#include + +#include #include "ioconf.h" @@ -261,7 +262,7 @@ wsintr(void *arg) struct ws_softc *sc = arg; struct sioreg *sio = sc->sc_ctl; uint8_t code; - int rr; + uint16_t rr; bool handled = false; rr = getsiocsr(sio); @@ -513,10 +514,14 @@ omkbd_get_buzcmd(struct ws_softc *sc, st static void ws_cngetc(void *cookie, u_int *type, int *data) { - struct ws_softc *sc = cookie; + struct ws_softc *sc = cookie; /* currently unused */ + struct sioreg *sio, *sio_base; int code; - code = syscngetc((dev_t)1); + sio_base = (struct sioreg *)OBIO_SIO; + sio = _base[1]; /* channel B */ + + code = siogetc(sio); omkbd_decode(sc, code, type, data); } @@ -528,10 +533,14 @@ ws_cnpollc(void *cookie, int on) static void ws_cnbell(void *cookie, u_int pitch, u_int period, u_int volume) { - struct ws_softc *sc = cookie; + struct ws_softc *sc = cookie; /* currently unused */ + struct sioreg *sio, *sio_base; struct wskbd_bell_data wbd; uint8_t buzcmd; + sio_base = (struct sioreg *)OBIO_SIO; + sio = _base[1]; /* channel B */ + /* * XXX cnbell(9) man page should describe each args.. * (it looks similar to the struct wskbd_bell_data) @@ -545,7 +554,7 @@ ws_cnbell(void *cookie, u_int pitch, u_i wbd.volume = volume; buzcmd = omkbd_get_buzcmd(sc, , OMKBD_BUZZER_DEFAULT); - syscnputc((dev_t)1, buzcmd); + sioputc(sio, buzcmd); } /* EXPORT */ void Index: src/sys/arch/luna68k/dev/sio.c diff -u src/sys/arch/luna68k/dev/sio.c:1.15 src/sys/arch/luna68k/dev/sio.c:1.16 --- src/sys/arch/luna68k/dev/sio.c:1.15 Sat Aug 7 16:18:57 2021 +++ src/sys/arch/luna68k/dev/sio.c Sat Sep 25 15:18:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $ */ +/* $NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $"); #include #include @@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15 #include #include +#include #include #include "ioconf.h" Index:
CVS commit: src/sys/arch/luna68k
Module Name:src Committed By: tsutsui Date: Sat Sep 25 15:18:38 UTC 2021 Modified Files: src/sys/arch/luna68k/dev: lunaws.c sio.c sioreg.h siotty.c siovar.h src/sys/arch/luna68k/luna68k: machdep.c Added Files: src/sys/arch/luna68k/dev: siottyvar.h Removed Files: src/sys/arch/luna68k/dev: syscn.h Log Message: Refactor and cleanup sio (uPD7201) drivers. - remove confusing syscn*() functions (and its header) and prepare explicit siottycninit(), siottycnget() and siottycnput() functions - use exported struct consdev and cn_tab to initialize siotty console - enable and handle E/S interrupts to make BREAK signal detected properly - make CSR (status regsiters) access functions inline static - make single byte read/write (i.e. cnputc() and cngetc()) functions static inline and take struct sio_register rather than sio channel - use proper integer type (uint16_t) for getsiocsr() as siotty.c - handle channel dependent CR2A and CR2B registers properly - use more explicit definitions for RR_* macro used by getsiocsr() - define and use proper RR0 (read register) values (there is no isStatusReg(r) macro used on 4.4BSD/luna68k) Tested on LUNA with both wscons console and serial console. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunaws.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/dev/sio.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/sioreg.h cvs rdiff -u -r1.50 -r1.51 src/sys/arch/luna68k/dev/siotty.c cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/siottyvar.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/siovar.h cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/syscn.h cvs rdiff -u -r1.106 -r1.107 src/sys/arch/luna68k/luna68k/machdep.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/pci
Module Name:src Committed By: jmcneill Date: Sat Sep 25 15:16:36 UTC 2021 Modified Files: src/sys/dev/pci: if_mcx.c Log Message: Sync with OpenBSD r1.101: When processing a received packet, only sync the amount of bytes mcx(4) told us has arrived. The DMA map's mapsize on RX packets is the length of the allocated buffer. For mcx(4), this can be more than around 9000 bytes, as each buffer will be at least as big as the maximum supported MTU. There's no need to sync the whole buffer, if it's only a small packet. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_mcx.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/pci/if_mcx.c diff -u src/sys/dev/pci/if_mcx.c:1.19 src/sys/dev/pci/if_mcx.c:1.20 --- src/sys/dev/pci/if_mcx.c:1.19 Mon Sep 20 11:47:26 2021 +++ src/sys/dev/pci/if_mcx.c Sat Sep 25 15:16:36 2021 @@ -1,5 +1,5 @@ -/* $NetBSD: if_mcx.c,v 1.19 2021/09/20 11:47:26 jmcneill Exp $ */ -/* $OpenBSD: if_mcx.c,v 1.99 2021/02/15 03:42:00 dlg Exp $ */ +/* $NetBSD: if_mcx.c,v 1.20 2021/09/25 15:16:36 jmcneill Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */ /* * Copyright (c) 2017 David Gwynne @@ -23,7 +23,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.19 2021/09/20 11:47:26 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.20 2021/09/25 15:16:36 jmcneill Exp $"); #include #include @@ -6921,21 +6921,21 @@ mcx_process_rx(struct mcx_softc *sc, str struct ifnet *ifp = >sc_ec.ec_if; struct mcx_slot *ms; struct mbuf *m; - uint32_t flags; + uint32_t flags, len; int slot; + len = be32dec(>cq_byte_cnt); slot = be16toh(cqe->cq_wqe_count) % (1 << MCX_LOG_RQ_SIZE); ms = >rx_slots[slot]; - bus_dmamap_sync(sc->sc_dmat, ms->ms_map, 0, ms->ms_map->dm_mapsize, - BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmat, ms->ms_map, 0, len, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, ms->ms_map); m = ms->ms_m; ms->ms_m = NULL; m_set_rcvif(m, >sc_ec.ec_if); - m->m_pkthdr.len = m->m_len = be32dec(>cq_byte_cnt); + m->m_pkthdr.len = m->m_len = len; #if 0 if (cqe->cq_rx_hash_type) {
CVS commit: src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sat Sep 25 15:16:36 UTC 2021 Modified Files: src/sys/dev/pci: if_mcx.c Log Message: Sync with OpenBSD r1.101: When processing a received packet, only sync the amount of bytes mcx(4) told us has arrived. The DMA map's mapsize on RX packets is the length of the allocated buffer. For mcx(4), this can be more than around 9000 bytes, as each buffer will be at least as big as the maximum supported MTU. There's no need to sync the whole buffer, if it's only a small packet. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_mcx.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:38:31 UTC 2021 Modified Files: src/usr.bin/indent: indent.h indent_globs.h Log Message: indent: use standard definition for bool, true, false To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/indent/indent.h cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/indent_globs.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/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.19 src/usr.bin/indent/indent.h:1.20 --- src/usr.bin/indent/indent.h:1.19 Sat Sep 25 14:16:06 2021 +++ src/usr.bin/indent/indent.h Sat Sep 25 14:38:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.19 2021/09/25 14:16:06 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.20 2021/09/25 14:38:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $"); #endif +#include + #include "indent_codes.h" #include "indent_globs.h" Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.27 src/usr.bin/indent/indent_globs.h:1.28 --- src/usr.bin/indent/indent_globs.h:1.27 Sat Sep 25 10:41:03 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 14:38:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.27 2021/09/25 10:41:03 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.28 2021/09/25 14:38:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,9 +46,6 @@ * of code */ -#define false 0 -#define true 1 - struct buffer { char *buf; /* buffer */ char *s; /* start */
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:38:31 UTC 2021 Modified Files: src/usr.bin/indent: indent.h indent_globs.h Log Message: indent: use standard definition for bool, true, false To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/indent/indent.h cvs rdiff -u -r1.27 -r1.28 src/usr.bin/indent/indent_globs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:26:05 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: merge duplicate code for initializing buffers No functional change. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.71 src/usr.bin/indent/indent.c:1.72 --- src/usr.bin/indent/indent.c:1.71 Sat Sep 25 14:16:06 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 14:26:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.71 2021/09/25 14:16:06 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.72 2021/09/25 14:26:05 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.71 2021/09/25 14:16:06 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.72 2021/09/25 14:26:05 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -366,6 +366,17 @@ search_brace(token_type *inout_ttype, in } static void +buf_init(struct buffer *buf) +{ +buf->buf = xmalloc(bufsize); +buf->buf[0] = ' '; /* allow accessing buf->e[-1] */ +buf->buf[1] = '\0'; +buf->s = buf->buf + 1; +buf->e = buf->s; +buf->l = buf->buf + bufsize - 5; /* safety margin, though unreliable */ +} + +static void main_init_globals(void) { found_err = 0; @@ -374,24 +385,13 @@ main_init_globals(void) ps.last_nl = true; /* this is true if the last thing scanned was * a newline */ ps.last_token = semicolon; -com.buf = xmalloc(bufsize); -lab.buf = xmalloc(bufsize); -code.buf = xmalloc(bufsize); -token.buf = xmalloc(bufsize); +buf_init(); +buf_init(); +buf_init(); +buf_init(); alloc_typenames(); init_constant_tt(); -com.l = com.buf + bufsize - 5; -lab.l = lab.buf + bufsize - 5; -code.l = code.buf + bufsize - 5; -token.l = token.buf + bufsize - 5; -com.buf[0] = code.buf[0] = lab.buf[0] = ' '; /* set up code, label, and - * comment buffers */ -com.buf[1] = code.buf[1] = lab.buf[1] = token.buf[1] = '\0'; opt.else_if = 1; /* Default else-if special processing to on */ -lab.s = lab.e = lab.buf + 1; -code.s = code.e = code.buf + 1; -com.s = com.e = com.buf + 1; -token.s = token.e = token.buf + 1; in_buffer = xmalloc(10); in_buffer_limit = in_buffer + 8;
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:26:05 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: merge duplicate code for initializing buffers No functional change. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/usr.bin/indent/indent.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:16:06 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h Log Message: indent: clean up initialization of options The default values in 'struct pro' were redundant but all consistent, even with the commented defaults in main_parse_command_line. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/args.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/indent/indent.c cvs rdiff -u -r1.18 -r1.19 src/usr.bin/indent/indent.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 14:16:06 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h Log Message: indent: clean up initialization of options The default values in 'struct pro' were redundant but all consistent, even with the commented defaults in main_parse_command_line. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.bin/indent/args.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/indent/indent.c cvs rdiff -u -r1.18 -r1.19 src/usr.bin/indent/indent.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.23 src/usr.bin/indent/args.c:1.24 --- src/usr.bin/indent/args.c:1.23 Sat Sep 25 13:38:32 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 14:16:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.23 2021/09/25 13:38:32 rillig Exp $ */ +/* $NetBSD: args.c,v 1.24 2021/09/25 14:16:06 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c 8.1 ( #include #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.23 2021/09/25 13:38:32 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.24 2021/09/25 14:16:06 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif @@ -97,82 +97,81 @@ void add_typedefs_from_file(const char * const struct pro { const char *p_name; /* name, e.g. -bl, -cli */ int p_type; /* type (int, bool, special) */ -int p_default; /* the default value (if int) */ int p_special; /* depends on type */ int*p_obj; /* the associated variable */ } pro[] = { -{"T", PRO_SPECIAL, 0, KEY, 0}, -{"U", PRO_SPECIAL, 0, KEY_FILE, 0}, -{"-version", PRO_SPECIAL, 0, VERSION, 0}, -{"P", PRO_SPECIAL, 0, IGN, 0}, -{"bacc", PRO_BOOL, false, ON, _around_conditional_compilation}, -{"badp", PRO_BOOL, false, ON, _after_declarations_at_proctop}, -{"bad", PRO_BOOL, false, ON, _after_declarations}, -{"bap", PRO_BOOL, false, ON, _after_procs}, -{"bbb", PRO_BOOL, false, ON, _before_blockcomments}, -{"bc", PRO_BOOL, true, OFF, _comma}, -{"bl", PRO_BOOL, true, OFF, _2}, -{"br", PRO_BOOL, true, ON, _2}, -{"bs", PRO_BOOL, false, ON, _Shannon}, -{"cdb", PRO_BOOL, true, ON, _delimiter_on_blankline}, -{"cd", PRO_INT, 0, 0, _comment_column}, -{"ce", PRO_BOOL, true, ON, _else}, -{"ci", PRO_INT, 0, 0, _indent}, -{"cli", PRO_SPECIAL, 0, CLI, 0}, -{"cs", PRO_BOOL, false, ON, _after_cast}, -{"c", PRO_INT, 33, 0, _column}, -{"di", PRO_INT, 16, 0, _indent}, -{"dj", PRO_BOOL, false, ON, _decl}, -{"d", PRO_INT, 0, 0, _displace}, -{"eei", PRO_BOOL, false, ON, _expression_indent}, -{"ei", PRO_BOOL, true, ON, _if}, -{"fbs", PRO_BOOL, true, ON, _brace_split}, -{"fc1", PRO_BOOL, true, ON, _col1_comments}, -{"fcb", PRO_BOOL, true, ON, _block_comments}, -{"ip", PRO_BOOL, true, ON, _parameters}, -{"i", PRO_INT, 8, 0, _size}, -{"lc", PRO_INT, 0, 0, _comment_max_line_length}, -{"ldi", PRO_INT, -1, 0, _decl_indent}, -{"lpl", PRO_BOOL, false, ON, _to_parens_always}, -{"lp", PRO_BOOL, true, ON, _to_parens}, -{"l", PRO_INT, 78, 0, _line_length}, -{"nbacc", PRO_BOOL, false, OFF, _around_conditional_compilation}, -{"nbadp", PRO_BOOL, false, OFF, _after_declarations_at_proctop}, -{"nbad", PRO_BOOL, false, OFF, _after_declarations}, -{"nbap", PRO_BOOL, false, OFF, _after_procs}, -{"nbbb", PRO_BOOL, false, OFF, _before_blockcomments}, -{"nbc", PRO_BOOL, true, ON, _comma}, -{"nbs", PRO_BOOL, false, OFF, _Shannon}, -{"ncdb", PRO_BOOL, true, OFF, _delimiter_on_blankline}, -{"nce", PRO_BOOL, true, OFF, _else}, -{"ncs", PRO_BOOL, false, OFF, _after_cast}, -{"ndj", PRO_BOOL, false, OFF, _decl}, -{"neei", PRO_BOOL, false, OFF, _expression_indent}, -{"nei", PRO_BOOL, true, OFF, _if}, -{"nfbs", PRO_BOOL, true, OFF, _brace_split}, -{"nfc1", PRO_BOOL, true, OFF, _col1_comments}, -{"nfcb", PRO_BOOL, true, OFF, _block_comments}, -{"nip", PRO_BOOL, true, OFF, _parameters}, -{"nlpl", PRO_BOOL, false, OFF, _to_parens_always}, -{"nlp", PRO_BOOL, true, OFF, _to_parens}, -{"npcs", PRO_BOOL, false, OFF, _calls_space}, -{"npro", PRO_SPECIAL, 0, IGN, 0}, -{"npsl", PRO_BOOL, true, OFF, _start_line}, -{"nsc", PRO_BOOL, true, OFF, _comment_cont}, -{"nsob", PRO_BOOL, false, OFF, _optional_blanklines}, -{"nut", PRO_BOOL, true, OFF, _tabs}, -{"nv", PRO_BOOL, false, OFF, }, -{"pcs", PRO_BOOL, false, ON, _calls_space}, -{"psl", PRO_BOOL, true, ON, _start_line}, -{"sc", PRO_BOOL, true, ON, _comment_cont}, -{"sob", PRO_BOOL, false, ON, _optional_blanklines}, -{"st", PRO_SPECIAL,
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:38:33 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h io.c lexi.c parse.c pr_comment.c Log Message: indent: remove ifdef for lint NetBSD lint does not need them anymore, FreeBSD does not have lint. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/indent/args.c \ src/usr.bin/indent/parse.c cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/indent.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/indent.h cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/io.c cvs rdiff -u -r1.52 -r1.53 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/indent/pr_comment.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/indent/args.c diff -u src/usr.bin/indent/args.c:1.22 src/usr.bin/indent/args.c:1.23 --- src/usr.bin/indent/args.c:1.22 Sun Mar 14 00:22:16 2021 +++ src/usr.bin/indent/args.c Sat Sep 25 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.22 2021/03/14 00:22:16 rillig Exp $ */ +/* $NetBSD: args.c,v 1.23 2021/09/25 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,19 +38,15 @@ */ #if 0 -#ifndef lint static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93"; -#endif /* not lint */ #endif #include -#ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: args.c,v 1.22 2021/03/14 00:22:16 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.23 2021/09/25 13:38:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $"); #endif -#endif /* * Argument scanning and profile reading code. Default parameters are set Index: src/usr.bin/indent/parse.c diff -u src/usr.bin/indent/parse.c:1.22 src/usr.bin/indent/parse.c:1.23 --- src/usr.bin/indent/parse.c:1.22 Sat Sep 25 08:04:13 2021 +++ src/usr.bin/indent/parse.c Sat Sep 25 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.22 2021/09/25 08:04:13 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.23 2021/09/25 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,19 +38,15 @@ */ #if 0 -#ifndef lint static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93"; -#endif /* not lint */ #endif #include -#ifndef lint #if defined(__NetBSD__) __RCSID("$FreeBSD$"); #else __FBSDID("$FreeBSD: head/usr.bin/indent/parse.c 337651 2018-08-11 19:20:06Z pstef $"); #endif -#endif #include #include Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.69 src/usr.bin/indent/indent.c:1.70 --- src/usr.bin/indent/indent.c:1.69 Sat Sep 25 10:41:03 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.69 2021/09/25 10:41:03 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.70 2021/09/25 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,19 +38,15 @@ */ #if 0 -#ifndef lint static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93"; -#endif /* not lint */ #endif #include -#ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.69 2021/09/25 10:41:03 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.70 2021/09/25 13:38:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif -#endif #include #if HAVE_CAPSICUM Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.17 src/usr.bin/indent/indent.h:1.18 --- src/usr.bin/indent/indent.h:1.17 Sat Sep 25 08:23:31 2021 +++ src/usr.bin/indent/indent.h Sat Sep 25 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.17 2021/09/25 08:23:31 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.18 2021/09/25 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -29,10 +29,8 @@ */ #if 0 -#if defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $"); #endif -#endif #include "indent_codes.h" #include "indent_globs.h" Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.58 src/usr.bin/indent/io.c:1.59 --- src/usr.bin/indent/io.c:1.58 Sat Sep 25 10:41:03 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 13:38:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.58 2021/09/25 10:41:03 rillig Exp $ */ +/* $NetBSD: io.c,v 1.59 2021/09/25 13:38:32 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,19 +38,15 @@ */ #if 0 -#ifndef lint static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; -#endif /* not lint */ #endif #include -#ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.58 2021/09/25 10:41:03 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.59 2021/09/25 13:38:32 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif -#endif #include
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:38:33 UTC 2021 Modified Files: src/usr.bin/indent: args.c indent.c indent.h io.c lexi.c parse.c pr_comment.c Log Message: indent: remove ifdef for lint NetBSD lint does not need them anymore, FreeBSD does not have lint. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/indent/args.c \ src/usr.bin/indent/parse.c cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/indent.c cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/indent.h cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/io.c cvs rdiff -u -r1.52 -r1.53 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:26:07 UTC 2021 Modified Files: src/tests/usr.bin/indent: token-while_expr.0 token-while_expr.0.stdout Log Message: tests/indent: test formatting of while and do-while loops To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token-while_expr.0 \ src/tests/usr.bin/indent/token-while_expr.0.stdout 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/indent/token-while_expr.0 diff -u src/tests/usr.bin/indent/token-while_expr.0:1.1 src/tests/usr.bin/indent/token-while_expr.0:1.2 --- src/tests/usr.bin/indent/token-while_expr.0:1.1 Fri Mar 12 00:13:06 2021 +++ src/tests/usr.bin/indent/token-while_expr.0 Sat Sep 25 13:26:07 2021 @@ -1,8 +1,9 @@ -/* $NetBSD: token-while_expr.0,v 1.1 2021/03/12 00:13:06 rillig Exp $ */ +/* $NetBSD: token-while_expr.0,v 1.2 2021/09/25 13:26:07 rillig Exp $ */ /* $FreeBSD$ */ /* * Tests for the keyword 'while', followed by a parenthesized expression. */ -/* TODO: Add some code to be formatted. */ +int main(int argc,char**argv){int o;while((o=getopt(argc,argv,"x:"))!=-1) +switch(o){case'x':do{o++;}while(o<5);break;default:usage();}return 0;} Index: src/tests/usr.bin/indent/token-while_expr.0.stdout diff -u src/tests/usr.bin/indent/token-while_expr.0.stdout:1.1 src/tests/usr.bin/indent/token-while_expr.0.stdout:1.2 --- src/tests/usr.bin/indent/token-while_expr.0.stdout:1.1 Fri Mar 12 00:13:06 2021 +++ src/tests/usr.bin/indent/token-while_expr.0.stdout Sat Sep 25 13:26:07 2021 @@ -1,8 +1,23 @@ -/* $NetBSD: token-while_expr.0.stdout,v 1.1 2021/03/12 00:13:06 rillig Exp $ */ +/* $NetBSD: token-while_expr.0.stdout,v 1.2 2021/09/25 13:26:07 rillig Exp $ */ /* $FreeBSD$ */ /* * Tests for the keyword 'while', followed by a parenthesized expression. */ -/* TODO: Add some code to be formatted. */ +int +main(int argc, char **argv) +{ + int o; + while ((o = getopt(argc, argv, "x:")) != -1) + switch (o) { + case 'x': + do { +o++; + } while (o < 5); + break; + default: + usage(); +/* $ XXX: The 'return' should be in a separate line. */ + } return 0; +}
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:26:07 UTC 2021 Modified Files: src/tests/usr.bin/indent: token-while_expr.0 token-while_expr.0.stdout Log Message: tests/indent: test formatting of while and do-while loops To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token-while_expr.0 \ src/tests/usr.bin/indent/token-while_expr.0.stdout 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: Sat Sep 25 13:06:06 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi Log Message: tests/indent: test deeply nested struct declarations To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 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.1128 src/distrib/sets/lists/tests/mi:1.1129 --- src/distrib/sets/lists/tests/mi:1.1128 Sat Sep 25 12:20:44 2021 +++ src/distrib/sets/lists/tests/mi Sat Sep 25 13:06:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1128 2021/09/25 12:20:44 rillig Exp $ +# $NetBSD: mi,v 1.1129 2021/09/25 13:06:05 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4739,6 +4739,7 @@ ./usr/tests/usr.bin/indent/cs.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/cs.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/declarations.0tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/declarations.0.stderr tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/declarations.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/elsecomment.0tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/elsecomment.0.protests-usr.bin-tests compattestfile,atf
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: rillig Date: Sat Sep 25 13:06:06 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi Log Message: tests/indent: test deeply nested struct declarations To generate a diff of this commit: cvs rdiff -u -r1.1128 -r1.1129 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/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:04:55 UTC 2021 Modified Files: src/tests/usr.bin/indent: Makefile declarations.0 declarations.0.stdout Added Files: src/tests/usr.bin/indent: declarations.0.stderr Log Message: tests/indent: test deeply nested struct declarations To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/declarations.0 cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/declarations.0.stderr cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/declarations.0.stdout 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/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.10 src/tests/usr.bin/indent/Makefile:1.11 --- src/tests/usr.bin/indent/Makefile:1.10 Sat Sep 25 12:20:44 2021 +++ src/tests/usr.bin/indent/Makefile Sat Sep 25 13:04:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2021/09/25 12:20:44 rillig Exp $ +# $NetBSD: Makefile,v 1.11 2021/09/25 13:04:55 rillig Exp $ .include @@ -16,6 +16,7 @@ FILES+= comments.0 FILES+= comments.0.pro FILES+= comments.0.stdout FILES+= declarations.0 +FILES+= declarations.0.stderr FILES+= declarations.0.stdout FILES+= elsecomment.0 FILES+= elsecomment.0.stdout Index: src/tests/usr.bin/indent/declarations.0 diff -u src/tests/usr.bin/indent/declarations.0:1.2 src/tests/usr.bin/indent/declarations.0:1.3 --- src/tests/usr.bin/indent/declarations.0:1.2 Sat Mar 6 19:51:24 2021 +++ src/tests/usr.bin/indent/declarations.0 Sat Sep 25 13:04:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: declarations.0,v 1.2 2021/03/06 19:51:24 rillig Exp $ */ +/* $NetBSD: declarations.0,v 1.3 2021/09/25 13:04:55 rillig Exp $ */ /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */ /* See r303570 */ @@ -78,3 +78,53 @@ do_execve(td, args, mac_p) { } + +/* Trigger the warning about nested struct declarations. */ +struct s01 { +struct s02 { +struct s03 { +struct s04 { +struct s05 { +struct s06 { +struct s07 { +struct s08 { +struct s09 { +struct s00 { +struct s11 { +struct s12 { +struct s13 { +struct s14 { +struct s15 { +struct s16 { +struct s17 { +struct s18 { +struct s19 { +struct s20 { +struct s21 { +struct s22 { +struct s23 { +struct s24 { +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; +}; Index: src/tests/usr.bin/indent/declarations.0.stdout diff -u src/tests/usr.bin/indent/declarations.0.stdout:1.1 src/tests/usr.bin/indent/declarations.0.stdout:1.2 --- src/tests/usr.bin/indent/declarations.0.stdout:1.1 Thu Apr 4 15:27:35 2019 +++ src/tests/usr.bin/indent/declarations.0.stdout Sat Sep 25 13:04:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: declarations.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $ */ +/* $NetBSD: declarations.0.stdout,v 1.2 2021/09/25 13:04:55 rillig Exp $ */ /* $FreeBSD: head/usr.bin/indent/tests/declarations.0.stdout 334480 2018-06-01 09:58:44Z pstef $ */ /* See r303570 */ @@ -72,3 +72,53 @@ do_execve(td, args, mac_p) { } + +/* Trigger the warning about nested struct declarations. */ +struct s01 { + struct s02 { + struct s03 { + struct s04 { +struct s05 { + struct s06 { + struct s07 { + struct s08 { +struct s09 { + struct s00 { + struct s11 { + struct s12 { +struct s13 { + struct s14 { + struct s15 { + struct s16 { +struct s17 { + struct s18 { + struct s19 { + struct s20 { +struct s21 { + struct s22 { + struct s23 { + struct s24 { + }; + }; + }; +}; + }; + }; + }; +}; + }; + }; + }; +}; + }; + }; + }; +}; + }; + }; + }; +}; + }; + }; + }; +}; Added files: Index: src/tests/usr.bin/indent/declarations.0.stderr diff -u /dev/null src/tests/usr.bin/indent/declarations.0.stderr:1.1 --- /dev/null Sat Sep 25 13:04:55 2021 +++ src/tests/usr.bin/indent/declarations.0.stderr Sat Sep 25 13:04:55 2021 @@ -0,0 +1,5 @@ +/**INDENT** Warning@95: Reached internal limit of 20 struct levels */ +/**INDENT** Warning@96: Reached internal limit of 20 struct levels */ +/**INDENT** Warning@97: Reached internal limit of 20 struct levels */ +/**INDENT** Warning@98: Reached internal limit of 20 struct levels */ +/**INDENT** Warning@99: Reached internal limit of 20 struct levels */
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 13:04:55 UTC 2021 Modified Files: src/tests/usr.bin/indent: Makefile declarations.0 declarations.0.stdout Added Files: src/tests/usr.bin/indent: declarations.0.stderr Log Message: tests/indent: test deeply nested struct declarations To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/declarations.0 cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/declarations.0.stderr cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/declarations.0.stdout 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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 12:47:17 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_indent.sh Log Message: tests/indent: clean up test driver For most of the test data, it was not necessary to copy the files to the working directory, even though the comment said so. The test data had been taken from the cleaned files anyway. Use sed instead of cp to copy the files, to allow for comments in all kind of files, even the type lists for the option '-U'. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/t_indent.sh 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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 12:47:17 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_indent.sh Log Message: tests/indent: clean up test driver For most of the test data, it was not necessary to copy the files to the working directory, even though the comment said so. The test data had been taken from the cleaned files anyway. Use sed instead of cp to copy the files, to allow for comments in all kind of files, even the type lists for the option '-U'. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/t_indent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/indent/t_indent.sh diff -u src/tests/usr.bin/indent/t_indent.sh:1.6 src/tests/usr.bin/indent/t_indent.sh:1.7 --- src/tests/usr.bin/indent/t_indent.sh:1.6 Sat Sep 25 09:22:39 2021 +++ src/tests/usr.bin/indent/t_indent.sh Sat Sep 25 12:47:17 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_indent.sh,v 1.6 2021/09/25 09:22:39 rillig Exp $ +# $NetBSD: t_indent.sh,v 1.7 2021/09/25 12:47:17 rillig Exp $ # # Copyright 2016 Dell EMC # All rights reserved. @@ -30,49 +30,41 @@ # shellcheck disable=SC2039 -SRCDIR=$(atf_get_srcdir) +srcdir=$(atf_get_srcdir) +indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) check() { local tc=$1; shift - # shellcheck disable=SC2155 - local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) - - # All of the files need to be in the ATF sandbox in order for the tests - # to pass. - atf_check cp "$SRCDIR/$tc"* . - - # Remove single-line block comments that start with '$'. This removes + # Copy the test data to the working directory and while doing that, + # remove single-line block comments that start with '$'. This removes # RCS IDs, preventing them to be broken into several lines. It also # allows for remarks that are only needed in either the input or the # output. These removals affect the line numbers in the diffs. - for fname in "$tc" "$tc.stdout" "$tc.stderr"; do - if [ -f "$fname" ]; then - atf_check -o "save:$fname.clean" \ - sed -e '/^\/\*[[:space:]]$.*/d' "$fname" - fi + for fname in "$srcdir/$tc"*; do + atf_check -o "save:${fname##*/}" \ + sed -e '/^\/\*[[:space:]]$.*/d' "$fname" done local out_arg='empty' - if [ -f "$tc.stdout.clean" ]; then - out_arg="file:$tc.stdout.clean" + if [ -f "$tc.stdout" ]; then + out_arg="file:$tc.stdout" fi local err_arg='empty' - if [ -f "$tc.stderr.clean" ]; then - err_arg="file:$tc.stderr.clean" + if [ -f "$tc.stderr" ]; then + err_arg="file:$tc.stderr" fi - # Make sure we don't implicitly use ~/.indent.pro from the test - # host, for determinism purposes. + # Do not implicitly use ~/.indent.pro from the test host. local pro_arg='-npro' if [ -f "$tc.pro" ]; then pro_arg="-P$tc.pro" fi atf_check -s "exit:${tc##*.}" -o "$out_arg" -e "$err_arg" \ - "$indent" "$pro_arg" < "$tc.clean" + "$indent" "$pro_arg" < "$tc" } add_testcase() @@ -100,7 +92,7 @@ add_testcase() atf_init_test_cases() { # shellcheck disable=SC2044 - for path in $(find -Es "$SRCDIR" -regex '.*\.[0-9]+$'); do + for path in $(find -Es "$srcdir" -regex '.*\.[0-9]+$'); do add_testcase "${path##*/}" done }
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Sep 25 12:20:44 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: lex.0 lex.0.pro lex.0.stdout Log Message: tests/indent: test edge cases for the tokenizer To generate a diff of this commit: cvs rdiff -u -r1.1127 -r1.1128 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lex.0 \ src/tests/usr.bin/indent/lex.0.pro src/tests/usr.bin/indent/lex.0.stdout 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.1127 src/distrib/sets/lists/tests/mi:1.1128 --- src/distrib/sets/lists/tests/mi:1.1127 Sat Sep 25 09:46:29 2021 +++ src/distrib/sets/lists/tests/mi Sat Sep 25 12:20:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1127 2021/09/25 09:46:29 rillig Exp $ +# $NetBSD: mi,v 1.1128 2021/09/25 12:20:44 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4753,6 +4753,9 @@ ./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.stdouttests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex.0.pro tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lex_char.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lex_char.0.protests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lex_char.0.stdouttests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.9 src/tests/usr.bin/indent/Makefile:1.10 --- src/tests/usr.bin/indent/Makefile:1.9 Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/Makefile Sat Sep 25 12:20:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2021/09/25 09:46:29 rillig Exp $ +# $NetBSD: Makefile,v 1.10 2021/09/25 12:20:44 rillig Exp $ .include @@ -30,6 +30,9 @@ FILES+= indent_variables.0.stdout FILES+= label.0 FILES+= label.0.stdout FILES+= label.0.pro +FILES+= lex.0 +FILES+= lex.0.pro +FILES+= lex.0.stdout FILES+= lex_char.0 FILES+= lex_char.0.pro FILES+= lex_char.0.stdout Added files: Index: src/tests/usr.bin/indent/lex.0 diff -u /dev/null src/tests/usr.bin/indent/lex.0:1.1 --- /dev/null Sat Sep 25 12:20:44 2021 +++ src/tests/usr.bin/indent/lex.0 Sat Sep 25 12:20:44 2021 @@ -0,0 +1,40 @@ +/* $NetBSD: lex.0,v 1.1 2021/09/25 12:20:44 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * Test lexing of tokens, such as keywords, identifiers, operators. + */ + +/* GCC accepts this even with WARNS=6. */ +in\ +t \ +var\ +iable; + +int + no_backslash; + +/* $ See check_size_token. */ +/* $ The default buffer size is 200, the limit is 195. */ +struct long_tag_name_to_overflow_the_token_buffer_4567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890; + +/* $ See check_size_token. */ +/* $ The difference between limit and start got incremented to 595. */ +struct long_tag_name_to_overflow_the_token_buffer_4567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890\ +12345678901234567890123456789012345678901234567890; + +/* This is a syntax error; see lex_word. */ +int identifier\n; Index: src/tests/usr.bin/indent/lex.0.pro diff -u /dev/null src/tests/usr.bin/indent/lex.0.pro:1.1 --- /dev/null Sat Sep 25 12:20:44 2021 +++ src/tests/usr.bin/indent/lex.0.pro Sat Sep 25 12:20:44 2021 @@ -0,0 +1,4 @@ +/* $NetBSD: lex.0.pro,v 1.1 2021/09/25 12:20:44 rillig Exp $ */ +/* $FreeBSD$ */ + +-di16 Index: src/tests/usr.bin/indent/lex.0.stdout diff -u /dev/null src/tests/usr.bin/indent/lex.0.stdout:1.1 --- /dev/null Sat Sep 25 12:20:44 2021 +++ src/tests/usr.bin/indent/lex.0.stdout Sat Sep 25 12:20:44 2021 @@ -0,0 +1,21 @@ +/* $NetBSD: lex.0.stdout,v 1.1 2021/09/25 12:20:44 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * Test lexing of tokens, such as keywords, identifiers, operators. + */ + +/* GCC accepts this even with WARNS=6. */ +/* $ XXX:
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Sep 25 12:20:44 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: lex.0 lex.0.pro lex.0.stdout Log Message: tests/indent: test edge cases for the tokenizer To generate a diff of this commit: cvs rdiff -u -r1.1127 -r1.1128 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lex.0 \ src/tests/usr.bin/indent/lex.0.pro src/tests/usr.bin/indent/lex.0.stdout Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 10:41:03 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c pr_comment.c Log Message: indent: move statistical values into a separate struct No functional change. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/usr.bin/indent/indent.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/io.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.68 src/usr.bin/indent/indent.c:1.69 --- src/usr.bin/indent/indent.c:1.68 Sat Sep 25 08:23:31 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 10:41:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.68 2021/09/25 08:23:31 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.69 2021/09/25 10:41:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.68 2021/09/25 08:23:31 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.69 2021/09/25 10:41:03 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -94,7 +94,6 @@ int prefix_blankline_requested; int postfix_blankline_requested; int break_comma; float case_ind; -int code_lines; int had_eof; int line_no; int inhibit_formatting; @@ -528,9 +527,9 @@ process_end_of_file(void) if (opt.verbose) { printf("There were %d output lines and %d comments\n", - ps.out_lines, ps.out_coms); + ps.stats.lines, ps.stats.comments); printf("(Lines with comments)/(Lines with code): %6.3f\n", - (1.0 * ps.com_lines) / code_lines); + (1.0 * ps.stats.comment_lines) / ps.stats.code_lines); } fflush(output); Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.26 src/usr.bin/indent/indent_globs.h:1.27 --- src/usr.bin/indent/indent_globs.h:1.26 Sat Sep 25 08:04:13 2021 +++ src/usr.bin/indent/indent_globs.h Sat Sep 25 10:41:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.26 2021/09/25 08:04:13 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.27 2021/09/25 10:41:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -184,7 +184,6 @@ extern int break_comma; /* when * comma */ extern float case_ind; /* indentation level to be used for a "case * n:" */ -extern int code_lines; /* count of lines with code */ extern int had_eof; /* set to true when input is exhausted */ extern int line_no; /* the current line number. */ extern int inhibit_formatting; /* true if INDENT OFF is in effect */ @@ -226,8 +225,6 @@ extern struct parser_state { * column 1 */ int com_col; /* this is the column in which the current * comment should start */ -int com_lines; /* the number of lines with comments, set by - * dump_line */ int dec_nest; /* current nesting level for structure or init */ int decl_on_line; /* set to true if this line of code has part * of a declaration on it */ @@ -243,10 +240,6 @@ extern struct parser_state { * middle of a stmt */ int last_u_d; /* set to true after scanning a token which * forces a following operator to be unary */ -int out_coms; /* the number of comments processed, set by - * process_comment */ -int out_lines; /* the number of lines written, set by - * dump_line */ int p_l_follow; /* used to remember how to indent following * statement */ int paren_level; /* parenthesization level. used to indent @@ -271,6 +264,13 @@ extern struct parser_state { int tos; /* pointer to top of stack */ charprocname[100]; /* The name of the current procedure */ int just_saw_decl; + +struct { + int comments; + int lines; + int code_lines; + int comment_lines; +} stats; } ps; extern int ifdef_level; Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.57 src/usr.bin/indent/io.c:1.58 --- src/usr.bin/indent/io.c:1.57 Sat Sep 25 08:23:31 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 10:41:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.57 2021/09/25 08:23:31 rillig Exp $ */ +/* $NetBSD: io.c,v 1.58 2021/09/25 10:41:03 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.57 2021/09/25 08:23:31 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.58
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 10:41:03 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c pr_comment.c Log Message: indent: move statistical values into a separate struct No functional change. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/usr.bin/indent/indent.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/io.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 10:24:10 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: make lex_char_or_string simpler The previous code was so tricky that every second line needed a comment that explains what's going on. Replace the complicated code with the usual straight-forward string-copying patterns. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.bin/indent/lexi.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/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.51 src/usr.bin/indent/lexi.c:1.52 --- src/usr.bin/indent/lexi.c:1.51 Sat Sep 25 08:23:31 2021 +++ src/usr.bin/indent/lexi.c Sat Sep 25 10:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.51 2021/09/25 08:23:31 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.52 2021/09/25 10:24:10 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.51 2021/09/25 08:23:31 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.52 2021/09/25 10:24:10 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -319,27 +319,21 @@ lex_word(void) static void lex_char_or_string(void) { -char delim; - -delim = *token.s; -do { /* copy the string */ - for (;;) { /* move one character or [/] */ - if (*buf_ptr == '\n') { - diag(1, "Unterminated literal"); - return; - } - check_size_token(2); - *token.e = inbuf_next(); - if (*token.e == '\\') { /* if escape, copy extra char */ - if (*buf_ptr == '\n') /* check for escaped newline */ - ++line_no; - *++token.e = inbuf_next(); - ++token.e; /* we must increment this again because we - * copied two chars */ - } else - break; /* we copied one character */ - } /* end of while (1) */ -} while (*token.e++ != delim); +for (char delim = *token.s;;) { + if (*buf_ptr == '\n') { + diag(1, "Unterminated literal"); + return; + } + check_size_token(2); + *token.e++ = inbuf_next(); + if (token.e[-1] == delim) + return; + if (token.e[-1] == '\\') { + if (*buf_ptr == '\n') + ++line_no; + *token.e++ = inbuf_next(); + } +} } /* Reads the next token, placing it in the global variable "token". */
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 10:24:10 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: make lex_char_or_string simpler The previous code was so tricky that every second line needed a comment that explains what's going on. Replace the complicated code with the usual straight-forward string-copying patterns. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.bin/indent/lexi.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 09:52:21 UTC 2021 Modified Files: src/tests/usr.bin/indent: lex_char.0 lex_char.0.stdout lex_string.0 lex_string.0.stdout Log Message: tests/indent: extend tests for strings and characters To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/lex_char.0 \ src/tests/usr.bin/indent/lex_char.0.stdout \ src/tests/usr.bin/indent/lex_string.0 \ src/tests/usr.bin/indent/lex_string.0.stdout 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/indent/lex_char.0 diff -u src/tests/usr.bin/indent/lex_char.0:1.1 src/tests/usr.bin/indent/lex_char.0:1.2 --- src/tests/usr.bin/indent/lex_char.0:1.1 Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_char.0 Sat Sep 25 09:52:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex_char.0,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $NetBSD: lex_char.0,v 1.2 2021/09/25 09:52:21 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -17,3 +17,6 @@ int escape_f = '\f'; int escape_n = '\n'; int escape_t = '\t'; int escape_v = '\v'; +int escape_single_quote = '\''; +int escape_double_quote = '\"'; +int escape_backslash = '\\'; Index: src/tests/usr.bin/indent/lex_char.0.stdout diff -u src/tests/usr.bin/indent/lex_char.0.stdout:1.1 src/tests/usr.bin/indent/lex_char.0.stdout:1.2 --- src/tests/usr.bin/indent/lex_char.0.stdout:1.1 Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_char.0.stdout Sat Sep 25 09:52:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex_char.0.stdout,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $NetBSD: lex_char.0.stdout,v 1.2 2021/09/25 09:52:21 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -17,3 +17,6 @@ int escape_f = '\f'; int escape_n = '\n'; int escape_t = '\t'; int escape_v = '\v'; +int escape_single_quote = '\''; +int escape_double_quote = '\"'; +int escape_backslash = '\\'; Index: src/tests/usr.bin/indent/lex_string.0 diff -u src/tests/usr.bin/indent/lex_string.0:1.1 src/tests/usr.bin/indent/lex_string.0:1.2 --- src/tests/usr.bin/indent/lex_string.0:1.1 Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_string.0 Sat Sep 25 09:52:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex_string.0,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $NetBSD: lex_string.0,v 1.2 2021/09/25 09:52:21 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -17,6 +17,9 @@ char escape_f[] = "\f"; char escape_n[] = "\n"; char escape_t[] = "\t"; char escape_v[] = "\v"; +char escape_single_quote[] = "\'"; +char escape_double_quote[] = "\""; +char escape_backslash[] = "\\"; char escape_newline[] = "\ "; Index: src/tests/usr.bin/indent/lex_string.0.stdout diff -u src/tests/usr.bin/indent/lex_string.0.stdout:1.1 src/tests/usr.bin/indent/lex_string.0.stdout:1.2 --- src/tests/usr.bin/indent/lex_string.0.stdout:1.1 Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_string.0.stdout Sat Sep 25 09:52:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex_string.0.stdout,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $NetBSD: lex_string.0.stdout,v 1.2 2021/09/25 09:52:21 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -17,6 +17,9 @@ char escape_f[] = "\f"; char escape_n[] = "\n"; char escape_t[] = "\t"; char escape_v[] = "\v"; +char escape_single_quote[] = "\'"; +char escape_double_quote[] = "\""; +char escape_backslash[] = "\\"; char escape_newline[] = "\ ";
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 09:52:21 UTC 2021 Modified Files: src/tests/usr.bin/indent: lex_char.0 lex_char.0.stdout lex_string.0 lex_string.0.stdout Log Message: tests/indent: extend tests for strings and characters To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/lex_char.0 \ src/tests/usr.bin/indent/lex_char.0.stdout \ src/tests/usr.bin/indent/lex_string.0 \ src/tests/usr.bin/indent/lex_string.0.stdout 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: Sat Sep 25 09:46:29 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: lex_char.0 lex_char.0.pro lex_char.0.stdout lex_string.0 lex_string.0.pro lex_string.0.stdout Log Message: tests/indent: test lexing of character constants and string literals To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lex_char.0 \ src/tests/usr.bin/indent/lex_char.0.pro \ src/tests/usr.bin/indent/lex_char.0.stdout \ src/tests/usr.bin/indent/lex_string.0 \ src/tests/usr.bin/indent/lex_string.0.pro \ src/tests/usr.bin/indent/lex_string.0.stdout 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.1126 src/distrib/sets/lists/tests/mi:1.1127 --- src/distrib/sets/lists/tests/mi:1.1126 Sun Sep 19 15:51:28 2021 +++ src/distrib/sets/lists/tests/mi Sat Sep 25 09:46:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1126 2021/09/19 15:51:28 thorpej Exp $ +# $NetBSD: mi,v 1.1127 2021/09/25 09:46:29 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4753,6 +4753,12 @@ ./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.stdouttests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_char.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_char.0.protests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_char.0.stdouttests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_string.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_string.0.protests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lex_string.0.stdouttests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lineno.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lineno.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/lineno.0.stdouttests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.8 src/tests/usr.bin/indent/Makefile:1.9 --- src/tests/usr.bin/indent/Makefile:1.8 Fri Mar 12 00:13:06 2021 +++ src/tests/usr.bin/indent/Makefile Sat Sep 25 09:46:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2021/03/12 00:13:06 rillig Exp $ +# $NetBSD: Makefile,v 1.9 2021/09/25 09:46:29 rillig Exp $ .include @@ -30,6 +30,12 @@ FILES+= indent_variables.0.stdout FILES+= label.0 FILES+= label.0.stdout FILES+= label.0.pro +FILES+= lex_char.0 +FILES+= lex_char.0.pro +FILES+= lex_char.0.stdout +FILES+= lex_string.0 +FILES+= lex_string.0.pro +FILES+= lex_string.0.stdout FILES+= lineno.0 FILES+= lineno.0.pro FILES+= lineno.0.stdout @@ -406,7 +412,7 @@ add-test: .PHONY '' \ '/*' \ ' * TODO: Explain the purpose of the test.' \ - '*/' \ + ' */' \ '' \ '// TODO: Add some code that passes.' \ > "$$test"; \ Added files: Index: src/tests/usr.bin/indent/lex_char.0 diff -u /dev/null src/tests/usr.bin/indent/lex_char.0:1.1 --- /dev/null Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_char.0 Sat Sep 25 09:46:29 2021 @@ -0,0 +1,19 @@ +/* $NetBSD: lex_char.0,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * Test lexing of character constants. + */ + +int simple = 'x'; +int multi = 'xy'; +int empty = ''; +int null = '\0'; +int escape_hex = '\x3f'; +int escape_octal = '\040'; +int escape_a = '\a'; +int escape_b = '\b'; +int escape_f = '\f'; +int escape_n = '\n'; +int escape_t = '\t'; +int escape_v = '\v'; Index: src/tests/usr.bin/indent/lex_char.0.pro diff -u /dev/null src/tests/usr.bin/indent/lex_char.0.pro:1.1 --- /dev/null Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_char.0.pro Sat Sep 25 09:46:29 2021 @@ -0,0 +1,4 @@ +/* $NetBSD: lex_char.0.pro,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $FreeBSD$ */ + +-di0 Index: src/tests/usr.bin/indent/lex_char.0.stdout diff -u /dev/null src/tests/usr.bin/indent/lex_char.0.stdout:1.1 --- /dev/null Sat Sep 25 09:46:29 2021 +++ src/tests/usr.bin/indent/lex_char.0.stdout Sat Sep 25 09:46:29 2021 @@ -0,0 +1,19 @@ +/* $NetBSD: lex_char.0.stdout,v 1.1 2021/09/25 09:46:29 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * Test lexing of character constants. + */ + +int simple = 'x'; +int multi = 'xy'; +int empty = ''; +int null = '\0'; +int escape_hex = '\x3f'; +int escape_octal = '\040'; +int escape_a = '\a'; +int escape_b = '\b'; +int escape_f = '\f'; +int
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Sep 25 09:46:29 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: lex_char.0 lex_char.0.pro lex_char.0.stdout lex_string.0 lex_string.0.pro lex_string.0.stdout Log Message: tests/indent: test lexing of character constants and string literals To generate a diff of this commit: cvs rdiff -u -r1.1126 -r1.1127 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lex_char.0 \ src/tests/usr.bin/indent/lex_char.0.pro \ src/tests/usr.bin/indent/lex_char.0.stdout \ src/tests/usr.bin/indent/lex_string.0 \ src/tests/usr.bin/indent/lex_string.0.pro \ src/tests/usr.bin/indent/lex_string.0.stdout 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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 09:22:39 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_indent.sh Log Message: tests/indent: fix ShellCheck warnings, use simple variables To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/t_indent.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/indent/t_indent.sh diff -u src/tests/usr.bin/indent/t_indent.sh:1.5 src/tests/usr.bin/indent/t_indent.sh:1.6 --- src/tests/usr.bin/indent/t_indent.sh:1.5 Fri Sep 24 06:30:02 2021 +++ src/tests/usr.bin/indent/t_indent.sh Sat Sep 25 09:22:39 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_indent.sh,v 1.5 2021/09/24 06:30:02 rillig Exp $ +# $NetBSD: t_indent.sh,v 1.6 2021/09/25 09:22:39 rillig Exp $ # # Copyright 2016 Dell EMC # All rights reserved. @@ -28,17 +28,20 @@ # # $FreeBSD: head/usr.bin/indent/tests/functional_test.sh 314613 2017-03-03 20:15:22Z ngie $ +# shellcheck disable=SC2039 + SRCDIR=$(atf_get_srcdir) check() { - local tc=${1}; shift + local tc=$1; shift + # shellcheck disable=SC2155 local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) # All of the files need to be in the ATF sandbox in order for the tests # to pass. - atf_check cp ${SRCDIR}/${tc}* . + atf_check cp "$SRCDIR/$tc"* . # Remove single-line block comments that start with '$'. This removes # RCS IDs, preventing them to be broken into several lines. It also @@ -74,14 +77,14 @@ check() add_testcase() { - local tc=${1} + local tc=$1 local tc_escaped word case "${tc%.*}" in *-*) local IFS="-+" for word in ${tc%.*}; do - tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" + tc_escaped="${tc_escaped:+${tc_escaped}_}$word" done ;; *) @@ -89,14 +92,15 @@ add_testcase() ;; esac - atf_test_case ${tc_escaped} - eval "${tc_escaped}_body() { check ${tc}; }" - atf_add_test_case ${tc_escaped} + atf_test_case "$tc_escaped" + eval "${tc_escaped}_body() { check $tc; }" + atf_add_test_case "$tc_escaped" } atf_init_test_cases() { - for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do - add_testcase ${path##*/} + # shellcheck disable=SC2044 + for path in $(find -Es "$SRCDIR" -regex '.*\.[0-9]+$'); do + add_testcase "${path##*/}" done }
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 09:22:39 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_indent.sh Log Message: tests/indent: fix ShellCheck warnings, use simple variables To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/t_indent.sh 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: maya Date: Sat Sep 25 08:54:31 UTC 2021 Modified Files: src/distrib/amd64/cdroms: Makefile.cdrom src/distrib/common/bootimage: Makefile.bootimage Makefile.installimage src/distrib/i386/cdroms: Makefile.cdrom src/distrib/notes/amd64: contents src/distrib/notes/evbarm: contents src/distrib/notes/i386: contents src/distrib/sets: README maketars regpkgset sets.subr src/distrib/sets/lists/base: mi src/distrib/utils/embedded: mkimage src/etc: Makefile src/external/nvidia-firmware: Makefile src/share/mk: bsd.README bsd.own.mk src/sys/dev/microcode/radeon: Makefile src/usr.sbin/sysinst: Makefile.inc defs.h msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl util.c src/usr.sbin/sysinst/arch/amd64: md.h src/usr.sbin/sysinst/arch/evbarm: md.h src/usr.sbin/sysinst/arch/i386: md.h Added Files: src/distrib/sets/lists/gpufw: mi Log Message: Move DRM-driver firmware from base to its own set, gpufw This set is only installed on amd64,i386,evbarm. This set is installed on minimal installs and on install media, in case someone needs it for basic driver functionality. Comments: Switched to a single MK tunable for it - that is probably unneeded. An upcoming DRM update will include even fatter firmware, and we'd like to minimize the impact of it. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/distrib/amd64/cdroms/Makefile.cdrom cvs rdiff -u -r1.28 -r1.29 src/distrib/common/bootimage/Makefile.bootimage cvs rdiff -u -r1.8 -r1.9 src/distrib/common/bootimage/Makefile.installimage cvs rdiff -u -r1.41 -r1.42 src/distrib/i386/cdroms/Makefile.cdrom cvs rdiff -u -r1.12 -r1.13 src/distrib/notes/amd64/contents cvs rdiff -u -r1.14 -r1.15 src/distrib/notes/evbarm/contents cvs rdiff -u -r1.34 -r1.35 src/distrib/notes/i386/contents cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/README cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/maketars cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/regpkgset cvs rdiff -u -r1.195 -r1.196 src/distrib/sets/sets.subr cvs rdiff -u -r1.1283 -r1.1284 src/distrib/sets/lists/base/mi cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/gpufw/mi cvs rdiff -u -r1.77 -r1.78 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.450 -r1.451 src/etc/Makefile cvs rdiff -u -r1.3 -r1.4 src/external/nvidia-firmware/Makefile cvs rdiff -u -r1.416 -r1.417 src/share/mk/bsd.README cvs rdiff -u -r1.1260 -r1.1261 src/share/mk/bsd.own.mk cvs rdiff -u -r1.6 -r1.7 src/sys/dev/microcode/radeon/Makefile cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/Makefile.inc cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/defs.h cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/sysinst/msg.mi.en \ src/usr.sbin/sysinst/msg.mi.pl cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/sysinst/util.c cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/amd64/md.h cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/evbarm/md.h cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/i386/md.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/amd64/cdroms/Makefile.cdrom diff -u src/distrib/amd64/cdroms/Makefile.cdrom:1.26 src/distrib/amd64/cdroms/Makefile.cdrom:1.27 --- src/distrib/amd64/cdroms/Makefile.cdrom:1.26 Sun Mar 7 03:55:47 2021 +++ src/distrib/amd64/cdroms/Makefile.cdrom Sat Sep 25 08:54:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.cdrom,v 1.26 2021/03/07 03:55:47 dbj Exp $ +# $NetBSD: Makefile.cdrom,v 1.27 2021/09/25 08:54:29 maya Exp $ .include .include @@ -17,7 +17,7 @@ CDMAKEFSOPTIONS= bootimage=i386;bootxx.$ CDINSTKERNEL= ../../instkernel CDKERNELS= netbsd-GENERIC.gz netbsd CDRELEASE_NOISOS= true -CD_SETS= base etc +CD_SETS= base etc gpufw .if ${MKKMOD} != "no" CD_SETS+= modules .endif Index: src/distrib/common/bootimage/Makefile.bootimage diff -u src/distrib/common/bootimage/Makefile.bootimage:1.28 src/distrib/common/bootimage/Makefile.bootimage:1.29 --- src/distrib/common/bootimage/Makefile.bootimage:1.28 Sat Jul 24 13:59:28 2021 +++ src/distrib/common/bootimage/Makefile.bootimage Sat Sep 25 08:54:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.bootimage,v 1.28 2021/07/24 13:59:28 jmcneill Exp $ +# $NetBSD: Makefile.bootimage,v 1.29 2021/09/25 08:54:29 maya Exp $ # # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved. # @@ -71,8 +71,8 @@ # (default: kern-GENERIC) # SETS # binary sets that should be extracted into image -# (default: modules base etc comp games man misc rescue tests -# text xbase xcomp xetc xfont xserver) +# (default: modules base etc comp games gpufw man misc +# rescue tests text xbase xcomp xetc xfont xserver) #
CVS commit: src
Module Name:src Committed By: maya Date: Sat Sep 25 08:54:31 UTC 2021 Modified Files: src/distrib/amd64/cdroms: Makefile.cdrom src/distrib/common/bootimage: Makefile.bootimage Makefile.installimage src/distrib/i386/cdroms: Makefile.cdrom src/distrib/notes/amd64: contents src/distrib/notes/evbarm: contents src/distrib/notes/i386: contents src/distrib/sets: README maketars regpkgset sets.subr src/distrib/sets/lists/base: mi src/distrib/utils/embedded: mkimage src/etc: Makefile src/external/nvidia-firmware: Makefile src/share/mk: bsd.README bsd.own.mk src/sys/dev/microcode/radeon: Makefile src/usr.sbin/sysinst: Makefile.inc defs.h msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl util.c src/usr.sbin/sysinst/arch/amd64: md.h src/usr.sbin/sysinst/arch/evbarm: md.h src/usr.sbin/sysinst/arch/i386: md.h Added Files: src/distrib/sets/lists/gpufw: mi Log Message: Move DRM-driver firmware from base to its own set, gpufw This set is only installed on amd64,i386,evbarm. This set is installed on minimal installs and on install media, in case someone needs it for basic driver functionality. Comments: Switched to a single MK tunable for it - that is probably unneeded. An upcoming DRM update will include even fatter firmware, and we'd like to minimize the impact of it. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/distrib/amd64/cdroms/Makefile.cdrom cvs rdiff -u -r1.28 -r1.29 src/distrib/common/bootimage/Makefile.bootimage cvs rdiff -u -r1.8 -r1.9 src/distrib/common/bootimage/Makefile.installimage cvs rdiff -u -r1.41 -r1.42 src/distrib/i386/cdroms/Makefile.cdrom cvs rdiff -u -r1.12 -r1.13 src/distrib/notes/amd64/contents cvs rdiff -u -r1.14 -r1.15 src/distrib/notes/evbarm/contents cvs rdiff -u -r1.34 -r1.35 src/distrib/notes/i386/contents cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/README cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/maketars cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/regpkgset cvs rdiff -u -r1.195 -r1.196 src/distrib/sets/sets.subr cvs rdiff -u -r1.1283 -r1.1284 src/distrib/sets/lists/base/mi cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/gpufw/mi cvs rdiff -u -r1.77 -r1.78 src/distrib/utils/embedded/mkimage cvs rdiff -u -r1.450 -r1.451 src/etc/Makefile cvs rdiff -u -r1.3 -r1.4 src/external/nvidia-firmware/Makefile cvs rdiff -u -r1.416 -r1.417 src/share/mk/bsd.README cvs rdiff -u -r1.1260 -r1.1261 src/share/mk/bsd.own.mk cvs rdiff -u -r1.6 -r1.7 src/sys/dev/microcode/radeon/Makefile cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/Makefile.inc cvs rdiff -u -r1.72 -r1.73 src/usr.sbin/sysinst/defs.h cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/sysinst/msg.mi.en \ src/usr.sbin/sysinst/msg.mi.pl cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/sysinst/util.c cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/arch/amd64/md.h cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/evbarm/md.h cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/i386/md.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 08:23:32 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h io.c lexi.c pr_comment.c Log Message: indent: add nonnull memory allocation functions The only functional change is a single error message. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/usr.bin/indent/indent.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/indent.h cvs rdiff -u -r1.56 -r1.57 src/usr.bin/indent/io.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.67 src/usr.bin/indent/indent.c:1.68 --- src/usr.bin/indent/indent.c:1.67 Sat Sep 25 08:04:13 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 08:23:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.67 2021/09/25 08:04:13 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.68 2021/09/25 08:23:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.67 2021/09/25 08:04:13 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.68 2021/09/25 08:23:31 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -126,9 +126,7 @@ check_size_code(size_t desired_size) size_t nsize = code.l - code.s + 400 + desired_size; size_t code_len = code.e - code.s; -code.buf = realloc(code.buf, nsize); -if (code.buf == NULL) - err(1, NULL); +code.buf = xrealloc(code.buf, nsize); code.e = code.buf + code_len + 1; code.l = code.buf + nsize - 5; code.s = code.buf + 1; @@ -142,9 +140,7 @@ check_size_label(size_t desired_size) size_t nsize = lab.l - lab.s + 400 + desired_size; size_t label_len = lab.e - lab.s; -lab.buf = realloc(lab.buf, nsize); -if (lab.buf == NULL) - err(1, NULL); +lab.buf = xrealloc(lab.buf, nsize); lab.e = lab.buf + label_len + 1; lab.l = lab.buf + nsize - 5; lab.s = lab.buf + 1; @@ -362,18 +358,10 @@ main_init_globals(void) ps.last_nl = true; /* this is true if the last thing scanned was * a newline */ ps.last_token = semicolon; -com.buf = malloc(bufsize); -if (com.buf == NULL) - err(1, NULL); -lab.buf = malloc(bufsize); -if (lab.buf == NULL) - err(1, NULL); -code.buf = malloc(bufsize); -if (code.buf == NULL) - err(1, NULL); -token.buf = malloc(bufsize); -if (token.buf == NULL) - err(1, NULL); +com.buf = xmalloc(bufsize); +lab.buf = xmalloc(bufsize); +code.buf = xmalloc(bufsize); +token.buf = xmalloc(bufsize); alloc_typenames(); init_constant_tt(); com.l = com.buf + bufsize - 5; @@ -389,9 +377,7 @@ main_init_globals(void) com.s = com.e = com.buf + 1; token.s = token.e = token.buf + 1; -in_buffer = malloc(10); -if (in_buffer == NULL) - err(1, NULL); +in_buffer = xmalloc(10); in_buffer_limit = in_buffer + 8; buf_ptr = buf_end = in_buffer; line_no = 1; @@ -1571,3 +1557,29 @@ debug_vis_range(const char *prefix, cons debug_printf("%s", suffix); } #endif + +static void * +nonnull(void *p) +{ +if (p == NULL) + err(EXIT_FAILURE, NULL); +return p; +} + +void * +xmalloc(size_t size) +{ +return nonnull(malloc(size)); +} + +void * +xrealloc(void *p, size_t new_size) +{ +return nonnull(realloc(p, new_size)); +} + +char * +xstrdup(const char *s) +{ +return nonnull(strdup(s)); +} Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.16 src/usr.bin/indent/indent.h:1.17 --- src/usr.bin/indent/indent.h:1.16 Sun Mar 14 00:33:25 2021 +++ src/usr.bin/indent/indent.h Sat Sep 25 08:23:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.16 2021/03/14 00:33:25 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.17 2021/09/25 08:23:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -68,3 +68,7 @@ void process_comment(void); void set_defaults(void); void set_option(char *); void set_profile(const char *); + +void *xmalloc(size_t); +void *xrealloc(void *, size_t); +char *xstrdup(const char *); Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.56 src/usr.bin/indent/io.c:1.57 --- src/usr.bin/indent/io.c:1.56 Sat Sep 25 08:04:13 2021 +++ src/usr.bin/indent/io.c Sat Sep 25 08:23:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.56 2021/09/25 08:04:13 rillig Exp $ */ +/* $NetBSD: io.c,v 1.57 2021/09/25 08:23:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.56 2021/09/25 08:04:13 rillig Exp $");
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 08:23:32 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent.h io.c lexi.c pr_comment.c Log Message: indent: add nonnull memory allocation functions The only functional change is a single error message. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/usr.bin/indent/indent.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/indent.h cvs rdiff -u -r1.56 -r1.57 src/usr.bin/indent/io.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 08:04:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: group global variables for token buffer No functional change. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/indent.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/io.c cvs rdiff -u -r1.49 -r1.50 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/indent/parse.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.66 src/usr.bin/indent/indent.c:1.67 --- src/usr.bin/indent/indent.c:1.66 Sat Sep 25 07:59:52 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 08:04:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.66 2021/09/25 07:59:52 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.67 2021/09/25 08:04:13 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.66 2021/09/25 07:59:52 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.67 2021/09/25 08:04:13 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -74,11 +74,7 @@ struct parser_state ps; struct buffer lab; struct buffer code; struct buffer com; - -char *tokenbuf; -char *s_token; -char *e_token; -char *l_token; +struct buffer token; char *in_buffer; char *in_buffer_limit; @@ -259,11 +255,11 @@ search_brace(token_type *inout_ttype, in remove_newlines = /* "} else" */ - (*inout_ttype == keyword_do_else && *s_token == 'e' && + (*inout_ttype == keyword_do_else && *token.s == 'e' && code.e != code.s && code.e[-1] == '}') /* "else if" */ || (*inout_ttype == keyword_for_if_while && - *s_token == 'i' && *inout_last_else && opt.else_if); + *token.s == 'i' && *inout_last_else && opt.else_if); if (remove_newlines) *inout_force_nl = false; if (sc_end == NULL) { /* ignore buffering if @@ -292,7 +288,7 @@ search_brace(token_type *inout_ttype, in * not already broken */ diag(0, "Line broken"); } - for (const char *t_ptr = s_token; *t_ptr; ++t_ptr) + for (const char *t_ptr = token.s; *t_ptr; ++t_ptr) *sc_end++ = *t_ptr; sw_buffer: @@ -375,23 +371,23 @@ main_init_globals(void) code.buf = malloc(bufsize); if (code.buf == NULL) err(1, NULL); -tokenbuf = malloc(bufsize); -if (tokenbuf == NULL) +token.buf = malloc(bufsize); +if (token.buf == NULL) err(1, NULL); alloc_typenames(); init_constant_tt(); com.l = com.buf + bufsize - 5; lab.l = lab.buf + bufsize - 5; code.l = code.buf + bufsize - 5; -l_token = tokenbuf + bufsize - 5; +token.l = token.buf + bufsize - 5; com.buf[0] = code.buf[0] = lab.buf[0] = ' '; /* set up code, label, and * comment buffers */ -com.buf[1] = code.buf[1] = lab.buf[1] = tokenbuf[1] = '\0'; +com.buf[1] = code.buf[1] = lab.buf[1] = token.buf[1] = '\0'; opt.else_if = 1; /* Default else-if special processing to on */ lab.s = lab.e = lab.buf + 1; code.s = code.e = code.buf + 1; com.s = com.e = com.buf + 1; -s_token = e_token = tokenbuf + 1; +token.s = token.e = token.buf + 1; in_buffer = malloc(10); if (in_buffer == NULL) @@ -616,7 +612,7 @@ process_lparen_or_lbracket(int dec_ind, nitems(ps.paren_indents)); ps.p_l_follow--; } -if (*s_token == '[') +if (*token.s == '[') /* not a function pointer declaration or a function call */; else if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && ps.procname[0] == '\0' && ps.paren_level == 0) { @@ -630,7 +626,7 @@ process_lparen_or_lbracket(int dec_ind, ps.keyword != rw_0 && ps.keyword != rw_offsetof))) *code.e++ = ' '; ps.want_blank = false; -*code.e++ = s_token[0]; +*code.e++ = token.s[0]; ps.paren_indents[ps.p_l_follow - 1] = indentation_after_range(0, code.s, code.e); @@ -642,7 +638,7 @@ process_lparen_or_lbracket(int dec_ind, ps.paren_indents[0] = 2 * opt.indent_size; debug_println("paren_indent[0] is now %d", ps.paren_indents[0]); } -if (ps.in_or_st && *s_token == '(' && ps.tos <= 2) { +if (ps.in_or_st && *token.s == '(' && ps.tos <= 2) { /* * this is a kluge to make sure that declarations will be * aligned right if proc decl has an explicit type on it, i.e. @@ -671,13 +667,13 @@ process_rparen_or_rbracket(int *inout_sp if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; - diag(0, "Extra
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 08:04:13 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h io.c lexi.c parse.c pr_comment.c Log Message: indent: group global variables for token buffer No functional change. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/indent.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/io.c cvs rdiff -u -r1.49 -r1.50 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.21 -r1.22 src/usr.bin/indent/parse.c cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/pr_comment.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/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 07:59:52 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h lexi.c parse.c Log Message: indent: inline macro 'token' No functional change. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.bin/indent/indent.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.48 -r1.49 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.20 -r1.21 src/usr.bin/indent/parse.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.65 src/usr.bin/indent/indent.c:1.66 --- src/usr.bin/indent/indent.c:1.65 Sat Sep 25 07:55:24 2021 +++ src/usr.bin/indent/indent.c Sat Sep 25 07:59:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.65 2021/09/25 07:55:24 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.66 2021/09/25 07:59:52 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.65 2021/09/25 07:55:24 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.66 2021/09/25 07:59:52 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -259,11 +259,11 @@ search_brace(token_type *inout_ttype, in remove_newlines = /* "} else" */ - (*inout_ttype == keyword_do_else && *token == 'e' && + (*inout_ttype == keyword_do_else && *s_token == 'e' && code.e != code.s && code.e[-1] == '}') /* "else if" */ || (*inout_ttype == keyword_for_if_while && - *token == 'i' && *inout_last_else && opt.else_if); + *s_token == 'i' && *inout_last_else && opt.else_if); if (remove_newlines) *inout_force_nl = false; if (sc_end == NULL) { /* ignore buffering if @@ -292,7 +292,7 @@ search_brace(token_type *inout_ttype, in * not already broken */ diag(0, "Line broken"); } - for (const char *t_ptr = token; *t_ptr; ++t_ptr) + for (const char *t_ptr = s_token; *t_ptr; ++t_ptr) *sc_end++ = *t_ptr; sw_buffer: @@ -616,7 +616,7 @@ process_lparen_or_lbracket(int dec_ind, nitems(ps.paren_indents)); ps.p_l_follow--; } -if (*token == '[') +if (*s_token == '[') /* not a function pointer declaration or a function call */; else if (ps.in_decl && !ps.block_init && !ps.dumped_decl_indent && ps.procname[0] == '\0' && ps.paren_level == 0) { @@ -630,7 +630,7 @@ process_lparen_or_lbracket(int dec_ind, ps.keyword != rw_0 && ps.keyword != rw_offsetof))) *code.e++ = ' '; ps.want_blank = false; -*code.e++ = token[0]; +*code.e++ = s_token[0]; ps.paren_indents[ps.p_l_follow - 1] = indentation_after_range(0, code.s, code.e); @@ -642,7 +642,7 @@ process_lparen_or_lbracket(int dec_ind, ps.paren_indents[0] = 2 * opt.indent_size; debug_println("paren_indent[0] is now %d", ps.paren_indents[0]); } -if (ps.in_or_st && *token == '(' && ps.tos <= 2) { +if (ps.in_or_st && *s_token == '(' && ps.tos <= 2) { /* * this is a kluge to make sure that declarations will be * aligned right if proc decl has an explicit type on it, i.e. @@ -671,13 +671,13 @@ process_rparen_or_rbracket(int *inout_sp if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; - diag(0, "Extra %c", *token); + diag(0, "Extra %c", *s_token); } if (code.e == code.s) /* if the paren starts the line */ ps.paren_level = ps.p_l_follow; /* then indent it */ -*code.e++ = token[0]; +*code.e++ = s_token[0]; if (*inout_sp_sw && (ps.p_l_follow == 0)) { /* check for end of if * (...), or some such */ @@ -706,7 +706,7 @@ process_unary_op(int dec_ind, int tabs_t * this token */ int i; - for (i = 0; token[i]; ++i) + for (i = 0; s_token[i]; ++i) /* find length of token */; indent_declaration(dec_ind - i, tabs_to_var); ps.dumped_decl_indent = true; @@ -717,7 +717,7 @@ process_unary_op(int dec_ind, int tabs_t size_t len = e_token - s_token; check_size_code(len); - memcpy(code.e, token, len); + memcpy(code.e, s_token, len); code.e += len; } ps.want_blank = false; @@ -731,7 +731,7 @@ process_binary_op(void) check_size_code(len + 1); if (ps.want_blank) *code.e++ = ' '; -memcpy(code.e, token, len); +memcpy(code.e, s_token, len); code.e += len; ps.want_blank = true; @@ -740,8 +740,8 @@ process_binary_op(void) static void process_postfix_op(void) { -*code.e++ = token[0]; -*code.e++ = token[1]; +*code.e++ = s_token[0]; +*code.e++ = s_token[1]; ps.want_blank = true; } @@ -966,7 +966,7 @@ static void process_keyword_do_else(int *inout_force_nl, int *inout_last_else) { ps.in_stmt = false; -if (*token == 'e') { +if (*s_token == 'e') {
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Sat Sep 25 07:59:52 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h lexi.c parse.c Log Message: indent: inline macro 'token' No functional change. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.bin/indent/indent.c cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.48 -r1.49 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.20 -r1.21 src/usr.bin/indent/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.