make(1): rename CmdOpts.lint to strict

When running lint(1) on the code, it defines the preprocessor macro
"lint" to 1, which generated a syntax error in the declaration "Boolean
lint", as that became "Boolean 1".
This commit is contained in:
rillig 2020-12-23 13:50:54 +00:00
parent b3b6e90160
commit dff2a68ecc
5 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.230 2020/12/20 14:32:13 rillig Exp $ */
/* $NetBSD: cond.c,v 1.231 2020/12/23 13:50:54 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -94,7 +94,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
MAKE_RCSID("$NetBSD: cond.c,v 1.230 2020/12/20 14:32:13 rillig Exp $");
MAKE_RCSID("$NetBSD: cond.c,v 1.231 2020/12/23 13:50:54 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@ -852,7 +852,7 @@ CondParser_Token(CondParser *par, Boolean doEval)
par->p++;
if (par->p[0] == '|')
par->p++;
else if (opts.lint) {
else if (opts.strict) {
Parse_Error(PARSE_FATAL, "Unknown operator '|'");
par->printedError = TRUE;
return TOK_ERROR;
@ -863,7 +863,7 @@ CondParser_Token(CondParser *par, Boolean doEval)
par->p++;
if (par->p[0] == '&')
par->p++;
else if (opts.lint) {
else if (opts.strict) {
Parse_Error(PARSE_FATAL, "Unknown operator '&'");
par->printedError = TRUE;
return TOK_ERROR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.500 2020/12/20 14:39:46 rillig Exp $ */
/* $NetBSD: main.c,v 1.501 2020/12/23 13:50:54 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -109,7 +109,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: main.c,v 1.500 2020/12/20 14:39:46 rillig Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.501 2020/12/23 13:50:54 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -288,7 +288,7 @@ parse_debug_options(const char *argvalue)
debug |= DEBUG_JOB;
break;
case 'L':
opts.lint = TRUE;
opts.strict = TRUE;
break;
case 'l':
debug |= DEBUG_LOUD;
@ -1114,7 +1114,7 @@ CmdOpts_Init(void)
opts.compatMake = FALSE;
opts.debug = DEBUG_NONE;
/* opts.debug_file has been initialized earlier */
opts.lint = FALSE;
opts.strict = FALSE;
opts.debugVflag = FALSE;
opts.checkEnvFirst = FALSE;
Lst_Init(&opts.makefiles);
@ -1645,7 +1645,7 @@ main_CleanUp(void)
static int
main_Exit(Boolean outOfDate)
{
if (opts.lint && (main_errors > 0 || Parse_GetFatals() > 0))
if (opts.strict && (main_errors > 0 || Parse_GetFatals() > 0))
return 2; /* Not 1 so -q can distinguish error */
return outOfDate ? 1 : 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.236 2020/12/22 22:31:50 rillig Exp $ */
/* $NetBSD: make.h,v 1.237 2020/12/23 13:50:54 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -626,7 +626,7 @@ typedef struct CmdOpts {
*
* Runs make in strict mode, with additional checks and better error
* handling. */
Boolean lint;
Boolean strict;
/* -dV: for the -V option, print unexpanded variable values */
Boolean debugVflag;

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.514 2020/12/22 08:51:30 rillig Exp $ */
/* $NetBSD: parse.c,v 1.515 2020/12/23 13:50:54 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.514 2020/12/22 08:51:30 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.515 2020/12/23 13:50:54 rillig Exp $");
/* types and constants */
@ -1912,7 +1912,7 @@ Parse_IsVar(const char *p, VarAssign *out_var)
static void
VarCheckSyntax(VarAssignOp type, const char *uvalue, GNode *ctxt)
{
if (opts.lint) {
if (opts.strict) {
if (type != VAR_SUBST && strchr(uvalue, '$') != NULL) {
char *expandedValue;
@ -3171,7 +3171,7 @@ ParseDependency(char *line)
* Var_Parse does not print any parse errors in such a case.
* It simply returns the special empty string var_Error,
* which cannot be detected in the result of Var_Subst. */
eflags = opts.lint ? VARE_WANTRES : VARE_WANTRES | VARE_UNDEFERR;
eflags = opts.strict ? VARE_WANTRES : VARE_WANTRES | VARE_UNDEFERR;
(void)Var_Subst(line, VAR_CMDLINE, eflags, &expanded_line);
/* TODO: handle errors */

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.763 2020/12/23 13:11:27 rillig Exp $ */
/* $NetBSD: var.c,v 1.764 2020/12/23 13:50:54 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: var.c,v 1.763 2020/12/23 13:11:27 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.764 2020/12/23 13:50:54 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@ -2225,7 +2225,7 @@ ApplyModifier_Loop(const char **pp, const char *val, ApplyModifiersState *st)
res = ParseModifierPart(pp, '@', VARE_NONE, st, &args.tvar);
if (res != VPR_OK)
return AMR_CLEANUP;
if (opts.lint && strchr(args.tvar, '$') != NULL) {
if (opts.strict && strchr(args.tvar, '$') != NULL) {
Parse_Error(PARSE_FATAL,
"In the :@ modifier of \"%s\", the variable name \"%s\" "
"must not contain a dollar.",
@ -3552,7 +3552,7 @@ ApplySingleModifier(ApplyModifiersState *st, const char *mod, char endc,
st->endc, st->var->name.str, inout_value->str, *mod);
} else if (*p == ':') {
p++;
} else if (opts.lint && *p != '\0' && *p != endc) {
} else if (opts.strict && *p != '\0' && *p != endc) {
Parse_Error(PARSE_FATAL,
"Missing delimiter ':' after modifier \"%.*s\"",
(int)(p - mod), mod);
@ -3749,7 +3749,7 @@ ValidShortVarname(char varname, const char *start)
return VPR_OK;
}
if (!opts.lint)
if (!opts.strict)
return VPR_PARSE_SILENT;
if (varname == '$')
@ -3797,7 +3797,7 @@ ParseVarnameShort(char startc, const char **pp, GNode *ctxt,
*pp += 2;
*out_FALSE_val = UndefinedShortVarValue(startc, ctxt, eflags);
if (opts.lint && *out_FALSE_val == var_Error) {
if (opts.strict && *out_FALSE_val == var_Error) {
Parse_Error(PARSE_FATAL,
"Variable \"%s\" is undefined", name);
*out_FALSE_res = VPR_UNDEF_MSG;
@ -3854,7 +3854,7 @@ EvalUndefined(Boolean dynamic, const char *start, const char *p, char *varname,
return VPR_OK;
}
if ((eflags & VARE_UNDEFERR) && opts.lint) {
if ((eflags & VARE_UNDEFERR) && opts.strict) {
Parse_Error(PARSE_FATAL,
"Variable \"%s\" is undefined", varname);
free(varname);
@ -4103,7 +4103,7 @@ Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags, FStr *out_val)
if (strchr(value.str, '$') != NULL && (eflags & VARE_WANTRES)) {
char *expanded;
VarEvalFlags nested_eflags = eflags;
if (opts.lint)
if (opts.strict)
nested_eflags &= ~(unsigned)VARE_UNDEFERR;
v->flags |= VAR_IN_USE;
(void)Var_Subst(value.str, ctxt, nested_eflags, &expanded);