Module Name:    src
Committed By:   rillig
Date:           Fri Oct 23 20:04:56 UTC 2020

Modified Files:
        src/usr.bin/make: make.h nonints.h parse.c

Log Message:
make(1): convert error level for Parse_Error to an enum


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/make.h
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.397 -r1.398 src/usr.bin/make/parse.c

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/make.h
diff -u src/usr.bin/make/make.h:1.166 src/usr.bin/make/make.h:1.167
--- src/usr.bin/make/make.h:1.166	Fri Oct 23 19:48:17 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.166 2020/10/23 19:48:17 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.167 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -379,12 +379,14 @@ typedef struct GNode {
 
 /*
  * Error levels for parsing. PARSE_FATAL means the process cannot continue
- * once the makefile has been parsed. PARSE_WARNING means it can. Passed
- * as the first argument to Parse_Error.
+ * once the top-level makefile has been parsed. PARSE_WARNING and PARSE_INFO
+ * mean it can.
  */
-#define PARSE_INFO	3
-#define PARSE_WARNING	2
-#define PARSE_FATAL	1
+typedef enum ParseErrorLevel {
+    PARSE_FATAL = 1,
+    PARSE_WARNING,
+    PARSE_INFO
+} ParseErrorLevel;
 
 /*
  * Values returned by Cond_EvalLine and Cond_EvalCondition.

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.145 src/usr.bin/make/nonints.h:1.146
--- src/usr.bin/make/nonints.h:1.145	Mon Oct 19 23:43:55 2020
+++ src/usr.bin/make/nonints.h	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.145 2020/10/19 23:43:55 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.146 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@ typedef struct VarAssign {
 
 typedef char *(*NextBufProc)(void *, size_t *);
 
-void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
+void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 Boolean Parse_IsVar(const char *, VarAssign *out_var);
 void Parse_DoVar(VarAssign *, GNode *);
 void Parse_AddIncludeDir(const char *);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.397 src/usr.bin/make/parse.c:1.398
--- src/usr.bin/make/parse.c:1.397	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/parse.c	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.398 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.398 2020/10/23 20:04:56 rillig Exp $");
 
 /* types and constants */
 
@@ -645,8 +645,8 @@ PrintLocation(FILE *f, const char *filen
  * until the end of the current top-level makefile, then exit (see
  * Parse_File). */
 static void
-ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno, int type,
-    const char *fmt, va_list ap)
+ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno,
+		    ParseErrorLevel type, const char *fmt, va_list ap)
 {
 	static Boolean fatal_warning_error_printed = FALSE;
 
@@ -671,7 +671,7 @@ ParseVErrorInternal(FILE *f, const char 
 }
 
 static void
-ParseErrorInternal(const char *cfname, size_t clineno, int type,
+ParseErrorInternal(const char *cfname, size_t clineno, ParseErrorLevel type,
 		   const char *fmt, ...)
 {
 	va_list ap;
@@ -693,7 +693,7 @@ ParseErrorInternal(const char *cfname, s
  *
  * Fmt is given without a trailing newline. */
 void
-Parse_Error(int type, const char *fmt, ...)
+Parse_Error(ParseErrorLevel type, const char *fmt, ...)
 {
 	va_list ap;
 	const char *fname;

Reply via email to