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): convert error level for Parse_Error to...



details:   https://anonhg.NetBSD.org/src/rev/e7428fe8f7ed
branches:  trunk
changeset: 945200:e7428fe8f7ed
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 23 20:04:56 2020 +0000

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

diffstat:

 usr.bin/make/make.h    |  14 ++++++++------
 usr.bin/make/nonints.h |   4 ++--
 usr.bin/make/parse.c   |  12 ++++++------
 3 files changed, 16 insertions(+), 14 deletions(-)

diffs (94 lines):

diff -r d4ca95e2103a -r e7428fe8f7ed usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Oct 23 19:54:35 2020 +0000
+++ b/usr.bin/make/make.h       Fri Oct 23 20:04:56 2020 +0000
@@ -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 @@
 
 /*
  * 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.
diff -r d4ca95e2103a -r e7428fe8f7ed usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Fri Oct 23 19:54:35 2020 +0000
+++ b/usr.bin/make/nonints.h    Fri Oct 23 20:04:56 2020 +0000
@@ -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 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 *);
diff -r d4ca95e2103a -r e7428fe8f7ed usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Oct 23 19:54:35 2020 +0000
+++ b/usr.bin/make/parse.c      Fri Oct 23 20:04:56 2020 +0000
@@ -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 @@
  * 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 @@
 }
 
 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 @@
  *
  * 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;



Home | Main Index | Thread Index | Old Index