| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: parse.c,v 1.406 2020/10/28 01:51:36 rillig Exp $ */ | | 1 | /* $NetBSD: parse.c,v 1.407 2020/10/28 01:58:37 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. |
| @@ -107,27 +107,27 @@ | | | @@ -107,27 +107,27 @@ |
107 | #ifndef MAP_FILE | | 107 | #ifndef MAP_FILE |
108 | #define MAP_FILE 0 | | 108 | #define MAP_FILE 0 |
109 | #endif | | 109 | #endif |
110 | #ifndef MAP_COPY | | 110 | #ifndef MAP_COPY |
111 | #define MAP_COPY MAP_PRIVATE | | 111 | #define MAP_COPY MAP_PRIVATE |
112 | #endif | | 112 | #endif |
113 | | | 113 | |
114 | #include "make.h" | | 114 | #include "make.h" |
115 | #include "dir.h" | | 115 | #include "dir.h" |
116 | #include "job.h" | | 116 | #include "job.h" |
117 | #include "pathnames.h" | | 117 | #include "pathnames.h" |
118 | | | 118 | |
119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ | | 119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ |
120 | MAKE_RCSID("$NetBSD: parse.c,v 1.406 2020/10/28 01:51:36 rillig Exp $"); | | 120 | MAKE_RCSID("$NetBSD: parse.c,v 1.407 2020/10/28 01:58:37 rillig Exp $"); |
121 | | | 121 | |
122 | /* types and constants */ | | 122 | /* types and constants */ |
123 | | | 123 | |
124 | /* | | 124 | /* |
125 | * Structure for a file being read ("included file") | | 125 | * Structure for a file being read ("included file") |
126 | */ | | 126 | */ |
127 | typedef struct IFile { | | 127 | typedef struct IFile { |
128 | char *fname; /* name of file */ | | 128 | char *fname; /* name of file */ |
129 | Boolean fromForLoop; /* simulated .include by the .for loop */ | | 129 | Boolean fromForLoop; /* simulated .include by the .for loop */ |
130 | int lineno; /* current line number in file */ | | 130 | int lineno; /* current line number in file */ |
131 | int first_lineno; /* line number of start of text */ | | 131 | int first_lineno; /* line number of start of text */ |
132 | unsigned int cond_depth; /* 'if' nesting when file opened */ | | 132 | unsigned int cond_depth; /* 'if' nesting when file opened */ |
133 | Boolean depending; /* state of doing_depend on EOF */ | | 133 | Boolean depending; /* state of doing_depend on EOF */ |
| @@ -205,27 +205,27 @@ static GNodeList *targets; | | | @@ -205,27 +205,27 @@ static GNodeList *targets; |
205 | | | 205 | |
206 | #ifdef CLEANUP | | 206 | #ifdef CLEANUP |
207 | /* All shell commands for all targets, in no particular order and possibly | | 207 | /* All shell commands for all targets, in no particular order and possibly |
208 | * with duplicates. Kept in a separate list since the commands from .USE or | | 208 | * with duplicates. Kept in a separate list since the commands from .USE or |
209 | * .USEBEFORE nodes are shared with other GNodes, thereby giving up the | | 209 | * .USEBEFORE nodes are shared with other GNodes, thereby giving up the |
210 | * easily understandable ownership over the allocated strings. */ | | 210 | * easily understandable ownership over the allocated strings. */ |
211 | static StringList *targCmds; | | 211 | static StringList *targCmds; |
212 | #endif | | 212 | #endif |
213 | | | 213 | |
214 | /* | | 214 | /* |
215 | * Predecessor node for handling .ORDER. Initialized to NULL when .ORDER | | 215 | * Predecessor node for handling .ORDER. Initialized to NULL when .ORDER |
216 | * seen, then set to each successive source on the line. | | 216 | * seen, then set to each successive source on the line. |
217 | */ | | 217 | */ |
218 | static GNode *predecessor; | | 218 | static GNode *order_pred; |
219 | | | 219 | |
220 | /* parser state */ | | 220 | /* parser state */ |
221 | | | 221 | |
222 | /* number of fatal errors */ | | 222 | /* number of fatal errors */ |
223 | static int fatals = 0; | | 223 | static int fatals = 0; |
224 | | | 224 | |
225 | /* | | 225 | /* |
226 | * Variables for doing includes | | 226 | * Variables for doing includes |
227 | */ | | 227 | */ |
228 | | | 228 | |
229 | /* current file being read */ | | 229 | /* current file being read */ |
230 | static IFile *curFile; | | 230 | static IFile *curFile; |
231 | | | 231 | |
| @@ -909,40 +909,40 @@ ParseDoSrcMain(const char *src) | | | @@ -909,40 +909,40 @@ ParseDoSrcMain(const char *src) |
909 | } | | 909 | } |
910 | | | 910 | |
911 | static void | | 911 | static void |
912 | ParseDoSrcOrder(const char *src) | | 912 | ParseDoSrcOrder(const char *src) |
913 | { | | 913 | { |
914 | GNode *gn; | | 914 | GNode *gn; |
915 | /* | | 915 | /* |
916 | * Create proper predecessor/successor links between the previous | | 916 | * Create proper predecessor/successor links between the previous |
917 | * source and the current one. | | 917 | * source and the current one. |
918 | */ | | 918 | */ |
919 | gn = Targ_GetNode(src); | | 919 | gn = Targ_GetNode(src); |
920 | if (doing_depend) | | 920 | if (doing_depend) |
921 | ParseMark(gn); | | 921 | ParseMark(gn); |
922 | if (predecessor != NULL) { | | 922 | if (order_pred != NULL) { |
923 | Lst_Append(predecessor->order_succ, gn); | | 923 | Lst_Append(order_pred->order_succ, gn); |
924 | Lst_Append(gn->order_pred, predecessor); | | 924 | Lst_Append(gn->order_pred, order_pred); |
925 | if (DEBUG(PARSE)) { | | 925 | if (DEBUG(PARSE)) { |
926 | debug_printf("# %s: added Order dependency %s - %s\n", | | 926 | debug_printf("# %s: added Order dependency %s - %s\n", |
927 | __func__, predecessor->name, gn->name); | | 927 | __func__, order_pred->name, gn->name); |
928 | Targ_PrintNode(predecessor, 0); | | 928 | Targ_PrintNode(order_pred, 0); |
929 | Targ_PrintNode(gn, 0); | | 929 | Targ_PrintNode(gn, 0); |
930 | } | | 930 | } |
931 | } | | 931 | } |
932 | /* | | 932 | /* |
933 | * The current source now becomes the predecessor for the next one. | | 933 | * The current source now becomes the predecessor for the next one. |
934 | */ | | 934 | */ |
935 | predecessor = gn; | | 935 | order_pred = gn; |
936 | } | | 936 | } |
937 | | | 937 | |
938 | static void | | 938 | static void |
939 | ParseDoSrcOther(const char *src, GNodeType tOp, ParseSpecial specType) | | 939 | ParseDoSrcOther(const char *src, GNodeType tOp, ParseSpecial specType) |
940 | { | | 940 | { |
941 | GNode *gn; | | 941 | GNode *gn; |
942 | | | 942 | |
943 | /* | | 943 | /* |
944 | * If the source is not an attribute, we need to find/create | | 944 | * If the source is not an attribute, we need to find/create |
945 | * a node for it. After that we can apply any operator to it | | 945 | * a node for it. After that we can apply any operator to it |
946 | * from a special target or link it to its parents, as | | 946 | * from a special target or link it to its parents, as |
947 | * appropriate. | | 947 | * appropriate. |
948 | * | | 948 | * |
| @@ -1138,27 +1138,27 @@ ParseDoDependencyTargetSpecial(ParseSpec | | | @@ -1138,27 +1138,27 @@ ParseDoDependencyTargetSpecial(ParseSpec |
1138 | DEFAULT = gn; | | 1138 | DEFAULT = gn; |
1139 | break; | | 1139 | break; |
1140 | } | | 1140 | } |
1141 | case SP_DELETE_ON_ERROR: | | 1141 | case SP_DELETE_ON_ERROR: |
1142 | deleteOnError = TRUE; | | 1142 | deleteOnError = TRUE; |
1143 | break; | | 1143 | break; |
1144 | case SP_NOTPARALLEL: | | 1144 | case SP_NOTPARALLEL: |
1145 | opts.maxJobs = 1; | | 1145 | opts.maxJobs = 1; |
1146 | break; | | 1146 | break; |
1147 | case SP_SINGLESHELL: | | 1147 | case SP_SINGLESHELL: |
1148 | opts.compatMake = TRUE; | | 1148 | opts.compatMake = TRUE; |
1149 | break; | | 1149 | break; |
1150 | case SP_ORDER: | | 1150 | case SP_ORDER: |
1151 | predecessor = NULL; | | 1151 | order_pred = NULL; |
1152 | break; | | 1152 | break; |
1153 | default: | | 1153 | default: |
1154 | break; | | 1154 | break; |
1155 | } | | 1155 | } |
1156 | } | | 1156 | } |
1157 | | | 1157 | |
1158 | /* | | 1158 | /* |
1159 | * .PATH<suffix> has to be handled specially. | | 1159 | * .PATH<suffix> has to be handled specially. |
1160 | * Call on the suffix module to give us a path to modify. | | 1160 | * Call on the suffix module to give us a path to modify. |
1161 | */ | | 1161 | */ |
1162 | static Boolean | | 1162 | static Boolean |
1163 | ParseDoDependencyTargetPath(const char *line, SearchPathList **inout_paths) | | 1163 | ParseDoDependencyTargetPath(const char *line, SearchPathList **inout_paths) |
1164 | { | | 1164 | { |