Skip to content

Commit

Permalink
Import bmake-20200704
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sgerraty committed Jul 8, 2020
1 parent 6e02962 commit 1a2b743
Show file tree
Hide file tree
Showing 60 changed files with 2,551 additions and 2,611 deletions.
39 changes: 39 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
2020-07-04 Simon J Gerraty <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* VERSION (_MAKE_VERSION): 20200629
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# keep this compatible with sh and make
_MAKE_VERSION=20200629
_MAKE_VERSION=20200704
48 changes: 24 additions & 24 deletions arch.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -312,7 +312,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
free(freeIt);

if (result == var_Error) {
return(FAILURE);
return FAILURE;
} else {
subLibName = TRUE;
}
Expand Down Expand Up @@ -354,7 +354,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
free(freeIt);

if (result == var_Error) {
return(FAILURE);
return FAILURE;
} else {
doSubst = TRUE;
}
Expand All @@ -372,7 +372,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
*/
if (*cp == '\0') {
printf("No closing parenthesis in archive specification\n");
return (FAILURE);
return FAILURE;
}

/*
Expand Down Expand Up @@ -426,7 +426,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)

if (gn == NULL) {
free(buf);
return(FAILURE);
return FAILURE;
} else {
gn->type |= OP_ARCHV;
(void)Lst_AtEnd(nodeLst, gn);
Expand All @@ -437,7 +437,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
* ourselves.
*/
free(buf);
return(FAILURE);
return FAILURE;
}
/*
* Free buffer and continue with our work.
Expand All @@ -461,7 +461,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
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
Expand All @@ -483,7 +483,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
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
Expand Down Expand Up @@ -520,7 +520,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
} while (*cp != '\0' && isspace ((unsigned char)*cp));

*linePtr = cp;
return (SUCCESS);
return SUCCESS;
}

/*-
Expand All @@ -544,7 +544,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
static int
ArchFindArchive(const void *ar, const void *archName)
{
return (strcmp(archName, ((const Arch *)ar)->name));
return strcmp(archName, ((const Arch *)ar)->name);
}

/*-
Expand Down Expand Up @@ -602,7 +602,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
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];
Expand All @@ -614,7 +614,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
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;
}
}
Expand All @@ -635,7 +635,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
return NULL;
} else {
fclose(arch);
return (&sarh);
return &sarh;
}
}

Expand Down Expand Up @@ -753,7 +753,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
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;
}
Expand Down Expand Up @@ -962,7 +962,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
fclose(arch);
return NULL;
}
return (arch);
return arch;
}
} else
#ifdef AR_EFMT1
Expand Down Expand Up @@ -996,7 +996,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
fclose(arch);
return NULL;
}
return (arch);
return arch;
}
if (fseek(arch, -elen, SEEK_CUR) != 0) {
fclose(arch);
Expand Down Expand Up @@ -1152,7 +1152,7 @@ Arch_MTime(GNode *gn)
}

gn->mtime = modTime;
return (modTime);
return modTime;
}

/*-
Expand All @@ -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);
Expand Down Expand Up @@ -1211,7 +1211,7 @@ Arch_MemMTime(GNode *gn)

Lst_Close(gn->parents);

return (gn->mtime);
return gn->mtime;
}

/*-
Expand Down Expand Up @@ -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 */
}

Expand Down Expand Up @@ -1337,7 +1337,7 @@ Arch_LibOODate(GNode *gn)
oodate = FALSE;
#endif
}
return (oodate);
return oodate;
}

/*-
Expand Down
8 changes: 4 additions & 4 deletions buf.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -160,7 +160,7 @@ Buf_GetAll(Buffer *bp, int *numBytesPtr)
if (numBytesPtr != NULL)
*numBytesPtr = bp->count;

return (bp->buffer);
return bp->buffer;
}

/*-
Expand Down
Loading

0 comments on commit 1a2b743

Please sign in to comment.