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): normalize spacing in parse.c



details:   https://anonhg.NetBSD.org/src/rev/deb4d2084b37
branches:  trunk
changeset: 1015205:deb4d2084b37
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 17 18:36:56 2020 +0000

description:
make(1): normalize spacing in parse.c

diffstat:

 usr.bin/make/parse.c |  121 +++++++++++++++++++++++++-------------------------
 1 files changed, 60 insertions(+), 61 deletions(-)

diffs (truncated from 368 to 300 lines):

diff -r 41dbc93d972f -r deb4d2084b37 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Oct 17 17:47:14 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Oct 17 18:36:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.373 2020/10/17 17:47:14 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.374 2020/10/17 18:36:56 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.373 2020/10/17 17:47:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.374 2020/10/17 18:36:56 rillig Exp $");
 
 /* types and constants */
 
@@ -235,7 +235,7 @@
  * Predecessor node for handling .ORDER. Initialized to NULL when .ORDER
  * seen, then set to each successive source on the line.
  */
-static GNode   *predecessor;
+static GNode *predecessor;
 
 /* parser state */
 
@@ -594,8 +594,8 @@
 static int
 ParseFindKeyword(const char *str)
 {
-    int    start, end, cur;
-    int    diff;
+    int start, end, cur;
+    int diff;
 
     start = 0;
     end = (sizeof(parseKeywords)/sizeof(parseKeywords[0])) - 1;
@@ -680,7 +680,7 @@
 
 static void
 ParseErrorInternal(const char *cfname, size_t clineno, int type,
-    const char *fmt, ...)
+                  const char *fmt, ...)
 {
        va_list ap;
 
@@ -739,7 +739,7 @@
 {
     int mtype;
 
-    switch(*line) {
+    switch (*line) {
     case 'i':
        mtype = PARSE_INFO;
        break;
@@ -834,7 +834,7 @@
         * and the new instance is linked to all parents of the initial
         * instance.
         */
-       GNode   *cohort;
+       GNode *cohort;
 
        /*
         * Propagate copied bits to the initial node.  They'll be propagated
@@ -857,7 +857,7 @@
        cohort->centurion = gn;
        gn->unmade_cohorts++;
        snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
-               gn->unmade_cohorts % 1000000);
+                gn->unmade_cohorts % 1000000);
     } else {
        /*
         * We don't want to nuke any previous flags (whatever they were) so we
@@ -1101,7 +1101,7 @@
             */
            const char *nested_p = cp;
            const char *nested_val;
-           void    *freeIt;
+           void *freeIt;
 
            (void)Var_Parse(&nested_p, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES,
                            &nested_val, &freeIt);
@@ -1289,7 +1289,7 @@
 
     /* Apply the targets. */
 
-    while(!Lst_IsEmpty(curTargs)) {
+    while (!Lst_IsEmpty(curTargs)) {
        char *targName = Lst_Dequeue(curTargs);
        GNode *gn = Suff_IsTransform(targName)
                    ? Suff_AddTransform(targName)
@@ -1324,7 +1324,7 @@
 static void
 ParseDoDependencyCheckSpec(ParseSpecial const specType)
 {
-    switch(specType) {
+    switch (specType) {
     default:
        Parse_Error(PARSE_WARNING,
                    "Special and mundane targets don't mix. Mundane ones ignored");
@@ -1586,7 +1586,7 @@
 
 static Boolean
 ParseDoDependencySourcesMundane(char *line, char *cp,
-                        ParseSpecial specType, GNodeType tOp)
+                               ParseSpecial specType, GNodeType tOp)
 {
     while (*line) {
        /*
@@ -1669,7 +1669,7 @@
     int tOp;                   /* operator from special target */
     StringList *curTargs;      /* target names to be found and added
                                 * to the targets list */
-    char          *lstart = line;
+    char *lstart = line;
 
     /*
      * specType contains the SPECial TYPE of the current target. It is Not
@@ -1749,7 +1749,7 @@
        }
        *line = '\0';
     } else if (specType == NotParallel || specType == SingleShell ||
-           specType == DeleteOnError) {
+              specType == DeleteOnError) {
        *line = '\0';
     }
 
@@ -1949,7 +1949,7 @@
         *
         * And not get an error.
         */
-       Boolean   oldOldVars = oldVars;
+       Boolean oldOldVars = oldVars;
 
        oldVars = FALSE;
 
@@ -2114,11 +2114,11 @@
                     gn->name, gn->fname, gn->lineno);
 #else
        Parse_Error(PARSE_WARNING,
-                    "duplicate script for target \"%s\" ignored",
-                    gn->name);
+                   "duplicate script for target \"%s\" ignored",
+                   gn->name);
        ParseErrorInternal(gn->fname, (size_t)gn->lineno, PARSE_WARNING,
-                           "using previous script for \"%s\" defined here",
-                           gn->name);
+                          "using previous script for \"%s\" defined here",
+                          gn->name);
 #endif
     }
 }
@@ -2142,11 +2142,11 @@
 Parse_include_file(char *file, Boolean isSystem, Boolean depinc, int silent)
 {
     struct loadedfile *lf;
-    char          *fullname;   /* full pathname of file */
-    char          *newName;
-    char          *prefEnd, *incdir;
-    int           fd;
-    int           i;
+    char *fullname;            /* full pathname of file */
+    char *newName;
+    char *prefEnd, *incdir;
+    int fd;
+    int i;
 
     /*
      * Now we know the file's name and its search path, we attempt to
@@ -2239,16 +2239,16 @@
     Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
     curFile->lf = lf;
     if (depinc)
-       doing_depend = depinc;          /* only turn it on */
+       doing_depend = depinc;  /* only turn it on */
 }
 
 static void
 ParseDoInclude(char *line)
 {
-    char          endc;                /* the character which ends the file spec */
-    char          *cp;         /* current position in file spec */
-    int                  silent = *line != 'i';
-    char         *file = &line[7 + silent];
+    char endc;                 /* the character which ends the file spec */
+    char *cp;                  /* current position in file spec */
+    int silent = *line != 'i';
+    char *file = &line[7 + silent];
 
     /* Skip to delimiter character so we know where to look */
     while (*file == ' ' || *file == '\t')
@@ -2256,7 +2256,7 @@
 
     if (*file != '"' && *file != '<') {
        Parse_Error(PARSE_FATAL,
-           ".include filename must be delimited by '\"' or '<'");
+                   ".include filename must be delimited by '\"' or '<'");
        return;
     }
 
@@ -2277,8 +2277,8 @@
 
     if (*cp != endc) {
        Parse_Error(PARSE_FATAL,
-                    "Unclosed %cinclude filename. '%c' expected",
-                    '.', endc);
+                   "Unclosed %cinclude filename. '%c' expected",
+                   '.', endc);
        return;
     }
     *cp = '\0';
@@ -2373,14 +2373,14 @@
            if (*old == ' ')
                old++;
            if (old >= ep)
-               break;                  /* cannot contain name */
-           if (memcmp(old, name, name_len) == 0
-                   && (old[name_len] == 0 || old[name_len] == ' '))
+               break;          /* cannot contain name */
+           if (memcmp(old, name, name_len) == 0 &&
+               (old[name_len] == '\0' || old[name_len] == ' '))
                goto cleanup;
        }
     }
-    Var_Append (MAKE_MAKEFILES, name, VAR_GLOBAL);
- cleanup:
+    Var_Append(MAKE_MAKEFILES, name, VAR_GLOBAL);
+cleanup:
     bmake_free(fp);
 }
 
@@ -2390,7 +2390,7 @@
  * The given file is added to the includes stack. */
 void
 Parse_SetInput(const char *name, int line, int fd,
-       char *(*nextbuf)(void *, size_t *), void *arg)
+              char *(*nextbuf)(void *, size_t *), void *arg)
 {
     char *buf;
     size_t len;
@@ -2446,7 +2446,7 @@
     }
     curFile->P_str = buf;
     curFile->P_ptr = buf;
