Author: sjg
Date: Wed Jul  8 21:20:12 2020
New Revision: 363031
URL: https://svnweb.freebsd.org/changeset/base/363031

Log:
  Update to bmake-20200704
  
  Key changes include reduced noise at end of failed build log
  and avoid evaluation of unnecessary terms in conditionals.
  
  MFC after:    1 week

Added:
  head/contrib/bmake/LICENSE
     - copied unchanged from r363019, vendor/NetBSD/bmake/dist/LICENSE
  head/contrib/bmake/unit-tests/cond-short.exp
     - copied unchanged from r363019, 
vendor/NetBSD/bmake/dist/unit-tests/cond-short.exp
  head/contrib/bmake/unit-tests/cond-short.mk
     - copied unchanged from r363019, 
vendor/NetBSD/bmake/dist/unit-tests/cond-short.mk
Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/FILES
  head/contrib/bmake/VERSION
  head/contrib/bmake/arch.c
  head/contrib/bmake/buf.c
  head/contrib/bmake/compat.c
  head/contrib/bmake/cond.c
  head/contrib/bmake/dir.c
  head/contrib/bmake/for.c
  head/contrib/bmake/hash.c
  head/contrib/bmake/hash.h
  head/contrib/bmake/job.c
  head/contrib/bmake/job.h
  head/contrib/bmake/lst.lib/lstAppend.c
  head/contrib/bmake/lst.lib/lstAtEnd.c
  head/contrib/bmake/lst.lib/lstAtFront.c
  head/contrib/bmake/lst.lib/lstClose.c
  head/contrib/bmake/lst.lib/lstConcat.c
  head/contrib/bmake/lst.lib/lstDatum.c
  head/contrib/bmake/lst.lib/lstDeQueue.c
  head/contrib/bmake/lst.lib/lstDupl.c
  head/contrib/bmake/lst.lib/lstEnQueue.c
  head/contrib/bmake/lst.lib/lstFind.c
  head/contrib/bmake/lst.lib/lstFindFrom.c
  head/contrib/bmake/lst.lib/lstFirst.c
  head/contrib/bmake/lst.lib/lstForEach.c
  head/contrib/bmake/lst.lib/lstForEachFrom.c
  head/contrib/bmake/lst.lib/lstInit.c
  head/contrib/bmake/lst.lib/lstInsert.c
  head/contrib/bmake/lst.lib/lstIsAtEnd.c
  head/contrib/bmake/lst.lib/lstIsEmpty.c
  head/contrib/bmake/lst.lib/lstLast.c
  head/contrib/bmake/lst.lib/lstNext.c
  head/contrib/bmake/lst.lib/lstOpen.c
  head/contrib/bmake/lst.lib/lstPrev.c
  head/contrib/bmake/lst.lib/lstRemove.c
  head/contrib/bmake/lst.lib/lstReplace.c
  head/contrib/bmake/lst.lib/lstSucc.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make.c
  head/contrib/bmake/make.h
  head/contrib/bmake/make_malloc.c
  head/contrib/bmake/meta.c
  head/contrib/bmake/meta.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/FILES
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/mkopt.sh
  head/contrib/bmake/mk/sys/AIX.mk
  head/contrib/bmake/mk/sys/Darwin.mk
  head/contrib/bmake/mk/sys/Generic.mk
  head/contrib/bmake/mk/sys/HP-UX.mk
  head/contrib/bmake/mk/sys/IRIX.mk
  head/contrib/bmake/mk/sys/Linux.mk
  head/contrib/bmake/mk/sys/NetBSD.mk
  head/contrib/bmake/mk/sys/OSF1.mk
  head/contrib/bmake/mk/sys/OpenBSD.mk
  head/contrib/bmake/mk/sys/SunOS.mk
  head/contrib/bmake/mk/sys/UnixWare.mk
  head/contrib/bmake/nonints.h
  head/contrib/bmake/parse.c
  head/contrib/bmake/str.c
  head/contrib/bmake/suff.c
  head/contrib/bmake/targ.c
  head/contrib/bmake/trace.c
  head/contrib/bmake/unit-tests/Makefile
  head/contrib/bmake/unit-tests/modmatch.mk
  head/contrib/bmake/unit-tests/modmisc.exp
  head/contrib/bmake/unit-tests/modmisc.mk
  head/contrib/bmake/unit-tests/modorder.exp
  head/contrib/bmake/unit-tests/modorder.mk
  head/contrib/bmake/unit-tests/sysv.exp
  head/contrib/bmake/unit-tests/sysv.mk
  head/contrib/bmake/unit-tests/varmisc.exp
  head/contrib/bmake/unit-tests/varmisc.mk
  head/contrib/bmake/util.c
  head/contrib/bmake/var.c
  head/usr.bin/bmake/Makefile.config
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==============================================================================
--- head/contrib/bmake/ChangeLog        Wed Jul  8 20:26:19 2020        
(r363030)
+++ head/contrib/bmake/ChangeLog        Wed Jul  8 21:20:12 2020        
(r363031)
@@ -1,3 +1,81 @@
+2020-07-04  Simon J Gerraty  <s...@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  <s...@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  <s...@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  <s...@beast.crufty.net>
+
+       * VERSION (_MAKE_VERSION): 20200629
+       Merge with NetBSD make, pick up
+       o cond.c: do not eval unnecessary terms of conditionals.
+
+2020-06-25  Simon J Gerraty  <s...@beast.crufty.net>
+
+       * VERSION (_MAKE_VERSION): 20200625
+       Merge with NetBSD make, pick up
+       o meta.c: report error if lseek in filemon_read fails
+
+2020-06-22  Simon J Gerraty  <s...@beast.crufty.net>
+
+       * VERSION (_MAKE_VERSION): 20200622
+       Merge with NetBSD make, pick up
+       o dieQuietly: ignore OP_SUBMAKE as too aggressive
+
+2020-06-19  Simon J Gerraty  <s...@beast.crufty.net>
+
+       * VERSION (_MAKE_VERSION): 20200619
+       Merge with NetBSD make, pick up
+       o str.c: performance improvement for Str_Match for multiple '*'
+       o dieQuietly: supress the failure output from make
+       when failing node is a sub-make or a sibling failed.
+       This cuts down greatly on unhelpful noise at the end of
+       build log.  Disabled by -dj or .MAKE.DIE_QUIETLY=no
+
+2020-06-10  Simon J Gerraty  <s...@beast.crufty.net>
+
+       * FILES: add LICENSE to appease some packagers.
+       This is an attempt to fairly represent the license on almost
+       200 files, which are almost all BSD-3-Clause
+       The few exceptions being more liberal.
+
+       * VERSION (_MAKE_VERSION): 20200610
+       Merge with NetBSD make, pick up
+       o unit test for :Or
+
 2020-06-06  Simon J Gerraty  <s...@beast.crufty.net>
 
        * VERSION (_MAKE_VERSION): 20200606

