Module Name:    src
Committed By:   rillig
Date:           Sun Nov 28 23:12:51 UTC 2021

Modified Files:
        src/usr.bin/make: compat.c make.c make.h

Log Message:
make: fix a few lint warnings about type mismatch in enum comparisons

These warnings were triggered with the lint flag '-e', which enables
additional checks on enums.  This check would have detected the type
mismatch from the previous commit.

The check has a few strange warnings though, complaining about
initialization of 'unsigned long' with 'unsigned long', so don't enable
it for the official builds.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/usr.bin/make/compat.c
cvs rdiff -u -r1.247 -r1.248 src/usr.bin/make/make.c
cvs rdiff -u -r1.269 -r1.270 src/usr.bin/make/make.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.228 src/usr.bin/make/compat.c:1.229
--- src/usr.bin/make/compat.c:1.228	Sun Nov 28 19:51:06 2021
+++ src/usr.bin/make/compat.c	Sun Nov 28 23:12:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.228 2021/11/28 19:51:06 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.229 2021/11/28 23:12:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.228 2021/11/28 19:51:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.229 2021/11/28 23:12:51 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -237,7 +237,7 @@ Compat_RunCommand(const char *cmdp, GNod
 				 * using a shell */
 	const char *volatile cmd = cmdp;
 
-	silent = (gn->type & OP_SILENT) != 0;
+	silent = (gn->type & OP_SILENT) != OP_NONE;
 	errCheck = !(gn->type & OP_IGNORE);
 	doIt = false;
 
@@ -562,7 +562,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 			RunCommands(gn);
 			curTarg = NULL;
 		} else {
-			Job_Touch(gn, (gn->type & OP_SILENT) != 0);
+			Job_Touch(gn, (gn->type & OP_SILENT) != OP_NONE);
 		}
 	} else {
 		gn->made = ERROR;

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.247 src/usr.bin/make/make.c:1.248
--- src/usr.bin/make/make.c:1.247	Sun Nov 28 22:48:06 2021
+++ src/usr.bin/make/make.c	Sun Nov 28 23:12:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.247 2021/11/28 22:48:06 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.248 2021/11/28 23:12:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.247 2021/11/28 22:48:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.248 2021/11/28 23:12:51 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -144,7 +144,7 @@ GNodeType_ToString(GNodeType type, void 
 	Buffer buf;
 
 	Buf_InitSize(&buf, 32);
-#define ADD(flag) Buf_AddFlag(&buf, (type & (flag)) != 0, #flag)
+#define ADD(flag) Buf_AddFlag(&buf, (type & (flag)) != OP_NONE, #flag)
 	ADD(OP_DEPENDS);
 	ADD(OP_FORCE);
 	ADD(OP_DOUBLEDEP);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.269 src/usr.bin/make/make.h:1.270
--- src/usr.bin/make/make.h:1.269	Sun Nov 28 20:11:45 2021
+++ src/usr.bin/make/make.h	Sun Nov 28 23:12:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.269 2021/11/28 20:11:45 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.270 2021/11/28 23:12:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -706,7 +706,7 @@ bool GNode_ShouldExecute(GNode *gn);
 MAKE_INLINE bool
 GNode_IsTarget(const GNode *gn)
 {
-	return (gn->type & OP_OPMASK) != 0;
+	return (gn->type & OP_OPMASK) != OP_NONE;
 }
 
 MAKE_INLINE const char *

Reply via email to