Tue Oct 27 07:16:27 2020 UTC ()
make(1): initialize all CmdOpts fiels


(rillig)
diff -r1.395 -r1.396 src/usr.bin/make/main.c
diff -r1.590 -r1.591 src/usr.bin/make/var.c

cvs diff -r1.395 -r1.396 src/usr.bin/make/main.c (expand / switch to unified diff)

--- src/usr.bin/make/main.c 2020/10/27 07:13:02 1.395
+++ src/usr.bin/make/main.c 2020/10/27 07:16:27 1.396
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.395 2020/10/27 07:13:02 rillig Exp $ */ 1/* $NetBSD: main.c,v 1.396 2020/10/27 07:16:27 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.
@@ -108,27 +108,27 @@ @@ -108,27 +108,27 @@
108 108
109#include <errno.h> 109#include <errno.h>
110#include <signal.h> 110#include <signal.h>
111#include <stdarg.h> 111#include <stdarg.h>
112#include <time.h> 112#include <time.h>
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#include "trace.h" 118#include "trace.h"
119 119
120/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ 120/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
121MAKE_RCSID("$NetBSD: main.c,v 1.395 2020/10/27 07:13:02 rillig Exp $"); 121MAKE_RCSID("$NetBSD: main.c,v 1.396 2020/10/27 07:16:27 rillig Exp $");
122#if defined(MAKE_NATIVE) && !defined(lint) 122#if defined(MAKE_NATIVE) && !defined(lint)
123__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " 123__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
124 "The Regents of the University of California. " 124 "The Regents of the University of California. "
125 "All rights reserved."); 125 "All rights reserved.");
126#endif 126#endif
127 127
128#ifndef DEFMAXLOCAL 128#ifndef DEFMAXLOCAL
129#define DEFMAXLOCAL DEFMAXJOBS 129#define DEFMAXLOCAL DEFMAXJOBS
130#endif 130#endif
131 131
132CmdOpts opts; 132CmdOpts opts;
133time_t now; /* Time at start of make */ 133time_t now; /* Time at start of make */
134GNode *DEFAULT; /* .DEFAULT node */ 134GNode *DEFAULT; /* .DEFAULT node */
@@ -1057,42 +1057,42 @@ UnlimitFiles(void) @@ -1057,42 +1057,42 @@ UnlimitFiles(void)
1057 rl.rlim_cur = rl.rlim_max; 1057 rl.rlim_cur = rl.rlim_max;
1058 (void)setrlimit(RLIMIT_NOFILE, &rl); 1058 (void)setrlimit(RLIMIT_NOFILE, &rl);
1059 } 1059 }
1060#endif 1060#endif
1061} 1061}
1062 1062
1063static void 1063static void
1064CmdOpts_Init(void) 1064CmdOpts_Init(void)
1065{ 1065{
1066 opts.compatMake = FALSE; /* No compat mode */ 1066 opts.compatMake = FALSE; /* No compat mode */
1067 opts.debug = 0; /* No debug verbosity, please. */ 1067 opts.debug = 0; /* No debug verbosity, please. */
1068 /* opts.debug_file has been initialized earlier */ 1068 /* opts.debug_file has been initialized earlier */
1069 opts.debugVflag = FALSE; 1069 opts.debugVflag = FALSE;
1070 /* TODO: checkEnvFirst = FALSE; */ 1070 opts.checkEnvFirst = FALSE;
1071 opts.makefiles = Lst_New(); 1071 opts.makefiles = Lst_New();
1072 opts.ignoreErrors = FALSE; /* Pay attention to non-zero returns */ 1072 opts.ignoreErrors = FALSE; /* Pay attention to non-zero returns */
1073 opts.maxJobs = DEFMAXLOCAL; /* Set default local max concurrency */ 1073 opts.maxJobs = DEFMAXLOCAL; /* Set default local max concurrency */
1074 opts.keepgoing = FALSE; /* Stop on error */ 1074 opts.keepgoing = FALSE; /* Stop on error */
1075 opts.noRecursiveExecute = FALSE; /* Execute all .MAKE targets */ 1075 opts.noRecursiveExecute = FALSE; /* Execute all .MAKE targets */
1076 opts.noExecute = FALSE; /* Execute all commands */ 1076 opts.noExecute = FALSE; /* Execute all commands */
1077 opts.queryFlag = FALSE; /* This is not just a check-run */ 1077 opts.queryFlag = FALSE; /* This is not just a check-run */
1078 opts.noBuiltins = FALSE; /* Read the built-in rules */ 1078 opts.noBuiltins = FALSE; /* Read the built-in rules */
1079 opts.beSilent = FALSE; /* Print commands as executed */ 1079 opts.beSilent = FALSE; /* Print commands as executed */
1080 opts.touchFlag = FALSE; /* Actually update targets */ 1080 opts.touchFlag = FALSE; /* Actually update targets */
1081 opts.printVars = 0; 1081 opts.printVars = 0;
1082 opts.variables = Lst_New(); 1082 opts.variables = Lst_New();
1083 /* TODO: parseWarnFatal = FALSE; */ 1083 opts.parseWarnFatal = FALSE;
1084 /* TODO: enterFlag = FALSE; */ 1084 opts.enterFlag = FALSE;
1085 /* TODO: varNoExportEnv = FALSE; */ 1085 opts.varNoExportEnv = FALSE;
1086 opts.create = Lst_New(); 1086 opts.create = Lst_New();
1087} 1087}
1088 1088
1089/*- 1089/*-
1090 * main -- 1090 * main --
1091 * The main function, for obvious reasons. Initializes variables 1091 * The main function, for obvious reasons. Initializes variables
1092 * and a few modules, then parses the arguments give it in the 1092 * and a few modules, then parses the arguments give it in the
1093 * environment and on the command line. Reads the system makefile 1093 * environment and on the command line. Reads the system makefile
1094 * followed by either Makefile, makefile or the file given by the 1094 * followed by either Makefile, makefile or the file given by the
1095 * -f argument. Sets the .MAKEFLAGS PMake variable based on all the 1095 * -f argument. Sets the .MAKEFLAGS PMake variable based on all the
1096 * flags it has received by then uses either the Make or the Compat 1096 * flags it has received by then uses either the Make or the Compat
1097 * module to create the initial list of targets. 1097 * module to create the initial list of targets.
1098 * 1098 *

cvs diff -r1.590 -r1.591 src/usr.bin/make/var.c (expand / switch to unified diff)

--- src/usr.bin/make/var.c 2020/10/26 21:34:10 1.590
+++ src/usr.bin/make/var.c 2020/10/27 07:16:27 1.591
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: var.c,v 1.590 2020/10/26 21:34:10 rillig Exp $ */ 1/* $NetBSD: var.c,v 1.591 2020/10/27 07:16:27 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.
@@ -111,27 +111,27 @@ @@ -111,27 +111,27 @@
111#include <sys/types.h> 111#include <sys/types.h>
112#include <regex.h> 112#include <regex.h>
113#endif 113#endif
114#include <inttypes.h> 114#include <inttypes.h>
115#include <limits.h> 115#include <limits.h>
116#include <time.h> 116#include <time.h>
117 117
118#include "make.h" 118#include "make.h"
119#include "dir.h" 119#include "dir.h"
120#include "job.h" 120#include "job.h"
121#include "metachar.h" 121#include "metachar.h"
122 122
123/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ 123/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
124MAKE_RCSID("$NetBSD: var.c,v 1.590 2020/10/26 21:34:10 rillig Exp $"); 124MAKE_RCSID("$NetBSD: var.c,v 1.591 2020/10/27 07:16:27 rillig Exp $");
125 125
126#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) 126#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
127#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) 127#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
128#define VAR_DEBUG3(fmt, arg1, arg2, arg3) DEBUG3(VAR, fmt, arg1, arg2, arg3) 128#define VAR_DEBUG3(fmt, arg1, arg2, arg3) DEBUG3(VAR, fmt, arg1, arg2, arg3)
129#define VAR_DEBUG4(fmt, arg1, arg2, arg3, arg4) DEBUG4(VAR, fmt, arg1, arg2, arg3, arg4) 129#define VAR_DEBUG4(fmt, arg1, arg2, arg3, arg4) DEBUG4(VAR, fmt, arg1, arg2, arg3, arg4)
130 130
131ENUM_FLAGS_RTTI_3(VarEvalFlags, 131ENUM_FLAGS_RTTI_3(VarEvalFlags,
132 VARE_UNDEFERR, VARE_WANTRES, VARE_ASSIGN); 132 VARE_UNDEFERR, VARE_WANTRES, VARE_ASSIGN);
133 133
134/* 134/*
135 * This lets us tell if we have replaced the original environ 135 * This lets us tell if we have replaced the original environ
136 * (which we cannot free). 136 * (which we cannot free).
137 */ 137 */
@@ -166,27 +166,27 @@ static Boolean save_dollars = TRUE; @@ -166,27 +166,27 @@ static Boolean save_dollars = TRUE;
166/* 166/*
167 * Internally, variables are contained in four different contexts. 167 * Internally, variables are contained in four different contexts.
168 * 1) the environment. They cannot be changed. If an environment 168 * 1) the environment. They cannot be changed. If an environment
169 * variable is appended to, the result is placed in the global 169 * variable is appended to, the result is placed in the global
170 * context. 170 * context.
171 * 2) the global context. Variables set in the Makefile are located in 171 * 2) the global context. Variables set in the Makefile are located in
172 * the global context. 172 * the global context.
173 * 3) the command-line context. All variables set on the command line 173 * 3) the command-line context. All variables set on the command line
174 * are placed in this context. They are UNALTERABLE once placed here. 174 * are placed in this context. They are UNALTERABLE once placed here.
175 * 4) the local context. Each target has associated with it a context 175 * 4) the local context. Each target has associated with it a context
176 * list. On this list are located the structures describing such 176 * list. On this list are located the structures describing such
177 * local variables as $(@) and $(*) 177 * local variables as $(@) and $(*)
178 * The four contexts are searched in the reverse order from which they are 178 * The four contexts are searched in the reverse order from which they are
179 * listed (but see checkEnvFirst). 179 * listed (but see opts.checkEnvFirst).
180 */ 180 */
181GNode *VAR_INTERNAL; /* variables from make itself */ 181GNode *VAR_INTERNAL; /* variables from make itself */
182GNode *VAR_GLOBAL; /* variables from the makefile */ 182GNode *VAR_GLOBAL; /* variables from the makefile */
183GNode *VAR_CMD; /* variables defined on the command-line */ 183GNode *VAR_CMD; /* variables defined on the command-line */
184 184
185typedef enum VarFindFlags { 185typedef enum VarFindFlags {
186 FIND_CMD = 0x01, /* look in VAR_CMD when searching */ 186 FIND_CMD = 0x01, /* look in VAR_CMD when searching */
187 FIND_GLOBAL = 0x02, /* look in VAR_GLOBAL as well */ 187 FIND_GLOBAL = 0x02, /* look in VAR_GLOBAL as well */
188 FIND_ENV = 0x04 /* look in the environment also */ 188 FIND_ENV = 0x04 /* look in the environment also */
189} VarFindFlags; 189} VarFindFlags;
190 190
191typedef enum VarFlags { 191typedef enum VarFlags {
192 /* The variable's value is currently being used by Var_Parse or Var_Subst. 192 /* The variable's value is currently being used by Var_Parse or Var_Subst.