Module Name: src Committed By: rillig Date: Sat Sep 12 16:13:48 UTC 2020
Modified Files: src/usr.bin/make: nonints.h suff.c targ.c Log Message: make(1): fix API for Targ_PrintCmd The previous API was too low-level and not strictly typed. To generate a diff of this commit: cvs rdiff -u -r1.111 -r1.112 src/usr.bin/make/nonints.h cvs rdiff -u -r1.150 -r1.151 src/usr.bin/make/suff.c cvs rdiff -u -r1.83 -r1.84 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.111 src/usr.bin/make/nonints.h:1.112 --- src/usr.bin/make/nonints.h:1.111 Sat Sep 12 15:21:25 2020 +++ src/usr.bin/make/nonints.h Sat Sep 12 16:13:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.111 2020/09/12 15:21:25 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.112 2020/09/12 16:13:48 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -181,7 +181,7 @@ Boolean Targ_Ignore(GNode *); Boolean Targ_Silent(GNode *); Boolean Targ_Precious(GNode *); void Targ_SetMain(GNode *); -int Targ_PrintCmd(void *, void *); +void Targ_PrintCmds(GNode *); int Targ_PrintNode(void *, void *); char *Targ_FmtTime(time_t); void Targ_PrintType(int); Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.150 src/usr.bin/make/suff.c:1.151 --- src/usr.bin/make/suff.c:1.150 Sat Sep 12 15:21:25 2020 +++ src/usr.bin/make/suff.c Sat Sep 12 16:13:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $"; +static char rcsid[] = "$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -__RCSID("$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $"); +__RCSID("$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -2247,7 +2247,7 @@ SuffPrintTrans(void *tp, void *dummy MAK fprintf(debug_file, "%-16s:", t->name); Targ_PrintType(t->type); fputc('\n', debug_file); - Lst_ForEach(t->commands, Targ_PrintCmd, NULL); + Targ_PrintCmds(t); fputc('\n', debug_file); return 0; } Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.83 src/usr.bin/make/targ.c:1.84 --- src/usr.bin/make/targ.c:1.83 Sat Sep 5 13:55:08 2020 +++ src/usr.bin/make/targ.c Sat Sep 12 16:13:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $"; +static char rcsid[] = "$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $"); +__RCSID("$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -379,14 +379,19 @@ TargPrintName(void *gnp, void *pflags MA return 0; } - -int -Targ_PrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED) +static int +TargPrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED) { fprintf(debug_file, "\t%s\n", (char *)cmd); return 0; } +void +Targ_PrintCmds(GNode *gn) +{ + Lst_ForEach(gn->commands, TargPrintCmd, NULL); +} + /* Format a modification time in some reasonable way and return it. * The time is placed in a static area, so it is overwritten with each call. */ char * @@ -524,7 +529,7 @@ Targ_PrintNode(void *gnp, void *passp) Targ_PrintType(gn->type); Lst_ForEach(gn->children, TargPrintName, NULL); fprintf(debug_file, "\n"); - Lst_ForEach(gn->commands, Targ_PrintCmd, NULL); + Targ_PrintCmds(gn); fprintf(debug_file, "\n\n"); if (gn->type & OP_DOUBLEDEP) { Lst_ForEach(gn->cohorts, Targ_PrintNode, &pass);