Sun Sep 13 20:38:47 2020 UTC ()
make(1): fix documentation of VarParseErrors

It does not matter whether lint mode is enabled or not, Var_Parse must
reliably return whether an error message has been printed or not.

In the current phase where proper error handling is implemented only in
lint mode, this leads to code that looks a bit bloated since a few extra
branches are added, but that's ok.  Eventually the SILENT constants will
all be removed, and then the number of different cases will shrink
again.


(rillig)
diff -r1.121 -r1.122 src/usr.bin/make/nonints.h

cvs diff -r1.121 -r1.122 src/usr.bin/make/Attic/nonints.h (expand / switch to unified diff)

--- src/usr.bin/make/Attic/nonints.h 2020/09/13 19:46:23 1.121
+++ src/usr.bin/make/Attic/nonints.h 2020/09/13 20:38:47 1.122
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: nonints.h,v 1.121 2020/09/13 19:46:23 rillig Exp $ */ 1/* $NetBSD: nonints.h,v 1.122 2020/09/13 20:38:47 rillig Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1988, 1989, 1990, 1993 4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor. 8 * Adam de Boor.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -209,57 +209,54 @@ typedef enum { @@ -209,57 +209,54 @@ typedef enum {
209 * As of 2020-09-13, this bitset looks quite bloated, 209 * As of 2020-09-13, this bitset looks quite bloated,
210 * with all the constants doubled. 210 * with all the constants doubled.
211 * 211 *
212 * Its purpose is to first document the existing behavior, 212 * Its purpose is to first document the existing behavior,
213 * and then migrate away from the SILENT constants, step by step, 213 * and then migrate away from the SILENT constants, step by step,
214 * as these are not suited for reliable, consistent error handling 214 * as these are not suited for reliable, consistent error handling
215 * and reporting. */ 215 * and reporting. */
216typedef enum { 216typedef enum {
217 217
218 /* Both parsing and evaluation succeeded. */ 218 /* Both parsing and evaluation succeeded. */
219 VPE_OK = 0x0000, 219 VPE_OK = 0x0000,
220 220
221 /* Parsing failed. 221 /* Parsing failed.
222 * An error message has already been printed. 222 * An error message has already been printed. */
223 * (It suffices if the error message is printed in lint mode.) */ 
224 VPE_PARSE_MSG = 0x0001, 223 VPE_PARSE_MSG = 0x0001,
225 224
226 /* Parsing failed. 225 /* Parsing failed.
227 * No error message has been printed yet. 226 * No error message has been printed yet.
228 * 227 *
229 * This should never happen since it is impossible to say where 228 * This should never happen since it is impossible to say where
230 * the parsing error occurred. */ 229 * the parsing error occurred. */
231 VPE_PARSE_SILENT = 0x0002, 230 VPE_PARSE_SILENT = 0x0002,
232 231
233 /* Parsing succeeded. 232 /* Parsing succeeded.
234 * During evaluation, VARE_UNDEFERR was set and there was an undefined 233 * During evaluation, VARE_UNDEFERR was set and there was an undefined
235 * variable. 234 * variable.
236 * An error message has already been printed. 235 * An error message has already been printed. */
237 * (It suffices if the error message is printed in lint mode.) */ 
238 VPE_UNDEF_MSG = 0x0010, 236 VPE_UNDEF_MSG = 0x0010,
239 237
240 /* Parsing succeeded. 238 /* Parsing succeeded.
241 * During evaluation, VARE_UNDEFERR was set and there was an undefined 239 * During evaluation, VARE_UNDEFERR was set and there was an undefined
242 * variable. 240 * variable.
243 * No error message has been printed yet. 241 * No error message has been printed yet.
244 * 242 *
245 * This should never happen since it is impossible to say which of 243 * This should never happen since it is impossible to say which of
246 * the variables was undefined. */ 244 * the variables was undefined. */
247 VPE_UNDEF_SILENT = 0x0020, 245 VPE_UNDEF_SILENT = 0x0020,
248 246
249 /* Parsing succeeded. 247 /* Parsing succeeded.
250 * Evaluation failed. 248 * Evaluation failed.
251 * An error message has already been printed. 249 * An error message has already been printed. */
252 * (It suffices if the error message is printed in lint mode.) */ 
253 VPE_EVAL_MSG = 0x0100, 250 VPE_EVAL_MSG = 0x0100,
254 251
255 /* Parsing succeeded. 252 /* Parsing succeeded.
256 * Evaluation failed. 253 * Evaluation failed.
257 * No error message has been printed yet. 254 * No error message has been printed yet.
258 * 255 *
259 * This should never happen since it is impossible to say where 256 * This should never happen since it is impossible to say where
260 * exactly the evaluation error occurred. */ 257 * exactly the evaluation error occurred. */
261 VPE_EVAL_SILENT = 0x0200, 258 VPE_EVAL_SILENT = 0x0200,
262 259
263 /* See if a message has already been printed for this error. */ 260 /* See if a message has already been printed for this error. */
264 VPE_ANY_MSG = VPE_PARSE_MSG | VPE_UNDEF_MSG | VPE_EVAL_MSG 261 VPE_ANY_MSG = VPE_PARSE_MSG | VPE_UNDEF_MSG | VPE_EVAL_MSG
265} VarParseErrors; 262} VarParseErrors;