Date: Wed, 8 Jul 2020 18:32:15 +0000 (UTC) From: "Simon J. Gerraty" <sjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r363018 - in vendor/NetBSD/bmake/dist: . lst.lib unit-tests Message-ID: <202007081832.068IWFaf043470@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sjg Date: Wed Jul 8 18:32:15 2020 New Revision: 363018 URL: https://svnweb.freebsd.org/changeset/base/363018 Log: Import bmake-20200704 from ChangeLog: (most of this by rillig@) o lots of style and white-space cleanup o lots more unit tests for variable modifiers o simplified description of some functions o str.c: refactor Str_Match o var.c: debugging output for :@ constify VarModify parameter fix :hash modifier on 16-bit platforms remove unnecessary forward declarations refactor ApplyModifier_SysV to have less indentation simplify code for :E and :R clean up code for :H and :T refactor ApplyModifiers * var.c: we need stdint.h on some platforms to get uint32_t * unit-test/Makefile: we need to supress the specific error for RE substitution error in modmisc, since it varies accross different OS. Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/VERSION vendor/NetBSD/bmake/dist/arch.c vendor/NetBSD/bmake/dist/buf.c vendor/NetBSD/bmake/dist/compat.c vendor/NetBSD/bmake/dist/cond.c vendor/NetBSD/bmake/dist/dir.c vendor/NetBSD/bmake/dist/for.c vendor/NetBSD/bmake/dist/hash.c vendor/NetBSD/bmake/dist/hash.h vendor/NetBSD/bmake/dist/job.c vendor/NetBSD/bmake/dist/job.h vendor/NetBSD/bmake/dist/lst.lib/lstAppend.c vendor/NetBSD/bmake/dist/lst.lib/lstAtEnd.c vendor/NetBSD/bmake/dist/lst.lib/lstAtFront.c vendor/NetBSD/bmake/dist/lst.lib/lstClose.c vendor/NetBSD/bmake/dist/lst.lib/lstConcat.c vendor/NetBSD/bmake/dist/lst.lib/lstDatum.c vendor/NetBSD/bmake/dist/lst.lib/lstDeQueue.c vendor/NetBSD/bmake/dist/lst.lib/lstDupl.c vendor/NetBSD/bmake/dist/lst.lib/lstEnQueue.c vendor/NetBSD/bmake/dist/lst.lib/lstFind.c vendor/NetBSD/bmake/dist/lst.lib/lstFindFrom.c vendor/NetBSD/bmake/dist/lst.lib/lstFirst.c vendor/NetBSD/bmake/dist/lst.lib/lstForEach.c vendor/NetBSD/bmake/dist/lst.lib/lstForEachFrom.c vendor/NetBSD/bmake/dist/lst.lib/lstInit.c vendor/NetBSD/bmake/dist/lst.lib/lstInsert.c vendor/NetBSD/bmake/dist/lst.lib/lstIsAtEnd.c vendor/NetBSD/bmake/dist/lst.lib/lstIsEmpty.c vendor/NetBSD/bmake/dist/lst.lib/lstLast.c vendor/NetBSD/bmake/dist/lst.lib/lstNext.c vendor/NetBSD/bmake/dist/lst.lib/lstOpen.c vendor/NetBSD/bmake/dist/lst.lib/lstPrev.c vendor/NetBSD/bmake/dist/lst.lib/lstRemove.c vendor/NetBSD/bmake/dist/lst.lib/lstReplace.c vendor/NetBSD/bmake/dist/lst.lib/lstSucc.c vendor/NetBSD/bmake/dist/main.c vendor/NetBSD/bmake/dist/make.c vendor/NetBSD/bmake/dist/make.h vendor/NetBSD/bmake/dist/make_malloc.c vendor/NetBSD/bmake/dist/meta.c vendor/NetBSD/bmake/dist/meta.h vendor/NetBSD/bmake/dist/nonints.h vendor/NetBSD/bmake/dist/parse.c vendor/NetBSD/bmake/dist/str.c vendor/NetBSD/bmake/dist/suff.c vendor/NetBSD/bmake/dist/targ.c vendor/NetBSD/bmake/dist/trace.c vendor/NetBSD/bmake/dist/unit-tests/Makefile vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk vendor/NetBSD/bmake/dist/unit-tests/modmisc.exp vendor/NetBSD/bmake/dist/unit-tests/modmisc.mk vendor/NetBSD/bmake/dist/unit-tests/sysv.exp vendor/NetBSD/bmake/dist/unit-tests/sysv.mk vendor/NetBSD/bmake/dist/unit-tests/varmisc.exp vendor/NetBSD/bmake/dist/unit-tests/varmisc.mk vendor/NetBSD/bmake/dist/util.c vendor/NetBSD/bmake/dist/var.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/ChangeLog Wed Jul 8 18:32:15 2020 (r363018) @@ -1,3 +1,42 @@ +2020-07-04 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20200704 + Merge with NetBSD make, pick up + (most of this by rillig@) + o lots of style and white-space cleanup + o lots more unit tests for variable modifiers + o simplified description of some functions + o str.c: refactor Str_Match + o var.c: debugging output for :@ + constify VarModify parameter + fix :hash modifier on 16-bit platforms + remove unnecessary forward declarations + refactor ApplyModifier_SysV to have less indentation + simplify code for :E and :R + clean up code for :H and :T + refactor ApplyModifiers + + * var.c: we need stdint.h on some platforms to get uint32_t + * unit-test/Makefile: we need to supress the specific error + for RE substitution error in modmisc, since it varies accross + different OS. + +2020-07-02 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20200702 + Merge with NetBSD make, pick up + o var.c: more improvements to avoiding unnecessary evaluation + use enums for flags + o remove flags arg to Var_Set which outside of var.c is always 0 + +2020-07-01 Simon J Gerraty <sjg@beast.crufty.net> + + * VERSION (_MAKE_VERSION): 20200701 + Merge with NetBSD make, pick up + o var.c: with change to cond.c; ensure that nested variables + within a variable name are expanded. + o unit-tests/varmisc.mk: test for nested varname + 2020-06-29 Simon J Gerraty <sjg@beast.crufty.net> * VERSION (_MAKE_VERSION): 20200629 Modified: vendor/NetBSD/bmake/dist/VERSION ============================================================================== --- vendor/NetBSD/bmake/dist/VERSION Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/VERSION Wed Jul 8 18:32:15 2020 (r363018) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20200629 +_MAKE_VERSION=20200704 Modified: vendor/NetBSD/bmake/dist/arch.c ============================================================================== --- vendor/NetBSD/bmake/dist/arch.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/arch.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $ */ +/* $NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $"); +__RCSID("$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -312,7 +312,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * free(freeIt); if (result == var_Error) { - return(FAILURE); + return FAILURE; } else { subLibName = TRUE; } @@ -354,7 +354,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * free(freeIt); if (result == var_Error) { - return(FAILURE); + return FAILURE; } else { doSubst = TRUE; } @@ -372,7 +372,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * */ if (*cp == '\0') { printf("No closing parenthesis in archive specification\n"); - return (FAILURE); + return FAILURE; } /* @@ -426,7 +426,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * if (gn == NULL) { free(buf); - return(FAILURE); + return FAILURE; } else { gn->type |= OP_ARCHV; (void)Lst_AtEnd(nodeLst, gn); @@ -437,7 +437,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * * ourselves. */ free(buf); - return(FAILURE); + return FAILURE; } /* * Free buffer and continue with our work. @@ -461,7 +461,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * gn = Targ_FindNode(nameBuf, TARG_CREATE); if (gn == NULL) { free(nameBuf); - return (FAILURE); + return FAILURE; } else { /* * We've found the node, but have to make sure the rest of @@ -483,7 +483,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * gn = Targ_FindNode(nameBuf, TARG_CREATE); free(nameBuf); if (gn == NULL) { - return (FAILURE); + return FAILURE; } else { /* * We've found the node, but have to make sure the rest of the @@ -520,7 +520,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * } while (*cp != '\0' && isspace ((unsigned char)*cp)); *linePtr = cp; - return (SUCCESS); + return SUCCESS; } /*- @@ -544,7 +544,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * static int ArchFindArchive(const void *ar, const void *archName) { - return (strcmp(archName, ((const Arch *)ar)->name)); + return strcmp(archName, ((const Arch *)ar)->name); } /*- @@ -602,7 +602,7 @@ ArchStatMember(char *archive, char *member, Boolean ha he = Hash_FindEntry(&ar->members, member); if (he != NULL) { - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); } else { /* Try truncated name */ char copy[AR_MAX_NAME_LEN+1]; @@ -614,7 +614,7 @@ ArchStatMember(char *archive, char *member, Boolean ha copy[AR_MAX_NAME_LEN] = '\0'; } if ((he = Hash_FindEntry(&ar->members, copy)) != NULL) - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); return NULL; } } @@ -635,7 +635,7 @@ ArchStatMember(char *archive, char *member, Boolean ha return NULL; } else { fclose(arch); - return (&sarh); + return &sarh; } } @@ -753,7 +753,7 @@ ArchStatMember(char *archive, char *member, Boolean ha he = Hash_FindEntry(&ar->members, member); if (he != NULL) { - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); } else { return NULL; } @@ -962,7 +962,7 @@ ArchFindMember(char *archive, char *member, struct ar_ fclose(arch); return NULL; } - return (arch); + return arch; } } else #ifdef AR_EFMT1 @@ -996,7 +996,7 @@ ArchFindMember(char *archive, char *member, struct ar_ fclose(arch); return NULL; } - return (arch); + return arch; } if (fseek(arch, -elen, SEEK_CUR) != 0) { fclose(arch); @@ -1152,7 +1152,7 @@ Arch_MTime(GNode *gn) } gn->mtime = modTime; - return (modTime); + return modTime; } /*- @@ -1179,7 +1179,7 @@ Arch_MemMTime(GNode *gn) if (Lst_Open(gn->parents) != SUCCESS) { gn->mtime = 0; - return (0); + return 0; } while ((ln = Lst_Next(gn->parents)) != NULL) { pgn = (GNode *)Lst_Datum(ln); @@ -1211,7 +1211,7 @@ Arch_MemMTime(GNode *gn) Lst_Close(gn->parents); - return (gn->mtime); + return gn->mtime; } /*- @@ -1252,9 +1252,9 @@ Arch_FindLib(GNode *gn, Lst path) free(libName); #ifdef LIBRARIES - Var_Set(TARGET, gn->name, gn, 0); + Var_Set(TARGET, gn->name, gn); #else - Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn, 0); + Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn); #endif /* LIBRARIES */ } @@ -1337,7 +1337,7 @@ Arch_LibOODate(GNode *gn) oodate = FALSE; #endif } - return (oodate); + return oodate; } /*- Modified: vendor/NetBSD/bmake/dist/buf.c ============================================================================== --- vendor/NetBSD/bmake/dist/buf.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/buf.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $ */ +/* $NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $"); +__RCSID("$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -160,7 +160,7 @@ Buf_GetAll(Buffer *bp, int *numBytesPtr) if (numBytesPtr != NULL) *numBytesPtr = bp->count; - return (bp->buffer); + return bp->buffer; } /*- Modified: vendor/NetBSD/bmake/dist/compat.c ============================================================================== --- vendor/NetBSD/bmake/dist/compat.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/compat.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $ */ +/* $NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $"); +__RCSID("$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -236,7 +236,7 @@ CompatRunCommand(void *cmdp, void *gnp) silent = gn->type & OP_SILENT; errCheck = !(gn->type & OP_IGNORE); doIt = FALSE; - + cmdNode = Lst_Member(gn->commands, cmd); cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES); @@ -249,18 +249,18 @@ CompatRunCommand(void *cmdp, void *gnp) if (*cmdStart == '\0') { free(cmdStart); - return(0); + return 0; } cmd = cmdStart; Lst_Replace(cmdNode, cmdStart); if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { (void)Lst_AtEnd(ENDNode->commands, cmdStart); - return(0); + return 0; } if (strcmp(cmdStart, "...") == 0) { gn->type |= OP_SAVE_CMDS; - return(0); + return 0; } while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) { @@ -287,7 +287,7 @@ CompatRunCommand(void *cmdp, void *gnp) * If we did not end up with a command, just skip it. */ if (!*cmd) - return (0); + return 0; #if !defined(MAKE_NATIVE) /* @@ -307,7 +307,7 @@ CompatRunCommand(void *cmdp, void *gnp) * go to the shell. Therefore treat '=' and ':' like shell * meta characters as documented in make(1). */ - + useShell = needshell(cmd, FALSE); #endif @@ -325,7 +325,7 @@ CompatRunCommand(void *cmdp, void *gnp) * we go... */ if (!doIt && NoExecute(gn)) { - return (0); + return 0; } if (DEBUG(JOB)) fprintf(debug_file, "Execute: '%s'\n", cmd); @@ -377,7 +377,7 @@ again: meta_compat_start(); } #endif - + /* * Fork and execute the single command. If the fork fails, we abort. */ @@ -499,8 +499,8 @@ again: bmake_signal(compatSigno, SIG_DFL); kill(myPid, compatSigno); } - - return (status); + + return status; } /*- @@ -550,7 +550,7 @@ Compat_Make(void *gnp, void *pgnp) if (Lst_Member(gn->iParents, pgn) != NULL) { char *p1; - Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); free(p1); } @@ -654,7 +654,7 @@ Compat_Make(void *gnp, void *pgnp) } else { if (Lst_Member(gn->iParents, pgn) != NULL) { char *p1; - Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); free(p1); } switch(gn->made) { @@ -681,7 +681,7 @@ Compat_Make(void *gnp, void *pgnp) cohorts: Lst_ForEach(gn->cohorts, Compat_Make, pgnp); - return (0); + return 0; } /*- Modified: vendor/NetBSD/bmake/dist/cond.c ============================================================================== --- vendor/NetBSD/bmake/dist/cond.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/cond.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.76 2020/06/28 11:06:26 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.76 2020/06/28 11:06:26 rillig Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.76 2020/06/28 11:06:26 rillig Exp $"); +__RCSID("$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -186,7 +186,7 @@ static unsigned int cond_min_depth = 0; /* depth at * Indicate when we should be strict about lhs of comparisons. * TRUE when Cond_EvalExpression is called from Cond_Eval (.if etc) * FALSE when Cond_EvalExpression is called from var.c:ApplyModifiers - * since lhs is already expanded and we cannot tell if + * since lhs is already expanded and we cannot tell if * it was a variable reference or not. */ static Boolean lhsStrict; @@ -256,7 +256,7 @@ CondGetArg(Boolean doEval, char **linePtr, char **argP * the word 'make' or 'defined' at the beginning of a symbol... */ *argPtr = NULL; - return (0); + return 0; } while (*cp == ' ' || *cp == '\t') { @@ -314,11 +314,11 @@ CondGetArg(Boolean doEval, char **linePtr, char **argP if (func != NULL && *cp++ != ')') { Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()", func); - return (0); + return 0; } *linePtr = cp; - return (argLen); + return argLen; } /*- @@ -347,7 +347,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char } free(p1); - return (result); + return result; } /*- @@ -367,7 +367,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char static int CondStrMatch(const void *string, const void *pattern) { - return(!Str_Match(string, pattern)); + return !Str_Match(string, pattern); } /*- @@ -412,14 +412,14 @@ CondDoExists(int argLen MAKE_ATTR_UNUSED, const char * if (DEBUG(COND)) { fprintf(debug_file, "exists(%s) result is \"%s\"\n", arg, path ? path : ""); - } + } if (path != NULL) { result = TRUE; free(path); } else { result = FALSE; } - return (result); + return result; } /*- @@ -441,7 +441,7 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char * GNode *gn; gn = Targ_FindNode(arg, TARG_NOCREATE); - return (gn != NULL) && !OP_NOP(gn->type); + return gn != NULL && !OP_NOP(gn->type); } /*- @@ -465,7 +465,7 @@ CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char GNode *gn; gn = Targ_FindNode(arg, TARG_NOCREATE); - return (gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands); + return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands); } /*- @@ -666,7 +666,7 @@ compare_expression(Boolean doEval) rhs = NULL; lhsFree = rhsFree = FALSE; lhsQuoted = rhsQuoted = FALSE; - + /* * Parse the variable spec and skip over it, saving its * value in lhs. @@ -709,7 +709,7 @@ compare_expression(Boolean doEval) goto done; } /* For .ifxxx <number> compare against zero */ - if (CondCvtArg(lhs, &left)) { + if (CondCvtArg(lhs, &left)) { t = left != 0.0; goto done; } @@ -762,7 +762,7 @@ do_string_compare: * rhs is either a float or an integer. Convert both the * lhs and the rhs to a double and compare the two. */ - + if (!CondCvtArg(lhs, &left) || !CondCvtArg(rhs, &right)) goto do_string_compare; @@ -1038,7 +1038,7 @@ CondT(Boolean doEval) t = TOK_TRUE; } } - return (t); + return t; } /*- @@ -1084,7 +1084,7 @@ CondF(Boolean doEval) CondPushBack(o); } } - return (l); + return l; } /*- @@ -1131,7 +1131,7 @@ CondE(Boolean doEval) CondPushBack(o); } } - return (l); + return l; } /*- Modified: vendor/NetBSD/bmake/dist/dir.c ============================================================================== --- vendor/NetBSD/bmake/dist/dir.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/dir.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $"); +__RCSID("$NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -112,7 +112,7 @@ __RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg * Dir_FindHereOrAbove Search for a path in the current directory and * then all the directories above it in turn until * the path is found or we reach the root ("/"). - * + * * Dir_MTime Return the modification time of a node. The file * is searched for along the default search path. * The path and mtime fields of the node are filled @@ -377,7 +377,7 @@ void Dir_InitCur(const char *cdname) { Path *p; - + if (cdname != NULL) { /* * Our build directory is not the same as our source directory. @@ -480,7 +480,7 @@ Dir_SetPATH(void) Boolean hasLastDot = FALSE; /* true we should search dot last */ Var_Delete(".PATH", VAR_GLOBAL); - + if (Lst_Open(dirSearchPath) == SUCCESS) { if ((ln = Lst_First(dirSearchPath)) != NULL) { p = (Path *)Lst_Datum(ln); @@ -537,7 +537,7 @@ Dir_SetPATH(void) static int DirFindName(const void *p, const void *dname) { - return (strcmp(((const Path *)p)->name, dname)); + return strcmp(((const Path *)p)->name, dname); } /*- @@ -545,7 +545,7 @@ DirFindName(const void *p, const void *dname) * Dir_HasWildcards -- * see if the given name has any wildcard characters in it * be careful not to expand unmatching brackets or braces. - * XXX: This code is not 100% correct. ([^]] fails etc.) + * XXX: This code is not 100% correct. ([^]] fails etc.) * I really don't think that make(1) should be expanding * patterns, because then you have to set a mechanism for * escaping the expansion! @@ -644,7 +644,7 @@ DirMatchFiles(const char *pattern, Path *p, Lst expans STR_ADDSLASH))); } } - return (0); + return 0; } /*- @@ -947,7 +947,7 @@ Dir_Expand(const char *word, Lst path, Lst expansions) *----------------------------------------------------------------------- */ static char * -DirLookup(Path *p, const char *name MAKE_ATTR_UNUSED, const char *cp, +DirLookup(Path *p, const char *name MAKE_ATTR_UNUSED, const char *cp, Boolean hasSlash MAKE_ATTR_UNUSED) { char *file; /* the current filename to check */ @@ -1004,7 +1004,7 @@ DirLookupSubdir(Path *p, const char *name) if (cached_stat(file, &stb) == 0) { nearmisses += 1; - return (file); + return file; } free(file); return NULL; @@ -1061,7 +1061,7 @@ DirLookupAbs(Path *p, const char *name, const char *cp if (DEBUG(DIR)) { fprintf(debug_file, " returning %s\n", name); } - return (bmake_strdup(name)); + return bmake_strdup(name); } /*- @@ -1087,7 +1087,7 @@ DirFindDot(Boolean hasSlash MAKE_ATTR_UNUSED, const ch } hits += 1; dot->hits += 1; - return (bmake_strdup(name)); + return bmake_strdup(name); } if (cur && Hash_FindEntry(&cur->files, cp) != NULL) { @@ -1185,7 +1185,7 @@ Dir_FindFile(const char *name, Lst path) * is found, we concatenate the directory name and the final * component and return the resulting string. If we don't find any * such thing, we go on to phase two... - * + * * No matter what, we always look for the file in the current * directory before anywhere else (unless we found the magic * DOTLAST path, in which case we search it last) and we *do not* @@ -1384,7 +1384,7 @@ Dir_FindFile(const char *name, Lst path) } if (Hash_FindEntry(&p->files, cp) != NULL) { - return (bmake_strdup(name)); + return bmake_strdup(name); } else { return NULL; } @@ -1395,7 +1395,7 @@ Dir_FindFile(const char *name, Lst path) bigmisses += 1; if (cached_stat(name, &stb) == 0) { - return (bmake_strdup(name)); + return bmake_strdup(name); } if (DEBUG(DIR)) { @@ -1409,14 +1409,14 @@ Dir_FindFile(const char *name, Lst path) /*- *----------------------------------------------------------------------- * Dir_FindHereOrAbove -- - * search for a path starting at a given directory and then working + * search for a path starting at a given directory and then working * our way up towards the root. * * Input: * here starting directory * search_path the path we are looking for * result the result of a successful search is placed here - * rlen the length of the result buffer + * rlen the length of the result buffer * (typically MAXPATHLEN + 1) * * Results: @@ -1426,7 +1426,7 @@ Dir_FindFile(const char *name, Lst path) * Side Effects: *----------------------------------------------------------------------- */ -int +int Dir_FindHereOrAbove(char *here, char *search_path, char *result, int rlen) { struct stat st; @@ -1451,7 +1451,7 @@ Dir_FindHereOrAbove(char *here, char *search_path, cha try_end = try + strlen(try); while (try_end > try && *try_end != '/') try_end--; - if (try_end > try) + if (try_end > try) *try_end = 0; /* chop! */ } @@ -1459,10 +1459,10 @@ Dir_FindHereOrAbove(char *here, char *search_path, cha * done! */ snprintf(result, rlen, "%s", try); - return(1); + return 1; } - /* + /* * nope, we didn't find it. if we used up dirbase we've * reached the root and failed. */ @@ -1479,9 +1479,9 @@ Dir_FindHereOrAbove(char *here, char *search_path, cha } /* while (1) */ /* - * we failed... + * we failed... */ - return(0); + return 0; } /*- @@ -1529,7 +1529,7 @@ Dir_MTime(GNode *gn, Boolean recheck) * see if we can find it via the current .PATH */ cp++; - + fullName = Dir_FindFile(cp, Suff_FindPath(gn)); if (fullName) { /* @@ -1572,7 +1572,7 @@ Dir_MTime(GNode *gn, Boolean recheck) } gn->mtime = stb.st_mtime; - return (gn->mtime); + return gn->mtime; } /*- @@ -1677,7 +1677,7 @@ Dir_CopyDir(void *p) { ((Path *)p)->refCount += 1; - return (p); + return p; } /*- @@ -1722,7 +1722,7 @@ Dir_MakeFlags(const char *flag, Lst path) Lst_Close(path); } - return (str); + return str; } /*- Modified: vendor/NetBSD/bmake/dist/for.c ============================================================================== --- vendor/NetBSD/bmake/dist/for.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/for.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $ */ +/* $NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -30,14 +30,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $"; +static char rcsid[] = "$NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $"); +__RCSID("$NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -224,7 +224,7 @@ For_Eval(char *line) words = brk_string(sub, &nwords, FALSE, &word_buf); free(sub); - + if (words != NULL) { for (n = 0; n < nwords; n++) { ptr = words[n]; @@ -480,9 +480,9 @@ For_Iterate(void *v_arg, size_t *ret_len) void For_Run(int lineno) -{ +{ For *arg; - + arg = accumFor; accumFor = NULL; @@ -491,6 +491,6 @@ For_Run(int lineno) For_Free(arg); return; } - + Parse_SetInput(NULL, lineno, -1, For_Iterate, arg); } Modified: vendor/NetBSD/bmake/dist/hash.c ============================================================================== --- vendor/NetBSD/bmake/dist/hash.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/hash.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $ */ +/* $NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $"; +static char rcsid[] = "$NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $"); +__RCSID("$NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -229,7 +229,7 @@ Hash_FindEntry(Hash_Table *t, const char *key) p = key; for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next) if (e->namehash == h && strcmp(e->name, p) == 0) - return (e); + return e; return NULL; } @@ -279,7 +279,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boole if (e->namehash == h && strcmp(e->name, p) == 0) { if (newPtr != NULL) *newPtr = FALSE; - return (e); + return e; } } @@ -301,7 +301,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boole if (newPtr != NULL) *newPtr = TRUE; - return (e); + return e; } /* @@ -418,7 +418,7 @@ Hash_EnumNext(Hash_Search *searchPtr) e = t->bucketPtr[searchPtr->nextIndex++]; } searchPtr->hashEntryPtr = e; - return (e); + return e; } /* @@ -463,4 +463,15 @@ RebuildTable(Hash_Table *t) } } free(oldhp); +} + +void Hash_ForEach(Hash_Table *t, void (*action)(void *, void *), void *data) +{ + Hash_Search search; + Hash_Entry *e; + + for (e = Hash_EnumFirst(t, &search); + e != NULL; + e = Hash_EnumNext(&search)) + action(Hash_GetValue(e), data); } Modified: vendor/NetBSD/bmake/dist/hash.h ============================================================================== --- vendor/NetBSD/bmake/dist/hash.h Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/hash.h Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.12 2017/05/31 21:07:03 maya Exp $ */ +/* $NetBSD: hash.h,v 1.13 2020/07/03 17:03:09 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -145,5 +145,6 @@ Hash_Entry *Hash_CreateEntry(Hash_Table *, const char void Hash_DeleteEntry(Hash_Table *, Hash_Entry *); Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *); Hash_Entry *Hash_EnumNext(Hash_Search *); +void Hash_ForEach(Hash_Table *, void (*)(void *, void *), void *); #endif /* _HASH_H */ Modified: vendor/NetBSD/bmake/dist/job.c ============================================================================== --- vendor/NetBSD/bmake/dist/job.c Wed Jul 8 18:29:06 2020 (r363017) +++ vendor/NetBSD/bmake/dist/job.c Wed Jul 8 18:32:15 2020 (r363018) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $ */ +/* $NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -274,7 +274,7 @@ static Shell shells[] = { "", }, /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007081832.068IWFaf043470>