make(1): migrate Lst_IsEmpty to Lst_IsEmptySdiff -r1.98 -r1.99 src/usr.bin/make/arch.c
(rillig)
--- src/usr.bin/make/arch.c 2020/08/27 06:13:53 1.98
+++ src/usr.bin/make/arch.c 2020/08/27 19:15:35 1.99
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig Exp $ */ | 1 | /* $NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; | 77 | static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: arch.c,v 1.98 2020/08/27 06:13:53 rillig Exp $"); | 79 | __RCSID("$NetBSD: arch.c,v 1.99 2020/08/27 19:15:35 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * arch.c -- | 85 | * arch.c -- | |
86 | * Functions to manipulate libraries, archives and their members. | 86 | * Functions to manipulate libraries, archives and their members. | |
87 | * | 87 | * | |
88 | * Once again, cacheing/hashing comes into play in the manipulation | 88 | * Once again, cacheing/hashing comes into play in the manipulation | |
89 | * of archives. The first time an archive is referenced, all of its members' | 89 | * of archives. The first time an archive is referenced, all of its members' | |
90 | * headers are read and hashed and the archive closed again. All hashed | 90 | * headers are read and hashed and the archive closed again. All hashed | |
91 | * archives are kept on a list which is searched each time an archive member | 91 | * archives are kept on a list which is searched each time an archive member | |
92 | * is referenced. | 92 | * is referenced. | |
@@ -386,27 +386,27 @@ Arch_ParseArchive(char **linePtr, Lst no | @@ -386,27 +386,27 @@ Arch_ParseArchive(char **linePtr, Lst no | |||
386 | free(buf); | 386 | free(buf); | |
387 | return FALSE; | 387 | return FALSE; | |
388 | } | 388 | } | |
389 | /* | 389 | /* | |
390 | * Free buffer and continue with our work. | 390 | * Free buffer and continue with our work. | |
391 | */ | 391 | */ | |
392 | free(buf); | 392 | free(buf); | |
393 | } else if (Dir_HasWildcards(memName)) { | 393 | } else if (Dir_HasWildcards(memName)) { | |
394 | Lst members = Lst_Init(); | 394 | Lst members = Lst_Init(); | |
395 | Buffer nameBuf; | 395 | Buffer nameBuf; | |
396 | 396 | |||
397 | Buf_Init(&nameBuf, 0); | 397 | Buf_Init(&nameBuf, 0); | |
398 | Dir_Expand(memName, dirSearchPath, members); | 398 | Dir_Expand(memName, dirSearchPath, members); | |
399 | while (!Lst_IsEmpty(members)) { | 399 | while (!Lst_IsEmptyS(members)) { | |
400 | char *member = Lst_DequeueS(members); | 400 | char *member = Lst_DequeueS(members); | |
401 | 401 | |||
402 | Buf_Empty(&nameBuf); | 402 | Buf_Empty(&nameBuf); | |
403 | Buf_AddStr(&nameBuf, libName); | 403 | Buf_AddStr(&nameBuf, libName); | |
404 | Buf_AddStr(&nameBuf, "("); | 404 | Buf_AddStr(&nameBuf, "("); | |
405 | Buf_AddStr(&nameBuf, member); | 405 | Buf_AddStr(&nameBuf, member); | |
406 | Buf_AddStr(&nameBuf, ")"); | 406 | Buf_AddStr(&nameBuf, ")"); | |
407 | free(member); | 407 | free(member); | |
408 | 408 | |||
409 | gn = Targ_FindNode(Buf_GetAll(&nameBuf, NULL), TARG_CREATE); | 409 | gn = Targ_FindNode(Buf_GetAll(&nameBuf, NULL), TARG_CREATE); | |
410 | if (gn == NULL) { | 410 | if (gn == NULL) { | |
411 | Buf_Destroy(&nameBuf, TRUE); | 411 | Buf_Destroy(&nameBuf, TRUE); | |
412 | return FALSE; | 412 | return FALSE; | |
@@ -1242,29 +1242,29 @@ Arch_FindLib(GNode *gn, Lst path) | @@ -1242,29 +1242,29 @@ Arch_FindLib(GNode *gn, Lst path) | |||
1242 | * | 1242 | * | |
1243 | * Side Effects: | 1243 | * Side Effects: | |
1244 | * The library will be hashed if it hasn't been already. | 1244 | * The library will be hashed if it hasn't been already. | |
1245 | * | 1245 | * | |
1246 | *----------------------------------------------------------------------- | 1246 | *----------------------------------------------------------------------- | |
1247 | */ | 1247 | */ | |
1248 | Boolean | 1248 | Boolean | |
1249 | Arch_LibOODate(GNode *gn) | 1249 | Arch_LibOODate(GNode *gn) | |
1250 | { | 1250 | { | |
1251 | Boolean oodate; | 1251 | Boolean oodate; | |
1252 | 1252 | |||
1253 | if (gn->type & OP_PHONY) { | 1253 | if (gn->type & OP_PHONY) { | |
1254 | oodate = TRUE; | 1254 | oodate = TRUE; | |
1255 | } else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) { | 1255 | } else if (OP_NOP(gn->type) && Lst_IsEmptyS(gn->children)) { | |
1256 | oodate = FALSE; | 1256 | oodate = FALSE; | |
1257 | } else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) || | 1257 | } else if ((!Lst_IsEmptyS(gn->children) && gn->cmgn == NULL) || | |
1258 | (gn->mtime > now) || | 1258 | (gn->mtime > now) || | |
1259 | (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime)) { | 1259 | (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime)) { | |
1260 | oodate = TRUE; | 1260 | oodate = TRUE; | |
1261 | } else { | 1261 | } else { | |
1262 | #ifdef RANLIBMAG | 1262 | #ifdef RANLIBMAG | |
1263 | struct ar_hdr *arhPtr; /* Header for __.SYMDEF */ | 1263 | struct ar_hdr *arhPtr; /* Header for __.SYMDEF */ | |
1264 | int modTimeTOC; /* The table-of-contents's mod time */ | 1264 | int modTimeTOC; /* The table-of-contents's mod time */ | |
1265 | 1265 | |||
1266 | arhPtr = ArchStatMember(gn->path, RANLIBMAG, FALSE); | 1266 | arhPtr = ArchStatMember(gn->path, RANLIBMAG, FALSE); | |
1267 | 1267 | |||
1268 | if (arhPtr != NULL) { | 1268 | if (arhPtr != NULL) { | |
1269 | modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10); | 1269 | modTimeTOC = (int)strtol(arhPtr->ar_date, NULL, 10); | |
1270 | 1270 |
--- src/usr.bin/make/compat.c 2020/08/27 06:53:57 1.130
+++ src/usr.bin/make/compat.c 2020/08/27 19:15:35 1.131
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $ */ | 1 | /* $NetBSD: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; | 78 | static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $"); | 80 | __RCSID("$NetBSD: compat.c,v 1.131 2020/08/27 19:15:35 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * compat.c -- | 86 | * compat.c -- | |
87 | * The routines in this file implement the full-compatibility | 87 | * The routines in this file implement the full-compatibility | |
88 | * mode of PMake. Most of the special functionality of PMake | 88 | * mode of PMake. Most of the special functionality of PMake | |
89 | * is available in this mode. Things not supported: | 89 | * is available in this mode. Things not supported: | |
90 | * - different shells. | 90 | * - different shells. | |
91 | * - friendly variable substitution. | 91 | * - friendly variable substitution. | |
92 | * | 92 | * | |
93 | * Interface: | 93 | * Interface: | |
@@ -737,27 +737,27 @@ Compat_Run(Lst targs) | @@ -737,27 +737,27 @@ Compat_Run(Lst targs) | |||
737 | Make_ExpandUse(targs); | 737 | Make_ExpandUse(targs); | |
738 | 738 | |||
739 | /* | 739 | /* | |
740 | * For each entry in the list of targets to create, call Compat_Make on | 740 | * For each entry in the list of targets to create, call Compat_Make on | |
741 | * it to create the thing. Compat_Make will leave the 'made' field of gn | 741 | * it to create the thing. Compat_Make will leave the 'made' field of gn | |
742 | * in one of several states: | 742 | * in one of several states: | |
743 | * UPTODATE gn was already up-to-date | 743 | * UPTODATE gn was already up-to-date | |
744 | * MADE gn was recreated successfully | 744 | * MADE gn was recreated successfully | |
745 | * ERROR An error occurred while gn was being created | 745 | * ERROR An error occurred while gn was being created | |
746 | * ABORTED gn was not remade because one of its inferiors | 746 | * ABORTED gn was not remade because one of its inferiors | |
747 | * could not be made due to errors. | 747 | * could not be made due to errors. | |
748 | */ | 748 | */ | |
749 | errors = 0; | 749 | errors = 0; | |
750 | while (!Lst_IsEmpty(targs)) { | 750 | while (!Lst_IsEmptyS(targs)) { | |
751 | gn = Lst_DequeueS(targs); | 751 | gn = Lst_DequeueS(targs); | |
752 | Compat_Make(gn, gn); | 752 | Compat_Make(gn, gn); | |
753 | 753 | |||
754 | if (gn->made == UPTODATE) { | 754 | if (gn->made == UPTODATE) { | |
755 | printf("`%s' is up to date.\n", gn->name); | 755 | printf("`%s' is up to date.\n", gn->name); | |
756 | } else if (gn->made == ABORTED) { | 756 | } else if (gn->made == ABORTED) { | |
757 | printf("`%s' not remade because of errors.\n", gn->name); | 757 | printf("`%s' not remade because of errors.\n", gn->name); | |
758 | errors += 1; | 758 | errors += 1; | |
759 | } | 759 | } | |
760 | } | 760 | } | |
761 | 761 | |||
762 | /* | 762 | /* | |
763 | * If the user has defined a .END target, run its commands. | 763 | * If the user has defined a .END target, run its commands. |
--- src/usr.bin/make/cond.c 2020/08/23 16:58:02 1.100
+++ src/usr.bin/make/cond.c 2020/08/27 19:15:35 1.101
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $ */ | 1 | /* $NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; | 78 | static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $"); | 80 | __RCSID("$NetBSD: cond.c,v 1.101 2020/08/27 19:15:35 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * cond.c -- | 86 | * cond.c -- | |
87 | * Functions to handle conditionals in a makefile. | 87 | * Functions to handle conditionals in a makefile. | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Cond_Eval Evaluate the conditional in the passed line. | 90 | * Cond_Eval Evaluate the conditional in the passed line. | |
91 | * | 91 | * | |
92 | */ | 92 | */ | |
93 | 93 | |||
@@ -316,27 +316,27 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED | @@ -316,27 +316,27 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED | |||
316 | 316 | |||
317 | gn = Targ_FindNode(arg, TARG_NOCREATE); | 317 | gn = Targ_FindNode(arg, TARG_NOCREATE); | |
318 | return gn != NULL && !OP_NOP(gn->type); | 318 | return gn != NULL && !OP_NOP(gn->type); | |
319 | } | 319 | } | |
320 | 320 | |||
321 | /* See if the given node exists and is an actual target with commands | 321 | /* See if the given node exists and is an actual target with commands | |
322 | * associated with it. */ | 322 | * associated with it. */ | |
323 | static Boolean | 323 | static Boolean | |
324 | CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg) | 324 | CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg) | |
325 | { | 325 | { | |
326 | GNode *gn; | 326 | GNode *gn; | |
327 | 327 | |||
328 | gn = Targ_FindNode(arg, TARG_NOCREATE); | 328 | gn = Targ_FindNode(arg, TARG_NOCREATE); | |
329 | return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands); | 329 | return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmptyS(gn->commands); | |
330 | } | 330 | } | |
331 | 331 | |||
332 | /*- | 332 | /*- | |
333 | * Convert the given number into a double. | 333 | * Convert the given number into a double. | |
334 | * We try a base 10 or 16 integer conversion first, if that fails | 334 | * We try a base 10 or 16 integer conversion first, if that fails | |
335 | * then we try a floating point conversion instead. | 335 | * then we try a floating point conversion instead. | |
336 | * | 336 | * | |
337 | * Results: | 337 | * Results: | |
338 | * Sets 'value' to double value of string. | 338 | * Sets 'value' to double value of string. | |
339 | * Returns TRUE if the conversion succeeded. | 339 | * Returns TRUE if the conversion succeeded. | |
340 | */ | 340 | */ | |
341 | static Boolean | 341 | static Boolean | |
342 | CondCvtArg(const char *str, double *value) | 342 | CondCvtArg(const char *str, double *value) |
--- src/usr.bin/make/dir.c 2020/08/27 07:00:29 1.114
+++ src/usr.bin/make/dir.c 2020/08/27 19:15:35 1.115
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 rillig Exp $ */ | 1 | /* $NetBSD: dir.c,v 1.115 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: dir.c,v 1.115 2020/08/27 19:15:35 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; | 78 | static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: dir.c,v 1.114 2020/08/27 07:00:29 rillig Exp $"); | 80 | __RCSID("$NetBSD: dir.c,v 1.115 2020/08/27 19:15:35 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * dir.c -- | 86 | * dir.c -- | |
87 | * Directory searching using wildcards and/or normal names... | 87 | * Directory searching using wildcards and/or normal names... | |
88 | * Used both for source wildcarding in the Makefile and for finding | 88 | * Used both for source wildcarding in the Makefile and for finding | |
89 | * implicit sources. | 89 | * implicit sources. | |
90 | * | 90 | * | |
91 | * The interface for this module is: | 91 | * The interface for this module is: | |
92 | * Dir_Init Initialize the module. | 92 | * Dir_Init Initialize the module. | |
93 | * | 93 | * | |
@@ -1468,27 +1468,27 @@ Dir_MTime(GNode *gn, Boolean recheck) | @@ -1468,27 +1468,27 @@ Dir_MTime(GNode *gn, Boolean recheck) | |||
1468 | struct stat stb; /* buffer for finding the mod time */ | 1468 | struct stat stb; /* buffer for finding the mod time */ | |
1469 | 1469 | |||
1470 | if (gn->type & OP_ARCHV) { | 1470 | if (gn->type & OP_ARCHV) { | |
1471 | return Arch_MTime(gn); | 1471 | return Arch_MTime(gn); | |
1472 | } else if (gn->type & OP_PHONY) { | 1472 | } else if (gn->type & OP_PHONY) { | |
1473 | gn->mtime = 0; | 1473 | gn->mtime = 0; | |
1474 | return 0; | 1474 | return 0; | |
1475 | } else if (gn->path == NULL) { | 1475 | } else if (gn->path == NULL) { | |
1476 | if (gn->type & OP_NOPATH) | 1476 | if (gn->type & OP_NOPATH) | |
1477 | fullName = NULL; | 1477 | fullName = NULL; | |
1478 | else { | 1478 | else { | |
1479 | fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); | 1479 | fullName = Dir_FindFile(gn->name, Suff_FindPath(gn)); | |
1480 | if (fullName == NULL && gn->flags & FROM_DEPEND && | 1480 | if (fullName == NULL && gn->flags & FROM_DEPEND && | |
1481 | !Lst_IsEmpty(gn->iParents)) { | 1481 | !Lst_IsEmptyS(gn->iParents)) { | |
1482 | char *cp; | 1482 | char *cp; | |
1483 | 1483 | |||
1484 | cp = strrchr(gn->name, '/'); | 1484 | cp = strrchr(gn->name, '/'); | |
1485 | if (cp) { | 1485 | if (cp) { | |
1486 | /* | 1486 | /* | |
1487 | * This is an implied source, and it may have moved, | 1487 | * This is an implied source, and it may have moved, | |
1488 | * see if we can find it via the current .PATH | 1488 | * see if we can find it via the current .PATH | |
1489 | */ | 1489 | */ | |
1490 | cp++; | 1490 | cp++; | |
1491 | 1491 | |||
1492 | fullName = Dir_FindFile(cp, Suff_FindPath(gn)); | 1492 | fullName = Dir_FindFile(cp, Suff_FindPath(gn)); | |
1493 | if (fullName) { | 1493 | if (fullName) { | |
1494 | /* | 1494 | /* | |
@@ -1723,27 +1723,27 @@ Dir_Destroy(void *pp) | @@ -1723,27 +1723,27 @@ Dir_Destroy(void *pp) | |||
1723 | * path Path to clear | 1723 | * path Path to clear | |
1724 | * | 1724 | * | |
1725 | * Results: | 1725 | * Results: | |
1726 | * None. | 1726 | * None. | |
1727 | * | 1727 | * | |
1728 | * Side Effects: | 1728 | * Side Effects: | |
1729 | * The path is set to the empty list. | 1729 | * The path is set to the empty list. | |
1730 | * | 1730 | * | |
1731 | *----------------------------------------------------------------------- | 1731 | *----------------------------------------------------------------------- | |
1732 | */ | 1732 | */ | |
1733 | void | 1733 | void | |
1734 | Dir_ClearPath(Lst path) | 1734 | Dir_ClearPath(Lst path) | |
1735 | { | 1735 | { | |
1736 | while (!Lst_IsEmpty(path)) { | 1736 | while (!Lst_IsEmptyS(path)) { | |
1737 | Path *p = Lst_DequeueS(path); | 1737 | Path *p = Lst_DequeueS(path); | |
1738 | Dir_Destroy(p); | 1738 | Dir_Destroy(p); | |
1739 | } | 1739 | } | |
1740 | } | 1740 | } | |
1741 | 1741 | |||
1742 | 1742 | |||
1743 | /*- | 1743 | /*- | |
1744 | *----------------------------------------------------------------------- | 1744 | *----------------------------------------------------------------------- | |
1745 | * Dir_Concat -- | 1745 | * Dir_Concat -- | |
1746 | * Concatenate two paths, adding the second to the end of the first. | 1746 | * Concatenate two paths, adding the second to the end of the first. | |
1747 | * Makes sure to avoid duplicates. | 1747 | * Makes sure to avoid duplicates. | |
1748 | * | 1748 | * | |
1749 | * Input: | 1749 | * Input: |
--- src/usr.bin/make/job.c 2020/08/27 07:00:29 1.218
+++ src/usr.bin/make/job.c 2020/08/27 19:15:35 1.219
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: job.c,v 1.218 2020/08/27 07:00:29 rillig Exp $ */ | 1 | /* $NetBSD: job.c,v 1.219 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -60,34 +60,34 @@ | @@ -60,34 +60,34 @@ | |||
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #ifndef MAKE_NATIVE | 72 | #ifndef MAKE_NATIVE | |
73 | static char rcsid[] = "$NetBSD: job.c,v 1.218 2020/08/27 07:00:29 rillig Exp $"; | 73 | static char rcsid[] = "$NetBSD: job.c,v 1.219 2020/08/27 19:15:35 rillig Exp $"; | |
74 | #else | 74 | #else | |
75 | #include <sys/cdefs.h> | 75 | #include <sys/cdefs.h> | |
76 | #ifndef lint | 76 | #ifndef lint | |
77 | #if 0 | 77 | #if 0 | |
78 | static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; | 78 | static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; | |
79 | #else | 79 | #else | |
80 | __RCSID("$NetBSD: job.c,v 1.218 2020/08/27 07:00:29 rillig Exp $"); | 80 | __RCSID("$NetBSD: job.c,v 1.219 2020/08/27 19:15:35 rillig Exp $"); | |
81 | #endif | 81 | #endif | |
82 | #endif /* not lint */ | 82 | #endif /* not lint */ | |
83 | #endif | 83 | #endif | |
84 | 84 | |||
85 | /*- | 85 | /*- | |
86 | * job.c -- | 86 | * job.c -- | |
87 | * handle the creation etc. of our child processes. | 87 | * handle the creation etc. of our child processes. | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Job_Make Start the creation of the given target. | 90 | * Job_Make Start the creation of the given target. | |
91 | * | 91 | * | |
92 | * Job_CatchChildren Check for and handle the termination of any | 92 | * Job_CatchChildren Check for and handle the termination of any | |
93 | * children. This must be called reasonably | 93 | * children. This must be called reasonably | |
@@ -1224,33 +1224,33 @@ Job_Touch(GNode *gn, Boolean silent) | @@ -1224,33 +1224,33 @@ Job_Touch(GNode *gn, Boolean silent) | |||
1224 | * abortProc Function to abort with message | 1224 | * abortProc Function to abort with message | |
1225 | * | 1225 | * | |
1226 | * Results: | 1226 | * Results: | |
1227 | * TRUE if the commands list is/was ok. | 1227 | * TRUE if the commands list is/was ok. | |
1228 | * | 1228 | * | |
1229 | * Side Effects: | 1229 | * Side Effects: | |
1230 | * The node will have commands from the .DEFAULT rule added to it | 1230 | * The node will have commands from the .DEFAULT rule added to it | |
1231 | * if it needs them. | 1231 | * if it needs them. | |
1232 | *----------------------------------------------------------------------- | 1232 | *----------------------------------------------------------------------- | |
1233 | */ | 1233 | */ | |
1234 | Boolean | 1234 | Boolean | |
1235 | Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...)) | 1235 | Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...)) | |
1236 | { | 1236 | { | |
1237 | if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) && | 1237 | if (OP_NOP(gn->type) && Lst_IsEmptyS(gn->commands) && | |
1238 | ((gn->type & OP_LIB) == 0 || Lst_IsEmpty(gn->children))) { | 1238 | ((gn->type & OP_LIB) == 0 || Lst_IsEmptyS(gn->children))) { | |
1239 | /* | 1239 | /* | |
1240 | * No commands. Look for .DEFAULT rule from which we might infer | 1240 | * No commands. Look for .DEFAULT rule from which we might infer | |
1241 | * commands | 1241 | * commands | |
1242 | */ | 1242 | */ | |
1243 | if ((DEFAULT != NULL) && !Lst_IsEmpty(DEFAULT->commands) && | 1243 | if ((DEFAULT != NULL) && !Lst_IsEmptyS(DEFAULT->commands) && | |
1244 | (gn->type & OP_SPECIAL) == 0) { | 1244 | (gn->type & OP_SPECIAL) == 0) { | |
1245 | char *p1; | 1245 | char *p1; | |
1246 | /* | 1246 | /* | |
1247 | * Make only looks for a .DEFAULT if the node was never the | 1247 | * Make only looks for a .DEFAULT if the node was never the | |
1248 | * target of an operator, so that's what we do too. If | 1248 | * target of an operator, so that's what we do too. If | |
1249 | * a .DEFAULT was given, we substitute its commands for gn's | 1249 | * a .DEFAULT was given, we substitute its commands for gn's | |
1250 | * commands and set the IMPSRC variable to be the target's name | 1250 | * commands and set the IMPSRC variable to be the target's name | |
1251 | * The DEFAULT node acts like a transformation rule, in that | 1251 | * The DEFAULT node acts like a transformation rule, in that | |
1252 | * gn also inherits any attributes or sources attached to | 1252 | * gn also inherits any attributes or sources attached to | |
1253 | * .DEFAULT itself. | 1253 | * .DEFAULT itself. | |
1254 | */ | 1254 | */ | |
1255 | Make_HandleUse(DEFAULT, gn); | 1255 | Make_HandleUse(DEFAULT, gn); | |
1256 | Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn); | 1256 | Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn); | |
@@ -2661,28 +2661,28 @@ JobInterrupt(int runINTERRUPT, int signo | @@ -2661,28 +2661,28 @@ JobInterrupt(int runINTERRUPT, int signo | |||
2661 | * attached to the .END target. | 2661 | * attached to the .END target. | |
2662 | * | 2662 | * | |
2663 | * Results: | 2663 | * Results: | |
2664 | * Number of errors reported. | 2664 | * Number of errors reported. | |
2665 | * | 2665 | * | |
2666 | * Side Effects: | 2666 | * Side Effects: | |
2667 | * None. | 2667 | * None. | |
2668 | *----------------------------------------------------------------------- | 2668 | *----------------------------------------------------------------------- | |
2669 | */ | 2669 | */ | |
2670 | int | 2670 | int | |
2671 | Job_Finish(void) | 2671 | Job_Finish(void) | |
2672 | { | 2672 | { | |
2673 | if (postCommands != NULL && | 2673 | if (postCommands != NULL && | |
2674 | (!Lst_IsEmpty(postCommands->commands) || | 2674 | (!Lst_IsEmptyS(postCommands->commands) || | |
2675 | !Lst_IsEmpty(postCommands->children))) { | 2675 | !Lst_IsEmptyS(postCommands->children))) { | |
2676 | if (errors) { | 2676 | if (errors) { | |
2677 | Error("Errors reported so .END ignored"); | 2677 | Error("Errors reported so .END ignored"); | |
2678 | } else { | 2678 | } else { | |
2679 | JobRun(postCommands); | 2679 | JobRun(postCommands); | |
2680 | } | 2680 | } | |
2681 | } | 2681 | } | |
2682 | return errors; | 2682 | return errors; | |
2683 | } | 2683 | } | |
2684 | 2684 | |||
2685 | /*- | 2685 | /*- | |
2686 | *----------------------------------------------------------------------- | 2686 | *----------------------------------------------------------------------- | |
2687 | * Job_End -- | 2687 | * Job_End -- | |
2688 | * Cleanup any memory used by the jobs module | 2688 | * Cleanup any memory used by the jobs module |
--- src/usr.bin/make/lst.c 2020/08/27 07:03:48 1.46
+++ src/usr.bin/make/lst.c 2020/08/27 19:15:35 1.47
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 rillig Exp $ */ | 1 | /* $NetBSD: lst.c,v 1.47 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,31 +27,31 @@ | @@ -27,31 +27,31 @@ | |||
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 | * SUCH DAMAGE. | 32 | * SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <stdint.h> | 35 | #include <stdint.h> | |
36 | 36 | |||
37 | #include "make.h" | 37 | #include "make.h" | |
38 | 38 | |||
39 | #ifndef MAKE_NATIVE | 39 | #ifndef MAKE_NATIVE | |
40 | static char rcsid[] = "$NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 rillig Exp $"; | 40 | static char rcsid[] = "$NetBSD: lst.c,v 1.47 2020/08/27 19:15:35 rillig Exp $"; | |
41 | #else | 41 | #else | |
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | #ifndef lint | 43 | #ifndef lint | |
44 | __RCSID("$NetBSD: lst.c,v 1.46 2020/08/27 07:03:48 rillig Exp $"); | 44 | __RCSID("$NetBSD: lst.c,v 1.47 2020/08/27 19:15:35 rillig Exp $"); | |
45 | #endif /* not lint */ | 45 | #endif /* not lint */ | |
46 | #endif | 46 | #endif | |
47 | 47 | |||
48 | struct ListNode { | 48 | struct ListNode { | |
49 | struct ListNode *prev; /* previous element in list */ | 49 | struct ListNode *prev; /* previous element in list */ | |
50 | struct ListNode *next; /* next in list */ | 50 | struct ListNode *next; /* next in list */ | |
51 | uint8_t useCount; /* Count of functions using the node. | 51 | uint8_t useCount; /* Count of functions using the node. | |
52 | * node may not be deleted until count | 52 | * node may not be deleted until count | |
53 | * goes to 0 */ | 53 | * goes to 0 */ | |
54 | Boolean deleted; /* List node should be removed when done */ | 54 | Boolean deleted; /* List node should be removed when done */ | |
55 | union { | 55 | union { | |
56 | void *datum; /* datum associated with this element */ | 56 | void *datum; /* datum associated with this element */ | |
57 | const GNode *gnode; /* alias, just for debugging */ | 57 | const GNode *gnode; /* alias, just for debugging */ | |
@@ -380,33 +380,26 @@ Lst_PrevS(LstNode node) | @@ -380,33 +380,26 @@ Lst_PrevS(LstNode node) | |||
380 | /* Return the datum stored in the given node. */ | 380 | /* Return the datum stored in the given node. */ | |
381 | void * | 381 | void * | |
382 | Lst_DatumS(LstNode node) | 382 | Lst_DatumS(LstNode node) | |
383 | { | 383 | { | |
384 | assert(LstNodeIsValid(node)); | 384 | assert(LstNodeIsValid(node)); | |
385 | return node->datum; | 385 | return node->datum; | |
386 | } | 386 | } | |
387 | 387 | |||
388 | 388 | |||
389 | /* | 389 | /* | |
390 | * Functions for entire lists | 390 | * Functions for entire lists | |
391 | */ | 391 | */ | |
392 | 392 | |||
393 | /* Return TRUE if the given list is empty or invalid. */ | |||
394 | Boolean | |||
395 | Lst_IsEmpty(Lst list) | |||
396 | { | |||
397 | return !LstIsValid(list) || LstIsEmpty(list); | |||
398 | } | |||
399 | ||||
400 | /* Return TRUE if the given list is empty. */ | 393 | /* Return TRUE if the given list is empty. */ | |
401 | Boolean | 394 | Boolean | |
402 | Lst_IsEmptyS(Lst list) | 395 | Lst_IsEmptyS(Lst list) | |
403 | { | 396 | { | |
404 | assert(LstIsValid(list)); | 397 | assert(LstIsValid(list)); | |
405 | 398 | |||
406 | return LstIsEmpty(list); | 399 | return LstIsEmpty(list); | |
407 | } | 400 | } | |
408 | 401 | |||
409 | /* Return the first node from the given list for which the given comparison | 402 | /* Return the first node from the given list for which the given comparison | |
410 | * function returns 0, or NULL if none of the nodes matches. */ | 403 | * function returns 0, or NULL if none of the nodes matches. */ | |
411 | LstNode | 404 | LstNode | |
412 | Lst_Find(Lst list, LstFindProc cmp, const void *cmpData) | 405 | Lst_Find(Lst list, LstFindProc cmp, const void *cmpData) |
--- src/usr.bin/make/lst.h 2020/08/27 07:00:29 1.48
+++ src/usr.bin/make/lst.h 2020/08/27 19:15:35 1.49
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lst.h,v 1.48 2020/08/27 07:00:29 rillig Exp $ */ | 1 | /* $NetBSD: lst.h,v 1.49 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -96,27 +96,26 @@ typedef int LstFindProc(const void *, co | @@ -96,27 +96,26 @@ typedef int LstFindProc(const void *, co | |||
96 | typedef int LstActionProc(void *, void *); | 96 | typedef int LstActionProc(void *, void *); | |
97 | 97 | |||
98 | /* | 98 | /* | |
99 | * Creation/destruction functions | 99 | * Creation/destruction functions | |
100 | */ | 100 | */ | |
101 | /* Create a new list */ | 101 | /* Create a new list */ | |
102 | Lst Lst_Init(void); | 102 | Lst Lst_Init(void); | |
103 | /* Duplicate an existing list */ | 103 | /* Duplicate an existing list */ | |
104 | Lst Lst_CopyS(Lst, LstCopyProc); | 104 | Lst Lst_CopyS(Lst, LstCopyProc); | |
105 | /* Destroy an old one */ | 105 | /* Destroy an old one */ | |
106 | void Lst_FreeS(Lst); | 106 | void Lst_FreeS(Lst); | |
107 | void Lst_DestroyS(Lst, LstFreeProc); | 107 | void Lst_DestroyS(Lst, LstFreeProc); | |
108 | /* True if list is empty */ | 108 | /* True if list is empty */ | |
109 | Boolean Lst_IsEmpty(Lst); | |||
110 | Boolean Lst_IsEmptyS(Lst); | 109 | Boolean Lst_IsEmptyS(Lst); | |
111 | 110 | |||
112 | /* | 111 | /* | |
113 | * Functions to modify a list | 112 | * Functions to modify a list | |
114 | */ | 113 | */ | |
115 | /* Insert an element before another */ | 114 | /* Insert an element before another */ | |
116 | void Lst_InsertBeforeS(Lst, LstNode, void *); | 115 | void Lst_InsertBeforeS(Lst, LstNode, void *); | |
117 | /* Place an element at the front of a lst. */ | 116 | /* Place an element at the front of a lst. */ | |
118 | void Lst_PrependS(Lst, void *); | 117 | void Lst_PrependS(Lst, void *); | |
119 | /* Place an element at the end of a lst. */ | 118 | /* Place an element at the end of a lst. */ | |
120 | void Lst_AppendS(Lst, void *); | 119 | void Lst_AppendS(Lst, void *); | |
121 | /* Remove an element */ | 120 | /* Remove an element */ | |
122 | void Lst_RemoveS(Lst, LstNode); | 121 | void Lst_RemoveS(Lst, LstNode); |
--- src/usr.bin/make/main.c 2020/08/27 07:00:29 1.316
+++ src/usr.bin/make/main.c 2020/08/27 19:15:35 1.317
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: main.c,v 1.316 2020/08/27 07:00:29 rillig Exp $ */ | 1 | /* $NetBSD: main.c,v 1.317 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,39 +59,39 @@ | @@ -59,39 +59,39 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: main.c,v 1.316 2020/08/27 07:00:29 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: main.c,v 1.317 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ | 76 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ | |
77 | The Regents of the University of California. All rights reserved."); | 77 | The Regents of the University of California. All rights reserved."); | |
78 | #endif /* not lint */ | 78 | #endif /* not lint */ | |
79 | 79 | |||
80 | #ifndef lint | 80 | #ifndef lint | |
81 | #if 0 | 81 | #if 0 | |
82 | static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; | 82 | static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; | |
83 | #else | 83 | #else | |
84 | __RCSID("$NetBSD: main.c,v 1.316 2020/08/27 07:00:29 rillig Exp $"); | 84 | __RCSID("$NetBSD: main.c,v 1.317 2020/08/27 19:15:35 rillig Exp $"); | |
85 | #endif | 85 | #endif | |
86 | #endif /* not lint */ | 86 | #endif /* not lint */ | |
87 | #endif | 87 | #endif | |
88 | 88 | |||
89 | /*- | 89 | /*- | |
90 | * main.c -- | 90 | * main.c -- | |
91 | * The main file for this entire program. Exit routines etc | 91 | * The main file for this entire program. Exit routines etc | |
92 | * reside here. | 92 | * reside here. | |
93 | * | 93 | * | |
94 | * Utility functions defined in this file: | 94 | * Utility functions defined in this file: | |
95 | * Main_ParseArgLine Takes a line of arguments, breaks them and | 95 | * Main_ParseArgLine Takes a line of arguments, breaks them and | |
96 | * treats them as if they were given when first | 96 | * treats them as if they were given when first | |
97 | * invoked. Used by the parse module to implement | 97 | * invoked. Used by the parse module to implement | |
@@ -1265,27 +1265,27 @@ main(int argc, char **argv) | @@ -1265,27 +1265,27 @@ main(int argc, char **argv) | |||
1265 | Suff_Init(); | 1265 | Suff_Init(); | |
1266 | Trace_Init(tracefile); | 1266 | Trace_Init(tracefile); | |
1267 | 1267 | |||
1268 | DEFAULT = NULL; | 1268 | DEFAULT = NULL; | |
1269 | (void)time(&now); | 1269 | (void)time(&now); | |
1270 | 1270 | |||
1271 | Trace_Log(MAKESTART, NULL); | 1271 | Trace_Log(MAKESTART, NULL); | |
1272 | 1272 | |||
1273 | /* | 1273 | /* | |
1274 | * Set up the .TARGETS variable to contain the list of targets to be | 1274 | * Set up the .TARGETS variable to contain the list of targets to be | |
1275 | * created. If none specified, make the variable empty -- the parser | 1275 | * created. If none specified, make the variable empty -- the parser | |
1276 | * will fill the thing in with the default or .MAIN target. | 1276 | * will fill the thing in with the default or .MAIN target. | |
1277 | */ | 1277 | */ | |
1278 | if (!Lst_IsEmpty(create)) { | 1278 | if (!Lst_IsEmptyS(create)) { | |
1279 | LstNode ln; | 1279 | LstNode ln; | |
1280 | 1280 | |||
1281 | for (ln = Lst_First(create); ln != NULL; ln = Lst_SuccS(ln)) { | 1281 | for (ln = Lst_First(create); ln != NULL; ln = Lst_SuccS(ln)) { | |
1282 | char *name = Lst_DatumS(ln); | 1282 | char *name = Lst_DatumS(ln); | |
1283 | Var_Append(".TARGETS", name, VAR_GLOBAL); | 1283 | Var_Append(".TARGETS", name, VAR_GLOBAL); | |
1284 | } | 1284 | } | |
1285 | } else | 1285 | } else | |
1286 | Var_Set(".TARGETS", "", VAR_GLOBAL); | 1286 | Var_Set(".TARGETS", "", VAR_GLOBAL); | |
1287 | 1287 | |||
1288 | 1288 | |||
1289 | /* | 1289 | /* | |
1290 | * If no user-supplied system path was given (through the -m option) | 1290 | * If no user-supplied system path was given (through the -m option) | |
1291 | * add the directories from the DEFSYSPATH (more than one may be given | 1291 | * add the directories from the DEFSYSPATH (more than one may be given | |
@@ -1315,38 +1315,38 @@ main(int argc, char **argv) | @@ -1315,38 +1315,38 @@ main(int argc, char **argv) | |||
1315 | if (syspath != defsyspath) | 1315 | if (syspath != defsyspath) | |
1316 | free(syspath); | 1316 | free(syspath); | |
1317 | 1317 | |||
1318 | /* | 1318 | /* | |
1319 | * Read in the built-in rules first, followed by the specified | 1319 | * Read in the built-in rules first, followed by the specified | |
1320 | * makefile, if it was (makefile != NULL), or the default | 1320 | * makefile, if it was (makefile != NULL), or the default | |
1321 | * makefile and Makefile, in that order, if it wasn't. | 1321 | * makefile and Makefile, in that order, if it wasn't. | |
1322 | */ | 1322 | */ | |
1323 | if (!noBuiltins) { | 1323 | if (!noBuiltins) { | |
1324 | LstNode ln; | 1324 | LstNode ln; | |
1325 | 1325 | |||
1326 | sysMkPath = Lst_Init(); | 1326 | sysMkPath = Lst_Init(); | |
1327 | Dir_Expand(_PATH_DEFSYSMK, | 1327 | Dir_Expand(_PATH_DEFSYSMK, | |
1328 | Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, | 1328 | Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath, | |
1329 | sysMkPath); | 1329 | sysMkPath); | |
1330 | if (Lst_IsEmpty(sysMkPath)) | 1330 | if (Lst_IsEmptyS(sysMkPath)) | |
1331 | Fatal("%s: no system rules (%s).", progname, | 1331 | Fatal("%s: no system rules (%s).", progname, | |
1332 | _PATH_DEFSYSMK); | 1332 | _PATH_DEFSYSMK); | |
1333 | ln = Lst_Find(sysMkPath, ReadMakefile, NULL); | 1333 | ln = Lst_Find(sysMkPath, ReadMakefile, NULL); | |
1334 | if (ln == NULL) | 1334 | if (ln == NULL) | |
1335 | Fatal("%s: cannot open %s.", progname, | 1335 | Fatal("%s: cannot open %s.", progname, | |
1336 | (char *)Lst_DatumS(ln)); | 1336 | (char *)Lst_DatumS(ln)); | |
1337 | } | 1337 | } | |
1338 | 1338 | |||
1339 | if (!Lst_IsEmpty(makefiles)) { | 1339 | if (!Lst_IsEmptyS(makefiles)) { | |
1340 | LstNode ln; | 1340 | LstNode ln; | |
1341 | 1341 | |||
1342 | ln = Lst_Find(makefiles, ReadAllMakefiles, NULL); | 1342 | ln = Lst_Find(makefiles, ReadAllMakefiles, NULL); | |
1343 | if (ln != NULL) | 1343 | if (ln != NULL) | |
1344 | Fatal("%s: cannot open %s.", progname, | 1344 | Fatal("%s: cannot open %s.", progname, | |
1345 | (char *)Lst_DatumS(ln)); | 1345 | (char *)Lst_DatumS(ln)); | |
1346 | } else { | 1346 | } else { | |
1347 | p1 = Var_Subst("${" MAKEFILE_PREFERENCE "}", | 1347 | p1 = Var_Subst("${" MAKEFILE_PREFERENCE "}", | |
1348 | VAR_CMD, VARE_WANTRES); | 1348 | VAR_CMD, VARE_WANTRES); | |
1349 | if (p1) { | 1349 | if (p1) { | |
1350 | (void)str2Lst_Append(makefiles, p1, NULL); | 1350 | (void)str2Lst_Append(makefiles, p1, NULL); | |
1351 | (void)Lst_Find(makefiles, ReadMakefile, NULL); | 1351 | (void)Lst_Find(makefiles, ReadMakefile, NULL); | |
1352 | free(p1); | 1352 | free(p1); | |
@@ -1534,27 +1534,27 @@ ReadMakefile(const void *p, const void * | @@ -1534,27 +1534,27 @@ ReadMakefile(const void *p, const void * | |||
1534 | if (fd != -1) { | 1534 | if (fd != -1) { | |
1535 | fname = path; | 1535 | fname = path; | |
1536 | goto found; | 1536 | goto found; | |
1537 | } | 1537 | } | |
1538 | } else { | 1538 | } else { | |
1539 | fd = open(fname, O_RDONLY); | 1539 | fd = open(fname, O_RDONLY); | |
1540 | if (fd != -1) | 1540 | if (fd != -1) | |
1541 | goto found; | 1541 | goto found; | |
1542 | } | 1542 | } | |
1543 | /* look in -I and system include directories. */ | 1543 | /* look in -I and system include directories. */ | |
1544 | name = Dir_FindFile(fname, parseIncPath); | 1544 | name = Dir_FindFile(fname, parseIncPath); | |
1545 | if (!name) | 1545 | if (!name) | |
1546 | name = Dir_FindFile(fname, | 1546 | name = Dir_FindFile(fname, | |
1547 | Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath); | 1547 | Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath); | |
1548 | if (!name || (fd = open(name, O_RDONLY)) == -1) { | 1548 | if (!name || (fd = open(name, O_RDONLY)) == -1) { | |
1549 | free(name); | 1549 | free(name); | |
1550 | free(path); | 1550 | free(path); | |
1551 | return -1; | 1551 | return -1; | |
1552 | } | 1552 | } | |
1553 | fname = name; | 1553 | fname = name; | |
1554 | /* | 1554 | /* | |
1555 | * set the MAKEFILE variable desired by System V fans -- the | 1555 | * set the MAKEFILE variable desired by System V fans -- the | |
1556 | * placement of the setting here means it gets set to the last | 1556 | * placement of the setting here means it gets set to the last | |
1557 | * makefile specified, as it is set by SysV make. | 1557 | * makefile specified, as it is set by SysV make. | |
1558 | */ | 1558 | */ | |
1559 | found: | 1559 | found: | |
1560 | if (!doing_depend) | 1560 | if (!doing_depend) |
--- src/usr.bin/make/make.c 2020/08/27 06:53:57 1.126
+++ src/usr.bin/make/make.c 2020/08/27 19:15:35 1.127
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $ */ | 1 | /* $NetBSD: make.c,v 1.127 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: make.c,v 1.127 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; | 77 | static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $"); | 79 | __RCSID("$NetBSD: make.c,v 1.127 2020/08/27 19:15:35 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * make.c -- | 85 | * make.c -- | |
86 | * The functions which perform the examination of targets and | 86 | * The functions which perform the examination of targets and | |
87 | * their suitability for creation | 87 | * their suitability for creation | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Make_Run Initialize things for the module and recreate | 90 | * Make_Run Initialize things for the module and recreate | |
91 | * whatever needs recreating. Returns TRUE if | 91 | * whatever needs recreating. Returns TRUE if | |
92 | * work was (or would have been) done and FALSE | 92 | * work was (or would have been) done and FALSE | |
@@ -464,27 +464,27 @@ MakeFindChild(void *gnp, void *pgnp) | @@ -464,27 +464,27 @@ MakeFindChild(void *gnp, void *pgnp) | |||
464 | */ | 464 | */ | |
465 | void | 465 | void | |
466 | Make_HandleUse(GNode *cgn, GNode *pgn) | 466 | Make_HandleUse(GNode *cgn, GNode *pgn) | |
467 | { | 467 | { | |
468 | LstNode ln; /* An element in the children list */ | 468 | LstNode ln; /* An element in the children list */ | |
469 | 469 | |||
470 | #ifdef DEBUG_SRC | 470 | #ifdef DEBUG_SRC | |
471 | if ((cgn->type & (OP_USE|OP_USEBEFORE|OP_TRANSFORM)) == 0) { | 471 | if ((cgn->type & (OP_USE|OP_USEBEFORE|OP_TRANSFORM)) == 0) { | |
472 | fprintf(debug_file, "Make_HandleUse: called for plain node %s\n", cgn->name); | 472 | fprintf(debug_file, "Make_HandleUse: called for plain node %s\n", cgn->name); | |
473 | return; | 473 | return; | |
474 | } | 474 | } | |
475 | #endif | 475 | #endif | |
476 | 476 | |||
477 | if ((cgn->type & (OP_USE|OP_USEBEFORE)) || Lst_IsEmpty(pgn->commands)) { | 477 | if ((cgn->type & (OP_USE|OP_USEBEFORE)) || Lst_IsEmptyS(pgn->commands)) { | |
478 | if (cgn->type & OP_USEBEFORE) { | 478 | if (cgn->type & OP_USEBEFORE) { | |
479 | /* .USEBEFORE */ | 479 | /* .USEBEFORE */ | |
480 | Lst_PrependAllS(pgn->commands, cgn->commands); | 480 | Lst_PrependAllS(pgn->commands, cgn->commands); | |
481 | } else { | 481 | } else { | |
482 | /* .USE, or target has no commands */ | 482 | /* .USE, or target has no commands */ | |
483 | Lst_AppendAllS(pgn->commands, cgn->commands); | 483 | Lst_AppendAllS(pgn->commands, cgn->commands); | |
484 | } | 484 | } | |
485 | } | 485 | } | |
486 | 486 | |||
487 | Lst_OpenS(cgn->children); | 487 | Lst_OpenS(cgn->children); | |
488 | while ((ln = Lst_NextS(cgn->children)) != NULL) { | 488 | while ((ln = Lst_NextS(cgn->children)) != NULL) { | |
489 | GNode *gn = Lst_DatumS(ln); | 489 | GNode *gn = Lst_DatumS(ln); | |
490 | 490 | |||
@@ -604,27 +604,27 @@ Make_Recheck(GNode *gn) | @@ -604,27 +604,27 @@ Make_Recheck(GNode *gn) | |||
604 | * cmp -s y.tab.h parse.h || mv y.tab.h parse.h | 604 | * cmp -s y.tab.h parse.h || mv y.tab.h parse.h | |
605 | * | 605 | * | |
606 | * In this case, if the definitions produced by yacc haven't changed | 606 | * In this case, if the definitions produced by yacc haven't changed | |
607 | * from before, parse.h won't have been updated and gn->mtime will | 607 | * from before, parse.h won't have been updated and gn->mtime will | |
608 | * reflect the current modification time for parse.h. This is | 608 | * reflect the current modification time for parse.h. This is | |
609 | * something of a kludge, I admit, but it's a useful one.. | 609 | * something of a kludge, I admit, but it's a useful one.. | |
610 | * XXX: People like to use a rule like | 610 | * XXX: People like to use a rule like | |
611 | * | 611 | * | |
612 | * FRC: | 612 | * FRC: | |
613 | * | 613 | * | |
614 | * To force things that depend on FRC to be made, so we have to | 614 | * To force things that depend on FRC to be made, so we have to | |
615 | * check for gn->children being empty as well... | 615 | * check for gn->children being empty as well... | |
616 | */ | 616 | */ | |
617 | if (!Lst_IsEmpty(gn->commands) || Lst_IsEmpty(gn->children)) { | 617 | if (!Lst_IsEmptyS(gn->commands) || Lst_IsEmptyS(gn->children)) { | |
618 | gn->mtime = now; | 618 | gn->mtime = now; | |
619 | } | 619 | } | |
620 | #else | 620 | #else | |
621 | /* | 621 | /* | |
622 | * This is what Make does and it's actually a good thing, as it | 622 | * This is what Make does and it's actually a good thing, as it | |
623 | * allows rules like | 623 | * allows rules like | |
624 | * | 624 | * | |
625 | * cmp -s y.tab.h parse.h || cp y.tab.h parse.h | 625 | * cmp -s y.tab.h parse.h || cp y.tab.h parse.h | |
626 | * | 626 | * | |
627 | * to function as intended. Unfortunately, thanks to the stateless | 627 | * to function as intended. Unfortunately, thanks to the stateless | |
628 | * nature of NFS (by which I mean the loose coupling of two clients | 628 | * nature of NFS (by which I mean the loose coupling of two clients | |
629 | * using the same file from a common server), there are times | 629 | * using the same file from a common server), there are times | |
630 | * when the modification time of a file created on a remote | 630 | * when the modification time of a file created on a remote | |
@@ -714,27 +714,27 @@ Make_Update(GNode *cgn) | @@ -714,27 +714,27 @@ Make_Update(GNode *cgn) | |||
714 | * If the child was actually made, see what its modification time is | 714 | * If the child was actually made, see what its modification time is | |
715 | * now -- some rules won't actually update the file. If the file still | 715 | * now -- some rules won't actually update the file. If the file still | |
716 | * doesn't exist, make its mtime now. | 716 | * doesn't exist, make its mtime now. | |
717 | */ | 717 | */ | |
718 | if (cgn->made != UPTODATE) { | 718 | if (cgn->made != UPTODATE) { | |
719 | mtime = Make_Recheck(cgn); | 719 | mtime = Make_Recheck(cgn); | |
720 | } | 720 | } | |
721 | 721 | |||
722 | /* | 722 | /* | |
723 | * If this is a `::' node, we must consult its first instance | 723 | * If this is a `::' node, we must consult its first instance | |
724 | * which is where all parents are linked. | 724 | * which is where all parents are linked. | |
725 | */ | 725 | */ | |
726 | if ((centurion = cgn->centurion) != NULL) { | 726 | if ((centurion = cgn->centurion) != NULL) { | |
727 | if (!Lst_IsEmpty(cgn->parents)) | 727 | if (!Lst_IsEmptyS(cgn->parents)) | |
728 | Punt("%s%s: cohort has parents", cgn->name, cgn->cohort_num); | 728 | Punt("%s%s: cohort has parents", cgn->name, cgn->cohort_num); | |
729 | centurion->unmade_cohorts -= 1; | 729 | centurion->unmade_cohorts -= 1; | |
730 | if (centurion->unmade_cohorts < 0) | 730 | if (centurion->unmade_cohorts < 0) | |
731 | Error("Graph cycles through centurion %s", centurion->name); | 731 | Error("Graph cycles through centurion %s", centurion->name); | |
732 | } else { | 732 | } else { | |
733 | centurion = cgn; | 733 | centurion = cgn; | |
734 | } | 734 | } | |
735 | parents = centurion->parents; | 735 | parents = centurion->parents; | |
736 | 736 | |||
737 | /* If this was a .ORDER node, schedule the RHS */ | 737 | /* If this was a .ORDER node, schedule the RHS */ | |
738 | Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade)); | 738 | Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade)); | |
739 | 739 | |||
740 | /* Now mark all the parents as having one less unmade child */ | 740 | /* Now mark all the parents as having one less unmade child */ | |
@@ -1077,27 +1077,27 @@ MakeBuildParent(void *v_pn, void *toBeMa | @@ -1077,27 +1077,27 @@ MakeBuildParent(void *v_pn, void *toBeMa | |||
1077 | /* Mark so that when this node is built we reschedule its parents */ | 1077 | /* Mark so that when this node is built we reschedule its parents */ | |
1078 | pn->flags |= DONE_ORDER; | 1078 | pn->flags |= DONE_ORDER; | |
1079 | } | 1079 | } | |
1080 | 1080 | |||
1081 | return 0; | 1081 | return 0; | |
1082 | } | 1082 | } | |
1083 | 1083 | |||
1084 | static Boolean | 1084 | static Boolean | |
1085 | MakeStartJobs(void) | 1085 | MakeStartJobs(void) | |
1086 | { | 1086 | { | |
1087 | GNode *gn; | 1087 | GNode *gn; | |
1088 | int have_token = 0; | 1088 | int have_token = 0; | |
1089 | 1089 | |||
1090 | while (!Lst_IsEmpty(toBeMade)) { | 1090 | while (!Lst_IsEmptyS(toBeMade)) { | |
1091 | /* Get token now to avoid cycling job-list when we only have 1 token */ | 1091 | /* Get token now to avoid cycling job-list when we only have 1 token */ | |
1092 | if (!have_token && !Job_TokenWithdraw()) | 1092 | if (!have_token && !Job_TokenWithdraw()) | |
1093 | break; | 1093 | break; | |
1094 | have_token = 1; | 1094 | have_token = 1; | |
1095 | 1095 | |||
1096 | gn = Lst_DequeueS(toBeMade); | 1096 | gn = Lst_DequeueS(toBeMade); | |
1097 | if (DEBUG(MAKE)) | 1097 | if (DEBUG(MAKE)) | |
1098 | fprintf(debug_file, "Examining %s%s...\n", | 1098 | fprintf(debug_file, "Examining %s%s...\n", | |
1099 | gn->name, gn->cohort_num); | 1099 | gn->name, gn->cohort_num); | |
1100 | 1100 | |||
1101 | if (gn->made != REQUESTED) { | 1101 | if (gn->made != REQUESTED) { | |
1102 | if (DEBUG(MAKE)) | 1102 | if (DEBUG(MAKE)) | |
1103 | fprintf(debug_file, "state %d\n", gn->made); | 1103 | fprintf(debug_file, "state %d\n", gn->made); | |
@@ -1428,27 +1428,27 @@ Make_ProcessWait(Lst targs) | @@ -1428,27 +1428,27 @@ Make_ProcessWait(Lst targs) | |||
1428 | pgn->flags = REMAKE; | 1428 | pgn->flags = REMAKE; | |
1429 | pgn->type = OP_PHONY | OP_DEPENDS; | 1429 | pgn->type = OP_PHONY | OP_DEPENDS; | |
1430 | /* Get it displayed in the diag dumps */ | 1430 | /* Get it displayed in the diag dumps */ | |
1431 | Lst_PrependS(Targ_List(), pgn); | 1431 | Lst_PrependS(Targ_List(), pgn); | |
1432 | 1432 | |||
1433 | Lst_ForEachS(targs, link_parent, pgn); | 1433 | Lst_ForEachS(targs, link_parent, pgn); | |
1434 | 1434 | |||
1435 | /* Start building with the 'dummy' .MAIN' node */ | 1435 | /* Start building with the 'dummy' .MAIN' node */ | |
1436 | MakeBuildChild(pgn, NULL); | 1436 | MakeBuildChild(pgn, NULL); | |
1437 | 1437 | |||
1438 | examine = Lst_Init(); | 1438 | examine = Lst_Init(); | |
1439 | Lst_AppendS(examine, pgn); | 1439 | Lst_AppendS(examine, pgn); | |
1440 | 1440 | |||
1441 | while (!Lst_IsEmpty(examine)) { | 1441 | while (!Lst_IsEmptyS(examine)) { | |
1442 | pgn = Lst_DequeueS(examine); | 1442 | pgn = Lst_DequeueS(examine); | |
1443 | 1443 | |||
1444 | /* We only want to process each child-list once */ | 1444 | /* We only want to process each child-list once */ | |
1445 | if (pgn->flags & DONE_WAIT) | 1445 | if (pgn->flags & DONE_WAIT) | |
1446 | continue; | 1446 | continue; | |
1447 | pgn->flags |= DONE_WAIT; | 1447 | pgn->flags |= DONE_WAIT; | |
1448 | if (DEBUG(MAKE)) | 1448 | if (DEBUG(MAKE)) | |
1449 | fprintf(debug_file, "Make_ProcessWait: examine %s\n", pgn->name); | 1449 | fprintf(debug_file, "Make_ProcessWait: examine %s\n", pgn->name); | |
1450 | 1450 | |||
1451 | if (pgn->type & OP_DOUBLEDEP) | 1451 | if (pgn->type & OP_DOUBLEDEP) | |
1452 | Lst_PrependAllS(examine, pgn->cohorts); | 1452 | Lst_PrependAllS(examine, pgn->cohorts); | |
1453 | 1453 | |||
1454 | owln = Lst_First(pgn->children); | 1454 | owln = Lst_First(pgn->children); | |
@@ -1526,27 +1526,27 @@ Make_Run(Lst targs) | @@ -1526,27 +1526,27 @@ Make_Run(Lst targs) | |||
1526 | */ | 1526 | */ | |
1527 | (void)MakeStartJobs(); | 1527 | (void)MakeStartJobs(); | |
1528 | 1528 | |||
1529 | /* | 1529 | /* | |
1530 | * Main Loop: The idea here is that the ending of jobs will take | 1530 | * Main Loop: The idea here is that the ending of jobs will take | |
1531 | * care of the maintenance of data structures and the waiting for output | 1531 | * care of the maintenance of data structures and the waiting for output | |
1532 | * will cause us to be idle most of the time while our children run as | 1532 | * will cause us to be idle most of the time while our children run as | |
1533 | * much as possible. Because the job table is kept as full as possible, | 1533 | * much as possible. Because the job table is kept as full as possible, | |
1534 | * the only time when it will be empty is when all the jobs which need | 1534 | * the only time when it will be empty is when all the jobs which need | |
1535 | * running have been run, so that is the end condition of this loop. | 1535 | * running have been run, so that is the end condition of this loop. | |
1536 | * Note that the Job module will exit if there were any errors unless the | 1536 | * Note that the Job module will exit if there were any errors unless the | |
1537 | * keepgoing flag was given. | 1537 | * keepgoing flag was given. | |
1538 | */ | 1538 | */ | |
1539 | while (!Lst_IsEmpty(toBeMade) || jobTokensRunning > 0) { | 1539 | while (!Lst_IsEmptyS(toBeMade) || jobTokensRunning > 0) { | |
1540 | Job_CatchOutput(); | 1540 | Job_CatchOutput(); | |
1541 | (void)MakeStartJobs(); | 1541 | (void)MakeStartJobs(); | |
1542 | } | 1542 | } | |
1543 | 1543 | |||
1544 | errors = Job_Finish(); | 1544 | errors = Job_Finish(); | |
1545 | 1545 | |||
1546 | /* | 1546 | /* | |
1547 | * Print the final status of each target. E.g. if it wasn't made | 1547 | * Print the final status of each target. E.g. if it wasn't made | |
1548 | * because some inferior reported an error. | 1548 | * because some inferior reported an error. | |
1549 | */ | 1549 | */ | |
1550 | if (DEBUG(MAKE)) | 1550 | if (DEBUG(MAKE)) | |
1551 | fprintf(debug_file, "done: errors %d\n", errors); | 1551 | fprintf(debug_file, "done: errors %d\n", errors); | |
1552 | if (errors == 0) { | 1552 | if (errors == 0) { |
--- src/usr.bin/make/meta.c 2020/08/27 07:00:29 1.102
+++ src/usr.bin/make/meta.c 2020/08/27 19:15:35 1.103
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: meta.c,v 1.102 2020/08/27 07:00:29 rillig Exp $ */ | 1 | /* $NetBSD: meta.c,v 1.103 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Implement 'meta' mode. | 4 | * Implement 'meta' mode. | |
5 | * Adapted from John Birrell's patches to FreeBSD make. | 5 | * Adapted from John Birrell's patches to FreeBSD make. | |
6 | * --sjg | 6 | * --sjg | |
7 | */ | 7 | */ | |
8 | /* | 8 | /* | |
9 | * Copyright (c) 2009-2016, Juniper Networks, Inc. | 9 | * Copyright (c) 2009-2016, Juniper Networks, Inc. | |
10 | * Portions Copyright (c) 2009, John Birrell. | 10 | * Portions Copyright (c) 2009, John Birrell. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -406,27 +406,27 @@ meta_needed(GNode *gn, const char *dname | @@ -406,27 +406,27 @@ meta_needed(GNode *gn, const char *dname | |||
406 | 406 | |||
407 | /* This may be a phony node which we don't want meta data for... */ | 407 | /* This may be a phony node which we don't want meta data for... */ | |
408 | /* Skip .meta for .BEGIN, .END, .ERROR etc as well. */ | 408 | /* Skip .meta for .BEGIN, .END, .ERROR etc as well. */ | |
409 | /* Or it may be explicitly flagged as .NOMETA */ | 409 | /* Or it may be explicitly flagged as .NOMETA */ | |
410 | SKIP_META_TYPE(NOMETA); | 410 | SKIP_META_TYPE(NOMETA); | |
411 | /* Unless it is explicitly flagged as .META */ | 411 | /* Unless it is explicitly flagged as .META */ | |
412 | if (!(gn->type & OP_META)) { | 412 | if (!(gn->type & OP_META)) { | |
413 | SKIP_META_TYPE(PHONY); | 413 | SKIP_META_TYPE(PHONY); | |
414 | SKIP_META_TYPE(SPECIAL); | 414 | SKIP_META_TYPE(SPECIAL); | |
415 | SKIP_META_TYPE(MAKE); | 415 | SKIP_META_TYPE(MAKE); | |
416 | } | 416 | } | |
417 | 417 | |||
418 | /* Check if there are no commands to execute. */ | 418 | /* Check if there are no commands to execute. */ | |
419 | if (Lst_IsEmpty(gn->commands)) { | 419 | if (Lst_IsEmptyS(gn->commands)) { | |
420 | if (verbose) | 420 | if (verbose) | |
421 | fprintf(debug_file, "Skipping meta for %s: no commands\n", | 421 | fprintf(debug_file, "Skipping meta for %s: no commands\n", | |
422 | gn->name); | 422 | gn->name); | |
423 | return FALSE; | 423 | return FALSE; | |
424 | } | 424 | } | |
425 | if ((gn->type & (OP_META|OP_SUBMAKE)) == OP_SUBMAKE) { | 425 | if ((gn->type & (OP_META|OP_SUBMAKE)) == OP_SUBMAKE) { | |
426 | /* OP_SUBMAKE is a bit too aggressive */ | 426 | /* OP_SUBMAKE is a bit too aggressive */ | |
427 | if (Lst_ForEachS(gn->commands, is_submake, gn)) { | 427 | if (Lst_ForEachS(gn->commands, is_submake, gn)) { | |
428 | if (DEBUG(META)) | 428 | if (DEBUG(META)) | |
429 | fprintf(debug_file, "Skipping meta for %s: .SUBMAKE\n", | 429 | fprintf(debug_file, "Skipping meta for %s: .SUBMAKE\n", | |
430 | gn->name); | 430 | gn->name); | |
431 | return FALSE; | 431 | return FALSE; | |
432 | } | 432 | } | |
@@ -1322,27 +1322,27 @@ meta_oodate(GNode *gn, Boolean oodate) | @@ -1322,27 +1322,27 @@ meta_oodate(GNode *gn, Boolean oodate) | |||
1322 | */ | 1322 | */ | |
1323 | cp = p; /* save this for a second */ | 1323 | cp = p; /* save this for a second */ | |
1324 | /* now get target */ | 1324 | /* now get target */ | |
1325 | if (strsep(&p, " ") == NULL) | 1325 | if (strsep(&p, " ") == NULL) | |
1326 | continue; | 1326 | continue; | |
1327 | CHECK_VALID_META(p); | 1327 | CHECK_VALID_META(p); | |
1328 | move_target = p; | 1328 | move_target = p; | |
1329 | p = cp; | 1329 | p = cp; | |
1330 | /* 'L' and 'M' put single quotes around the args */ | 1330 | /* 'L' and 'M' put single quotes around the args */ | |
1331 | DEQUOTE(p); | 1331 | DEQUOTE(p); | |
1332 | DEQUOTE(move_target); | 1332 | DEQUOTE(move_target); | |
1333 | /* FALLTHROUGH */ | 1333 | /* FALLTHROUGH */ | |
1334 | case 'D': /* unlink */ | 1334 | case 'D': /* unlink */ | |
1335 | if (*p == '/' && !Lst_IsEmpty(missingFiles)) { | 1335 | if (*p == '/' && !Lst_IsEmptyS(missingFiles)) { | |
1336 | /* remove any missingFiles entries that match p */ | 1336 | /* remove any missingFiles entries that match p */ | |
1337 | ln = Lst_Find(missingFiles, path_match, p); | 1337 | ln = Lst_Find(missingFiles, path_match, p); | |
1338 | if (ln != NULL) { | 1338 | if (ln != NULL) { | |
1339 | LstNode nln; | 1339 | LstNode nln; | |
1340 | char *tp; | 1340 | char *tp; | |
1341 | 1341 | |||
1342 | do { | 1342 | do { | |
1343 | nln = Lst_FindFrom(missingFiles, Lst_SuccS(ln), | 1343 | nln = Lst_FindFrom(missingFiles, Lst_SuccS(ln), | |
1344 | path_match, p); | 1344 | path_match, p); | |
1345 | tp = Lst_DatumS(ln); | 1345 | tp = Lst_DatumS(ln); | |
1346 | Lst_RemoveS(missingFiles, ln); | 1346 | Lst_RemoveS(missingFiles, ln); | |
1347 | free(tp); | 1347 | free(tp); | |
1348 | } while ((ln = nln) != NULL); | 1348 | } while ((ln = nln) != NULL); | |
@@ -1380,27 +1380,27 @@ meta_oodate(GNode *gn, Boolean oodate) | @@ -1380,27 +1380,27 @@ meta_oodate(GNode *gn, Boolean oodate) | |||
1380 | #endif | 1380 | #endif | |
1381 | /* FALLTHROUGH */ | 1381 | /* FALLTHROUGH */ | |
1382 | case 'W': /* Write */ | 1382 | case 'W': /* Write */ | |
1383 | check_write: | 1383 | check_write: | |
1384 | /* | 1384 | /* | |
1385 | * If a file we generated within our bailiwick | 1385 | * If a file we generated within our bailiwick | |
1386 | * but outside of .OBJDIR is missing, | 1386 | * but outside of .OBJDIR is missing, | |
1387 | * we need to do it again. | 1387 | * we need to do it again. | |
1388 | */ | 1388 | */ | |
1389 | /* ignore non-absolute paths */ | 1389 | /* ignore non-absolute paths */ | |
1390 | if (*p != '/') | 1390 | if (*p != '/') | |
1391 | break; | 1391 | break; | |
1392 | 1392 | |||
1393 | if (Lst_IsEmpty(metaBailiwick)) | 1393 | if (Lst_IsEmptyS(metaBailiwick)) | |
1394 | break; | 1394 | break; | |
1395 | 1395 | |||
1396 | /* ignore cwd - normal dependencies handle those */ | 1396 | /* ignore cwd - normal dependencies handle those */ | |
1397 | if (strncmp(p, cwd, cwdlen) == 0) | 1397 | if (strncmp(p, cwd, cwdlen) == 0) | |
1398 | break; | 1398 | break; | |
1399 | 1399 | |||
1400 | if (!Lst_ForEachS(metaBailiwick, prefix_match, p)) | 1400 | if (!Lst_ForEachS(metaBailiwick, prefix_match, p)) | |
1401 | break; | 1401 | break; | |
1402 | 1402 | |||
1403 | /* tmpdir might be within */ | 1403 | /* tmpdir might be within */ | |
1404 | if (tmplen > 0 && strncmp(p, tmpdir, tmplen) == 0) | 1404 | if (tmplen > 0 && strncmp(p, tmpdir, tmplen) == 0) | |
1405 | break; | 1405 | break; | |
1406 | 1406 | |||
@@ -1585,27 +1585,27 @@ meta_oodate(GNode *gn, Boolean oodate) | @@ -1585,27 +1585,27 @@ meta_oodate(GNode *gn, Boolean oodate) | |||
1585 | fprintf(debug_file, "%s: %d: there are extra build commands now that weren't in the meta data file\n", fname, lineno); | 1585 | fprintf(debug_file, "%s: %d: there are extra build commands now that weren't in the meta data file\n", fname, lineno); | |
1586 | oodate = TRUE; | 1586 | oodate = TRUE; | |
1587 | } | 1587 | } | |
1588 | CHECK_VALID_META(p); | 1588 | CHECK_VALID_META(p); | |
1589 | if (strcmp(p, cwd) != 0) { | 1589 | if (strcmp(p, cwd) != 0) { | |
1590 | if (DEBUG(META)) | 1590 | if (DEBUG(META)) | |
1591 | fprintf(debug_file, "%s: %d: the current working directory has changed from '%s' to '%s'\n", fname, lineno, p, curdir); | 1591 | fprintf(debug_file, "%s: %d: the current working directory has changed from '%s' to '%s'\n", fname, lineno, p, curdir); | |
1592 | oodate = TRUE; | 1592 | oodate = TRUE; | |
1593 | } | 1593 | } | |
1594 | } | 1594 | } | |
1595 | } | 1595 | } | |
1596 | 1596 | |||
1597 | fclose(fp); | 1597 | fclose(fp); | |
1598 | if (!Lst_IsEmpty(missingFiles)) { | 1598 | if (!Lst_IsEmptyS(missingFiles)) { | |
1599 | if (DEBUG(META)) | 1599 | if (DEBUG(META)) | |
1600 | fprintf(debug_file, "%s: missing files: %s...\n", | 1600 | fprintf(debug_file, "%s: missing files: %s...\n", | |
1601 | fname, (char *)Lst_DatumS(Lst_First(missingFiles))); | 1601 | fname, (char *)Lst_DatumS(Lst_First(missingFiles))); | |
1602 | oodate = TRUE; | 1602 | oodate = TRUE; | |
1603 | } | 1603 | } | |
1604 | if (!oodate && !have_filemon && filemonMissing) { | 1604 | if (!oodate && !have_filemon && filemonMissing) { | |
1605 | if (DEBUG(META)) | 1605 | if (DEBUG(META)) | |
1606 | fprintf(debug_file, "%s: missing filemon data\n", fname); | 1606 | fprintf(debug_file, "%s: missing filemon data\n", fname); | |
1607 | oodate = TRUE; | 1607 | oodate = TRUE; | |
1608 | } | 1608 | } | |
1609 | } else { | 1609 | } else { | |
1610 | if (writeMeta && (metaMissing || (gn->type & OP_META))) { | 1610 | if (writeMeta && (metaMissing || (gn->type & OP_META))) { | |
1611 | cp = NULL; | 1611 | cp = NULL; |
--- src/usr.bin/make/parse.c 2020/08/27 07:03:48 1.266
+++ src/usr.bin/make/parse.c 2020/08/27 19:15:35 1.267
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 rillig Exp $ */ | 1 | /* $NetBSD: parse.c,v 1.267 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: parse.c,v 1.267 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; | 77 | static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: parse.c,v 1.266 2020/08/27 07:03:48 rillig Exp $"); | 79 | __RCSID("$NetBSD: parse.c,v 1.267 2020/08/27 19:15:35 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * parse.c -- | 85 | * parse.c -- | |
86 | * Functions to parse a makefile. | 86 | * Functions to parse a makefile. | |
87 | * | 87 | * | |
88 | * One function, Parse_Init, must be called before any functions | 88 | * One function, Parse_Init, must be called before any functions | |
89 | * in this module are used. After that, the function Parse_File is the | 89 | * in this module are used. After that, the function Parse_File is the | |
90 | * main entry point and controls most of the other functions in this | 90 | * main entry point and controls most of the other functions in this | |
91 | * module. | 91 | * module. | |
92 | * | 92 | * | |
@@ -842,27 +842,27 @@ ParseMessage(char *line) | @@ -842,27 +842,27 @@ ParseMessage(char *line) | |||
842 | * | 842 | * | |
843 | * Side Effects: | 843 | * Side Effects: | |
844 | * New elements are added to the parents list of cgn and the | 844 | * New elements are added to the parents list of cgn and the | |
845 | * children list of cgn. the unmade field of pgn is updated | 845 | * children list of cgn. the unmade field of pgn is updated | |
846 | * to reflect the additional child. | 846 | * to reflect the additional child. | |
847 | *--------------------------------------------------------------------- | 847 | *--------------------------------------------------------------------- | |
848 | */ | 848 | */ | |
849 | static int | 849 | static int | |
850 | ParseLinkSrc(void *pgnp, void *cgnp) | 850 | ParseLinkSrc(void *pgnp, void *cgnp) | |
851 | { | 851 | { | |
852 | GNode *pgn = (GNode *)pgnp; | 852 | GNode *pgn = (GNode *)pgnp; | |
853 | GNode *cgn = (GNode *)cgnp; | 853 | GNode *cgn = (GNode *)cgnp; | |
854 | 854 | |||
855 | if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(pgn->cohorts)) | 855 | if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(pgn->cohorts)) | |
856 | pgn = Lst_DatumS(Lst_LastS(pgn->cohorts)); | 856 | pgn = Lst_DatumS(Lst_LastS(pgn->cohorts)); | |
857 | Lst_AppendS(pgn->children, cgn); | 857 | Lst_AppendS(pgn->children, cgn); | |
858 | if (specType == Not) | 858 | if (specType == Not) | |
859 | Lst_AppendS(cgn->parents, pgn); | 859 | Lst_AppendS(cgn->parents, pgn); | |
860 | pgn->unmade += 1; | 860 | pgn->unmade += 1; | |
861 | if (DEBUG(PARSE)) { | 861 | if (DEBUG(PARSE)) { | |
862 | fprintf(debug_file, "# %s: added child %s - %s\n", __func__, | 862 | fprintf(debug_file, "# %s: added child %s - %s\n", __func__, | |
863 | pgn->name, cgn->name); | 863 | pgn->name, cgn->name); | |
864 | Targ_PrintNode(pgn, 0); | 864 | Targ_PrintNode(pgn, 0); | |
865 | Targ_PrintNode(cgn, 0); | 865 | Targ_PrintNode(cgn, 0); | |
866 | } | 866 | } | |
867 | return 0; | 867 | return 0; | |
868 | } | 868 | } | |
@@ -1350,27 +1350,27 @@ ParseDoDependency(char *line) | @@ -1350,27 +1350,27 @@ ParseDoDependency(char *line) | |||
1350 | * main target. | 1350 | * main target. | |
1351 | * .NOTPARALLEL Make only one target at a time. | 1351 | * .NOTPARALLEL Make only one target at a time. | |
1352 | * .SINGLESHELL Create a shell for each command. | 1352 | * .SINGLESHELL Create a shell for each command. | |
1353 | * .ORDER Must set initial predecessor to NULL | 1353 | * .ORDER Must set initial predecessor to NULL | |
1354 | */ | 1354 | */ | |
1355 | switch (specType) { | 1355 | switch (specType) { | |
1356 | case ExPath: | 1356 | case ExPath: | |
1357 | if (paths == NULL) { | 1357 | if (paths == NULL) { | |
1358 | paths = Lst_Init(); | 1358 | paths = Lst_Init(); | |
1359 | } | 1359 | } | |
1360 | Lst_AppendS(paths, dirSearchPath); | 1360 | Lst_AppendS(paths, dirSearchPath); | |
1361 | break; | 1361 | break; | |
1362 | case Main: | 1362 | case Main: | |
1363 | if (!Lst_IsEmpty(create)) { | 1363 | if (!Lst_IsEmptyS(create)) { | |
1364 | specType = Not; | 1364 | specType = Not; | |
1365 | } | 1365 | } | |
1366 | break; | 1366 | break; | |
1367 | case Begin: | 1367 | case Begin: | |
1368 | case End: | 1368 | case End: | |
1369 | case Stale: | 1369 | case Stale: | |
1370 | case dotError: | 1370 | case dotError: | |
1371 | case Interrupt: | 1371 | case Interrupt: | |
1372 | gn = Targ_FindNode(line, TARG_CREATE); | 1372 | gn = Targ_FindNode(line, TARG_CREATE); | |
1373 | if (doing_depend) | 1373 | if (doing_depend) | |
1374 | ParseMark(gn); | 1374 | ParseMark(gn); | |
1375 | gn->type |= OP_NOTMAIN|OP_SPECIAL; | 1375 | gn->type |= OP_NOTMAIN|OP_SPECIAL; | |
1376 | Lst_AppendS(targets, gn); | 1376 | Lst_AppendS(targets, gn); | |
@@ -1437,27 +1437,27 @@ ParseDoDependency(char *line) | @@ -1437,27 +1437,27 @@ ParseDoDependency(char *line) | |||
1437 | Dir_Expand(line, emptyPath, curTargs); | 1437 | Dir_Expand(line, emptyPath, curTargs); | |
1438 | 1438 | |||
1439 | Lst_DestroyS(emptyPath, Dir_Destroy); | 1439 | Lst_DestroyS(emptyPath, Dir_Destroy); | |
1440 | } else { | 1440 | } else { | |
1441 | /* | 1441 | /* | |
1442 | * No wildcards, but we want to avoid code duplication, | 1442 | * No wildcards, but we want to avoid code duplication, | |
1443 | * so create a list with the word on it. | 1443 | * so create a list with the word on it. | |
1444 | */ | 1444 | */ | |
1445 | Lst_AppendS(curTargs, line); | 1445 | Lst_AppendS(curTargs, line); | |
1446 | } | 1446 | } | |
1447 | 1447 | |||
1448 | /* Apply the targets. */ | 1448 | /* Apply the targets. */ | |
1449 | 1449 | |||
1450 | while(!Lst_IsEmpty(curTargs)) { | 1450 | while(!Lst_IsEmptyS(curTargs)) { | |
1451 | char *targName = Lst_DequeueS(curTargs); | 1451 | char *targName = Lst_DequeueS(curTargs); | |
1452 | 1452 | |||
1453 | if (!Suff_IsTransform (targName)) { | 1453 | if (!Suff_IsTransform (targName)) { | |
1454 | gn = Targ_FindNode(targName, TARG_CREATE); | 1454 | gn = Targ_FindNode(targName, TARG_CREATE); | |
1455 | } else { | 1455 | } else { | |
1456 | gn = Suff_AddTransform(targName); | 1456 | gn = Suff_AddTransform(targName); | |
1457 | } | 1457 | } | |
1458 | if (doing_depend) | 1458 | if (doing_depend) | |
1459 | ParseMark(gn); | 1459 | ParseMark(gn); | |
1460 | 1460 | |||
1461 | Lst_AppendS(targets, gn); | 1461 | Lst_AppendS(targets, gn); | |
1462 | } | 1462 | } | |
1463 | } else if (specType == ExPath && *line != '.' && *line != '\0') { | 1463 | } else if (specType == ExPath && *line != '.' && *line != '\0') { | |
@@ -1490,27 +1490,27 @@ ParseDoDependency(char *line) | @@ -1490,27 +1490,27 @@ ParseDoDependency(char *line) | |||
1490 | cp++; | 1490 | cp++; | |
1491 | } | 1491 | } | |
1492 | } | 1492 | } | |
1493 | line = cp; | 1493 | line = cp; | |
1494 | } while (*line && (ParseIsEscaped(lstart, line) || | 1494 | } while (*line && (ParseIsEscaped(lstart, line) || | |
1495 | (*line != '!' && *line != ':'))); | 1495 | (*line != '!' && *line != ':'))); | |
1496 | 1496 | |||
1497 | /* | 1497 | /* | |
1498 | * Don't need the list of target names anymore... | 1498 | * Don't need the list of target names anymore... | |
1499 | */ | 1499 | */ | |
1500 | Lst_FreeS(curTargs); | 1500 | Lst_FreeS(curTargs); | |
1501 | curTargs = NULL; | 1501 | curTargs = NULL; | |
1502 | 1502 | |||
1503 | if (!Lst_IsEmpty(targets)) { | 1503 | if (targets != NULL && !Lst_IsEmptyS(targets)) { | |
1504 | switch(specType) { | 1504 | switch(specType) { | |
1505 | default: | 1505 | default: | |
1506 | Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored"); | 1506 | Parse_Error(PARSE_WARNING, "Special and mundane targets don't mix. Mundane ones ignored"); | |
1507 | break; | 1507 | break; | |
1508 | case Default: | 1508 | case Default: | |
1509 | case Stale: | 1509 | case Stale: | |
1510 | case Begin: | 1510 | case Begin: | |
1511 | case End: | 1511 | case End: | |
1512 | case dotError: | 1512 | case dotError: | |
1513 | case Interrupt: | 1513 | case Interrupt: | |
1514 | /* | 1514 | /* | |
1515 | * These four create nodes on which to hang commands, so | 1515 | * These four create nodes on which to hang commands, so | |
1516 | * targets shouldn't be empty... | 1516 | * targets shouldn't be empty... | |
@@ -1715,27 +1715,27 @@ ParseDoDependency(char *line) | @@ -1715,27 +1715,27 @@ ParseDoDependency(char *line) | |||
1715 | */ | 1715 | */ | |
1716 | break; | 1716 | break; | |
1717 | } | 1717 | } | |
1718 | } | 1718 | } | |
1719 | 1719 | |||
1720 | if (*cp == LPAREN) { | 1720 | if (*cp == LPAREN) { | |
1721 | sources = Lst_Init(); | 1721 | sources = Lst_Init(); | |
1722 | if (!Arch_ParseArchive(&line, sources, VAR_CMD)) { | 1722 | if (!Arch_ParseArchive(&line, sources, VAR_CMD)) { | |
1723 | Parse_Error(PARSE_FATAL, | 1723 | Parse_Error(PARSE_FATAL, | |
1724 | "Error in source archive spec \"%s\"", line); | 1724 | "Error in source archive spec \"%s\"", line); | |
1725 | goto out; | 1725 | goto out; | |
1726 | } | 1726 | } | |
1727 | 1727 | |||
1728 | while (!Lst_IsEmpty(sources)) { | 1728 | while (!Lst_IsEmptyS(sources)) { | |
1729 | gn = Lst_DequeueS(sources); | 1729 | gn = Lst_DequeueS(sources); | |
1730 | ParseDoSrc(tOp, gn->name); | 1730 | ParseDoSrc(tOp, gn->name); | |
1731 | } | 1731 | } | |
1732 | Lst_FreeS(sources); | 1732 | Lst_FreeS(sources); | |
1733 | cp = line; | 1733 | cp = line; | |
1734 | } else { | 1734 | } else { | |
1735 | if (*cp) { | 1735 | if (*cp) { | |
1736 | *cp = '\0'; | 1736 | *cp = '\0'; | |
1737 | cp += 1; | 1737 | cp += 1; | |
1738 | } | 1738 | } | |
1739 | 1739 | |||
1740 | ParseDoSrc(tOp, line); | 1740 | ParseDoSrc(tOp, line); | |
1741 | } | 1741 | } | |
@@ -2077,27 +2077,27 @@ ParseMaybeSubMake(const char *cmd) | @@ -2077,27 +2077,27 @@ ParseMaybeSubMake(const char *cmd) | |||
2077 | * Always 0 | 2077 | * Always 0 | |
2078 | * | 2078 | * | |
2079 | * Side Effects: | 2079 | * Side Effects: | |
2080 | * A new element is added to the commands list of the node, | 2080 | * A new element is added to the commands list of the node, | |
2081 | * and the node can be marked as a submake node if the command is | 2081 | * and the node can be marked as a submake node if the command is | |
2082 | * determined to be that. | 2082 | * determined to be that. | |
2083 | */ | 2083 | */ | |
2084 | static int | 2084 | static int | |
2085 | ParseAddCmd(void *gnp, void *cmd) | 2085 | ParseAddCmd(void *gnp, void *cmd) | |
2086 | { | 2086 | { | |
2087 | GNode *gn = (GNode *)gnp; | 2087 | GNode *gn = (GNode *)gnp; | |
2088 | 2088 | |||
2089 | /* Add to last (ie current) cohort for :: targets */ | 2089 | /* Add to last (ie current) cohort for :: targets */ | |
2090 | if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts)) | 2090 | if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(gn->cohorts)) | |
2091 | gn = Lst_DatumS(Lst_LastS(gn->cohorts)); | 2091 | gn = Lst_DatumS(Lst_LastS(gn->cohorts)); | |
2092 | 2092 | |||
2093 | /* if target already supplied, ignore commands */ | 2093 | /* if target already supplied, ignore commands */ | |
2094 | if (!(gn->type & OP_HAS_COMMANDS)) { | 2094 | if (!(gn->type & OP_HAS_COMMANDS)) { | |
2095 | Lst_AppendS(gn->commands, cmd); | 2095 | Lst_AppendS(gn->commands, cmd); | |
2096 | if (ParseMaybeSubMake(cmd)) | 2096 | if (ParseMaybeSubMake(cmd)) | |
2097 | gn->type |= OP_SUBMAKE; | 2097 | gn->type |= OP_SUBMAKE; | |
2098 | ParseMark(gn); | 2098 | ParseMark(gn); | |
2099 | } else { | 2099 | } else { | |
2100 | #ifdef notyet | 2100 | #ifdef notyet | |
2101 | /* XXX: We cannot do this until we fix the tree */ | 2101 | /* XXX: We cannot do this until we fix the tree */ | |
2102 | Lst_AppendS(gn->commands, cmd); | 2102 | Lst_AppendS(gn->commands, cmd); | |
2103 | Parse_Error(PARSE_WARNING, | 2103 | Parse_Error(PARSE_WARNING, | |
@@ -2129,27 +2129,27 @@ ParseAddCmd(void *gnp, void *cmd) | @@ -2129,27 +2129,27 @@ ParseAddCmd(void *gnp, void *cmd) | |||
2129 | * | 2129 | * | |
2130 | * Results: | 2130 | * Results: | |
2131 | * None | 2131 | * None | |
2132 | * | 2132 | * | |
2133 | * Side Effects: | 2133 | * Side Effects: | |
2134 | * OP_HAS_COMMANDS may be set for the target. | 2134 | * OP_HAS_COMMANDS may be set for the target. | |
2135 | * | 2135 | * | |
2136 | *----------------------------------------------------------------------- | 2136 | *----------------------------------------------------------------------- | |
2137 | */ | 2137 | */ | |
2138 | static void | 2138 | static void | |
2139 | ParseHasCommands(void *gnp) | 2139 | ParseHasCommands(void *gnp) | |
2140 | { | 2140 | { | |
2141 | GNode *gn = (GNode *)gnp; | 2141 | GNode *gn = (GNode *)gnp; | |
2142 | if (!Lst_IsEmpty(gn->commands)) { | 2142 | if (!Lst_IsEmptyS(gn->commands)) { | |
2143 | gn->type |= OP_HAS_COMMANDS; | 2143 | gn->type |= OP_HAS_COMMANDS; | |
2144 | } | 2144 | } | |
2145 | } | 2145 | } | |
2146 | 2146 | |||
2147 | /*- | 2147 | /*- | |
2148 | *----------------------------------------------------------------------- | 2148 | *----------------------------------------------------------------------- | |
2149 | * Parse_AddIncludeDir -- | 2149 | * Parse_AddIncludeDir -- | |
2150 | * Add a directory to the path searched for included makefiles | 2150 | * Add a directory to the path searched for included makefiles | |
2151 | * bracketed by double-quotes. Used by functions in main.c | 2151 | * bracketed by double-quotes. Used by functions in main.c | |
2152 | * | 2152 | * | |
2153 | * Input: | 2153 | * Input: | |
2154 | * dir The name of the directory to add | 2154 | * dir The name of the directory to add | |
2155 | * | 2155 | * | |
@@ -2252,27 +2252,27 @@ Parse_include_file(char *file, Boolean i | @@ -2252,27 +2252,27 @@ Parse_include_file(char *file, Boolean i | |||
2252 | if (fullname == NULL) { | 2252 | if (fullname == NULL) { | |
2253 | fullname = Dir_FindFile(file, dirSearchPath); | 2253 | fullname = Dir_FindFile(file, dirSearchPath); | |
2254 | } | 2254 | } | |
2255 | } | 2255 | } | |
2256 | } | 2256 | } | |
2257 | } | 2257 | } | |
2258 | 2258 | |||
2259 | /* Looking for a system file or file still not found */ | 2259 | /* Looking for a system file or file still not found */ | |
2260 | if (fullname == NULL) { | 2260 | if (fullname == NULL) { | |
2261 | /* | 2261 | /* | |
2262 | * Look for it on the system path | 2262 | * Look for it on the system path | |
2263 | */ | 2263 | */ | |
2264 | fullname = Dir_FindFile(file, | 2264 | fullname = Dir_FindFile(file, | |
2265 | Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath); | 2265 | Lst_IsEmptyS(sysIncPath) ? defIncPath : sysIncPath); | |
2266 | } | 2266 | } | |
2267 | 2267 | |||
2268 | if (fullname == NULL) { | 2268 | if (fullname == NULL) { | |
2269 | if (!silent) | 2269 | if (!silent) | |
2270 | Parse_Error(PARSE_FATAL, "Could not find %s", file); | 2270 | Parse_Error(PARSE_FATAL, "Could not find %s", file); | |
2271 | return; | 2271 | return; | |
2272 | } | 2272 | } | |
2273 | 2273 | |||
2274 | /* Actually open the file... */ | 2274 | /* Actually open the file... */ | |
2275 | fd = open(fullname, O_RDONLY); | 2275 | fd = open(fullname, O_RDONLY); | |
2276 | if (fd == -1) { | 2276 | if (fd == -1) { | |
2277 | if (!silent) | 2277 | if (!silent) | |
2278 | Parse_Error(PARSE_FATAL, "Cannot open %s", fullname); | 2278 | Parse_Error(PARSE_FATAL, "Cannot open %s", fullname); | |
@@ -2739,27 +2739,27 @@ ParseEOF(void) | @@ -2739,27 +2739,27 @@ ParseEOF(void) | |||
2739 | /* Ensure the makefile (or loop) didn't have mismatched conditionals */ | 2739 | /* Ensure the makefile (or loop) didn't have mismatched conditionals */ | |
2740 | Cond_restore_depth(curFile->cond_depth); | 2740 | Cond_restore_depth(curFile->cond_depth); | |
2741 | 2741 | |||
2742 | if (curFile->lf != NULL) { | 2742 | if (curFile->lf != NULL) { | |
2743 | loadedfile_destroy(curFile->lf); | 2743 | loadedfile_destroy(curFile->lf); | |
2744 | curFile->lf = NULL; | 2744 | curFile->lf = NULL; | |
2745 | } | 2745 | } | |
2746 | 2746 | |||
2747 | /* Dispose of curFile info */ | 2747 | /* Dispose of curFile info */ | |
2748 | /* Leak curFile->fname because all the gnodes have pointers to it */ | 2748 | /* Leak curFile->fname because all the gnodes have pointers to it */ | |
2749 | free(curFile->P_str); | 2749 | free(curFile->P_str); | |
2750 | free(curFile); | 2750 | free(curFile); | |
2751 | 2751 | |||
2752 | if (Lst_IsEmpty(includes)) { | 2752 | if (Lst_IsEmptyS(includes)) { | |
2753 | curFile = NULL; | 2753 | curFile = NULL; | |
2754 | /* We've run out of input */ | 2754 | /* We've run out of input */ | |
2755 | Var_Delete(".PARSEDIR", VAR_GLOBAL); | 2755 | Var_Delete(".PARSEDIR", VAR_GLOBAL); | |
2756 | Var_Delete(".PARSEFILE", VAR_GLOBAL); | 2756 | Var_Delete(".PARSEFILE", VAR_GLOBAL); | |
2757 | Var_Delete(".INCLUDEDFROMDIR", VAR_GLOBAL); | 2757 | Var_Delete(".INCLUDEDFROMDIR", VAR_GLOBAL); | |
2758 | Var_Delete(".INCLUDEDFROMFILE", VAR_GLOBAL); | 2758 | Var_Delete(".INCLUDEDFROMFILE", VAR_GLOBAL); | |
2759 | return DONE; | 2759 | return DONE; | |
2760 | } | 2760 | } | |
2761 | 2761 | |||
2762 | curFile = Lst_DequeueS(includes); | 2762 | curFile = Lst_DequeueS(includes); | |
2763 | if (DEBUG(PARSE)) | 2763 | if (DEBUG(PARSE)) | |
2764 | fprintf(debug_file, "ParseEOF: returning to file %s, line %d\n", | 2764 | fprintf(debug_file, "ParseEOF: returning to file %s, line %d\n", | |
2765 | curFile->fname, curFile->lineno); | 2765 | curFile->fname, curFile->lineno); |
--- src/usr.bin/make/suff.c 2020/08/27 07:03:48 1.120
+++ src/usr.bin/make/suff.c 2020/08/27 19:15:35 1.121
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 rillig Exp $ */ | 1 | /* $NetBSD: suff.c,v 1.121 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: suff.c,v 1.121 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; | 77 | static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: suff.c,v 1.120 2020/08/27 07:03:48 rillig Exp $"); | 79 | __RCSID("$NetBSD: suff.c,v 1.121 2020/08/27 19:15:35 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * suff.c -- | 85 | * suff.c -- | |
86 | * Functions to maintain suffix lists and find implicit dependents | 86 | * Functions to maintain suffix lists and find implicit dependents | |
87 | * using suffix transformation rules | 87 | * using suffix transformation rules | |
88 | * | 88 | * | |
89 | * Interface: | 89 | * Interface: | |
90 | * Suff_Init Initialize all things to do with suffixes. | 90 | * Suff_Init Initialize all things to do with suffixes. | |
91 | * | 91 | * | |
92 | * Suff_End Cleanup the module | 92 | * Suff_End Cleanup the module | |
@@ -219,27 +219,26 @@ static int SuffSuffIsSuffixP(const void | @@ -219,27 +219,26 @@ static int SuffSuffIsSuffixP(const void | |||
219 | static int SuffSuffHasNameP(const void *, const void *); | 219 | static int SuffSuffHasNameP(const void *, const void *); | |
220 | static int SuffSuffIsPrefix(const void *, const void *); | 220 | static int SuffSuffIsPrefix(const void *, const void *); | |
221 | static int SuffGNHasNameP(const void *, const void *); | 221 | static int SuffGNHasNameP(const void *, const void *); | |
222 | static void SuffUnRef(void *, void *); | 222 | static void SuffUnRef(void *, void *); | |
223 | static void SuffFree(void *); | 223 | static void SuffFree(void *); | |
224 | static void SuffInsert(Lst, Suff *); | 224 | static void SuffInsert(Lst, Suff *); | |
225 | static void SuffRemove(Lst, Suff *); | 225 | static void SuffRemove(Lst, Suff *); | |
226 | static Boolean SuffParseTransform(char *, Suff **, Suff **); | 226 | static Boolean SuffParseTransform(char *, Suff **, Suff **); | |
227 | static int SuffRebuildGraph(void *, void *); | 227 | static int SuffRebuildGraph(void *, void *); | |
228 | static int SuffScanTargets(void *, void *); | 228 | static int SuffScanTargets(void *, void *); | |
229 | static int SuffAddSrc(void *, void *); | 229 | static int SuffAddSrc(void *, void *); | |
230 | static int SuffRemoveSrc(Lst); | 230 | static int SuffRemoveSrc(Lst); | |
231 | static void SuffAddLevel(Lst, Src *); | 231 | static void SuffAddLevel(Lst, Src *); | |
232 | static Src *SuffFindThem(Lst, Lst); | |||
233 | static Src *SuffFindCmds(Src *, Lst); | 232 | static Src *SuffFindCmds(Src *, Lst); | |
234 | static void SuffExpandChildren(LstNode, GNode *); | 233 | static void SuffExpandChildren(LstNode, GNode *); | |
235 | static void SuffExpandWildcards(LstNode, GNode *); | 234 | static void SuffExpandWildcards(LstNode, GNode *); | |
236 | static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *); | 235 | static Boolean SuffApplyTransform(GNode *, GNode *, Suff *, Suff *); | |
237 | static void SuffFindDeps(GNode *, Lst); | 236 | static void SuffFindDeps(GNode *, Lst); | |
238 | static void SuffFindArchiveDeps(GNode *, Lst); | 237 | static void SuffFindArchiveDeps(GNode *, Lst); | |
239 | static void SuffFindNormalDeps(GNode *, Lst); | 238 | static void SuffFindNormalDeps(GNode *, Lst); | |
240 | static int SuffPrintName(void *, void *); | 239 | static int SuffPrintName(void *, void *); | |
241 | static int SuffPrintSuff(void *, void *); | 240 | static int SuffPrintSuff(void *, void *); | |
242 | static int SuffPrintTrans(void *, void *); | 241 | static int SuffPrintTrans(void *, void *); | |
243 | 242 | |||
244 | /*************** Lst Predicates ****************/ | 243 | /*************** Lst Predicates ****************/ | |
245 | /*- | 244 | /*- | |
@@ -765,30 +764,30 @@ Suff_AddTransform(char *line) | @@ -765,30 +764,30 @@ Suff_AddTransform(char *line) | |||
765 | * === 0 | 764 | * === 0 | |
766 | * | 765 | * | |
767 | * Side Effects: | 766 | * Side Effects: | |
768 | * If the node has no commands or children, the children and parents | 767 | * If the node has no commands or children, the children and parents | |
769 | * lists of the affected suffixes are altered. | 768 | * lists of the affected suffixes are altered. | |
770 | * | 769 | * | |
771 | *----------------------------------------------------------------------- | 770 | *----------------------------------------------------------------------- | |
772 | */ | 771 | */ | |
773 | int | 772 | int | |
774 | Suff_EndTransform(void *gnp, void *dummy MAKE_ATTR_UNUSED) | 773 | Suff_EndTransform(void *gnp, void *dummy MAKE_ATTR_UNUSED) | |
775 | { | 774 | { | |
776 | GNode *gn = (GNode *)gnp; | 775 | GNode *gn = (GNode *)gnp; | |
777 | 776 | |||
778 | if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts)) | 777 | if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmptyS(gn->cohorts)) | |
779 | gn = Lst_DatumS(Lst_LastS(gn->cohorts)); | 778 | gn = Lst_DatumS(Lst_LastS(gn->cohorts)); | |
780 | if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) && | 779 | if ((gn->type & OP_TRANSFORM) && Lst_IsEmptyS(gn->commands) && | |
781 | Lst_IsEmpty(gn->children)) | 780 | Lst_IsEmptyS(gn->children)) | |
782 | { | 781 | { | |
783 | Suff *s, *t; | 782 | Suff *s, *t; | |
784 | 783 | |||
785 | /* | 784 | /* | |
786 | * SuffParseTransform() may fail for special rules which are not | 785 | * SuffParseTransform() may fail for special rules which are not | |
787 | * actual transformation rules. (e.g. .DEFAULT) | 786 | * actual transformation rules. (e.g. .DEFAULT) | |
788 | */ | 787 | */ | |
789 | if (SuffParseTransform(gn->name, &s, &t)) { | 788 | if (SuffParseTransform(gn->name, &s, &t)) { | |
790 | Lst p; | 789 | Lst p; | |
791 | 790 | |||
792 | if (DEBUG(SUFF)) { | 791 | if (DEBUG(SUFF)) { | |
793 | fprintf(debug_file, "deleting transformation from `%s' to `%s'\n", | 792 | fprintf(debug_file, "deleting transformation from `%s' to `%s'\n", | |
794 | s->name, t->name); | 793 | s->name, t->name); | |
@@ -1061,27 +1060,27 @@ Suff_DoPaths(void) | @@ -1061,27 +1060,27 @@ Suff_DoPaths(void) | |||
1061 | Suff *s; | 1060 | Suff *s; | |
1062 | LstNode ln; | 1061 | LstNode ln; | |
1063 | char *ptr; | 1062 | char *ptr; | |
1064 | Lst inIncludes; /* Cumulative .INCLUDES path */ | 1063 | Lst inIncludes; /* Cumulative .INCLUDES path */ | |
1065 | Lst inLibs; /* Cumulative .LIBS path */ | 1064 | Lst inLibs; /* Cumulative .LIBS path */ | |
1066 | 1065 | |||
1067 | 1066 | |||
1068 | inIncludes = Lst_Init(); | 1067 | inIncludes = Lst_Init(); | |
1069 | inLibs = Lst_Init(); | 1068 | inLibs = Lst_Init(); | |
1070 | 1069 | |||
1071 | Lst_OpenS(sufflist); | 1070 | Lst_OpenS(sufflist); | |
1072 | while ((ln = Lst_NextS(sufflist)) != NULL) { | 1071 | while ((ln = Lst_NextS(sufflist)) != NULL) { | |
1073 | s = Lst_DatumS(ln); | 1072 | s = Lst_DatumS(ln); | |
1074 | if (!Lst_IsEmpty (s->searchPath)) { | 1073 | if (!Lst_IsEmptyS(s->searchPath)) { | |
1075 | #ifdef INCLUDES | 1074 | #ifdef INCLUDES | |
1076 | if (s->flags & SUFF_INCLUDE) { | 1075 | if (s->flags & SUFF_INCLUDE) { | |
1077 | Dir_Concat(inIncludes, s->searchPath); | 1076 | Dir_Concat(inIncludes, s->searchPath); | |
1078 | } | 1077 | } | |
1079 | #endif /* INCLUDES */ | 1078 | #endif /* INCLUDES */ | |
1080 | #ifdef LIBRARIES | 1079 | #ifdef LIBRARIES | |
1081 | if (s->flags & SUFF_LIBRARY) { | 1080 | if (s->flags & SUFF_LIBRARY) { | |
1082 | Dir_Concat(inLibs, s->searchPath); | 1081 | Dir_Concat(inLibs, s->searchPath); | |
1083 | } | 1082 | } | |
1084 | #endif /* LIBRARIES */ | 1083 | #endif /* LIBRARIES */ | |
1085 | Dir_Concat(s->searchPath, dirSearchPath); | 1084 | Dir_Concat(s->searchPath, dirSearchPath); | |
1086 | } else { | 1085 | } else { | |
1087 | Lst_DestroyS(s->searchPath, Dir_Destroy); | 1086 | Lst_DestroyS(s->searchPath, Dir_Destroy); | |
@@ -1344,27 +1343,27 @@ SuffRemoveSrc(Lst l) | @@ -1344,27 +1343,27 @@ SuffRemoveSrc(Lst l) | |||
1344 | * Side Effects: | 1343 | * Side Effects: | |
1345 | * None | 1344 | * None | |
1346 | *----------------------------------------------------------------------- | 1345 | *----------------------------------------------------------------------- | |
1347 | */ | 1346 | */ | |
1348 | static Src * | 1347 | static Src * | |
1349 | SuffFindThem(Lst srcs, Lst slst) | 1348 | SuffFindThem(Lst srcs, Lst slst) | |
1350 | { | 1349 | { | |
1351 | Src *s; /* current Src */ | 1350 | Src *s; /* current Src */ | |
1352 | Src *rs; /* returned Src */ | 1351 | Src *rs; /* returned Src */ | |
1353 | char *ptr; | 1352 | char *ptr; | |
1354 | 1353 | |||
1355 | rs = NULL; | 1354 | rs = NULL; | |
1356 | 1355 | |||
1357 | while (!Lst_IsEmpty (srcs)) { | 1356 | while (!Lst_IsEmptyS(srcs)) { | |
1358 | s = Lst_DequeueS(srcs); | 1357 | s = Lst_DequeueS(srcs); | |
1359 | 1358 | |||
1360 | if (DEBUG(SUFF)) { | 1359 | if (DEBUG(SUFF)) { | |
1361 | fprintf(debug_file, "\ttrying %s...", s->file); | 1360 | fprintf(debug_file, "\ttrying %s...", s->file); | |
1362 | } | 1361 | } | |
1363 | 1362 | |||
1364 | /* | 1363 | /* | |
1365 | * A file is considered to exist if either a node exists in the | 1364 | * A file is considered to exist if either a node exists in the | |
1366 | * graph for it or the file actually exists. | 1365 | * graph for it or the file actually exists. | |
1367 | */ | 1366 | */ | |
1368 | if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) { | 1367 | if (Targ_FindNode(s->file, TARG_NOCREATE) != NULL) { | |
1369 | #ifdef DEBUG_SRC | 1368 | #ifdef DEBUG_SRC | |
1370 | fprintf(debug_file, "remove %p from %p\n", s, srcs); | 1369 | fprintf(debug_file, "remove %p from %p\n", s, srcs); | |
@@ -1427,27 +1426,27 @@ SuffFindCmds(Src *targ, Lst slst) | @@ -1427,27 +1426,27 @@ SuffFindCmds(Src *targ, Lst slst) | |||
1427 | 1426 | |||
1428 | t = targ->node; | 1427 | t = targ->node; | |
1429 | Lst_OpenS(t->children); | 1428 | Lst_OpenS(t->children); | |
1430 | prefLen = strlen(targ->pref); | 1429 | prefLen = strlen(targ->pref); | |
1431 | 1430 | |||
1432 | for (;;) { | 1431 | for (;;) { | |
1433 | ln = Lst_NextS(t->children); | 1432 | ln = Lst_NextS(t->children); | |
1434 | if (ln == NULL) { | 1433 | if (ln == NULL) { | |
1435 | Lst_CloseS(t->children); | 1434 | Lst_CloseS(t->children); | |
1436 | return NULL; | 1435 | return NULL; | |
1437 | } | 1436 | } | |
1438 | s = Lst_DatumS(ln); | 1437 | s = Lst_DatumS(ln); | |
1439 | 1438 | |||
1440 | if (s->type & OP_OPTIONAL && Lst_IsEmpty(t->commands)) { | 1439 | if (s->type & OP_OPTIONAL && Lst_IsEmptyS(t->commands)) { | |
1441 | /* | 1440 | /* | |
1442 | * We haven't looked to see if .OPTIONAL files exist yet, so | 1441 | * We haven't looked to see if .OPTIONAL files exist yet, so | |
1443 | * don't use one as the implicit source. | 1442 | * don't use one as the implicit source. | |
1444 | * This allows us to use .OPTIONAL in .depend files so make won't | 1443 | * This allows us to use .OPTIONAL in .depend files so make won't | |
1445 | * complain "don't know how to make xxx.h' when a dependent file | 1444 | * complain "don't know how to make xxx.h' when a dependent file | |
1446 | * has been moved/deleted. | 1445 | * has been moved/deleted. | |
1447 | */ | 1446 | */ | |
1448 | continue; | 1447 | continue; | |
1449 | } | 1448 | } | |
1450 | 1449 | |||
1451 | cp = strrchr(s->name, '/'); | 1450 | cp = strrchr(s->name, '/'); | |
1452 | if (cp == NULL) { | 1451 | if (cp == NULL) { | |
1453 | cp = s->name; | 1452 | cp = s->name; | |
@@ -1521,27 +1520,27 @@ SuffFindCmds(Src *targ, Lst slst) | @@ -1521,27 +1520,27 @@ SuffFindCmds(Src *targ, Lst slst) | |||
1521 | * The expanded node is removed from the parent's list of children, | 1520 | * The expanded node is removed from the parent's list of children, | |
1522 | * and the parent's unmade counter is decremented, but other nodes | 1521 | * and the parent's unmade counter is decremented, but other nodes | |
1523 | * may be added. | 1522 | * may be added. | |
1524 | * | 1523 | * | |
1525 | *----------------------------------------------------------------------- | 1524 | *----------------------------------------------------------------------- | |
1526 | */ | 1525 | */ | |
1527 | static void | 1526 | static void | |
1528 | SuffExpandChildren(LstNode cln, GNode *pgn) | 1527 | SuffExpandChildren(LstNode cln, GNode *pgn) | |
1529 | { | 1528 | { | |
1530 | GNode *cgn = Lst_DatumS(cln); | 1529 | GNode *cgn = Lst_DatumS(cln); | |
1531 | GNode *gn; /* New source 8) */ | 1530 | GNode *gn; /* New source 8) */ | |
1532 | char *cp; /* Expanded value */ | 1531 | char *cp; /* Expanded value */ | |
1533 | 1532 | |||
1534 | if (!Lst_IsEmpty(cgn->order_pred) || !Lst_IsEmpty(cgn->order_succ)) | 1533 | if (!Lst_IsEmptyS(cgn->order_pred) || !Lst_IsEmptyS(cgn->order_succ)) | |
1535 | /* It is all too hard to process the result of .ORDER */ | 1534 | /* It is all too hard to process the result of .ORDER */ | |
1536 | return; | 1535 | return; | |
1537 | 1536 | |||
1538 | if (cgn->type & OP_WAIT) | 1537 | if (cgn->type & OP_WAIT) | |
1539 | /* Ignore these (& OP_PHONY ?) */ | 1538 | /* Ignore these (& OP_PHONY ?) */ | |
1540 | return; | 1539 | return; | |
1541 | 1540 | |||
1542 | /* | 1541 | /* | |
1543 | * First do variable expansion -- this takes precedence over | 1542 | * First do variable expansion -- this takes precedence over | |
1544 | * wildcard expansion. If the result contains wildcards, they'll be gotten | 1543 | * wildcard expansion. If the result contains wildcards, they'll be gotten | |
1545 | * to later since the resulting words are tacked on to the end of | 1544 | * to later since the resulting words are tacked on to the end of | |
1546 | * the children list. | 1545 | * the children list. | |
1547 | */ | 1546 | */ | |
@@ -1628,27 +1627,27 @@ SuffExpandChildren(LstNode cln, GNode *p | @@ -1628,27 +1627,27 @@ SuffExpandChildren(LstNode cln, GNode *p | |||
1628 | gn = Targ_FindNode(start, TARG_CREATE); | 1627 | gn = Targ_FindNode(start, TARG_CREATE); | |
1629 | Lst_AppendS(members, gn); | 1628 | Lst_AppendS(members, gn); | |
1630 | } | 1629 | } | |
1631 | /* | 1630 | /* | |
1632 | * Point cp back at the beginning again so the variable value | 1631 | * Point cp back at the beginning again so the variable value | |
1633 | * can be freed. | 1632 | * can be freed. | |
1634 | */ | 1633 | */ | |
1635 | cp = initcp; | 1634 | cp = initcp; | |
1636 | } | 1635 | } | |
1637 | 1636 | |||
1638 | /* | 1637 | /* | |
1639 | * Add all elements of the members list to the parent node. | 1638 | * Add all elements of the members list to the parent node. | |
1640 | */ | 1639 | */ | |
1641 | while(!Lst_IsEmpty(members)) { | 1640 | while(!Lst_IsEmptyS(members)) { | |
1642 | gn = Lst_DequeueS(members); | 1641 | gn = Lst_DequeueS(members); | |
1643 | 1642 | |||
1644 | if (DEBUG(SUFF)) { | 1643 | if (DEBUG(SUFF)) { | |
1645 | fprintf(debug_file, "%s...", gn->name); | 1644 | fprintf(debug_file, "%s...", gn->name); | |
1646 | } | 1645 | } | |
1647 | /* Add gn to the parents child list before the original child */ | 1646 | /* Add gn to the parents child list before the original child */ | |
1648 | Lst_InsertBeforeS(pgn->children, cln, gn); | 1647 | Lst_InsertBeforeS(pgn->children, cln, gn); | |
1649 | Lst_AppendS(gn->parents, pgn); | 1648 | Lst_AppendS(gn->parents, pgn); | |
1650 | pgn->unmade++; | 1649 | pgn->unmade++; | |
1651 | /* Expand wildcards on new node */ | 1650 | /* Expand wildcards on new node */ | |
1652 | SuffExpandWildcards(Lst_PrevS(cln), pgn); | 1651 | SuffExpandWildcards(Lst_PrevS(cln), pgn); | |
1653 | } | 1652 | } | |
1654 | Lst_FreeS(members); | 1653 | Lst_FreeS(members); | |
@@ -1678,27 +1677,27 @@ SuffExpandWildcards(LstNode cln, GNode * | @@ -1678,27 +1677,27 @@ SuffExpandWildcards(LstNode cln, GNode * | |||
1678 | GNode *gn; /* New source 8) */ | 1677 | GNode *gn; /* New source 8) */ | |
1679 | char *cp; /* Expanded value */ | 1678 | char *cp; /* Expanded value */ | |
1680 | Lst explist; /* List of expansions */ | 1679 | Lst explist; /* List of expansions */ | |
1681 | 1680 | |||
1682 | if (!Dir_HasWildcards(cgn->name)) | 1681 | if (!Dir_HasWildcards(cgn->name)) | |
1683 | return; | 1682 | return; | |
1684 | 1683 | |||
1685 | /* | 1684 | /* | |
1686 | * Expand the word along the chosen path | 1685 | * Expand the word along the chosen path | |
1687 | */ | 1686 | */ | |
1688 | explist = Lst_Init(); | 1687 | explist = Lst_Init(); | |
1689 | Dir_Expand(cgn->name, Suff_FindPath(cgn), explist); | 1688 | Dir_Expand(cgn->name, Suff_FindPath(cgn), explist); | |
1690 | 1689 | |||
1691 | while (!Lst_IsEmpty(explist)) { | 1690 | while (!Lst_IsEmptyS(explist)) { | |
1692 | /* | 1691 | /* | |
1693 | * Fetch next expansion off the list and find its GNode | 1692 | * Fetch next expansion off the list and find its GNode | |
1694 | */ | 1693 | */ | |
1695 | cp = Lst_DequeueS(explist); | 1694 | cp = Lst_DequeueS(explist); | |
1696 | 1695 | |||
1697 | if (DEBUG(SUFF)) { | 1696 | if (DEBUG(SUFF)) { | |
1698 | fprintf(debug_file, "%s...", cp); | 1697 | fprintf(debug_file, "%s...", cp); | |
1699 | } | 1698 | } | |
1700 | gn = Targ_FindNode(cp, TARG_CREATE); | 1699 | gn = Targ_FindNode(cp, TARG_CREATE); | |
1701 | 1700 | |||
1702 | /* Add gn to the parents child list before the original child */ | 1701 | /* Add gn to the parents child list before the original child */ | |
1703 | Lst_InsertBeforeS(pgn->children, cln, gn); | 1702 | Lst_InsertBeforeS(pgn->children, cln, gn); | |
1704 | Lst_AppendS(gn->parents, pgn); | 1703 | Lst_AppendS(gn->parents, pgn); | |
@@ -2129,74 +2128,74 @@ SuffFindNormalDeps(GNode *gn, Lst slst) | @@ -2129,74 +2128,74 @@ SuffFindNormalDeps(GNode *gn, Lst slst) | |||
2129 | */ | 2128 | */ | |
2130 | Lst_AppendS(targs, targ); | 2129 | Lst_AppendS(targs, targ); | |
2131 | 2130 | |||
2132 | /* | 2131 | /* | |
2133 | * Search from this suffix's successor... | 2132 | * Search from this suffix's successor... | |
2134 | */ | 2133 | */ | |
2135 | ln = Lst_SuccS(ln); | 2134 | ln = Lst_SuccS(ln); | |
2136 | } | 2135 | } | |
2137 | } | 2136 | } | |
2138 | 2137 | |||
2139 | /* | 2138 | /* | |
2140 | * Handle target of unknown suffix... | 2139 | * Handle target of unknown suffix... | |
2141 | */ | 2140 | */ | |
2142 | if (Lst_IsEmpty(targs) && suffNull != NULL) { | 2141 | if (Lst_IsEmptyS(targs) && suffNull != NULL) { | |
2143 | if (DEBUG(SUFF)) { | 2142 | if (DEBUG(SUFF)) { | |
2144 | fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name); | 2143 | fprintf(debug_file, "\tNo known suffix on %s. Using .NULL suffix\n", gn->name); | |
2145 | } | 2144 | } | |
2146 | 2145 | |||
2147 | targ = bmake_malloc(sizeof(Src)); | 2146 | targ = bmake_malloc(sizeof(Src)); | |
2148 | targ->file = bmake_strdup(gn->name); | 2147 | targ->file = bmake_strdup(gn->name); | |
2149 | targ->suff = suffNull; | 2148 | targ->suff = suffNull; | |
2150 | targ->suff->refCount++; | 2149 | targ->suff->refCount++; | |
2151 | targ->node = gn; | 2150 | targ->node = gn; | |
2152 | targ->parent = NULL; | 2151 | targ->parent = NULL; | |
2153 | targ->children = 0; | 2152 | targ->children = 0; | |
2154 | targ->pref = bmake_strdup(sopref); | 2153 | targ->pref = bmake_strdup(sopref); | |
2155 | #ifdef DEBUG_SRC | 2154 | #ifdef DEBUG_SRC | |
2156 | targ->cp = Lst_Init(); | 2155 | targ->cp = Lst_Init(); | |
2157 | #endif | 2156 | #endif | |
2158 | 2157 | |||
2159 | /* | 2158 | /* | |
2160 | * Only use the default suffix rules if we don't have commands | 2159 | * Only use the default suffix rules if we don't have commands | |
2161 | * defined for this gnode; traditional make programs used to | 2160 | * defined for this gnode; traditional make programs used to | |
2162 | * not define suffix rules if the gnode had children but we | 2161 | * not define suffix rules if the gnode had children but we | |
2163 | * don't do this anymore. | 2162 | * don't do this anymore. | |
2164 | */ | 2163 | */ | |
2165 | if (Lst_IsEmpty(gn->commands)) | 2164 | if (Lst_IsEmptyS(gn->commands)) | |
2166 | SuffAddLevel(srcs, targ); | 2165 | SuffAddLevel(srcs, targ); | |
2167 | else { | 2166 | else { | |
2168 | if (DEBUG(SUFF)) | 2167 | if (DEBUG(SUFF)) | |
2169 | fprintf(debug_file, "not "); | 2168 | fprintf(debug_file, "not "); | |
2170 | } | 2169 | } | |
2171 | 2170 | |||
2172 | if (DEBUG(SUFF)) | 2171 | if (DEBUG(SUFF)) | |
2173 | fprintf(debug_file, "adding suffix rules\n"); | 2172 | fprintf(debug_file, "adding suffix rules\n"); | |
2174 | 2173 | |||
2175 | Lst_AppendS(targs, targ); | 2174 | Lst_AppendS(targs, targ); | |
2176 | } | 2175 | } | |
2177 | 2176 | |||
2178 | /* | 2177 | /* | |
2179 | * Using the list of possible sources built up from the target | 2178 | * Using the list of possible sources built up from the target | |
2180 | * suffix(es), try and find an existing file/target that matches. | 2179 | * suffix(es), try and find an existing file/target that matches. | |
2181 | */ | 2180 | */ | |
2182 | bottom = SuffFindThem(srcs, slst); | 2181 | bottom = SuffFindThem(srcs, slst); | |
2183 | 2182 | |||
2184 | if (bottom == NULL) { | 2183 | if (bottom == NULL) { | |
2185 | /* | 2184 | /* | |
2186 | * No known transformations -- use the first suffix found | 2185 | * No known transformations -- use the first suffix found | |
2187 | * for setting the local variables. | 2186 | * for setting the local variables. | |
2188 | */ | 2187 | */ | |
2189 | if (!Lst_IsEmpty(targs)) { | 2188 | if (!Lst_IsEmptyS(targs)) { | |
2190 | targ = Lst_DatumS(Lst_First(targs)); | 2189 | targ = Lst_DatumS(Lst_First(targs)); | |
2191 | } else { | 2190 | } else { | |
2192 | targ = NULL; | 2191 | targ = NULL; | |
2193 | } | 2192 | } | |
2194 | } else { | 2193 | } else { | |
2195 | /* | 2194 | /* | |
2196 | * Work up the transformation path to find the suffix of the | 2195 | * Work up the transformation path to find the suffix of the | |
2197 | * target to which the transformation was made. | 2196 | * target to which the transformation was made. | |
2198 | */ | 2197 | */ | |
2199 | for (targ = bottom; targ->parent != NULL; targ = targ->parent) | 2198 | for (targ = bottom; targ->parent != NULL; targ = targ->parent) | |
2200 | continue; | 2199 | continue; | |
2201 | } | 2200 | } | |
2202 | } | 2201 | } | |
@@ -2283,27 +2282,27 @@ sfnd_abort: | @@ -2283,27 +2282,27 @@ sfnd_abort: | |||
2283 | } | 2282 | } | |
2284 | 2283 | |||
2285 | /* | 2284 | /* | |
2286 | * If the suffix indicates that the target is a library, mark that in | 2285 | * If the suffix indicates that the target is a library, mark that in | |
2287 | * the node's type field. | 2286 | * the node's type field. | |
2288 | */ | 2287 | */ | |
2289 | if (targ->suff->flags & SUFF_LIBRARY) { | 2288 | if (targ->suff->flags & SUFF_LIBRARY) { | |
2290 | gn->type |= OP_LIB; | 2289 | gn->type |= OP_LIB; | |
2291 | } | 2290 | } | |
2292 | 2291 | |||
2293 | /* | 2292 | /* | |
2294 | * Check for overriding transformation rule implied by sources | 2293 | * Check for overriding transformation rule implied by sources | |
2295 | */ | 2294 | */ | |
2296 | if (!Lst_IsEmpty(gn->children)) { | 2295 | if (!Lst_IsEmptyS(gn->children)) { | |
2297 | src = SuffFindCmds(targ, slst); | 2296 | src = SuffFindCmds(targ, slst); | |
2298 | 2297 | |||
2299 | if (src != NULL) { | 2298 | if (src != NULL) { | |
2300 | /* | 2299 | /* | |
2301 | * Free up all the Src structures in the transformation path | 2300 | * Free up all the Src structures in the transformation path | |
2302 | * up to, but not including, the parent node. | 2301 | * up to, but not including, the parent node. | |
2303 | */ | 2302 | */ | |
2304 | while (bottom && bottom->parent != NULL) { | 2303 | while (bottom && bottom->parent != NULL) { | |
2305 | if (Lst_MemberS(slst, bottom) == NULL) { | 2304 | if (Lst_MemberS(slst, bottom) == NULL) { | |
2306 | Lst_AppendS(slst, bottom); | 2305 | Lst_AppendS(slst, bottom); | |
2307 | } | 2306 | } | |
2308 | bottom = bottom->parent; | 2307 | bottom = bottom->parent; | |
2309 | } | 2308 | } |
--- src/usr.bin/make/targ.c 2020/08/27 06:53:57 1.74
+++ src/usr.bin/make/targ.c 2020/08/27 19:15:35 1.75
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $ */ | 1 | /* $NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Adam de Boor. | 8 | * Adam de Boor. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -59,34 +59,34 @@ | @@ -59,34 +59,34 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $"; | 72 | static char rcsid[] = "$NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | #if 0 | 76 | #if 0 | |
77 | static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; | 77 | static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; | |
78 | #else | 78 | #else | |
79 | __RCSID("$NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $"); | 79 | __RCSID("$NetBSD: targ.c,v 1.75 2020/08/27 19:15:35 rillig Exp $"); | |
80 | #endif | 80 | #endif | |
81 | #endif /* not lint */ | 81 | #endif /* not lint */ | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | /*- | 84 | /*- | |
85 | * targ.c -- | 85 | * targ.c -- | |
86 | * Functions for maintaining the Lst allTargets. Target nodes are | 86 | * Functions for maintaining the Lst allTargets. Target nodes are | |
87 | * kept in two structures: a Lst, maintained by the list library, and a | 87 | * kept in two structures: a Lst, maintained by the list library, and a | |
88 | * hash table, maintained by the hash library. | 88 | * hash table, maintained by the hash library. | |
89 | * | 89 | * | |
90 | * Interface: | 90 | * Interface: | |
91 | * Targ_Init Initialization procedure. | 91 | * Targ_Init Initialization procedure. | |
92 | * | 92 | * | |
@@ -650,46 +650,46 @@ Targ_PrintNode(void *gnp, void *passp) | @@ -650,46 +650,46 @@ Targ_PrintNode(void *gnp, void *passp) | |||
650 | } | 650 | } | |
651 | if (! (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { | 651 | if (! (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) { | |
652 | if (gn->mtime != 0) { | 652 | if (gn->mtime != 0) { | |
653 | fprintf(debug_file, "# last modified %s: %s\n", | 653 | fprintf(debug_file, "# last modified %s: %s\n", | |
654 | Targ_FmtTime(gn->mtime), | 654 | Targ_FmtTime(gn->mtime), | |
655 | made_name(gn->made)); | 655 | made_name(gn->made)); | |
656 | } else if (gn->made != UNMADE) { | 656 | } else if (gn->made != UNMADE) { | |
657 | fprintf(debug_file, "# non-existent (maybe): %s\n", | 657 | fprintf(debug_file, "# non-existent (maybe): %s\n", | |
658 | made_name(gn->made)); | 658 | made_name(gn->made)); | |
659 | } else { | 659 | } else { | |
660 | fprintf(debug_file, "# unmade\n"); | 660 | fprintf(debug_file, "# unmade\n"); | |
661 | } | 661 | } | |
662 | } | 662 | } | |
663 | if (!Lst_IsEmpty (gn->iParents)) { | 663 | if (!Lst_IsEmptyS(gn->iParents)) { | |
664 | fprintf(debug_file, "# implicit parents: "); | 664 | fprintf(debug_file, "# implicit parents: "); | |
665 | Lst_ForEachS(gn->iParents, TargPrintName, NULL); | 665 | Lst_ForEachS(gn->iParents, TargPrintName, NULL); | |
666 | fprintf(debug_file, "\n"); | 666 | fprintf(debug_file, "\n"); | |
667 | } | 667 | } | |
668 | } else { | 668 | } else { | |
669 | if (gn->unmade) | 669 | if (gn->unmade) | |
670 | fprintf(debug_file, "# %d unmade children\n", gn->unmade); | 670 | fprintf(debug_file, "# %d unmade children\n", gn->unmade); | |
671 | } | 671 | } | |
672 | if (!Lst_IsEmpty (gn->parents)) { | 672 | if (!Lst_IsEmptyS(gn->parents)) { | |
673 | fprintf(debug_file, "# parents: "); | 673 | fprintf(debug_file, "# parents: "); | |
674 | Lst_ForEachS(gn->parents, TargPrintName, NULL); | 674 | Lst_ForEachS(gn->parents, TargPrintName, NULL); | |
675 | fprintf(debug_file, "\n"); | 675 | fprintf(debug_file, "\n"); | |
676 | } | 676 | } | |
677 | if (!Lst_IsEmpty (gn->order_pred)) { | 677 | if (!Lst_IsEmptyS(gn->order_pred)) { | |
678 | fprintf(debug_file, "# order_pred: "); | 678 | fprintf(debug_file, "# order_pred: "); | |
679 | Lst_ForEachS(gn->order_pred, TargPrintName, NULL); | 679 | Lst_ForEachS(gn->order_pred, TargPrintName, NULL); | |
680 | fprintf(debug_file, "\n"); | 680 | fprintf(debug_file, "\n"); | |
681 | } | 681 | } | |
682 | if (!Lst_IsEmpty (gn->order_succ)) { | 682 | if (!Lst_IsEmptyS(gn->order_succ)) { | |
683 | fprintf(debug_file, "# order_succ: "); | 683 | fprintf(debug_file, "# order_succ: "); | |
684 | Lst_ForEachS(gn->order_succ, TargPrintName, NULL); | 684 | Lst_ForEachS(gn->order_succ, TargPrintName, NULL); | |
685 | fprintf(debug_file, "\n"); | 685 | fprintf(debug_file, "\n"); | |
686 | } | 686 | } | |
687 | 687 | |||
688 | fprintf(debug_file, "%-16s", gn->name); | 688 | fprintf(debug_file, "%-16s", gn->name); | |
689 | switch (gn->type & OP_OPMASK) { | 689 | switch (gn->type & OP_OPMASK) { | |
690 | case OP_DEPENDS: | 690 | case OP_DEPENDS: | |
691 | fprintf(debug_file, ": "); break; | 691 | fprintf(debug_file, ": "); break; | |
692 | case OP_FORCE: | 692 | case OP_FORCE: | |
693 | fprintf(debug_file, "! "); break; | 693 | fprintf(debug_file, "! "); break; | |
694 | case OP_DOUBLEDEP: | 694 | case OP_DOUBLEDEP: | |
695 | fprintf(debug_file, ":: "); break; | 695 | fprintf(debug_file, ":: "); break; |