Module Name:    src
Committed By:   rillig
Date:           Sun Nov  8 01:39:24 UTC 2020

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

Log Message:
make(1): fix type mismatch between int and PrintVarsMode


To generate a diff of this commit:
cvs rdiff -u -r1.436 -r1.437 src/usr.bin/make/main.c
cvs rdiff -u -r1.197 -r1.198 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/main.c
diff -u src/usr.bin/make/main.c:1.436 src/usr.bin/make/main.c:1.437
--- src/usr.bin/make/main.c:1.436	Sat Nov  7 21:40:08 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:39:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.436 2020/11/07 21:40:08 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.436 2020/11/07 21:40:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -489,7 +489,7 @@ MainParseArg(char c, const char *argvalu
 		break;
 	case 'V':
 	case 'v':
-		opts.printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
+		opts.printVars = c == 'v' ? PVM_EXPANDED : PVM_UNEXPANDED;
 		Lst_Append(opts.variables, bmake_strdup(argvalue));
 		/* XXX: Why always -V? */
 		Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
@@ -891,7 +891,7 @@ doPrintVars(void)
 	StringListNode *ln;
 	Boolean expandVars;
 
-	if (opts.printVars == EXPAND_VARS)
+	if (opts.printVars == PVM_EXPANDED)
 		expandVars = TRUE;
 	else if (opts.debugVflag)
 		expandVars = FALSE;
@@ -1131,7 +1131,7 @@ CmdOpts_Init(void)
 	opts.noBuiltins = FALSE;	/* Read the built-in rules */
 	opts.beSilent = FALSE;		/* Print commands as executed */
 	opts.touchFlag = FALSE;		/* Actually update targets */
-	opts.printVars = 0;
+	opts.printVars = PVM_NONE;
 	opts.variables = Lst_New();
 	opts.parseWarnFatal = FALSE;
 	opts.enterFlag = FALSE;
@@ -1550,7 +1550,7 @@ main(int argc, char **argv)
 	ReadMakefiles();
 
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
-	if (!opts.noBuiltins || !opts.printVars) {
+	if (!opts.noBuiltins || opts.printVars == PVM_NONE) {
 	    /* ignore /dev/null and anything starting with "no" */
 	    (void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
 			    VAR_CMDLINE, VARE_WANTRES, &makeDependfile);
@@ -1590,7 +1590,7 @@ main(int argc, char **argv)
 	DEBUG5(JOB, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n",
 	       jp_0, jp_1, opts.maxJobs, maxJobTokens, opts.compatMake ? 1 : 0);
 
-	if (!opts.printVars)
+	if (opts.printVars == PVM_NONE)
 	    Main_ExportMAKEFLAGS(TRUE);	/* initial export */
 
 	InitVpath();
@@ -1611,7 +1611,7 @@ main(int argc, char **argv)
 		Targ_PrintGraph(1);
 
 	/* print the values of any variables requested by the user */
-	if (opts.printVars) {
+	if (opts.printVars != PVM_NONE) {
 		doPrintVars();
 		outOfDate = FALSE;
 	} else {

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.197 src/usr.bin/make/make.h:1.198
--- src/usr.bin/make/make.h:1.197	Sat Nov  7 10:44:53 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 01:39:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.197 2020/11/07 10:44:53 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.198 2020/11/08 01:39:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -554,8 +554,9 @@ void debug_printf(const char *, ...) MAK
     else debug_printf(fmt, arg1, arg2, arg3, arg4, arg5)
 
 typedef enum PrintVarsMode {
-    COMPAT_VARS = 1,
-    EXPAND_VARS
+    PVM_NONE,
+    PVM_UNEXPANDED,
+    PVM_EXPANDED
 } PrintVarsMode;
 
 /* Command line options */

Reply via email to