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): rename CmdOpts.lint to strict



details:   https://anonhg.NetBSD.org/src/rev/ff4f644aaf52
branches:  trunk
changeset: 958097:ff4f644aaf52
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Dec 23 13:50:54 2020 +0000

description:
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".

diffstat:

 usr.bin/make/cond.c  |   8 ++++----
 usr.bin/make/main.c  |  10 +++++-----
 usr.bin/make/make.h  |   4 ++--
 usr.bin/make/parse.c |   8 ++++----
 usr.bin/make/var.c   |  16 ++++++++--------
 5 files changed, 23 insertions(+), 23 deletions(-)

diffs (207 lines):

diff -r 799c4cac44e9 -r ff4f644aaf52 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Wed Dec 23 13:49:12 2020 +0000
+++ b/usr.bin/make/cond.c       Wed Dec 23 13:50:54 2020 +0000
@@ -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 @@
                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 @@
                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;
diff -r 799c4cac44e9 -r ff4f644aaf52 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Dec 23 13:49:12 2020 +0000
+++ b/usr.bin/make/main.c       Wed Dec 23 13:50:54 2020 +0000
@@ -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 @@
                        debug |= DEBUG_JOB;
                        break;
                case 'L':
-                       opts.lint = TRUE;
+                       opts.strict = TRUE;
                        break;
                case 'l':
                        debug |= DEBUG_LOUD;
@@ -1114,7 +1114,7 @@
        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 @@
 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;
 }
diff -r 799c4cac44e9 -r ff4f644aaf52 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Wed Dec 23 13:49:12 2020 +0000
+++ b/usr.bin/make/make.h       Wed Dec 23 13:50:54 2020 +0000
@@ -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 @@
         *
         * 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;
diff -r 799c4cac44e9 -r ff4f644aaf52 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Wed Dec 23 13:49:12 2020 +0000
+++ b/usr.bin/make/parse.c      Wed Dec 23 13:50:54 2020 +0000
@@ -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 @@
 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 @@
         * 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 */
 
diff -r 799c4cac44e9 -r ff4f644aaf52 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Wed Dec 23 13:49:12 2020 +0000
+++ b/usr.bin/make/var.c        Wed Dec 23 13:50:54 2020 +0000
@@ -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 @@
        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 @@
                    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 @@
                return VPR_OK;
        }
 
-       if (!opts.lint)
+       if (!opts.strict)
                return VPR_PARSE_SILENT;
 
        if (varname == '$')
@@ -3797,7 +3797,7 @@
                *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 @@
                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 @@
        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);



Home | Main Index | Thread Index | Old Index