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: format comments according to /usr/share/m...



details:   https://anonhg.NetBSD.org/src/rev/e79b07f2184b
branches:  trunk
changeset: 1027685:e79b07f2184b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Dec 15 12:58:01 2021 +0000

description:
make: format comments according to /usr/share/misc/style

Assisted by indent(1), with manual corrections due to its many remaining
bugs.

No functional change.

diffstat:

 usr.bin/make/arch.c    |   19 ++-
 usr.bin/make/compat.c  |   18 ++-
 usr.bin/make/cond.c    |   24 +++-
 usr.bin/make/for.c     |   12 +-
 usr.bin/make/hash.h    |    6 +-
 usr.bin/make/job.c     |   56 ++++++----
 usr.bin/make/job.h     |   12 +-
 usr.bin/make/main.c    |   47 ++++++---
 usr.bin/make/make.c    |   17 ++-
 usr.bin/make/make.h    |  239 +++++++++++++++++++++++++++++++-----------------
 usr.bin/make/nonints.h |    8 +-
 usr.bin/make/parse.c   |   55 ++++++----
 usr.bin/make/suff.c    |   36 ++++--
 usr.bin/make/trace.c   |   10 +-
 usr.bin/make/util.c    |    8 +-
 usr.bin/make/var.c     |   70 +++++++++-----
 16 files changed, 401 insertions(+), 236 deletions(-)

diffs (truncated from 1476 to 300 lines):

diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/arch.c       Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.208 2021/12/15 12:24:13 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.209 2021/12/15 12:58:01 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.208 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.209 2021/12/15 12:58:01 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -205,9 +205,8 @@
        FStr lib;               /* Library-part of specification */
        FStr mem;               /* Member-part of specification */
        char saveChar;          /* Ending delimiter of member-name */
-       bool expandLib;         /* Whether the parsed lib contains
-                                * variable expressions that need to be
-                                * expanded */
+       bool expandLib;         /* Whether the parsed lib contains variable
+                                * expressions that need to be expanded */
 
        spec = *pp;
        lib = FStr_InitRefer(spec);
