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): add another Boolean variant to check d...



details:   https://anonhg.NetBSD.org/src/rev/622a36e5fb80
branches:  trunk
changeset: 943246:622a36e5fb80
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 29 08:09:07 2020 +0000

description:
make(1): add another Boolean variant to check during development

diffstat:

 usr.bin/make/compat.c |  12 ++++++------
 usr.bin/make/make.h   |  11 +++++++++--
 2 files changed, 15 insertions(+), 8 deletions(-)

diffs (79 lines):

diff -r 289cd8813013 -r 622a36e5fb80 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Aug 29 07:52:55 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Aug 29 08:09:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.133 2020/08/29 08:09:07 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.133 2020/08/29 08:09:07 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.132 2020/08/28 04:48:56 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.133 2020/08/29 08:09:07 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -226,7 +226,7 @@
     char         * volatile cmd = (char *)cmdp;
     GNode        *gn = (GNode *)gnp;
 
-    silent = gn->type & OP_SILENT;
+    silent = (gn->type & OP_SILENT) != 0;
     errCheck = !(gn->type & OP_IGNORE);
     doIt = FALSE;
 
@@ -260,7 +260,7 @@
     while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) {
        switch (*cmd) {
        case '@':
-           silent = DEBUG(LOUD) ? FALSE : TRUE;
+           silent = !DEBUG(LOUD);
            break;
        case '-':
            errCheck = FALSE;
@@ -605,7 +605,7 @@
                Lst_ForEach(gn->commands, CompatRunCommand, gn);
                curTarg = NULL;
            } else {
-               Job_Touch(gn, gn->type & OP_SILENT);
+               Job_Touch(gn, (gn->type & OP_SILENT) != 0);
            }
        } else {
            gn->made = ERROR;
diff -r 289cd8813013 -r 622a36e5fb80 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Aug 29 07:52:55 2020 +0000
+++ b/usr.bin/make/make.h       Sat Aug 29 08:09:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.130 2020/08/29 07:52:55 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.131 2020/08/29 08:09:07 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -133,8 +133,15 @@
  * boolean argument to be an expression that isn't strictly 0 or 1 valued.
  */
 
-#ifdef USE_DOUBLE_BOOLEAN      /* Just to find type mismatches. */
+#ifdef USE_DOUBLE_BOOLEAN
+/* During development, to find type mismatches in function declarations. */
 typedef double Boolean;
+#elif defined(USE_UCHAR_BOOLEAN)
+/* During development, to find code that depends on the exact value of TRUE or
+ * that stores other values in Boolean variables. */
+typedef unsigned char Boolean;
+#define TRUE ((unsigned char)0xFF)
+#define FALSE ((unsigned char)0x00)
 #else
 typedef int Boolean;
 #endif



Home | Main Index | Thread Index | Old Index