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: use C99 bool type instead of defining its...



details:   https://anonhg.NetBSD.org/src/rev/c5ede4fe747c
branches:  trunk
changeset: 960933:c5ede4fe747c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Apr 03 11:08:40 2021 +0000

description:
make: use C99 bool type instead of defining its own

No functional change.

diffstat:

 usr.bin/make/arch.c                            |   70 ++--
 usr.bin/make/buf.h                             |    4 +-
 usr.bin/make/compat.c                          |   38 +-
 usr.bin/make/cond.c                            |  218 +++++++-------
 usr.bin/make/dir.c                             |   60 ++--
 usr.bin/make/dir.h                             |    6 +-
 usr.bin/make/for.c                             |   46 +-
 usr.bin/make/hash.c                            |   10 +-
 usr.bin/make/hash.h                            |   10 +-
 usr.bin/make/job.c                             |  250 ++++++++--------
 usr.bin/make/job.h                             |   20 +-
 usr.bin/make/lst.h                             |    4 +-
 usr.bin/make/main.c                            |  224 ++++++++--------
 usr.bin/make/make.c                            |   82 ++--
 usr.bin/make/make.h                            |  119 +++-----
 usr.bin/make/meta.c                            |  172 ++++++------
 usr.bin/make/meta.h                            |    8 +-
 usr.bin/make/metachar.h                        |    4 +-
 usr.bin/make/nonints.h                         |   52 +-
 usr.bin/make/parse.c                           |  254 +++++++++---------
 usr.bin/make/str.c                             |   28 +-
 usr.bin/make/suff.c                            |   60 ++--
 usr.bin/make/targ.c                            |   10 +-
 usr.bin/make/test-variants.sh                  |   17 +-
 usr.bin/make/unit-tests/Makefile               |    6 +-
 usr.bin/make/unit-tests/varmod-match-escape.mk |    8 +-
 usr.bin/make/var.c                             |  348 ++++++++++++------------
 27 files changed, 1043 insertions(+), 1085 deletions(-)

diffs (truncated from 7193 to 300 lines):

diff -r 37c6fe65c2b0 -r c5ede4fe747c usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sat Apr 03 07:38:11 2021 +0000
+++ b/usr.bin/make/arch.c       Sat Apr 03 11:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.198 2021/03/15 12:15:03 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.199 2021/04/03 11:08:40 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
 #include "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.198 2021/03/15 12:15:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.199 2021/04/03 11:08:40 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -179,10 +179,10 @@
  *     scope           The scope in which to expand variables.
  *
  * Output:
- *     return          TRUE if it was a valid specification.
+ *     return          True if it was a valid specification.
  *     *pp             Points to the first non-space after the archive spec.
  */