@@ -258,7 +257,9 @@
                while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) {
                        if (*cp == '$') {
                                /* Expand nested variable expressions. */
-                               /* XXX: This code can probably be shortened. */
+                               /*
+                                * XXX: This code can probably be shortened.
+                                */
                                FStr result;
                                bool isError;
                                const char *nested_p = cp;
@@ -691,8 +692,10 @@
        if (ar_name[namelen] == ' ')
                return true;
 
-       /* In archives created by GNU binutils 2.27, the member names end with
-        * a slash. */
+       /*
+        * 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;
diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/compat.c     Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.231 2021/12/15 12:24:13 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.232 2021/12/15 12:58:01 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.231 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.232 2021/12/15 12:58:01 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -167,8 +167,10 @@
        debug_printf("\n*** Failed target:  %s\n*** Failed command: ",
                     gn->name);
 
-       /* Replace runs of whitespace with a single space, to reduce
-        * the amount of whitespace for multi-line command lines. */
+       /*
+        * Replace runs of whitespace with a single space, to reduce the
+        * amount of whitespace for multi-line command lines.
+        */
        while (*p != '\0') {
                if (ch_isspace(*p)) {
                        debug_printf(" ");
@@ -712,9 +714,11 @@
 
        InitSignals();
 
-       /* Create the .END node now, to keep the (debug) output of the
-        * counter.mk test the same as before 2020-09-23.  This implementation
-        * detail probably doesn't matter though. */
+       /*
+        * Create the .END node now, to keep the (debug) output of the
+        * counter.mk test the same as before 2020-09-23.  This
+        * implementation detail probably doesn't matter though.
+        */
        (void)Targ_GetEndNode();
 
        if (!opts.queryFlag)
diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/cond.c       Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.306 2021/12/15 12:58:01 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.306 2021/12/15 12:58:01 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -445,7 +445,7 @@
 
        Buf_AddStr(buf, inout_str->str);
        FStr_Done(inout_str);
-       *inout_str = FStr_InitRefer(NULL); /* not finished yet */
+       *inout_str = FStr_InitRefer(NULL);      /* not finished yet */
        return true;
 }
 
@@ -553,9 +553,11 @@
        if (TryParseNumber(value, &num))
                return num != 0.0;
 
-       /* For .if ${...}, check for non-empty string.  This is different from
-        * the evaluation function from that .if variant, which would test
-        * whether a variable of the given name were defined. */
+       /*
+        * For .if ${...}, check for non-empty string.  This is different
+        * from the evaluation function from that .if variant, which would
+        * test whether a variable of the given name were defined.
+        */
        /*
         * XXX: Whitespace should count as empty, just as in
         * CondParser_FuncCallEmpty.
@@ -1132,8 +1134,10 @@
                /* None of the previous <cond> evaluated to true. */
                IFS_INITIAL     = 0,
 
-               /* The previous <cond> evaluated to true.
-                * The lines following this condition are interpreted. */
+               /*
+                * The previous <cond> evaluated to true. The lines following
+                * this condition are interpreted.
+                */
                IFS_ACTIVE      = 1 << 0,
 
                /* The previous directive was an '.else'. */
@@ -1278,7 +1282,9 @@
        /* And evaluate the conditional expression */
        if (CondEvalExpression(p, &value, plain, evalBare, negate,
            true, false) == COND_INVALID) {
-               /* Syntax error in conditional, error message already output. */
+               /*
+                * Syntax error in conditional, error message already output.
+                */
                /* Skip everything to matching .endif */
                /* XXX: An extra '.else' is not detected in this case. */
                cond_states[cond_depth] = IFS_WAS_ACTIVE;
diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/for.c
--- a/usr.bin/make/for.c        Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/for.c        Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.150 2021/12/12 15:44:41 rillig Exp $ */
+/*     $NetBSD: for.c,v 1.151 2021/12/15 12:58:01 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: for.c,v 1.150 2021/12/12 15:44:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.151 2021/12/15 12:58:01 rillig Exp $");
 
 
 /* One of the variables to the left of the "in" in a .for loop. */
@@ -174,7 +174,7 @@
        free(items);
 
        if (f->items.len == 1 && Substring_IsEmpty(f->items.words[0]))
-               f->items.len = 0; /* .for var in ${:U} */
+               f->items.len = 0;       /* .for var in ${:U} */
 
        if (f->items.len != 0 && f->items.len % f->vars.len != 0) {
                Parse_Error(PARSE_FATAL,
@@ -340,8 +340,10 @@
                return;
        }
 
-       /* Escape ':', '$', '\\' and 'endc' - these will be removed later by
-        * :U processing, see ApplyModifier_Defined. */
+       /*
+        * Escape ':', '$', '\\' and 'endc' - these will be removed later by
+        * :U processing, see ApplyModifier_Defined.
+        */
        for (p = item.start; p != item.end; p++) {
                ch = *p;
                if (ch == '$') {
diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/hash.h
--- a/usr.bin/make/hash.h       Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/hash.h       Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.h,v 1.44 2021/12/15 12:08:25 rillig Exp $ */
+/*     $NetBSD: hash.h,v 1.45 2021/12/15 12:58:01 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -88,8 +88,8 @@
 
 /* The hash table containing the entries. */
 typedef struct HashTable {
-       HashEntry **buckets;    /* Pointers to HashEntry, one
-                                * for each bucket in the table. */
+       HashEntry **buckets;    /* Pointers to HashEntry, one for each bucket
+                                * in the table. */
        unsigned int bucketsSize;
        unsigned int numEntries; /* Number of entries in the table. */
        unsigned int bucketsMask; /* Used to select the bucket for a hash. */
diff -r 710ef8d271b1 -r e79b07f2184b usr.bin/make/job.c
--- a/usr.bin/make/job.c        Wed Dec 15 12:52:36 2021 +0000
+++ b/usr.bin/make/job.c        Wed Dec 15 12:58:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.442 2021/12/15 12:24:13 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.443 2021/12/15 12:58:01 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.442 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.443 2021/12/15 12:58:01 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -201,13 +201,15 @@
        const char *errOff;     /* command to turn off error checking */
 
        const char *echoTmpl;   /* template to echo a command */
-       const char *runIgnTmpl; /* template to run a command
-                                * without error checking */
-       const char *runChkTmpl; /* template to run a command
-                                * with error checking */
-
-       /* string literal that results in a newline character when it appears
-        * outside of any 'quote' or "quote" characters */
+       const char *runIgnTmpl; /* template to run a command without error
+                                * checking */
+       const char *runChkTmpl; /* template to run a command with error
+                                * checking */
+
+       /*
+        * A string literal that results in a newline character when it
+        * occurs outside of any 'quote' or "quote" characters.
+        */
        const char *newline;
        char commentChar;       /* character used by shell for comment lines */
 
@@ -425,7 +427,7 @@
 static void clearfd(Job *);
 static bool readyfd(Job *);
 
-static char *targPrefix = NULL; /* To identify a job change in the output. */
+static char *targPrefix = NULL;        /* To identify a job change in the output. */
 static Job tokenWaitJob;       /* token wait pseudo-job */
 
 static Job childExitJob;       /* child exit pseudo-job */
@@ -1266,9 +1268,11 @@
                return;         /* XXX: What about propagating the error? */
        }
 
-       /* Last resort: update the file's time stamps in the traditional way.
+       /*
+        * Last resort: update the file's time stamps in the traditional way.
         * XXX: This doesn't work for empty files, which are sometimes used
-        * as marker files. */
+        * as marker files.
+        */
        if (read(fd, &c, 1) == 1) {
                (void)lseek(fd, 0, SEEK_SET);
                while (write(fd, &c, 1) == -1 && errno == EAGAIN)
@@ -1620,7 +1624,7 @@
 #ifdef USE_META
        if (useMeta) {
                meta_job_start(job, gn);
-               if (gn->type & OP_SILENT) /* might have changed */
+               if (gn->type & OP_SILENT)       /* might have changed */
                        job->echo = false;
        }
 #endif
@@ -1683,7 +1687,7 @@



Home | Main Index | Thread Index | Old Index