Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): clean up JobStart
details: https://anonhg.NetBSD.org/src/rev/d27f5fc06b77
branches: trunk
changeset: 1016038:d27f5fc06b77
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 07 20:03:56 2020 +0000
description:
make(1): clean up JobStart
Initialize the fields in declaration order.
Initialize Job.flags in a single assignment.
diffstat:
usr.bin/make/job.c | 33 ++++++++++++---------------------
usr.bin/make/job.h | 13 +++++++------
2 files changed, 19 insertions(+), 27 deletions(-)
diffs (104 lines):
diff -r a1fbc78e343e -r d27f5fc06b77 usr.bin/make/job.c
--- a/usr.bin/make/job.c Sat Nov 07 20:01:17 2020 +0000
+++ b/usr.bin/make/job.c Sat Nov 07 20:03:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.308 2020/11/07 13:53:12 rillig Exp $ */
+/* $NetBSD: job.c,v 1.309 2020/11/07 20:03:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.308 2020/11/07 13:53:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.309 2020/11/07 20:03:56 rillig Exp $");
/* A shell defines how the commands are run. All commands for a target are
* written into a single file, which is then given to the shell to execute
@@ -1491,7 +1491,7 @@
*-----------------------------------------------------------------------
*/
static JobStartResult
-JobStart(GNode *gn, int flags)
+JobStart(GNode *gn, JobFlags flags)
{
Job *job; /* new job descriptor */
char *argv[10]; /* Argument vector to shell */
@@ -1507,26 +1507,17 @@
Punt("JobStart no job slots vacant");
memset(job, 0, sizeof *job);
- job->job_state = JOB_ST_SETUP;
- if (gn->type & OP_SPECIAL)
- flags |= JOB_SPECIAL;
-
job->node = gn;
job->tailCmds = NULL;
+ job->job_state = JOB_ST_SETUP;
- /*
- * Set the initial value of the flags for this job based on the global
- * ones and the node's attributes... Any flags supplied by the caller
- * are also added to the field.
- */
- job->flags = 0;
- if (Targ_Ignore(gn)) {
- job->flags |= JOB_IGNERR;
- }
- if (Targ_Silent(gn)) {
- job->flags |= JOB_SILENT;
- }
- job->flags |= flags;
+ if (gn->type & OP_SPECIAL)
+ flags |= JOB_SPECIAL;
+ if (Targ_Ignore(gn))
+ flags |= JOB_IGNERR;
+ if (Targ_Silent(gn))
+ flags |= JOB_SILENT;
+ job->flags = flags;
/*
* Check the commands now so any attributes from .DEFAULT have a chance
@@ -2053,7 +2044,7 @@
void
Job_Make(GNode *gn)
{
- (void)JobStart(gn, 0);
+ (void)JobStart(gn, JOB_NONE);
}
void
diff -r a1fbc78e343e -r d27f5fc06b77 usr.bin/make/job.h
--- a/usr.bin/make/job.h Sat Nov 07 20:01:17 2020 +0000
+++ b/usr.bin/make/job.h Sat Nov 07 20:03:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.h,v 1.58 2020/10/26 21:34:10 rillig Exp $ */
+/* $NetBSD: job.h,v 1.59 2020/11/07 20:03:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -125,17 +125,18 @@
} JobState;
typedef enum JobFlags {
+ JOB_NONE = 0,
/* Ignore non-zero exits */
- JOB_IGNERR = 0x001,
+ JOB_IGNERR = 1 << 0,
/* no output */
- JOB_SILENT = 0x002,
+ JOB_SILENT = 1 << 1,
/* Target is a special one. i.e. run it locally
* if we can't export it and maxLocal is 0 */
- JOB_SPECIAL = 0x004,
+ JOB_SPECIAL = 1 << 2,
/* Ignore "..." lines when processing commands */
- JOB_IGNDOTS = 0x008,
+ JOB_IGNDOTS = 1 << 3,
/* we've sent 'set -x' */
- JOB_TRACED = 0x400
+ JOB_TRACED = 1 << 10
} JobFlags;
/* A Job manages the shell commands that are run to create a single target.
Home |
Main Index |
Thread Index |
Old Index