-Boolean
+bool
 Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 {
        char *cp;               /* Pointer into line */
@@ -190,12 +190,12 @@
        MFStr libName;          /* Library-part of specification */
        char *memName;          /* Member-part of specification */
        char saveChar;          /* Ending delimiter of member-name */
-       Boolean expandLibName;  /* Whether the parsed libName contains
+       bool expandLibName;     /* Whether the parsed libName contains
                                 * variable expressions that need to be
                                 * expanded */
 
        libName = MFStr_InitRefer(*pp);
-       expandLibName = FALSE;
+       expandLibName = false;
 
        for (cp = libName.str; *cp != '(' && *cp != '\0';) {
                if (*cp == '$') {
@@ -203,7 +203,7 @@
                        /* XXX: This code can probably be shortened. */
                        const char *nested_p = cp;
                        FStr result;
-                       Boolean isError;
+                       bool isError;
 
                        /* XXX: is expanded twice: once here and once below */
                        (void)Var_Parse(&nested_p, scope,
@@ -212,9 +212,9 @@
                        isError = result.str == var_Error;
                        FStr_Done(&result);
                        if (isError)
-                               return FALSE;
+                               return false;
 
-                       expandLibName = TRUE;
+                       expandLibName = true;
                        cp += nested_p - cp;
                } else
                        cp++;
@@ -235,7 +235,7 @@
                 * place and skip to the end of it (either white-space or
                 * a close paren).
                 */
-               Boolean doSubst = FALSE;
+               bool doSubst = false;
 
                pp_skip_whitespace(&cp);
 
@@ -245,7 +245,7 @@
                                /* Expand nested variable expressions. */
                                /* XXX: This code can probably be shortened. */
                                FStr result;
-                               Boolean isError;
+                               bool isError;
                                const char *nested_p = cp;
 
                                (void)Var_Parse(&nested_p, scope,
@@ -255,9 +255,9 @@
                                FStr_Done(&result);
 
                                if (isError)
-                                       return FALSE;
+                                       return false;
 
-                               doSubst = TRUE;
+                               doSubst = true;
                                cp += nested_p - cp;
                        } else {
                                cp++;
@@ -274,7 +274,7 @@
                        Parse_Error(PARSE_FATAL,
                                    "No closing parenthesis "
                                    "in archive specification");
-                       return FALSE;
+                       return false;
                }
 
                /*
@@ -331,7 +331,7 @@
                                /* Error in nested call. */
                                free(fullName);
                                /* XXX: does unexpandedMemName leak? */
-                               return FALSE;
+                               return false;
                        }
                        free(fullName);
                        /* XXX: does unexpandedMemName leak? */
@@ -382,7 +382,7 @@
        /* We promised that pp would be set up at the next non-space. */
        pp_skip_whitespace(&cp);
        *pp = cp;
-       return TRUE;
+       return true;
 }
 
 /*
@@ -392,7 +392,7 @@
  * Input:
  *     archive         Path to the archive
  *     member          Name of member; only its basename is used.
- *     addToCache      TRUE if archive should be cached if not already so.
+ *     addToCache      True if archive should be cached if not already so.
  *
  * Results:
  *     The ar_hdr for the member, or NULL.
@@ -400,7 +400,7 @@
  * See ArchFindMember for an almost identical copy of this code.
  */
 static struct ar_hdr *
-ArchStatMember(const char *archive, const char *member, Boolean addToCache)
+ArchStatMember(const char *archive, const char *member, bool addToCache)
 {
 #define AR_MAX_NAME_LEN (sizeof arh.ar_name - 1)
        FILE *arch;
@@ -661,7 +661,7 @@
 #endif
 
 
-static Boolean
+static bool
 ArchiveMember_HasName(const struct ar_hdr *hdr,
                      const char *name, size_t namelen)
 {
@@ -669,22 +669,22 @@
        const char *ar_name = hdr->ar_name;
 
        if (strncmp(ar_name, name, namelen) != 0)
-               return FALSE;
+               return false;
 
        if (namelen >= ar_name_len)
                return namelen == ar_name_len;
 
        /* hdr->ar_name is space-padded to the right. */
        if (ar_name[namelen] == ' ')
-               return TRUE;
+               return true;
 
        /* In archives created by GNU binutils 2.27, the member names end with
         * a slash. */
        if (ar_name[namelen] == '/' &&
            (namelen == ar_name_len || ar_name[namelen + 1] == ' '))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 /*
@@ -899,7 +899,7 @@
 {
        struct ar_hdr *arh;
 
-       arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), TRUE);
+       arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), true);
        if (arh != NULL)
                gn->mtime = (time_t)strtol(arh->ar_date, NULL, 10);
        else
@@ -1006,26 +1006,26 @@
  *     since this is used by 'ar' rules that affect the data contents of the
  *     archive, not by ranlib rules, which affect the TOC.
  */
-Boolean
+bool
 Arch_LibOODate(GNode *gn)
 {
-       Boolean oodate;
+       bool oodate;
 
        if (gn->type & OP_PHONY) {
-               oodate = TRUE;
+               oodate = true;
        } else if (!GNode_IsTarget(gn) && Lst_IsEmpty(&gn->children)) {
-               oodate = FALSE;
+               oodate = false;
        } else if ((!Lst_IsEmpty(&gn->children) && gn->youngestChild == NULL) ||
                   (gn->mtime > now) ||
                   (gn->youngestChild != NULL &&
                    gn->mtime < gn->youngestChild->mtime)) {
-               oodate = TRUE;
+               oodate = true;
        } else {
 #ifdef RANLIBMAG
                struct ar_hdr *arh;     /* Header for __.SYMDEF */
                int modTimeTOC;         /* The table-of-contents' mod time */
 
-               arh = ArchStatMember(gn->path, RANLIBMAG, FALSE);
+               arh = ArchStatMember(gn->path, RANLIBMAG, false);
 
                if (arh != NULL) {
                        modTimeTOC = (int)strtol(arh->ar_date, NULL, 10);
@@ -1042,10 +1042,10 @@
                         */
                        if (DEBUG(ARCH) || DEBUG(MAKE))
                                debug_printf("no toc...");
-                       oodate = TRUE;
+                       oodate = true;
                }
 #else
-               oodate = FALSE;
+               oodate = false;
 #endif
        }
        return oodate;
@@ -1067,7 +1067,7 @@
 #endif
 }
 
-Boolean
+bool
 Arch_IsLib(GNode *gn)
 {
        static const char armag[] = "!<arch>\n";
@@ -1075,11 +1075,11 @@
        int fd;
 
        if ((fd = open(gn->path, O_RDONLY)) == -1)
-               return FALSE;
+               return false;
 
        if (read(fd, buf, sizeof buf) != sizeof buf) {
                (void)close(fd);
-               return FALSE;
+               return false;
        }
 
        (void)close(fd);
diff -r 37c6fe65c2b0 -r c5ede4fe747c usr.bin/make/buf.h
--- a/usr.bin/make/buf.h        Sat Apr 03 07:38:11 2021 +0000
+++ b/usr.bin/make/buf.h        Sat Apr 03 11:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.h,v 1.42 2021/01/30 21:25:10 rillig Exp $  */
+/*     $NetBSD: buf.h,v 1.43 2021/04/03 11:08:40 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -101,7 +101,7 @@
        end[1] = '\0';
 }
 
-MAKE_INLINE Boolean
+MAKE_INLINE bool
 Buf_EndsWith(const Buffer *buf, char ch)
 {
        return buf->len > 0 && buf->data[buf->len - 1] == ch;
diff -r 37c6fe65c2b0 -r c5ede4fe747c usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Apr 03 07:38:11 2021 +0000
+++ b/usr.bin/make/compat.c     Sat Apr 03 11:08:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.225 2021/04/03 11:08:40 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.225 2021/04/03 11:08:40 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -181,7 +181,7 @@
        debug_printf("\n");
 }
 
-static Boolean
+static bool
 UseShell(const char *cmd MAKE_ATTR_UNUSED)
 {



Home | Main Index | Thread Index | Old Index