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): fix a few inconsistencies for lint's s...



details:   https://anonhg.NetBSD.org/src/rev/664f3e5a31a3
branches:  trunk
changeset: 1017940:664f3e5a31a3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 16 20:49:31 2021 +0000

description:
make(1): fix a few inconsistencies for lint's strict bool mode

diffstat:

 usr.bin/make/main.c     |   6 +++---
 usr.bin/make/make.c     |  16 ++++++++--------
 usr.bin/make/make.h     |   4 ++--
 usr.bin/make/meta.c     |   6 +++---
 usr.bin/make/metachar.h |   4 ++--
 usr.bin/make/var.c      |   9 +++++++--
 6 files changed, 25 insertions(+), 20 deletions(-)

diffs (191 lines):

diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/main.c       Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.512 2021/01/10 23:59:53 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.513 2021/01/16 20:49:31 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.512 2021/01/10 23:59:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.513 2021/01/16 20:49:31 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2095,7 +2095,7 @@
                else
                        quietly = (gn != NULL && (gn->type & OP_MAKE)) ? 1 : 0;
        }
-       return quietly;
+       return quietly != 0;
 }
 
 static void
diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/make.c       Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.235 2021/01/16 20:49:31 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -103,7 +103,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.235 2021/01/16 20:49:31 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -893,7 +893,7 @@
        gn->flags |= DONE_ALLSRC;
 }
 
-static int
+static Boolean
 MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext)
 {
 
@@ -903,13 +903,13 @@
                GNode_FprintDetails(opts.debug_file, "", cn, "\n");
        }
        if (GNode_IsReady(cn))
-               return 0;
+               return FALSE;
 
        /* If this node is on the RHS of a .ORDER, check LHSs. */
        if (IsWaitingForOrder(cn)) {
                /* Can't build this (or anything else in this child list) yet */
                cn->made = DEFERRED;
-               return 0;       /* but keep looking */
+               return FALSE;   /* but keep looking */
        }
 
        DEBUG2(MAKE, "MakeBuildChild: schedule %s%s\n",
@@ -925,7 +925,7 @@
                ListNode *ln;
 
                for (ln = cn->cohorts.first; ln != NULL; ln = ln->next)
-                       if (MakeBuildChild(ln->datum, toBeMadeNext) != 0)
+                       if (MakeBuildChild(ln->datum, toBeMadeNext))
                                break;
        }
 
@@ -943,7 +943,7 @@
        if (pn->made != DEFERRED)
                return 0;
 
-       if (MakeBuildChild(pn, toBeMadeNext) == 0) {
+       if (!MakeBuildChild(pn, toBeMadeNext)) {
                /* When this node is built, reschedule its parents. */
                pn->flags |= DONE_ORDER;
        }
@@ -958,7 +958,7 @@
        GNodeListNode *ln;
 
        for (ln = gn->children.first; ln != NULL; ln = ln->next)
-               if (MakeBuildChild(ln->datum, toBeMadeNext) != 0)
+               if (MakeBuildChild(ln->datum, toBeMadeNext))
                        break;
 }
 
diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/make.h       Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.242 2021/01/10 21:20:46 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.243 2021/01/16 20:49:31 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -590,7 +590,7 @@
        do { \
                if (DEBUG(module)) \
                        debug_printf args; \
-       } while (/*CONSTCOND*/ 0)
+       } while (/*CONSTCOND*/FALSE)
 
 #define DEBUG0(module, text) \
        DEBUG_IMPL(module, ("%s", text))
diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/meta.c       Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.168 2021/01/10 21:20:46 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.169 2021/01/16 20:49:31 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -403,7 +403,7 @@
        } \
        return FALSE; \
     } \
-} while (/*CONSTCOND*/0)
+} while (/*CONSTCOND*/FALSE)
 
 
 /*
@@ -1695,7 +1695,7 @@
            fflush(stdout);
            buf[nread] = '\0';
            meta_job_output(NULL, buf, "");
-       } while (/*CONSTCOND*/0);
+       } while (/*CONSTCOND*/FALSE);
        if (metafd != -1 && FD_ISSET(metafd, &readfds) != 0) {
            if (meta_job_event(NULL) <= 0)
                metafd = -1;
diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/metachar.h
--- a/usr.bin/make/metachar.h   Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/metachar.h   Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: metachar.h,v 1.13 2021/01/10 21:20:46 rillig Exp $     */
+/*     $NetBSD: metachar.h,v 1.14 2021/01/16 20:49:31 rillig Exp $     */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #define is_shell_metachar(c)   (_metachar[(c) & 0x7f] != 0)
 
-MAKE_INLINE int
+MAKE_INLINE Boolean
 needshell(const char *cmd)
 {
        while (!is_shell_metachar(*cmd) && *cmd != ':' && *cmd != '=')
diff -r 44d5e507cf37 -r 664f3e5a31a3 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Jan 16 20:33:32 2021 +0000
+++ b/usr.bin/make/var.c        Sat Jan 16 20:49:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.781 2021/01/10 23:59:53 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.782 2021/01/16 20:49:31 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.781 2021/01/10 23:59:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.782 2021/01/16 20:49:31 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -3650,7 +3650,12 @@
 {
        ApplyModifiersState st = {
            startc, endc, v, ctxt, eflags,
+#if defined(lint)
+           /* lint cannot parse C99 struct initializers yet. */
+           { var_Error, NULL },
+#else
            FStr_InitRefer(var_Error), /* .newVal */
+#endif
            ' ',                /* .sep */
            FALSE,              /* .oneBigWord */
            *exprFlags          /* .exprFlags */



Home | Main Index | Thread Index | Old Index