Modified: head/contrib/bmake/FILES
==============================================================================
--- head/contrib/bmake/FILES    Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/FILES    Wed Jul  8 21:20:12 2020        (r363031)
@@ -1,5 +1,6 @@
 ChangeLog
 FILES
+LICENSE
 Makefile
 Makefile.config.in
 PSD.doc/Makefile
@@ -107,6 +108,8 @@ unit-tests/cond2.exp
 unit-tests/cond2.mk
 unit-tests/cond-late.mk
 unit-tests/cond-late.exp
+unit-tests/cond-short.mk
+unit-tests/cond-short.exp
 unit-tests/dollar.exp
 unit-tests/dollar.mk
 unit-tests/doterror.exp

Copied: head/contrib/bmake/LICENSE (from r363019, 
vendor/NetBSD/bmake/dist/LICENSE)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/bmake/LICENSE  Wed Jul  8 21:20:12 2020        (r363031, copy 
of r363019, vendor/NetBSD/bmake/dist/LICENSE)
@@ -0,0 +1,59 @@
+The individual files in this distribution are copyright their
+original contributors or assignees.
+Including:
+
+    Copyright (c) 1993-2020, Simon J Gerraty
+    Copyright (c) 2009-2016, Juniper Networks, Inc.
+    Copyright (c) 2009, John Birrell.
+    Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
+    Copyright (c) 1998 Todd C. Miller <todd.mil...@courtesan.com>
+    Copyright (c) 1989 by Berkeley Softworks
+    Copyright (c) 1988, 1989, 1990, 1992, 1993
+       The Regents of the University of California.
+    Copyright (c) 1988, 1989 by Adam de Boor
+
+With the exception of the GNU configure script, which states:
+
+    # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+    #
+    # This configure script is free software; the Free Software Foundation
+    # gives unlimited permission to copy, distribute and modify it.
+
+The license for this distribution is considered to be:
+
+    SPDX-License-Identifier: BSD-3-Clause
+
+example (from https://opensource.org/licenses/BSD-3-Clause):
+
+    Copyright <YEAR> <COPYRIGHT HOLDER>
+    
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    2. Redistributions in binary form must reproduce the above
+    copyright notice, this list of conditions and the following
+    disclaimer in the documentation and/or other materials provided
+    with the distribution.
+
+    3. Neither the name of the copyright holder nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+    TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+    SUCH DAMAGE.
+        

Modified: head/contrib/bmake/VERSION
==============================================================================
--- head/contrib/bmake/VERSION  Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/VERSION  Wed Jul  8 21:20:12 2020        (r363031)
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20200606
+_MAKE_VERSION=20200704

Modified: head/contrib/bmake/arch.c
==============================================================================
--- head/contrib/bmake/arch.c   Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/arch.c   Wed Jul  8 21:20:12 2020        (r363031)
@@ -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: head/contrib/bmake/buf.c
==============================================================================
--- head/contrib/bmake/buf.c    Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/buf.c    Wed Jul  8 21:20:12 2020        (r363031)
@@ -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: head/contrib/bmake/compat.c
==============================================================================
--- head/contrib/bmake/compat.c Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/compat.c Wed Jul  8 21:20:12 2020        (r363031)
@@ -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: head/contrib/bmake/cond.c
==============================================================================
--- head/contrib/bmake/cond.c   Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/cond.c   Wed Jul  8 21:20:12 2020        (r363031)
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh 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.75 2017/04/16 20:59:04 riastradh 
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.75 2017/04/16 20:59:04 riastradh Exp $");
+__RCSID("$NetBSD: cond.c,v 1.78 2020/07/03 08:13:23 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -146,7 +146,7 @@ typedef enum {
  * last two fields are stored in condInvert and condDefProc, respectively.
  */
 static void CondPushBack(Token);
-static int CondGetArg(char **, char **, const char *);
+static int CondGetArg(Boolean, char **, char **, const char *);
 static Boolean CondDoDefined(int, const char *);
 static int CondStrMatch(const void *, const void *);
 static Boolean CondDoMake(int, const char *);
@@ -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;
@@ -225,9 +225,6 @@ CondPushBack(Token t)
  * CondGetArg --
  *     Find the argument of a built-in function.
  *
- * Input:
- *     parens          TRUE if arg should be bounded by parens
- *
  * Results:
  *     The length of the argument and the address of the argument.
  *
@@ -238,7 +235,7 @@ CondPushBack(Token t)
  *-----------------------------------------------------------------------
  */
 static int
-CondGetArg(char **linePtr, char **argPtr, const char *func)
+CondGetArg(Boolean doEval, char **linePtr, char **argPtr, const char *func)
 {
     char         *cp;
     int                  argLen;
@@ -259,7 +256,7 @@ CondGetArg(char **linePtr, char **argPtr, const char *
         * the word 'make' or 'defined' at the beginning of a symbol...
         */
        *argPtr = NULL;
-       return (0);
+       return 0;
     }
 
     while (*cp == ' ' || *cp == '\t') {
@@ -290,7 +287,8 @@ CondGetArg(char **linePtr, char **argPtr, const char *
            int         len;
            void        *freeIt;
 
-           cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES,
+           cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|
+                           (doEval ? VARF_WANTRES : 0),
                            &len, &freeIt);
            Buf_AddBytes(&buf, strlen(cp2), cp2);
            free(freeIt);
@@ -316,11 +314,11 @@ CondGetArg(char **linePtr, char **argPtr, const char *
     if (func != NULL && *cp++ != ')') {
        Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()",
                     func);
-       return (0);
+       return 0;
     }
 
     *linePtr = cp;
-    return (argLen);
+    return argLen;
 }
 
 /*-
@@ -349,7 +347,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char 
     }
 
     free(p1);
-    return (result);
+    return result;
 }
 
 /*-
@@ -369,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);
 }
 
 /*-
@@ -414,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;
 }
 
 /*-
@@ -443,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);
 }
 
 /*-
@@ -467,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);
 }
 
 /*-
@@ -577,7 +575,7 @@ CondGetString(Boolean doEval, Boolean *quoted, void **
            /* if we are in quotes, then an undefined variable is ok */
            str = Var_Parse(condExpr, VAR_CMD,
                            ((!qt && doEval) ? VARF_UNDEFERR : 0) |
-                           VARF_WANTRES, &len, freeIt);
+                           (doEval ? VARF_WANTRES : 0), &len, freeIt);
            if (str == var_Error) {
                if (*freeIt) {
                    free(*freeIt);
@@ -668,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.
@@ -711,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;
            }
@@ -764,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;
 
@@ -813,7 +811,7 @@ done:
 }
 
 static int
-get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
+get_mpt_arg(Boolean doEval, char **linePtr, char **argPtr, const char *func 
MAKE_ATTR_UNUSED)
 {
     /*
      * Use Var_Parse to parse the spec in parens and return
@@ -827,7 +825,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char 
     /* We do all the work here and return the result as the length */
     *argPtr = NULL;
 
-    val = Var_Parse(cp - 1, VAR_CMD, VARF_WANTRES, &length, &freeIt);
+    val = Var_Parse(cp - 1, VAR_CMD, doEval ? VARF_WANTRES : 0, &length, 
&freeIt);
     /*
      * Advance *linePtr to beyond the closing ). Note that
      * we subtract one because 'length' is calculated from 'cp - 1'.
@@ -864,7 +862,7 @@ compare_function(Boolean doEval)
     static const struct fn_def {
        const char  *fn_name;
        int         fn_name_len;
-        int         (*fn_getarg)(char **, char **, const char *);
+        int         (*fn_getarg)(Boolean, char **, char **, const char *);
        Boolean     (*fn_proc)(int, const char *);
     } fn_defs[] = {
        { "defined",   7, CondGetArg, CondDoDefined },
@@ -892,7 +890,7 @@ compare_function(Boolean doEval)
        if (*cp != '(')
            break;
 
-       arglen = fn_def->fn_getarg(&cp, &arg, fn_def->fn_name);
+       arglen = fn_def->fn_getarg(doEval, &cp, &arg, fn_def->fn_name);
        if (arglen <= 0) {
            condExpr = cp;
            return arglen < 0 ? TOK_ERROR : TOK_FALSE;
@@ -917,7 +915,7 @@ compare_function(Boolean doEval)
      * would be invalid if we did "defined(a)" - so instead treat as an
      * expression.
      */
-    arglen = CondGetArg(&cp, &arg, NULL);
+    arglen = CondGetArg(doEval, &cp, &arg, NULL);
     for (cp1 = cp; isspace(*(unsigned char *)cp1); cp1++)
        continue;
     if (*cp1 == '=' || *cp1 == '!')
@@ -1040,7 +1038,7 @@ CondT(Boolean doEval)
            t = TOK_TRUE;
        }
     }
-    return (t);
+    return t;
 }
 
 /*-
@@ -1086,7 +1084,7 @@ CondF(Boolean doEval)
            CondPushBack(o);
        }
     }
-    return (l);
+    return l;
 }
 
 /*-
@@ -1133,7 +1131,7 @@ CondE(Boolean doEval)
            CondPushBack(o);
        }
     }
-    return (l);
+    return l;
 }
 
 /*-

Modified: head/contrib/bmake/dir.c
==============================================================================
--- head/contrib/bmake/dir.c    Wed Jul  8 20:26:19 2020        (r363030)
+++ head/contrib/bmake/dir.c    Wed Jul  8 21:20:12 2020        (r363031)
@@ -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;
 }
 
 /*-

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to