-    curFile->P_end = buf+len;
+    curFile->P_end = buf + len;
 
     curFile->cond_depth = Cond_save_depth();
     ParseSetParseFile(name);
@@ -2495,11 +2495,11 @@
 static void
 ParseTraditionalInclude(char *line)
 {
-    char          *cp;         /* current position in file spec */
-    int                   done = 0;
-    int                   silent = line[0] != 'i';
-    char         *file = &line[silent + 7];
-    char         *all_files;
+    char *cp;                  /* current position in file spec */
+    int done = 0;
+    int silent = line[0] != 'i';
+    char *file = line + (silent ? 8 : 7);
+    char *all_files;
 
     DEBUG2(PARSE, "%s: %s\n", __func__, file);
 
@@ -2513,8 +2513,7 @@
     /* TODO: handle errors */
 
     if (*file == '\0') {
-       Parse_Error(PARSE_FATAL,
-                    "Filename missing from \"include\"");
+       Parse_Error(PARSE_FATAL, "Filename missing from \"include\"");
        goto out;
     }
 
@@ -2540,8 +2539,8 @@
 static void
 ParseGmakeExport(char *line)
 {
-    char         *variable = &line[6];
-    char         *value;
+    char *variable = &line[6];
+    char *value;
 
     DEBUG2(PARSE, "%s: %s\n", __func__, variable);
 
@@ -2555,7 +2554,7 @@
                    "Variable/Value missing from \"export\"");
        return;
     }
-    *value++ = '\0';                   /* terminate variable */
+    *value++ = '\0';           /* terminate variable */
 
     /*
      * Expand the value before putting it in the environment.
@@ -2599,8 +2598,8 @@
     Cond_restore_depth(curFile->cond_depth);
 



Home | Main Index | Thread Index | Old Index