Module Name: src Committed By: rillig Date: Wed Dec 23 13:50:55 UTC 2020
Modified Files: src/usr.bin/make: cond.c main.c make.h parse.c var.c Log Message: 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". To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/usr.bin/make/cond.c cvs rdiff -u -r1.500 -r1.501 src/usr.bin/make/main.c cvs rdiff -u -r1.236 -r1.237 src/usr.bin/make/make.h cvs rdiff -u -r1.514 -r1.515 src/usr.bin/make/parse.c cvs rdiff -u -r1.763 -r1.764 src/usr.bin/make/var.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/cond.c diff -u src/usr.bin/make/cond.c:1.230 src/usr.bin/make/cond.c:1.231 --- src/usr.bin/make/cond.c:1.230 Sun Dec 20 14:32:13 2020 +++ src/usr.bin/make/cond.c Wed Dec 23 13:50:54 2020 @@ -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, Boolea 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, Boolea 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; Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.500 src/usr.bin/make/main.c:1.501 --- src/usr.bin/make/main.c:1.500 Sun Dec 20 14:39:46 2020 +++ src/usr.bin/make/main.c Wed Dec 23 13:50:54 2020 @@ -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; } Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.236 src/usr.bin/make/make.h:1.237 --- src/usr.bin/make/make.h:1.236 Tue Dec 22 22:31:50 2020 +++ src/usr.bin/make/make.h Wed Dec 23 13:50:54 2020 @@ -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; Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.514 src/usr.bin/make/parse.c:1.515 --- src/usr.bin/make/parse.c:1.514 Tue Dec 22 08:51:30 2020 +++ src/usr.bin/make/parse.c Wed Dec 23 13:50:54 2020 @@ -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 *ou 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 */ Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.763 src/usr.bin/make/var.c:1.764 --- src/usr.bin/make/var.c:1.763 Wed Dec 23 13:11:27 2020 +++ src/usr.bin/make/var.c Wed Dec 23 13:50:54 2020 @@ -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, cons 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->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 ch return VPR_OK; } - if (!opts.lint) + if (!opts.strict) return VPR_PARSE_SILENT; if (varname == '$') @@ -3797,7 +3797,7 @@ ParseVarnameShort(char startc, const cha *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 cha 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, 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);