CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: knakahara Date: Tue Nov 17 04:50:29 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h Log Message: Add new spin mutex to avoid race between ixgbe_msix_admin() and ixgbe_handle_admin(). At first, it seems "IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER)" cannot stop interrupts, because 31th bit is reserved for 82598, 82599, X540 and X550. So, the current following design (1) ixgbe_msix_admin() disables interrupts (2) ixgbe_msix_admin() calls workqueue_enqueue() for ixgbe_handle_admin() (3) ixgbe_handle_admin() does interrupt processing (4) after ixgbe_handle_admin() has done all interrupt processings, ixgbe_handle_admin() enables interrupts does not work correctly, that is, interrupts can be lost while ixgbe_handle_admin() is running. To fix that, add new spin mutex(adapter->admmin_mtx) which protects atomically the following two members. - adapter->admin_pending - adapter->task_requests The unnecessary "IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER)" code will be removed later. Reviewed and tested by hikaru@n.o and msaitoh@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.259 -r1.260 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/ixgbe/ixgbe.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.259 src/sys/dev/pci/ixgbe/ixgbe.c:1.260 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.259 Fri Nov 13 05:53:36 2020 +++ src/sys/dev/pci/ixgbe/ixgbe.c Tue Nov 17 04:50:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.259 2020/11/13 05:53:36 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.260 2020/11/17 04:50:29 knakahara Exp $ */ /** @@ -1136,6 +1136,7 @@ ixgbe_attach(device_t parent, device_t d goto err_late; /* Tasklets for Link, SFP, Multispeed Fiber and Flow Director */ + mutex_init(&(adapter)->admin_mtx, MUTEX_DEFAULT, IPL_NET); snprintf(wqname, sizeof(wqname), "%s-admin", device_xname(dev)); error = workqueue_create(>admin_wq, wqname, ixgbe_handle_admin, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, @@ -1283,6 +1284,7 @@ err_out: ixgbe_free_pci_resources(adapter); if (adapter->mta != NULL) free(adapter->mta, M_DEVBUF); + mutex_destroy(&(adapter)->admin_mtx); /* XXX appropriate order? */ IXGBE_CORE_LOCK_DESTROY(adapter); return; @@ -1538,10 +1540,13 @@ static void ixgbe_schedule_admin_tasklet(struct adapter *adapter) { + KASSERT(mutex_owned(>admin_mtx)); + if (__predict_true(adapter->osdep.detaching == false)) { - if (atomic_cas_uint(>admin_pending, 0, 1) == 0) + if (adapter->admin_pending == 0) workqueue_enqueue(adapter->admin_wq, >admin_wc, NULL); + adapter->admin_pending = 1; } } @@ -1564,8 +1569,11 @@ ixgbe_config_link(struct adapter *adapte task_requests |= IXGBE_REQUEST_TASK_MSF; } task_requests |= IXGBE_REQUEST_TASK_MOD; - atomic_or_32(>task_requests, task_requests); + + mutex_enter(>admin_mtx); + adapter->task_requests |= task_requests; ixgbe_schedule_admin_tasklet(adapter); + mutex_exit(>admin_mtx); } else { struct ifmedia *ifm = >media; @@ -3206,8 +3214,11 @@ ixgbe_msix_admin(void *arg) if (task_requests != 0) { /* Re-enabling other interrupts is done in the admin task */ task_requests |= IXGBE_REQUEST_TASK_NEED_ACKINTR; - atomic_or_32(>task_requests, task_requests); + + mutex_enter(>admin_mtx); + adapter->task_requests |= task_requests; ixgbe_schedule_admin_tasklet(adapter); + mutex_exit(>admin_mtx); } else { /* Re-enable other interrupts */ IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); @@ -3758,6 +3769,7 @@ ixgbe_detach(device_t dev, int flags) ixgbe_free_queues(adapter); free(adapter->mta, M_DEVBUF); + mutex_destroy(>admin_mtx); /* XXX appropriate order? */ IXGBE_CORE_LOCK_DESTROY(adapter); return (0); @@ -4522,9 +4534,10 @@ ixgbe_handle_timer(struct work *wk, void sched_mod_task = true; } if (sched_mod_task) { - atomic_or_32(>task_requests, - IXGBE_REQUEST_TASK_MOD); + mutex_enter(>admin_mtx); + adapter->task_requests |= IXGBE_REQUEST_TASK_MOD; ixgbe_schedule_admin_tasklet(adapter); + mutex_exit(>admin_mtx); } } @@ -4733,8 +4746,11 @@ out: * MSF. At least, calling ixgbe_handle_msf on 82598 DA makes the link * flap because the function calls setup_link(). */ - if (hw->mac.type != ixgbe_mac_82598EB) - atomic_or_32(>task_requests, IXGBE_REQUEST_TASK_MSF); + if (hw->mac.type != ixgbe_mac_82598EB) { + mutex_enter(>admin_mtx); + adapter->task_requests |= IXGBE_REQUEST_TASK_MSF; + mutex_exit(>admin_mtx); + } /* * Don't call ixgbe_schedule_admin_tasklet() because we are on @@ -4794,7 +4810,13 @@ ixgbe_handle_admin(struct work *wk, void struct adapter *adapter = context;
CVS commit: src/sys
Module Name:src Committed By: chs Date: Tue Nov 17 03:22:33 UTC 2020 Modified Files: src/sys/kern: sys_socket.c src/sys/sys: socketvar.h Log Message: When SS_RESTARTSYS was added, it was accidentally given the same value as the existing SS_ASYNC. SS_ASYNC was already vestigial at that point, having been superceded by SB_ASYNC, however the SS_ASYNC flag is still set and cleared, unlessly because it is never checked. Fix this conflict by removing SS_ASYNC and its vestigial uses. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/kern/sys_socket.c cvs rdiff -u -r1.161 -r1.162 src/sys/sys/socketvar.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/sys_socket.c diff -u src/sys/kern/sys_socket.c:1.78 src/sys/kern/sys_socket.c:1.79 --- src/sys/kern/sys_socket.c:1.78 Tue Dec 4 00:18:05 2018 +++ src/sys/kern/sys_socket.c Tue Nov 17 03:22:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_socket.c,v 1.78 2018/12/04 00:18:05 maya Exp $ */ +/* $NetBSD: sys_socket.c,v 1.79 2020/11/17 03:22:33 chs Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.78 2018/12/04 00:18:05 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.79 2020/11/17 03:22:33 chs Exp $"); #include #include @@ -141,11 +141,9 @@ soo_ioctl(file_t *fp, u_long cmd, void * case FIOASYNC: solock(so); if (*(int *)data) { - so->so_state |= SS_ASYNC; so->so_rcv.sb_flags |= SB_ASYNC; so->so_snd.sb_flags |= SB_ASYNC; } else { - so->so_state &= ~SS_ASYNC; so->so_rcv.sb_flags &= ~SB_ASYNC; so->so_snd.sb_flags &= ~SB_ASYNC; } Index: src/sys/sys/socketvar.h diff -u src/sys/sys/socketvar.h:1.161 src/sys/sys/socketvar.h:1.162 --- src/sys/sys/socketvar.h:1.161 Mon Oct 5 08:38:17 2020 +++ src/sys/sys/socketvar.h Tue Nov 17 03:22:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: socketvar.h,v 1.161 2020/10/05 08:38:17 roy Exp $ */ +/* $NetBSD: socketvar.h,v 1.162 2020/11/17 03:22:33 chs Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -199,7 +199,6 @@ struct socket { #define SS_RESTARTSYS 0x100 /* restart blocked system calls */ #define SS_ISDISCONNECTED 0x800 /* socket disconnected from peer */ -#define SS_ASYNC 0x100 /* async i/o notify */ #define SS_MORETOCOME 0x400 /* * hint from sosend to lower layer; * more data coming
CVS commit: src/external/cddl/osnet/dist/uts/common/dtrace
Module Name:src Committed By: chs Date: Tue Nov 17 03:20:33 UTC 2020 Modified Files: src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c Log Message: Remove a pointless printf. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 \ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c diff -u src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.40 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.41 --- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c:1.40 Sat May 23 23:42:41 2020 +++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c Tue Nov 17 03:20:33 2020 @@ -13840,7 +13840,6 @@ doferr: return (NULL); #endif /* __FreeBSD__ */ #ifdef __NetBSD__ - printf("dtrace: XXX %s not implemented (name=%s)\n", __func__, name); return (NULL); #endif /* __NetBSD__ */ }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 23:27:41 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): rename local functions in suffix handling Name these functions after their main object, which is the suffix list. To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.246 src/usr.bin/make/suff.c:1.247 --- src/usr.bin/make/suff.c:1.246 Mon Nov 16 23:23:57 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 23:27:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.246 2020/11/16 23:23:57 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.247 2020/11/16 23:27:41 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.246 2020/11/16 23:23:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.247 2020/11/16 23:27:41 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -278,7 +278,7 @@ FindTransformByName(const char *name) } static void -SuffUnRef(SuffList *list, Suff *suff) +SuffList_Unref(SuffList *list, Suff *suff) { SuffListNode *ln = Lst_FindDatum(list, suff); if (ln != NULL) { @@ -317,12 +317,12 @@ SuffFree(void *sp) /* Remove the suffix from the list, and free if it is otherwise unused. */ static void -SuffRemove(SuffList *list, Suff *suff) +SuffList_Remove(SuffList *list, Suff *suff) { -SuffUnRef(list, suff); +SuffList_Unref(list, suff); if (suff->refCount == 0) { /* XXX: can lead to suff->refCount == -1 */ - SuffUnRef(sufflist, suff); + SuffList_Unref(sufflist, suff); SuffFree(suff); } } @@ -552,14 +552,17 @@ Suff_EndTransform(GNode *gn) */ if (SuffParseTransform(gn->name, , )) { - /* Remember parents since srcSuff could be deleted in SuffRemove */ + /* + * Remember parents since srcSuff could be deleted in + * SuffList_Remove + */ SuffList *srcSuffParents = srcSuff->parents; SUFF_DEBUG2("deleting transformation from `%s' to `%s'\n", srcSuff->name, targSuff->name); - SuffRemove(targSuff->children, srcSuff); - SuffRemove(srcSuffParents, targSuff); + SuffList_Remove(targSuff->children, srcSuff); + SuffList_Remove(srcSuffParents, targSuff); } } else if (gn->type & OP_TRANSFORM) { SUFF_DEBUG1("transformation %s complete\n", gn->name);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 23:23:57 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): merge duplicate calls to SuffInsert To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.245 src/usr.bin/make/suff.c:1.246 --- src/usr.bin/make/suff.c:1.245 Mon Nov 16 22:31:42 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 23:23:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.245 2020/11/16 22:31:42 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.246 2020/11/16 23:23:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.245 2020/11/16 22:31:42 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.246 2020/11/16 23:23:57 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -330,7 +330,7 @@ SuffRemove(SuffList *list, Suff *suff) /* Insert the suffix into the list, keeping the list ordered by suffix * number. */ static void -SuffInsert(SuffList *list, Suff *suff) +SuffList_Insert(SuffList *list, Suff *suff) { SuffListNode *ln; Suff *listSuff = NULL; @@ -358,6 +358,13 @@ SuffInsert(SuffList *list, Suff *suff) } } +static void +SuffRelate(Suff *srcSuff, Suff *targSuff) +{ +SuffList_Insert(targSuff->children, srcSuff); +SuffList_Insert(srcSuff->parents, targSuff); +} + static Suff * SuffNew(const char *name) { @@ -514,8 +521,7 @@ Suff_AddTransform(const char *name) */ SUFF_DEBUG2("defining transformation from `%s' to `%s'\n", srcSuff->name, targSuff->name); -SuffInsert(targSuff->children, srcSuff); -SuffInsert(srcSuff->parents, targSuff); +SuffRelate(srcSuff, targSuff); return gn; } @@ -588,8 +594,7 @@ SuffRebuildGraph(GNode *transform, Suff Suff *to = FindSuffByName(toName); if (to != NULL) { /* Link in and return, since it can't be anything else. */ - SuffInsert(to->children, suff); - SuffInsert(suff->parents, to); + SuffRelate(suff, to); return; } } @@ -600,12 +605,8 @@ SuffRebuildGraph(GNode *transform, Suff toName = SuffSuffGetSuffix(suff, nameLen, name + nameLen); if (toName != NULL) { Suff *from = FindSuffByNameLen(name, (size_t)(toName - name)); - - if (from != NULL) { - /* establish the proper relationship */ - SuffInsert(suff->children, from); - SuffInsert(from->parents, suff); - } + if (from != NULL) + SuffRelate(from, suff); } } @@ -652,8 +653,7 @@ SuffScanTargets(GNode *target, GNode **i */ SUFF_DEBUG2("defining transformation from `%s' to `%s'\n", srcSuff->name, targSuff->name); - SuffInsert(targSuff->children, srcSuff); - SuffInsert(srcSuff->parents, targSuff); + SuffRelate(srcSuff, targSuff); } return FALSE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 22:31:42 UTC 2020 Modified Files: src/usr.bin/make: make.c suff.c Log Message: make(1): clean up code style in make.c and suff.c To generate a diff of this commit: cvs rdiff -u -r1.208 -r1.209 src/usr.bin/make/make.c cvs rdiff -u -r1.244 -r1.245 src/usr.bin/make/suff.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/make.c diff -u src/usr.bin/make/make.c:1.208 src/usr.bin/make/make.c:1.209 --- src/usr.bin/make/make.c:1.208 Mon Nov 16 21:39:22 2020 +++ src/usr.bin/make/make.c Mon Nov 16 22:31:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.208 2020/11/16 21:39:22 rillig Exp $ */ +/* $NetBSD: make.c,v 1.209 2020/11/16 22:31:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.208 2020/11/16 21:39:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.209 2020/11/16 22:31:42 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -279,7 +279,7 @@ GNode_IsOODate(GNode *gn) */ DEBUG0(MAKE, ".JOIN node..."); DEBUG1(MAKE, "source %smade...", gn->flags & CHILDMADE ? "" : "not "); - oodate = (gn->flags & CHILDMADE) ? TRUE : FALSE; + oodate = (gn->flags & CHILDMADE) != 0; } else if (gn->type & (OP_FORCE|OP_EXEC|OP_PHONY)) { /* * A node which is the object of the force (!) operator or which has @@ -309,7 +309,7 @@ GNode_IsOODate(GNode *gn) if (gn->flags & FORCE) debug_printf("non existing child..."); } - oodate = (gn->flags & FORCE) ? TRUE : FALSE; + oodate = (gn->flags & FORCE) != 0; } #ifdef USE_META Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.244 src/usr.bin/make/suff.c:1.245 --- src/usr.bin/make/suff.c:1.244 Mon Nov 16 21:39:22 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 22:31:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.244 2020/11/16 21:39:22 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.245 2020/11/16 22:31:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.244 2020/11/16 21:39:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.245 2020/11/16 22:31:42 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1116,7 +1116,7 @@ SuffExpandChildren(GNodeListNode *cln, G /* * Break the result into a vector of strings whose nodes * we can find, then add those nodes to the members list. - * Unfortunately, we can't use brk_string because it + * Unfortunately, we can't use Str_Words because it * doesn't understand about variable specifications with * spaces in them... */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 22:28:44 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): clean up code style in targ.c To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.134 src/usr.bin/make/targ.c:1.135 --- src/usr.bin/make/targ.c:1.134 Mon Nov 16 22:27:03 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 22:28:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.134 2020/11/16 22:27:03 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.135 2020/11/16 22:28:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -119,7 +119,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.134 2020/11/16 22:27:03 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.135 2020/11/16 22:28:44 rillig Exp $"); /* All target nodes found so far, but not the source nodes. */ static GNodeList *allTargets; @@ -480,12 +480,12 @@ Targ_PrintNode(GNode *gn, int pass) debug_printf("# *** MAIN TARGET ***\n"); } if (pass >= 2) { - if (gn->unmade) { + if (gn->unmade > 0) { debug_printf("# %d unmade children\n", gn->unmade); } else { debug_printf("# No unmade children\n"); } - if (! (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { + if (!(gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { if (gn->mtime != 0) { debug_printf("# last modified %s: %s\n", Targ_FmtTime(gn->mtime), @@ -553,16 +553,23 @@ Targ_PrintGraph(int pass) { debug_printf("#*** Input graph:\n"); Targ_PrintNodes(allTargets, pass); -debug_printf("\n\n"); -debug_printf("#\n# Files that are only sources:\n"); +debug_printf("\n"); +debug_printf("\n"); + +debug_printf("#\n"); +debug_printf("# Files that are only sources:\n"); PrintOnlySources(); + debug_printf("#*** Global Variables:\n"); Var_Dump(VAR_GLOBAL); + debug_printf("#*** Command-line Variables:\n"); Var_Dump(VAR_CMDLINE); + debug_printf("\n"); Dir_PrintDirectories(); debug_printf("\n"); + Suff_PrintAll(); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 22:27:04 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): initialize and free GNode fields in declaration order Initialization and destruction of the fields is independent from the other fields. Therefore use declaration order, which allows to quickly see whether a field was forgotten. While here, add comments that in cleanup mode, not all memory is freed. The variables of a node and the suffix survive right now. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.133 src/usr.bin/make/targ.c:1.134 --- src/usr.bin/make/targ.c:1.133 Mon Nov 16 21:59:08 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 22:27:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.133 2020/11/16 21:59:08 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.134 2020/11/16 22:27:03 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -119,7 +119,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.133 2020/11/16 21:59:08 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.134 2020/11/16 22:27:03 rillig Exp $"); /* All target nodes found so far, but not the source nodes. */ static GNodeList *allTargets; @@ -193,21 +193,21 @@ GNode_New(const char *name) gn->uname = NULL; gn->path = NULL; gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0; -gn->unmade = 0; -gn->unmade_cohorts = 0; -gn->cohort_num[0] = '\0'; -gn->centurion = NULL; -gn->made = UNMADE; gn->flags = 0; -gn->checked_seqno = 0; +gn->made = UNMADE; +gn->unmade = 0; gn->mtime = 0; gn->youngestChild = NULL; gn->implicitParents = Lst_New(); -gn->cohorts = Lst_New(); gn->parents = Lst_New(); gn->children = Lst_New(); gn->order_pred = Lst_New(); gn->order_succ = Lst_New(); +gn->cohorts = Lst_New(); +gn->cohort_num[0] = '\0'; +gn->unmade_cohorts = 0; +gn->centurion = NULL; +gn->checked_seqno = 0; HashTable_Init(>context); gn->commands = Lst_New(); gn->suffix = NULL; @@ -230,17 +230,22 @@ GNode_Free(void *gnp) free(gn->name); free(gn->uname); free(gn->path); - -Lst_Free(gn->implicitParents); -Lst_Free(gn->cohorts); -Lst_Free(gn->parents); -Lst_Free(gn->children); -Lst_Free(gn->order_succ); -Lst_Free(gn->order_pred); -HashTable_Done(>context); -Lst_Free(gn->commands); - -/* XXX: does gn->suffix need to be freed? It is reference-counted. */ +/* gn->youngestChild is not owned by this node. */ +Lst_Free(gn->implicitParents); /* ... but not the nodes themselves, */ +Lst_Free(gn->parents); /* as they are not owned by this node. */ +Lst_Free(gn->children); /* likewise */ +Lst_Free(gn->order_pred); /* likewise */ +Lst_Free(gn->order_succ); /* likewise */ +Lst_Free(gn->cohorts); /* likewise */ +HashTable_Done(>context); /* ... but not the variables themselves, + * even though they are owned by this node. + * XXX: they should probably be freed. */ +Lst_Free(gn->commands); /* ... but not the commands themselves, + * as they may be shared with other nodes. */ +/* gn->suffix is not owned by this node. */ +/* XXX: gn->suffix should be unreferenced here. This requires a thorough + * check that the reference counting is done correctly in all places, + * otherwise a suffix might be freed too early. */ free(gn); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 22:08:20 UTC 2020 Modified Files: src/usr.bin/make: main.c Log Message: make(1): fix initialization order of modules (broken since today) In CLEANUP mode, Var_Init depends on Targ_Init since the variable scopes are implemented as GNodes. By the way, since 1999-09-15 variables are no longer stored in lists but in hash tables. To generate a diff of this commit: cvs rdiff -u -r1.475 -r1.476 src/usr.bin/make/main.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/main.c diff -u src/usr.bin/make/main.c:1.475 src/usr.bin/make/main.c:1.476 --- src/usr.bin/make/main.c:1.475 Mon Nov 16 18:28:27 2020 +++ src/usr.bin/make/main.c Mon Nov 16 22:08:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.475 2020/11/16 18:28:27 rillig Exp $ */ +/* $NetBSD: main.c,v 1.476 2020/11/16 22:08:20 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.475 2020/11/16 18:28:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.476 2020/11/16 22:08:20 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1382,8 +1382,8 @@ main_Init(int argc, char **argv) /* * Just in case MAKEOBJDIR wants us to do something tricky. */ - Var_Init(); /* Initialize the lists of variables for - * parsing arguments */ + Targ_Init(); + Var_Init(); Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL); Var_Set("MACHINE", machine, VAR_GLOBAL); Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL); @@ -1505,7 +1505,6 @@ main_Init(int argc, char **argv) * parsing the makefile(s) */ Arch_Init(); - Targ_Init(); Suff_Init(); Trace_Init(tracefile);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:59:08 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): rename variables in targ.c The previous names didn't make it obvious that 'allTargets' and 'targets' belong together. Naming both 'allTargets' provides a stronger hint. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.132 src/usr.bin/make/targ.c:1.133 --- src/usr.bin/make/targ.c:1.132 Mon Nov 16 21:53:10 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:59:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.132 2020/11/16 21:53:10 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.133 2020/11/16 21:59:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -119,16 +119,15 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.132 2020/11/16 21:53:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.133 2020/11/16 21:59:08 rillig Exp $"); -static GNodeList *allTargets; /* the list of all targets found so far */ -static HashTable targets; /* a hash table of same */ +/* All target nodes found so far, but not the source nodes. */ +static GNodeList *allTargets; +static HashTable allTargetsByName; #ifdef CLEANUP -static GNodeList *allGNs; /* List of all the GNodes */ -#endif +static GNodeList *allNodes; -#ifdef CLEANUP static void GNode_Free(void *); #endif @@ -136,9 +135,9 @@ void Targ_Init(void) { allTargets = Lst_New(); -HashTable_Init(); +HashTable_Init(); #ifdef CLEANUP -allGNs = Lst_New(); +allNodes = Lst_New(); #endif } @@ -148,15 +147,15 @@ Targ_End(void) Targ_Stats(); #ifdef CLEANUP Lst_Free(allTargets); -HashTable_Done(); -Lst_Destroy(allGNs, GNode_Free); +HashTable_Done(); +Lst_Destroy(allNodes, GNode_Free); #endif } void Targ_Stats(void) { -HashTable_DebugStats(, "targets"); +HashTable_DebugStats(, "targets"); } /* @@ -216,7 +215,7 @@ GNode_New(const char *name) gn->lineno = 0; #ifdef CLEANUP -Lst_Append(allGNs, gn); +Lst_Append(allNodes, gn); #endif return gn; @@ -251,7 +250,7 @@ GNode_Free(void *gnp) GNode * Targ_FindNode(const char *name) { -return HashTable_FindValue(, name); +return HashTable_FindValue(, name); } /* Get the existing global node, or create it. */ @@ -259,7 +258,7 @@ GNode * Targ_GetNode(const char *name) { Boolean isNew; -HashEntry *he = HashTable_CreateEntry(, name, ); +HashEntry *he = HashTable_CreateEntry(, name, ); if (!isNew) return HashEntry_Get(he);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:53:10 UTC 2020 Modified Files: src/usr.bin/make: make.h targ.c Log Message: make(1): clean up and extend comments in targ.c To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/usr.bin/make/make.h cvs rdiff -u -r1.131 -r1.132 src/usr.bin/make/targ.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/make.h diff -u src/usr.bin/make/make.h:1.209 src/usr.bin/make/make.h:1.210 --- src/usr.bin/make/make.h:1.209 Sun Nov 15 12:02:44 2020 +++ src/usr.bin/make/make.h Mon Nov 16 21:53:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.209 2020/11/15 12:02:44 rillig Exp $ */ +/* $NetBSD: make.h,v 1.210 2020/11/16 21:53:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -381,6 +381,7 @@ typedef struct GNode { struct Suff *suffix; /* Filename where the GNode got defined */ +/* XXX: What is the lifetime of this string? */ const char *fname; /* Line number where the GNode got defined */ int lineno; Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.131 src/usr.bin/make/targ.c:1.132 --- src/usr.bin/make/targ.c:1.131 Mon Nov 16 21:48:18 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:53:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.132 2020/11/16 21:53:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -68,15 +68,13 @@ * SUCH DAMAGE. */ -/*- - * targ.c -- - * Functions for maintaining the Lst allTargets. Target nodes are - * kept in two structures: a Lst and a hash table. +/* + * Maintaining the targets and sources, which are both implemented as GNode. * * Interface: - * Targ_Init Initialization procedure. + * Targ_Init Initialize the module. * - * Targ_End Clean up the module + * Targ_End Clean up the module. * * Targ_List Return the list of all targets so far. * @@ -121,7 +119,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.132 2020/11/16 21:53:10 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ static HashTable targets; /* a hash table of same */ @@ -161,18 +159,30 @@ Targ_Stats(void) HashTable_DebugStats(, "targets"); } -/* Return the list of all targets. */ +/* + * Return the list of all targets, which are all nodes that appear on the + * left-hand side of a dependency declaration such as "target: source". + * The returned list does not contain pure sources. + */ GNodeList * Targ_List(void) { return allTargets; } -/* Create and initialize a new graph node. The gnode is added to the list of - * all gnodes. +/* Create a new graph node, but don't register it anywhere. * - * Input: - * name the name of the node, such as "clean", "src.c", ".END" + * Graph nodes that appear on the left-hand side of a dependency line such + * as "target: source" are called targets. XXX: In some cases (like the + * .ALLTARGETS variable), all nodes are called targets as well, even if they + * never appear on the left-hand side. This is a mistake. + * + * Typical names for graph nodes are: + * "src.c" (an ordinary file) + * "clean" (a .PHONY target) + * ".END" (a special hook target) + * "-lm" (a library) + * "libc.a(isspace.o)" (an archive member) */ GNode * GNode_New(const char *name) @@ -260,10 +270,12 @@ Targ_GetNode(const char *name) } } -/* Create a node, register it in .ALLTARGETS but don't store it in the +/* + * Create a node, register it in .ALLTARGETS but don't store it in the * table of global nodes. This means it cannot be found by name. * - * This is used for internal nodes, such as cohorts or .WAIT nodes. */ + * This is used for internal nodes, such as cohorts or .WAIT nodes. + */ GNode * Targ_NewInternalNode(const char *name) { @@ -275,8 +287,10 @@ Targ_NewInternalNode(const char *name) return gn; } -/* Return the .END node, which contains the commands to be executed when - * everything else is done. */ +/* + * Return the .END node, which contains the commands to be run when + * everything else has been made. + */ GNode *Targ_GetEndNode(void) { /* Save the node locally to avoid having to search for it all the time. */ @@ -324,12 +338,13 @@ Targ_Precious(const GNode *gn) return allPrecious || gn->type & (OP_PRECIOUS | OP_DOUBLEDEP); } -/*** DEBUG INFO PRINTING / - -static GNode *mainTarg; /* the main target, as set by Targ_SetMain */ +/* + * The main target to be made; only for debugging output. + * See mainNode in parse.c for the definitive source. + */ +static GNode *mainTarg; -/* Set our idea of the main target we'll be creating. Used for debugging - * output. */ +/* Remember the main target to make;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:48:19 UTC 2020 Modified Files: src/usr.bin/make: nonints.h targ.c Log Message: make(1): make some GNode functions const To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/usr.bin/make/nonints.h cvs rdiff -u -r1.130 -r1.131 src/usr.bin/make/targ.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/nonints.h diff -u src/usr.bin/make/nonints.h:1.161 src/usr.bin/make/nonints.h:1.162 --- src/usr.bin/make/nonints.h:1.161 Mon Nov 16 21:39:22 2020 +++ src/usr.bin/make/nonints.h Mon Nov 16 21:48:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.161 2020/11/16 21:39:22 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.162 2020/11/16 21:48:18 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -197,9 +197,9 @@ GNode *Targ_GetNode(const char *); GNode *Targ_NewInternalNode(const char *); GNode *Targ_GetEndNode(void); GNodeList *Targ_FindList(StringList *); -Boolean Targ_Ignore(GNode *); -Boolean Targ_Silent(GNode *); -Boolean Targ_Precious(GNode *); +Boolean Targ_Ignore(const GNode *); +Boolean Targ_Silent(const GNode *); +Boolean Targ_Precious(const GNode *); void Targ_SetMain(GNode *); void Targ_PrintCmds(GNode *); void Targ_PrintNode(GNode *, int); Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.130 src/usr.bin/make/targ.c:1.131 --- src/usr.bin/make/targ.c:1.130 Mon Nov 16 21:44:29 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:48:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,7 +121,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.131 2020/11/16 21:48:18 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ static HashTable targets; /* a hash table of same */ @@ -304,22 +304,23 @@ Targ_FindList(StringList *names) /* Return true if should ignore errors when creating gn. */ Boolean -Targ_Ignore(GNode *gn) +Targ_Ignore(const GNode *gn) { return opts.ignoreErrors || gn->type & OP_IGNORE; } /* Return true if be silent when creating gn. */ Boolean -Targ_Silent(GNode *gn) +Targ_Silent(const GNode *gn) { return opts.beSilent || gn->type & OP_SILENT; } /* See if the given target is precious. */ Boolean -Targ_Precious(GNode *gn) +Targ_Precious(const GNode *gn) { +/* XXX: Why are '::' targets precious? */ return allPrecious || gn->type & (OP_PRECIOUS | OP_DOUBLEDEP); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:44:29 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): in CLEANUP mode, preallocate list of all GNodes This makes the code simpler and more uniform. To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.129 src/usr.bin/make/targ.c:1.130 --- src/usr.bin/make/targ.c:1.129 Mon Nov 16 21:41:02 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:44:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.129 2020/11/16 21:41:02 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,13 +121,14 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.129 2020/11/16 21:41:02 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.130 2020/11/16 21:44:29 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ +static HashTable targets; /* a hash table of same */ + #ifdef CLEANUP static GNodeList *allGNs; /* List of all the GNodes */ #endif -static HashTable targets; /* a hash table of same */ #ifdef CLEANUP static void GNode_Free(void *); @@ -138,6 +139,9 @@ Targ_Init(void) { allTargets = Lst_New(); HashTable_Init(); +#ifdef CLEANUP +allGNs = Lst_New(); +#endif } void @@ -146,9 +150,8 @@ Targ_End(void) Targ_Stats(); #ifdef CLEANUP Lst_Free(allTargets); -if (allGNs != NULL) - Lst_Destroy(allGNs, GNode_Free); HashTable_Done(); +Lst_Destroy(allGNs, GNode_Free); #endif } @@ -203,8 +206,6 @@ GNode_New(const char *name) gn->lineno = 0; #ifdef CLEANUP -if (allGNs == NULL) - allGNs = Lst_New(); Lst_Append(allGNs, gn); #endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:41:02 UTC 2020 Modified Files: src/usr.bin/make: targ.c Log Message: make(1): rename TargFreeGN to GNode_Free This is the usual counterpart to a New function, like for Lst, HashTable, Buffer. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/usr.bin/make/targ.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/targ.c diff -u src/usr.bin/make/targ.c:1.128 src/usr.bin/make/targ.c:1.129 --- src/usr.bin/make/targ.c:1.128 Mon Nov 16 21:39:22 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:41:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.128 2020/11/16 21:39:22 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.129 2020/11/16 21:41:02 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,7 +121,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.128 2020/11/16 21:39:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.129 2020/11/16 21:41:02 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ #ifdef CLEANUP @@ -130,7 +130,7 @@ static GNodeList *allGNs; /* List of all static HashTable targets; /* a hash table of same */ #ifdef CLEANUP -static void TargFreeGN(void *); +static void GNode_Free(void *); #endif void @@ -147,7 +147,7 @@ Targ_End(void) #ifdef CLEANUP Lst_Free(allTargets); if (allGNs != NULL) - Lst_Destroy(allGNs, TargFreeGN); + Lst_Destroy(allGNs, GNode_Free); HashTable_Done(); #endif } @@ -213,7 +213,7 @@ GNode_New(const char *name) #ifdef CLEANUP static void -TargFreeGN(void *gnp) +GNode_Free(void *gnp) { GNode *gn = gnp;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 21:39:22 UTC 2020 Modified Files: src/usr.bin/make: make.c nonints.h parse.c suff.c targ.c var.c Log Message: make(1): rename Targ_NewGN to GNode_New This function is a classical constructor function, and if it weren't for CLEANUP mode, it would have no dependencies on anything else besides the memory allocator. Therefore it doesn't really matter which module defines this function, and there is no need for the "Targ" to be part of the function name. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/make.c cvs rdiff -u -r1.160 -r1.161 src/usr.bin/make/nonints.h cvs rdiff -u -r1.442 -r1.443 src/usr.bin/make/parse.c cvs rdiff -u -r1.243 -r1.244 src/usr.bin/make/suff.c cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/targ.c cvs rdiff -u -r1.687 -r1.688 src/usr.bin/make/var.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/make.c diff -u src/usr.bin/make/make.c:1.207 src/usr.bin/make/make.c:1.208 --- src/usr.bin/make/make.c:1.207 Sun Nov 15 10:11:26 2020 +++ src/usr.bin/make/make.c Mon Nov 16 21:39:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.207 2020/11/15 10:11:26 rillig Exp $ */ +/* $NetBSD: make.c,v 1.208 2020/11/16 21:39:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -102,7 +102,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.207 2020/11/15 10:11:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.208 2020/11/16 21:39:22 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -1207,7 +1207,7 @@ Make_ProcessWait(GNodeList *targs) * Perhaps this should be done earlier... */ -pgn = Targ_NewGN(".MAIN"); +pgn = GNode_New(".MAIN"); pgn->flags = REMAKE; pgn->type = OP_PHONY | OP_DEPENDS; /* Get it displayed in the diag dumps */ Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.160 src/usr.bin/make/nonints.h:1.161 --- src/usr.bin/make/nonints.h:1.160 Tue Nov 10 00:32:12 2020 +++ src/usr.bin/make/nonints.h Mon Nov 16 21:39:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.160 2020/11/10 00:32:12 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.161 2020/11/16 21:39:22 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -191,7 +191,7 @@ void Targ_End(void); void Targ_Stats(void); GNodeList *Targ_List(void); -GNode *Targ_NewGN(const char *); +GNode *GNode_New(const char *); GNode *Targ_FindNode(const char *); GNode *Targ_GetNode(const char *); GNode *Targ_NewInternalNode(const char *); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.442 src/usr.bin/make/parse.c:1.443 --- src/usr.bin/make/parse.c:1.442 Sun Nov 15 22:31:03 2020 +++ src/usr.bin/make/parse.c Mon Nov 16 21:39:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.442 2020/11/15 22:31:03 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.443 2020/11/16 21:39:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.442 2020/11/15 22:31:03 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.443 2020/11/16 21:39:22 rillig Exp $"); /* types and constants */ @@ -1110,7 +1110,7 @@ ParseDoDependencyTargetSpecial(ParseSpec * the node is a transformation rule to make life easier later, * when we'll use Make_HandleUse to actually apply the .DEFAULT * commands. */ - GNode *gn = Targ_NewGN(".DEFAULT"); + GNode *gn = GNode_New(".DEFAULT"); gn->type |= OP_NOTMAIN|OP_TRANSFORM; Lst_Append(targets, gn); defaultNode = gn; Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.243 src/usr.bin/make/suff.c:1.244 --- src/usr.bin/make/suff.c:1.243 Mon Nov 16 18:49:54 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 21:39:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.243 2020/11/16 18:49:54 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.244 2020/11/16 21:39:22 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.243 2020/11/16 18:49:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.244 2020/11/16 21:39:22 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -486,7 +486,7 @@ Suff_AddTransform(const char *name) * Make a new graph node for the transformation. It will be filled in * by the Parse module. */ - gn = Targ_NewGN(name); + gn = GNode_New(name); Lst_Append(transforms, gn); } else { /* Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.127 src/usr.bin/make/targ.c:1.128 --- src/usr.bin/make/targ.c:1.127 Thu Nov 5 17:27:16 2020 +++ src/usr.bin/make/targ.c Mon Nov 16 21:39:22 2020 @@ -1,4
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:49:54 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): inline SUFF_DEBUG3 and SUFF_DEBUG4 Each of them was only used a single time, which was not worth an additional macro. To generate a diff of this commit: cvs rdiff -u -r1.242 -r1.243 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.242 src/usr.bin/make/suff.c:1.243 --- src/usr.bin/make/suff.c:1.242 Mon Nov 16 18:47:03 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:49:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.242 2020/11/16 18:47:03 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.243 2020/11/16 18:49:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,14 +114,11 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.242 2020/11/16 18:47:03 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.243 2020/11/16 18:49:54 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) #define SUFF_DEBUG2(fmt, arg1, arg2) DEBUG2(SUFF, fmt, arg1, arg2) -#define SUFF_DEBUG3(fmt, arg1, arg2, arg3) DEBUG3(SUFF, fmt, arg1, arg2, arg3) -#define SUFF_DEBUG4(fmt, arg1, arg2, arg3, arg4) \ - DEBUG4(SUFF, fmt, arg1, arg2, arg3, arg4) typedef List SuffList; typedef ListNode SuffListNode; @@ -351,8 +348,8 @@ SuffInsert(SuffList *list, Suff *suff) suff->refCount++; Lst_Append(suff->ref, list); } else if (listSuff->sNum != suff->sNum) { - SUFF_DEBUG4("inserting \"%s\" (%d) before \"%s\" (%d)\n", - suff->name, suff->sNum, listSuff->name, listSuff->sNum); + DEBUG4(SUFF, "inserting \"%s\" (%d) before \"%s\" (%d)\n", + suff->name, suff->sNum, listSuff->name, listSuff->sNum); Lst_InsertBefore(list, ln, suff); suff->refCount++; Lst_Append(suff->ref, list); @@ -1343,7 +1340,7 @@ SuffApplyTransform(GNode *tgn, GNode *sg return FALSE; } -SUFF_DEBUG3("\tapplying %s -> %s to \"%s\"\n", +DEBUG3(SUFF,"\tapplying %s -> %s to \"%s\"\n", ssuff->name, tsuff->name, tgn->name); /* Record last child; Make_HandleUse may add child nodes. */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:47:03 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up coding style in suff.c To generate a diff of this commit: cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.241 src/usr.bin/make/suff.c:1.242 --- src/usr.bin/make/suff.c:1.241 Mon Nov 16 18:45:44 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:47:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.241 2020/11/16 18:45:44 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.242 2020/11/16 18:47:03 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.241 2020/11/16 18:45:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.242 2020/11/16 18:47:03 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -1164,7 +1164,7 @@ SuffExpandChildren(GNodeListNode *cln, G } free(freeIt); - } else if (*cp == '\\' && cp[1] != '\0') { + } else if (cp[0] == '\\' && cp[1] != '\0') { /* * Escaped something -- skip over it */ @@ -1320,7 +1320,7 @@ Suff_FindPath(GNode* gn) static Boolean SuffApplyTransform(GNode *tgn, GNode *sgn, Suff *tsuff, Suff *ssuff) { -GNodeListNode *ln, *nln;/* General node */ +GNodeListNode *ln; char *tname; /* Name of transformation rule */ GNode *gn; /* Node for same */ @@ -1350,12 +1350,14 @@ SuffApplyTransform(GNode *tgn, GNode *sg ln = tgn->children->last; /* Apply the rule. */ -(void)Make_HandleUse(gn, tgn); +Make_HandleUse(gn, tgn); /* Deal with wildcards and variables in any acquired sources. */ -for (ln = ln != NULL ? ln->next : NULL; ln != NULL; ln = nln) { - nln = ln->next; +ln = ln != NULL ? ln->next : NULL; +while (ln != NULL) { + GNodeListNode *nln = ln->next; SuffExpandChildren(ln, tgn); + ln = nln; } /* @@ -1485,7 +1487,8 @@ SuffFindArchiveDeps(GNode *gn, SrcList * * Replace the opening and closing parens now we've no need of the separate * pieces. */ -*eoarch = '('; *eoname = ')'; +*eoarch = '('; +*eoname = ')'; /* * Pretend gn appeared to the left of a dependency operator so @@ -1807,9 +1810,7 @@ sfnd_abort: * node, so all we need to do is set the standard variables. */ targ->node->type |= OP_DEPS_FOUND; - Var_Set(PREFIX, targ->pref, targ->node); - Var_Set(TARGET, targ->node->name, targ->node); } } @@ -1824,9 +1825,8 @@ sfnd_abort: * two lists. */ sfnd_return: -if (bottom != NULL) - if (Lst_FindDatum(slst, bottom) == NULL) - Lst_Append(slst, bottom); +if (bottom != NULL && Lst_FindDatum(slst, bottom) == NULL) + Lst_Append(slst, bottom); while (SuffRemoveSrc(srcs) || SuffRemoveSrc(targs)) continue;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:45:44 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): improve local variable names in suff.c The name 's' was used for both 'suff' and 'src', which was unnecessarily confusing. To generate a diff of this commit: cvs rdiff -u -r1.240 -r1.241 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.240 src/usr.bin/make/suff.c:1.241 --- src/usr.bin/make/suff.c:1.240 Mon Nov 16 18:41:41 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:45:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.240 2020/11/16 18:41:41 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.241 2020/11/16 18:45:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.240 2020/11/16 18:41:41 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.241 2020/11/16 18:45:44 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -874,12 +874,12 @@ SuffAddSources(Suff *suff, SrcList *srcL /* Add all the children of targ to the list. */ static void -SuffAddLevel(SrcList *l, Src *targ) +SuffAddLevel(SrcList *srcs, Src *targ) { SrcListNode *ln; for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) { Suff *childSuff = ln->datum; - SuffAddSources(childSuff, l, targ); + SuffAddSources(childSuff, srcs, targ); } } @@ -1228,7 +1228,7 @@ static void SuffExpandWildcards(GNodeListNode *cln, GNode *pgn) { GNode *cgn = cln->datum; -StringList *explist; +StringList *expansions; if (!Dir_HasWildcards(cgn->name)) return; @@ -1236,15 +1236,15 @@ SuffExpandWildcards(GNodeListNode *cln, /* * Expand the word along the chosen path */ -explist = Lst_New(); -Dir_Expand(cgn->name, Suff_FindPath(cgn), explist); +expansions = Lst_New(); +Dir_Expand(cgn->name, Suff_FindPath(cgn), expansions); -while (!Lst_IsEmpty(explist)) { +while (!Lst_IsEmpty(expansions)) { GNode *gn; /* * Fetch next expansion off the list and find its GNode */ - char *cp = Lst_Dequeue(explist); + char *cp = Lst_Dequeue(expansions); SUFF_DEBUG1("%s...", cp); gn = Targ_GetNode(cp); @@ -1255,7 +1255,7 @@ SuffExpandWildcards(GNodeListNode *cln, pgn->unmade++; } -Lst_Free(explist); +Lst_Free(expansions); SUFF_DEBUG0("\n"); @@ -1318,7 +1318,7 @@ Suff_FindPath(GNode* gn) * TRUE if successful, FALSE if not. */ static Boolean -SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s) +SuffApplyTransform(GNode *tgn, GNode *sgn, Suff *tsuff, Suff *ssuff) { GNodeListNode *ln, *nln;/* General node */ char *tname; /* Name of transformation rule */ @@ -1327,14 +1327,14 @@ SuffApplyTransform(GNode *tGn, GNode *sG /* * Form the proper links between the target and source. */ -Lst_Append(tGn->children, sGn); -Lst_Append(sGn->parents, tGn); -tGn->unmade++; +Lst_Append(tgn->children, sgn); +Lst_Append(sgn->parents, tgn); +tgn->unmade++; /* * Locate the transformation rule itself */ -tname = str_concat2(s->name, t->name); +tname = str_concat2(ssuff->name, tsuff->name); gn = FindTransformByName(tname); free(tname); @@ -1343,25 +1343,26 @@ SuffApplyTransform(GNode *tGn, GNode *sG return FALSE; } -SUFF_DEBUG3("\tapplying %s -> %s to \"%s\"\n", s->name, t->name, tGn->name); +SUFF_DEBUG3("\tapplying %s -> %s to \"%s\"\n", + ssuff->name, tsuff->name, tgn->name); /* Record last child; Make_HandleUse may add child nodes. */ -ln = tGn->children->last; +ln = tgn->children->last; /* Apply the rule. */ -(void)Make_HandleUse(gn, tGn); +(void)Make_HandleUse(gn, tgn); /* Deal with wildcards and variables in any acquired sources. */ for (ln = ln != NULL ? ln->next : NULL; ln != NULL; ln = nln) { nln = ln->next; - SuffExpandChildren(ln, tGn); + SuffExpandChildren(ln, tgn); } /* * Keep track of another parent to which this node is transformed so * the .IMPSRC variable can be set correctly for the parent. */ -Lst_Append(sGn->implicitParents, tGn); +Lst_Append(sgn->implicitParents, tgn); return TRUE; } @@ -1917,8 +1918,8 @@ SuffFindDeps(GNode *gn, SrcList *slst) void Suff_SetNull(const char *name) { -Suff *s = FindSuffByName(name); -if (s == NULL) { +Suff *suff = FindSuffByName(name); +if (suff == NULL) { Parse_Error(PARSE_WARNING, "Desired null suffix %s not defined.", name); return; @@ -1926,11 +1927,11 @@ Suff_SetNull(const char *name) if (suffNull != NULL) suffNull->flags &= ~(unsigned)SUFF_NULL; -s->flags |=
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:41:41 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): remove redundant braces and parentheses from suff.c To generate a diff of this commit: cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.239 src/usr.bin/make/suff.c:1.240 --- src/usr.bin/make/suff.c:1.239 Mon Nov 16 18:38:49 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:41:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.239 2020/11/16 18:38:49 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.240 2020/11/16 18:41:41 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.239 2020/11/16 18:38:49 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.240 2020/11/16 18:41:41 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -747,14 +747,12 @@ Suff_DoPaths(void) Suff *s = ln->datum; if (!Lst_IsEmpty(s->searchPath)) { #ifdef INCLUDES - if (s->flags & SUFF_INCLUDE) { + if (s->flags & SUFF_INCLUDE) Dir_Concat(inIncludes, s->searchPath); - } #endif #ifdef LIBRARIES - if (s->flags & SUFF_LIBRARY) { + if (s->flags & SUFF_LIBRARY) Dir_Concat(inLibs, s->searchPath); - } #endif Dir_Concat(s->searchPath, dirSearchPath); } else { @@ -1493,9 +1491,8 @@ SuffFindArchiveDeps(GNode *gn, SrcList * * the user needn't provide a transformation from the member to the * archive. */ -if (!GNode_IsTarget(gn)) { +if (!GNode_IsTarget(gn)) gn->type |= OP_DEPENDS; -} /* * Flag the member as such so we remember to look in the archive for @@ -1697,11 +1694,10 @@ SuffFindNormalDeps(GNode *gn, SrcList *s * No known transformations -- use the first suffix found * for setting the local variables. */ - if (!Lst_IsEmpty(targs)) { + if (targs->first != NULL) targ = targs->first->datum; - } else { + else targ = NULL; - } } else { /* * Work up the transformation path to find the suffix of the @@ -1714,7 +1710,7 @@ SuffFindNormalDeps(GNode *gn, SrcList *s Var_Set(TARGET, GNode_Path(gn), gn); -pref = (targ != NULL) ? targ->pref : gn->name; +pref = targ != NULL ? targ->pref : gn->name; Var_Set(PREFIX, pref, gn); /* @@ -1756,9 +1752,8 @@ sfnd_abort: * up to, but not including, the parent node. */ while (bottom != NULL && bottom->parent != NULL) { - if (Lst_FindDatum(slst, bottom) == NULL) { + if (Lst_FindDatum(slst, bottom) == NULL) Lst_Append(slst, bottom); - } bottom = bottom->parent; } bottom = src; @@ -1784,9 +1779,8 @@ sfnd_abort: * transformation rule. Also, the unmade field of gn is incremented. * Etc. */ -if (bottom->node == NULL) { +if (bottom->node == NULL) bottom->node = Targ_GetNode(bottom->file); -} for (src = bottom; src->parent != NULL; src = src->parent) { targ = src->parent; @@ -1796,9 +1790,8 @@ sfnd_abort: src->node->suffix = src->suff; src->node->suffix->refCount++; - if (targ->node == NULL) { + if (targ->node == NULL) targ->node = Targ_GetNode(targ->file); - } SuffApplyTransform(targ->node, src->node, targ->suff, src->suff); @@ -1931,9 +1924,8 @@ Suff_SetNull(const char *name) return; } -if (suffNull != NULL) { +if (suffNull != NULL) suffNull->flags &= ~(unsigned)SUFF_NULL; -} s->flags |= SUFF_NULL; /* * XXX: Here's where the transformation mangling would take place
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:38:50 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): use boolean expressions in conditions To generate a diff of this commit: cvs rdiff -u -r1.238 -r1.239 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.238 src/usr.bin/make/suff.c:1.239 --- src/usr.bin/make/suff.c:1.238 Mon Nov 16 18:34:29 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:38:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.238 2020/11/16 18:34:29 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.239 2020/11/16 18:38:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.238 2020/11/16 18:34:29 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.239 2020/11/16 18:38:49 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -215,7 +215,7 @@ SuffStrIsPrefix(const char *pref, const str++; } -return *pref ? NULL : str; +return *pref != '\0' ? NULL : str; } /* @@ -304,7 +304,7 @@ SuffFree(void *sp) #if 0 /* We don't delete suffixes in order, so we cannot use this */ -if (suff->refCount) +if (suff->refCount != 0) Punt("Internal error deleting suffix `%s' with refcount = %d", suff->name, suff->refCount); #endif @@ -1755,7 +1755,7 @@ sfnd_abort: * Free up all the Src structures in the transformation path * up to, but not including, the parent node. */ - while (bottom && bottom->parent != NULL) { + while (bottom != NULL && bottom->parent != NULL) { if (Lst_FindDatum(slst, bottom) == NULL) { Lst_Append(slst, bottom); } @@ -1820,7 +1820,7 @@ sfnd_abort: } } -if (gn->suffix) +if (gn->suffix != NULL) gn->suffix->refCount--; gn->suffix = src->suff; gn->suffix->refCount++; @@ -1830,7 +1830,7 @@ sfnd_abort: * two lists. */ sfnd_return: -if (bottom) +if (bottom != NULL) if (Lst_FindDatum(slst, bottom) == NULL) Lst_Append(slst, bottom);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:34:29 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): clean up comments in suff.c To generate a diff of this commit: cvs rdiff -u -r1.237 -r1.238 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.237 src/usr.bin/make/suff.c:1.238 --- src/usr.bin/make/suff.c:1.237 Mon Nov 16 16:15:37 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 18:34:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.237 2020/11/16 16:15:37 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.238 2020/11/16 18:34:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -68,36 +68,23 @@ * SUCH DAMAGE. */ -/*- - * suff.c -- - * Functions to maintain suffix lists and find implicit dependents - * using suffix transformation rules +/* + * Maintain suffix lists and find implicit dependents using suffix + * transformation rules such as ".c.o". * * Interface: - * Suff_Init Initialize all things to do with suffixes. + * Suff_Init Initialize the module. * - * Suff_End Clean up the module + * Suff_End Clean up the module. * - * Suff_DoPaths This function is used to make life easier - * when searching for a file according to its - * suffix. It takes the global search path, - * as defined using the .PATH: target, and appends - * its directories to the path of each of the - * defined suffixes, as specified using - * .PATH: targets. In addition, all - * directories given for suffixes labeled as - * include files or libraries, using the .INCLUDES - * or .LIBS targets, are played with using - * Dir_MakeFlags to create the .INCLUDES and - * .LIBS global variables. + * Suff_DoPaths Extend the search path of each suffix to include the + * default search path. * * Suff_ClearSuffixes - * Clear out all the suffixes and defined - * transformations. + * Clear out all the suffixes and transformations. * * Suff_IsTransform - * Return TRUE if the passed string is the lhs - * of a transformation rule. + * See if the passed string is a transformation rule. * * Suff_AddSuffix Add the passed string as another known suffix. * @@ -109,9 +96,7 @@ * Suff_AddLib Mark the given suffix as denoting a library. * * Suff_AddTransform - * Add another transformation to the suffix - * graph. Returns GNode suitable for framing, I - * mean, tacking commands, attributes, etc. on. + * Add another transformation to the suffix graph. * * Suff_SetNull Define the suffix to consider the suffix of * any file that doesn't have a known one. @@ -129,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.237 2020/11/16 16:15:37 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.238 2020/11/16 18:34:29 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -149,9 +134,11 @@ static SuffList *sufflist; /* List of su static SuffList *suffClean; /* List of suffixes to be cleaned */ #endif static SrcList *srclist; /* List of sources */ -static GNodeList *transforms; /* List of transformation rules */ -static intsNum = 0; /* Counter for assigning suffix numbers */ +/* List of transformation rules, such as ".c.o" */ +static GNodeList *transforms; + +static int sNum = 0; /* Counter for assigning suffix numbers */ typedef enum SuffFlags { SUFF_INCLUDE = 0x01, /* One which is #include'd */ @@ -165,20 +152,23 @@ ENUM_FLAGS_RTTI_3(SuffFlags, typedef List SuffListList; -/* - * Structure describing an individual suffix. - */ typedef struct Suff { -char *name; /* The suffix itself, such as ".c" */ -size_t nameLen; /* Length of the name, to avoid strlen calls */ -SuffFlags flags; /* Type of suffix */ -SearchPath *searchPath; /* The path along which files of this suffix - * may be found */ -int sNum; /* The suffix number */ -int refCount; /* Reference count of list membership - * and several other places */ -SuffList *parents; /* Suffixes we have a transformation to */ -SuffList *children; /* Suffixes we have a transformation from */ +/* The suffix itself, such as ".c" */ +char *name; +/* Length of the name, to avoid strlen calls */ +size_t nameLen; +/* Type of suffix */ +SuffFlags flags; +/* The path along which files of this suffix may be found */ +SearchPath *searchPath; +/* The suffix number; TODO: document the purpose of this number */ +int sNum; +/* Reference count of list membership and several other places */ +int refCount; +/* Suffixes we have a transformation to */ +SuffList *parents; +/* Suffixes we have a transformation from */ +SuffList *children; /* Lists in which this
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:29:49 UTC 2020 Modified Files: src/usr.bin/make: util.c Log Message: make(1): use postfix increment where possible To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/usr.bin/make/util.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/util.c diff -u src/usr.bin/make/util.c:1.67 src/usr.bin/make/util.c:1.68 --- src/usr.bin/make/util.c:1.67 Sun Nov 8 08:53:22 2020 +++ src/usr.bin/make/util.c Mon Nov 16 18:29:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $ */ +/* $NetBSD: util.c,v 1.68 2020/11/16 18:29:49 rillig Exp $ */ /* * Missing stuff from OS's @@ -15,7 +15,7 @@ #include "make.h" -MAKE_RCSID("$NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: util.c,v 1.68 2020/11/16 18:29:49 rillig Exp $"); #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR) extern int errno, sys_nerr; @@ -97,7 +97,7 @@ setenv(const char *name, const char *val } if (*value == '=') /* no `=' in value */ - ++value; + value++; l_value = strlen(value); /* find if already exists */
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Mon Nov 16 18:29:48 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Ticket #1133 To generate a diff of this commit: cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.13 src/doc/CHANGES-9.2:1.1.2.14 --- src/doc/CHANGES-9.2:1.1.2.13 Sat Nov 14 15:38:43 2020 +++ src/doc/CHANGES-9.2 Mon Nov 16 18:29:48 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.13 2020/11/14 15:38:43 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.14 2020/11/16 18:29:48 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1094,4 +1094,8 @@ sys/sys/param.h 1.679 more. [fair, ticket #1130] +sys/dev/pci/if_wm.c1.696 + + wm(4): fix support for 82574 and later cards on big endian machines. + [rin, ticket #1133]
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 18:28:27 UTC 2020 Modified Files: src/usr.bin/make: job.c main.c str.c Log Message: make(1): use postfix increment where possible To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/usr.bin/make/job.c cvs rdiff -u -r1.474 -r1.475 src/usr.bin/make/main.c cvs rdiff -u -r1.73 -r1.74 src/usr.bin/make/str.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.325 src/usr.bin/make/job.c:1.326 --- src/usr.bin/make/job.c:1.325 Sat Nov 14 17:04:01 2020 +++ src/usr.bin/make/job.c Mon Nov 16 18:28:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.325 2020/11/14 17:04:01 rillig Exp $ */ +/* $NetBSD: job.c,v 1.326 2020/11/16 18:28:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.325 2020/11/14 17:04:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.326 2020/11/16 18:28:27 rillig Exp $"); /* A shell defines how the commands are run. All commands for a target are * written into a single file, which is then given to the shell to execute @@ -1964,7 +1964,7 @@ Job_CatchOutput(void) default: abort(); } - --nready; + nready--; } Job_CatchChildren(); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.474 src/usr.bin/make/main.c:1.475 --- src/usr.bin/make/main.c:1.474 Sun Nov 15 09:54:16 2020 +++ src/usr.bin/make/main.c Mon Nov 16 18:28:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.474 2020/11/15 09:54:16 rillig Exp $ */ +/* $NetBSD: main.c,v 1.475 2020/11/16 18:28:27 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.474 2020/11/15 09:54:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.475 2020/11/16 18:28:27 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -276,13 +276,13 @@ parse_debug_options(const char *argvalue case 'g': if (modules[1] == '1') { debug |= DEBUG_GRAPH1; -++modules; +modules++; } else if (modules[1] == '2') { debug |= DEBUG_GRAPH2; -++modules; +modules++; } else if (modules[1] == '3') { debug |= DEBUG_GRAPH3; -++modules; +modules++; } break; case 'h': @@ -607,8 +607,8 @@ rearg: arginc = 0; if (inOption) { if (c == '\0') { -++argv; ---argc; +argv++; +argc--; inOption = FALSE; continue; } Index: src/usr.bin/make/str.c diff -u src/usr.bin/make/str.c:1.73 src/usr.bin/make/str.c:1.74 --- src/usr.bin/make/str.c:1.73 Sun Nov 15 12:02:44 2020 +++ src/usr.bin/make/str.c Mon Nov 16 18:28:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.73 2020/11/15 12:02:44 rillig Exp $ */ +/* $NetBSD: str.c,v 1.74 2020/11/16 18:28:27 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -71,7 +71,7 @@ #include "make.h" /* "@(#)str.c 5.8 (Berkeley) 6/1/90" */ -MAKE_RCSID("$NetBSD: str.c,v 1.73 2020/11/15 12:02:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: str.c,v 1.74 2020/11/16 18:28:27 rillig Exp $"); /* Return the concatenation of s1 and s2, freshly allocated. */ char * @@ -236,7 +236,7 @@ Str_Words(const char *str, Boolean expan case '\n': /* hmmm; fix it up as best we can */ ch = '\\'; ---str_p; +str_p--; break; case 'b': ch = '\b';
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon Nov 16 18:21:45 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-9]: if_wm.c Log Message: Pull up following revision(s) (requested by rin in ticket #1133): sys/dev/pci/if_wm.c: revision 1.696 Fix little-endian dependence in wm_rxeof(), by which packets cannot be received by 82574 and successors on big-endian machines. Tested by aarch64eb with I210-T1 on ROCKPro64. Thanks msaitoh for discussion! XXX pullup to netbsd-9 and netbsd-8 To generate a diff of this commit: cvs rdiff -u -r1.645.2.9 -r1.645.2.10 src/sys/dev/pci/if_wm.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_wm.c diff -u src/sys/dev/pci/if_wm.c:1.645.2.9 src/sys/dev/pci/if_wm.c:1.645.2.10 --- src/sys/dev/pci/if_wm.c:1.645.2.9 Wed Nov 4 11:48:26 2020 +++ src/sys/dev/pci/if_wm.c Mon Nov 16 18:21:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.9 2020/11/04 11:48:26 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8875,9 +8875,11 @@ wm_rxdesc_get_status(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_STATUS(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_STATUS( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_STATUS(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_STATUS( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_status; } @@ -,9 +8890,11 @@ wm_rxdesc_get_errors(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_ERROR(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_ERROR( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_ERROR(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_ERROR( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_errors; }
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Mon Nov 16 18:20:31 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1623 To generate a diff of this commit: cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.49 src/doc/CHANGES-8.3:1.1.2.50 --- src/doc/CHANGES-8.3:1.1.2.49 Sat Nov 14 12:59:56 2020 +++ src/doc/CHANGES-8.3 Mon Nov 16 18:20:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.49 2020/11/14 12:59:56 martin Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.50 2020/11/16 18:20:30 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -1319,3 +1319,8 @@ sys/coda/coda_vnops.c1.114 (patch) PR 55775: fix coda_readdir() to directly process the container file. [hannken, ticket #1622] +sys/dev/pci/if_wm.c1.696 + + wm(4): fix support for 82574 and later cards on big endian machines. + [rin, ticket #1623] +
CVS commit: [netbsd-8] src/sys/dev/pci
Module Name:src Committed By: martin Date: Mon Nov 16 18:18:15 UTC 2020 Modified Files: src/sys/dev/pci [netbsd-8]: if_wm.c Log Message: Pull up following revision(s) (requested by rin in ticket #1623): sys/dev/pci/if_wm.c: revision 1.696 Fix little-endian dependence in wm_rxeof(), by which packets cannot be received by 82574 and successors on big-endian machines. Tested by aarch64eb with I210-T1 on ROCKPro64. Thanks msaitoh for discussion! XXX pullup to netbsd-9 and netbsd-8 To generate a diff of this commit: cvs rdiff -u -r1.508.4.41 -r1.508.4.42 src/sys/dev/pci/if_wm.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_wm.c diff -u src/sys/dev/pci/if_wm.c:1.508.4.41 src/sys/dev/pci/if_wm.c:1.508.4.42 --- src/sys/dev/pci/if_wm.c:1.508.4.41 Wed Nov 4 11:51:57 2020 +++ src/sys/dev/pci/if_wm.c Mon Nov 16 18:18:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $ */ +/* $NetBSD: if_wm.c,v 1.508.4.42 2020/11/16 18:18:14 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.41 2020/11/04 11:51:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.42 2020/11/16 18:18:14 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8790,9 +8790,11 @@ wm_rxdesc_get_status(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_STATUS(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_STATUS( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_STATUS(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_STATUS( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_status; } @@ -8803,9 +8805,11 @@ wm_rxdesc_get_errors(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_ERROR(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_ERROR( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_ERROR(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_ERROR( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_errors; }
CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k
Module Name:xsrc Committed By: tsutsui Date: Mon Nov 16 16:46:28 UTC 2020 Modified Files: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68kConfig.c Log Message: Report which settings are chosen per a config file in the log file. Also reorganize a logging strategy in parseError() and make several variables and functions static or const. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 \ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c:1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c:1.7 --- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c:1.6 Tue Nov 3 16:59:38 2020 +++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kConfig.c Mon Nov 16 16:46:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x68kConfig.c,v 1.6 2020/11/03 16:59:38 tsutsui Exp $ */ +/* $NetBSD: x68kConfig.c,v 1.7 2020/11/16 16:46:28 tsutsui Exp $ */ /*- * Copyright (c) 1996 Yasushi Yamasaki * All rights reserved. @@ -112,16 +112,20 @@ const char *hostConfigFilename = "/etc/X const char *siteConfigFilename = X11_LIBDIR "/X68kConfig"; const char *configFilename = NULL; static FILE *config; -char modeSet = FALSE; +static char modeSet = FALSE; static int parseCommand(void); +static void logConfig(void); int x68kConfig(void) { -if (configFilename) +MessageType filefrom = X_DEFAULT; + +if (configFilename) { config = fopen(configFilename, "r"); -else { + filefrom = X_CMDLINE; +} else { configFilename = hostConfigFilename; config = fopen(configFilename, "r"); if (config == NULL) { @@ -131,11 +135,15 @@ x68kConfig(void) } if (config == NULL) FatalError("Can't open X68kConfig file"); + +LogMessage(filefrom, "Using config file: \"%s\"\n", configFilename); + while (parseCommand()) ; fclose(config); if (!modeSet) FatalError("No mode set."); +logConfig(); return 1; } @@ -143,7 +151,7 @@ x68kConfig(void) /*- * X68KConfig parsing part *---*/ -void parseError(int line, const char *str, ...); +static void parseError(int line, const char *str, ...); enum TokenType { TOKEN_EOF, @@ -255,7 +263,7 @@ static void parseMouse(int argc, Token * static void parseKeyboard(int argc, Token **argv); static void parseMode(int argc, Token **argv); -Command command[] = { +static const Command command[] = { { "ModeDef", parseModeDef }, { "Mouse", parseMouse }, { "Keyboard", parseKeyboard }, @@ -263,6 +271,24 @@ Command command[] = { }; #define NCOMMANDS (sizeof(command)/sizeof(command[0])) +static const char *x68kTypeStr[] = { + [X68K_FB_NULL]= NULL, + [X68K_FB_TEXT]= "Text", + [X68K_FB_GRAPHIC] = "Graphic", +}; +#define NTYPES (sizeof(x68kTypeStr) / sizeof(x68kTypeStr[0])) + +static const char *x68kClassStr[] = { + [StaticGray] = "StaticGray", + [GrayScale] = "GrayScale", + [StaticColor] = "StaticColor", + [PseudoColor] = "PseudoColor", + [TrueColor] = "TrueColor", + [DirectColor] = "DirectColor", +}; +#define NCLASSES (sizeof(x68kClassStr) / sizeof(x68kClassStr[0])) +#define ClassInvalid (-1) + /*- * function "parseCommand" * @@ -333,13 +359,13 @@ parseCommand(void) * purpose: examine the number of arguments and the type of each *argument. * argument: (int)n : correct number of arguments - *(enum TokenType *)type : table of types + *(const enum TokenType *)type : table of types *(int)argc_m1 : actual number of arguments *(Token **)argv : command and arguments * returns: nothing *---*/ static void -checkArguments(int n, enum TokenType *type, int argc_m1, Token **argv) +checkArguments(int n, const enum TokenType *type, int argc_m1, Token **argv) { int i; @@ -359,7 +385,7 @@ checkArguments(int n, enum TokenType *ty typedef struct _Mode { struct _Mode *next; -char *name; +const char *name; int type; int depth; int class; @@ -367,7 +393,8 @@ typedef struct _Mode { X68kFbReg reg; } Mode; -Mode *modeList = NULL; +static Mode *modeList = NULL; +static Mode *modeChosen; /*- * function "parseModeDef" @@ -379,7 +406,7 @@ Mode *modeList = NULL; static void parseModeDef(int
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Mon Nov 16 16:15:37 UTC 2020 Modified Files: src/usr.bin/make: suff.c Log Message: make(1): mark Suff.ref as probably unused To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.237 src/usr.bin/make/suff.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/suff.c diff -u src/usr.bin/make/suff.c:1.236 src/usr.bin/make/suff.c:1.237 --- src/usr.bin/make/suff.c:1.236 Sun Nov 15 22:31:03 2020 +++ src/usr.bin/make/suff.c Mon Nov 16 16:15:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.236 2020/11/15 22:31:03 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.237 2020/11/16 16:15:37 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -129,7 +129,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.236 2020/11/15 22:31:03 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.237 2020/11/16 16:15:37 rillig Exp $"); #define SUFF_DEBUG0(text) DEBUG0(SUFF, text) #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1) @@ -179,7 +179,12 @@ typedef struct Suff { * and several other places */ SuffList *parents; /* Suffixes we have a transformation to */ SuffList *children; /* Suffixes we have a transformation from */ -SuffListList *ref; /* Lists in which this suffix is referenced */ + +/* Lists in which this suffix is referenced. + * XXX: These lists are used nowhere, they are just appended to, for no + * apparent reason. They do have the side effect of increasing refCount + * though. */ +SuffListList *ref; } Suff; /*
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Nov 16 15:12:16 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: suff-self.exp suff-self.mk Log Message: make(1): add test for self-referencing suffix rule Just to ensure that make doesn't run into an endless loop. To generate a diff of this commit: cvs rdiff -u -r1.969 -r1.970 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-self.exp \ src/usr.bin/make/unit-tests/suff-self.mk 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.969 src/distrib/sets/lists/tests/mi:1.970 --- src/distrib/sets/lists/tests/mi:1.969 Sat Nov 14 15:35:20 2020 +++ src/distrib/sets/lists/tests/mi Mon Nov 16 15:12:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.969 2020/11/14 15:35:20 rillig Exp $ +# $NetBSD: mi,v 1.970 2020/11/16 15:12:16 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5285,6 +5285,8 @@ ./usr/tests/usr.bin/make/unit-tests/suff-main.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-self.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-self.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-endless.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-transform-expand.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.202 src/usr.bin/make/unit-tests/Makefile:1.203 --- src/usr.bin/make/unit-tests/Makefile:1.202 Sun Nov 15 20:50:46 2020 +++ src/usr.bin/make/unit-tests/Makefile Mon Nov 16 15:12:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.202 2020/11/15 20:50:46 rillig Exp $ +# $NetBSD: Makefile,v 1.203 2020/11/16 15:12:16 rillig Exp $ # # Unit tests for make(1) # @@ -266,6 +266,7 @@ TESTS+= suff-clear-single TESTS+= suff-lookup TESTS+= suff-main TESTS+= suff-rebuild +TESTS+= suff-self TESTS+= suff-transform-endless TESTS+= suff-transform-expand TESTS+= suff-transform-select Added files: Index: src/usr.bin/make/unit-tests/suff-self.exp diff -u /dev/null src/usr.bin/make/unit-tests/suff-self.exp:1.1 --- /dev/null Mon Nov 16 15:12:16 2020 +++ src/usr.bin/make/unit-tests/suff-self.exp Mon Nov 16 15:12:16 2020 @@ -0,0 +1,3 @@ +make: Graph cycles through suff-self.suff +`all' not remade because of errors. +exit status 0 Index: src/usr.bin/make/unit-tests/suff-self.mk diff -u /dev/null src/usr.bin/make/unit-tests/suff-self.mk:1.1 --- /dev/null Mon Nov 16 15:12:16 2020 +++ src/usr.bin/make/unit-tests/suff-self.mk Mon Nov 16 15:12:16 2020 @@ -0,0 +1,11 @@ +# $NetBSD: suff-self.mk,v 1.1 2020/11/16 15:12:16 rillig Exp $ +# +# See what happens if someone defines a self-referencing suffix +# transformation rule. + +.SUFFIXES: .suff + +.suff.suff: + : Making ${.TARGET} out of ${.IMPSRC}. + +all: suff-self.suff
CVS commit: src/external/mit/ctwm/etc
Module Name:src Committed By: nia Date: Mon Nov 16 14:12:46 UTC 2020 Modified Files: src/external/mit/ctwm/etc: system.ctwmrc Log Message: system.ctwmrc: Set Cursors to avoid strange default fallbacks To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/mit/ctwm/etc/system.ctwmrc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/mit/ctwm/etc/system.ctwmrc diff -u src/external/mit/ctwm/etc/system.ctwmrc:1.9 src/external/mit/ctwm/etc/system.ctwmrc:1.10 --- src/external/mit/ctwm/etc/system.ctwmrc:1.9 Mon Oct 12 15:24:16 2020 +++ src/external/mit/ctwm/etc/system.ctwmrc Mon Nov 16 14:12:46 2020 @@ -1,5 +1,5 @@ # -# $NetBSD: system.ctwmrc,v 1.9 2020/10/12 15:24:16 nia Exp $ +# $NetBSD: system.ctwmrc,v 1.10 2020/11/16 14:12:46 nia Exp $ # # ctwmrc by nia # @@ -197,6 +197,21 @@ WorkSpaces "5"{ "lavender" "black" "darkslateblue" "white" } } +Cursors +{ + Frame"left_ptr" + Title"left_ptr" + Icon "left_ptr" + IconMgr "left_ptr" + Move "fleur" + Resize "fleur" + Menu "left_ptr" + Button "hand2" + Wait "watch" + Select "dot" + Destroy "pirate" +} + Color { BorderColor "firebrick"
CVS commit: src/sys/dev/pci
Module Name:src Committed By: rin Date: Mon Nov 16 11:54:10 UTC 2020 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Fix little-endian dependence in wm_rxeof(), by which packets cannot be received by 82574 and successors on big-endian machines. Tested by aarch64eb with I210-T1 on ROCKPro64. Thanks msaitoh for discussion! XXX pullup to netbsd-9 and netbsd-8 To generate a diff of this commit: cvs rdiff -u -r1.695 -r1.696 src/sys/dev/pci/if_wm.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_wm.c diff -u src/sys/dev/pci/if_wm.c:1.695 src/sys/dev/pci/if_wm.c:1.696 --- src/sys/dev/pci/if_wm.c:1.695 Mon Nov 2 09:21:50 2020 +++ src/sys/dev/pci/if_wm.c Mon Nov 16 11:54:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.695 2020/11/02 09:21:50 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.696 2020/11/16 11:54:10 rin Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.695 2020/11/02 09:21:50 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.696 2020/11/16 11:54:10 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -8905,9 +8905,11 @@ wm_rxdesc_get_status(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_STATUS(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_STATUS( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_STATUS(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_STATUS( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_status; } @@ -8918,9 +8920,11 @@ wm_rxdesc_get_errors(struct wm_rxqueue * struct wm_softc *sc = rxq->rxq_sc; if (sc->sc_type == WM_T_82574) - return EXTRXC_ERROR(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat); + return EXTRXC_ERROR( + le32toh(rxq->rxq_ext_descs[idx].erx_ctx.erxc_err_stat)); else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) - return NQRXC_ERROR(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat); + return NQRXC_ERROR( + le32toh(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_err_stat)); else return rxq->rxq_descs[idx].wrx_errors; }
CVS commit: src/distrib/evbarm
Module Name:src Committed By: rin Date: Mon Nov 16 11:38:30 UTC 2020 Modified Files: src/distrib/evbarm: Makefile src/distrib/evbarm/installimage: Makefile src/distrib/evbarm/instkernel/ramdisk: Makefile Log Message: Correctly support aarch64eb and earmv7hfeb in a similar manner to their little-endian counterparts. Fix build failures for periodic binary snapshots. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/evbarm/Makefile cvs rdiff -u -r1.6 -r1.7 src/distrib/evbarm/installimage/Makefile cvs rdiff -u -r1.19 -r1.20 src/distrib/evbarm/instkernel/ramdisk/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/evbarm/Makefile diff -u src/distrib/evbarm/Makefile:1.14 src/distrib/evbarm/Makefile:1.15 --- src/distrib/evbarm/Makefile:1.14 Thu Oct 15 08:59:57 2020 +++ src/distrib/evbarm/Makefile Mon Nov 16 11:38:29 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2020/10/15 08:59:57 jmcneill Exp $ +# $NetBSD: Makefile,v 1.15 2020/11/16 11:38:29 rin Exp $ .include .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" @@ -6,10 +6,10 @@ .include SUBDIR= gzboot instkernel -.if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "earmv7hf" +.if !empty(MACHINE_ARCH:Maarch64*) || !empty(MACHINE_ARCH:Mearmv7hf*) SUBDIR+= installimage .endif -.if ${MACHINE_ARCH} == "aarch64" +.if !empty(MACHINE_ARCH:Maarch64*) SUBDIR+= isoimage .endif TARGETS+= release @@ -22,7 +22,7 @@ release: check_RELEASEDIR .WAIT ${MDECBO ${RELEASE_INSTALL} ${MDECBOOT} ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation .endif -.if ${MACHINE_ARCH} == "aarch64" +.if !empty(MACHINE_ARCH:Maarch64*) iso_image: ${MAKEDIRTARGET} isoimage iso_image .endif Index: src/distrib/evbarm/installimage/Makefile diff -u src/distrib/evbarm/installimage/Makefile:1.6 src/distrib/evbarm/installimage/Makefile:1.7 --- src/distrib/evbarm/installimage/Makefile:1.6 Tue Jun 2 14:27:32 2020 +++ src/distrib/evbarm/installimage/Makefile Mon Nov 16 11:38:29 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2020/06/02 14:27:32 jmcneill Exp $ +# $NetBSD: Makefile,v 1.7 2020/11/16 11:38:29 rin Exp $ .include @@ -6,10 +6,10 @@ INSTIMGBASE= NetBSD-${DISTRIBVER}-${MACH INSTIMAGEMB?= 1550 # for all installation binaries -.if ${MACHINE_ARCH} == "aarch64" +.if !empty(MACHINE_ARCH:Maarch64*) EFIBOOT= ${WORKDIR}/usr/mdec/bootaa64.efi KERN_SET= kern-GENERIC64 -.elif ${MACHINE_ARCH} == "earmv7hf" +.elif !empty(MACHINE_ARCH:Mearmv7hf*) EFIBOOT+= ${WORKDIR}/usr/mdec/bootarm.efi KERN_SET= kern-GENERIC .endif Index: src/distrib/evbarm/instkernel/ramdisk/Makefile diff -u src/distrib/evbarm/instkernel/ramdisk/Makefile:1.19 src/distrib/evbarm/instkernel/ramdisk/Makefile:1.20 --- src/distrib/evbarm/instkernel/ramdisk/Makefile:1.19 Sun Apr 1 04:35:01 2018 +++ src/distrib/evbarm/instkernel/ramdisk/Makefile Mon Nov 16 11:38:29 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.19 2018/04/01 04:35:01 ryo Exp $ +# $NetBSD: Makefile,v 1.20 2020/11/16 11:38:29 rin Exp $ .include .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" @@ -28,7 +28,7 @@ IMAGEDEPENDS= ${CRUNCHBIN} \ ${NETBSDSRCDIR}/etc/netconfig ${DISTRIBDIR}/common/protocols \ ${DISTRIBDIR}/common/services -.if !empty(MACHINE_ARCH:Maarch64) +.if !empty(MACHINE_ARCH:Maarch64*) UBOOT_IMAGE_ARCH= arm64 .else UBOOT_IMAGE_ARCH= arm