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): indent parse.c with tabs instead of sp...



details:   https://anonhg.NetBSD.org/src/rev/5270454a60aa
branches:  trunk
changeset: 957624:5270454a60aa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 05 19:46:04 2020 +0000

description:
make(1): indent parse.c with tabs instead of spaces

diffstat:

 usr.bin/make/parse.c |  3823 +++++++++++++++++++++++++------------------------
 1 files changed, 1960 insertions(+), 1863 deletions(-)

diffs (truncated from 4417 to 300 lines):

diff -r 947f915175cf -r 5270454a60aa usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Dec 05 19:08:50 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Dec 05 19:46:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.468 2020/12/05 19:06:51 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.469 2020/12/05 19:46:04 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.468 2020/12/05 19:06:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.469 2020/12/05 19:46:04 rillig Exp $");
 
 /* types and constants */
 
@@ -125,62 +125,62 @@
  * Structure for a file being read ("included file")
  */
 typedef struct IFile {
-    char *fname;               /* name of file (relative? absolute?) */
-    Boolean fromForLoop;       /* simulated .include by the .for loop */
-    int lineno;                        /* current line number in file */
-    int first_lineno;          /* line number of start of text */
-    unsigned int cond_depth;   /* 'if' nesting when file opened */
-    Boolean depending;         /* state of doing_depend on EOF */
-
-    /* The buffer from which the file's content is read. */
-    char *buf_freeIt;
-    char *buf_ptr;             /* next char to be read */
-    char *buf_end;
-
-    char *(*nextbuf)(void *, size_t *); /* Function to get more data */
-    void *nextbuf_arg;         /* Opaque arg for nextbuf() */
-    struct loadedfile *lf;     /* loadedfile object, if any */
+       char *fname;            /* name of file (relative? absolute?) */
+       Boolean fromForLoop;    /* simulated .include by the .for loop */
+       int lineno;             /* current line number in file */
+       int first_lineno;       /* line number of start of text */
+       unsigned int cond_depth; /* 'if' nesting when file opened */
+       Boolean depending;      /* state of doing_depend on EOF */
+
+       /* The buffer from which the file's content is read. */
+       char *buf_freeIt;
+       char *buf_ptr;          /* next char to be read */
+       char *buf_end;
+
+       char *(*nextbuf)(void *, size_t *); /* Function to get more data */
+       void *nextbuf_arg;      /* Opaque arg for nextbuf() */
+       struct loadedfile *lf;  /* loadedfile object, if any */
 } IFile;
 
 /*
  * Tokens for target attributes
  */
 typedef enum ParseSpecial {
-    SP_ATTRIBUTE,      /* Generic attribute */
-    SP_BEGIN,          /* .BEGIN */
-    SP_DEFAULT,                /* .DEFAULT */
-    SP_DELETE_ON_ERROR,        /* .DELETE_ON_ERROR */
-    SP_END,            /* .END */
-    SP_ERROR,          /* .ERROR */
-    SP_IGNORE,         /* .IGNORE */
-    SP_INCLUDES,       /* .INCLUDES; not mentioned in the manual page */
-    SP_INTERRUPT,      /* .INTERRUPT */
-    SP_LIBS,           /* .LIBS; not mentioned in the manual page */
-    SP_MAIN,           /* .MAIN and we don't have anything user-specified to
-                        * make */
-    SP_META,           /* .META */
-    SP_MFLAGS,         /* .MFLAGS or .MAKEFLAGS */
-    SP_NOMETA,         /* .NOMETA */
-    SP_NOMETA_CMP,     /* .NOMETA_CMP */
-    SP_NOPATH,         /* .NOPATH */
-    SP_NOT,            /* Not special */
-    SP_NOTPARALLEL,    /* .NOTPARALLEL or .NO_PARALLEL */
-    SP_NULL,           /* .NULL; not mentioned in the manual page */
-    SP_OBJDIR,         /* .OBJDIR */
-    SP_ORDER,          /* .ORDER */
-    SP_PARALLEL,       /* .PARALLEL; not mentioned in the manual page */
-    SP_PATH,           /* .PATH or .PATH.suffix */
-    SP_PHONY,          /* .PHONY */
+       SP_ATTRIBUTE,   /* Generic attribute */
+       SP_BEGIN,       /* .BEGIN */
+       SP_DEFAULT,     /* .DEFAULT */
+       SP_DELETE_ON_ERROR, /* .DELETE_ON_ERROR */
+       SP_END,         /* .END */
+       SP_ERROR,       /* .ERROR */
+       SP_IGNORE,      /* .IGNORE */
+       SP_INCLUDES,    /* .INCLUDES; not mentioned in the manual page */
+       SP_INTERRUPT,   /* .INTERRUPT */
+       SP_LIBS,        /* .LIBS; not mentioned in the manual page */
+       /* .MAIN and we don't have anything user-specified to make */
+       SP_MAIN,
+       SP_META,        /* .META */
+       SP_MFLAGS,      /* .MFLAGS or .MAKEFLAGS */
+       SP_NOMETA,      /* .NOMETA */
+       SP_NOMETA_CMP,  /* .NOMETA_CMP */
+       SP_NOPATH,      /* .NOPATH */
+       SP_NOT,         /* Not special */
+       SP_NOTPARALLEL, /* .NOTPARALLEL or .NO_PARALLEL */
+       SP_NULL,        /* .NULL; not mentioned in the manual page */
+       SP_OBJDIR,      /* .OBJDIR */
+       SP_ORDER,       /* .ORDER */
+       SP_PARALLEL,    /* .PARALLEL; not mentioned in the manual page */
+       SP_PATH,        /* .PATH or .PATH.suffix */
+       SP_PHONY,       /* .PHONY */
 #ifdef POSIX
-    SP_POSIX,          /* .POSIX; not mentioned in the manual page */
+       SP_POSIX,       /* .POSIX; not mentioned in the manual page */
 #endif
-    SP_PRECIOUS,       /* .PRECIOUS */
-    SP_SHELL,          /* .SHELL */
-    SP_SILENT,         /* .SILENT */
-    SP_SINGLESHELL,    /* .SINGLESHELL; not mentioned in the manual page */
-    SP_STALE,          /* .STALE */
-    SP_SUFFIXES,       /* .SUFFIXES */
-    SP_WAIT            /* .WAIT */
+       SP_PRECIOUS,    /* .PRECIOUS */
+       SP_SHELL,       /* .SHELL */
+       SP_SILENT,      /* .SILENT */
+       SP_SINGLESHELL, /* .SINGLESHELL; not mentioned in the manual page */
+       SP_STALE,       /* .STALE */
+       SP_SUFFIXES,    /* .SUFFIXES */
+       SP_WAIT         /* .WAIT */
 } ParseSpecial;
 
 typedef List SearchPathList;
@@ -270,14 +270,14 @@
 static IFile *
 GetInclude(size_t i)
 {
-    return Vector_Get(&includes, i);
+       return Vector_Get(&includes, i);
 }
 
 /* The file that is currently being read. */
 static IFile *
 CurFile(void)
 {
-    return GetInclude(includes.len - 1);
+       return GetInclude(includes.len - 1);
 }
 
 /* include paths */
@@ -295,9 +295,9 @@
  * keyword is used as a source ("0" if the keyword isn't special as a source)
  */
 static const struct {
-    const char   *name;                /* Name of keyword */
-    ParseSpecial  spec;                /* Type when used as a target */
-    GNodeType    op;           /* Operator when used as a source */
+       const char *name;       /* Name of keyword */
+       ParseSpecial spec;      /* Type when used as a target */
+       GNodeType op;           /* Operator when used as a source */
 } parseKeywords[] = {
     { ".BEGIN",                SP_BEGIN,       OP_NONE },
     { ".DEFAULT",      SP_DEFAULT,     OP_NONE },
@@ -349,11 +349,11 @@
 
 struct loadedfile {
        /* XXX: What is the lifetime of this path? Who manages the memory? */
-       const char *path;               /* name, for error reports */
-       char *buf;                      /* contents buffer */
-       size_t len;                     /* length of contents */
-       size_t maplen;                  /* length of mmap area, or 0 */
-       Boolean used;                   /* XXX: have we used the data yet */
+       const char *path;       /* name, for error reports */
+       char *buf;              /* contents buffer */
+       size_t len;             /* length of contents */
+       size_t maplen;          /* length of mmap area, or 0 */
+       Boolean used;           /* XXX: have we used the data yet */
 };
 
 /* XXX: What is the lifetime of the path? Who manages the memory? */
@@ -459,8 +459,8 @@
         * FUTURE: remove PROT_WRITE when the parser no longer
         * needs to scribble on the input.
         */
-       lf->buf = mmap(NULL, lf->maplen, PROT_READ|PROT_WRITE,
-                      MAP_FILE|MAP_COPY, fd, 0);
+       lf->buf = mmap(NULL, lf->maplen, PROT_READ | PROT_WRITE,
+           MAP_FILE | MAP_COPY, fd, 0);
        if (lf->buf == MAP_FAILED)
                return FALSE;
 
@@ -521,7 +521,7 @@
        for (;;) {
                assert(bufpos <= lf->len);
                if (bufpos == lf->len) {
-                       if (lf->len > SIZE_MAX/2) {
+                       if (lf->len > SIZE_MAX / 2) {
                                errno = EFBIG;
                                Error("%s: file too large", path);
                                exit(1);
@@ -565,14 +565,14 @@
 static Boolean
 ParseIsEscaped(const char *line, const char *c)
 {
-    Boolean active = FALSE;
-    for (;;) {
-       if (line == c)
-           return active;
-       if (*--c != '\\')
-           return active;
-       active = !active;
-    }
+       Boolean active = FALSE;
+       for (;;) {
+               if (line == c)
+                       return active;
+               if (*--c != '\\')
+                       return active;
+               active = !active;
+       }
 }
 
 /* Add the filename and lineno to the GNode so that we remember where it
@@ -580,9 +580,9 @@
 static void
 ParseMark(GNode *gn)
 {
-    IFile *curFile = CurFile();
-    gn->fname = curFile->fname;
-    gn->lineno = curFile->lineno;
+       IFile *curFile = CurFile();
+       gn->fname = curFile->fname;
+       gn->lineno = curFile->lineno;
 }
 
 /* Look in the table of keywords for one matching the given string.
@@ -590,28 +590,28 @@
 static int
 ParseFindKeyword(const char *str)
 {
-    int start = 0;
-    int end = sizeof parseKeywords / sizeof parseKeywords[0] - 1;
-
-    do {
-       int curr = start + (end - start) / 2;
-       int diff = strcmp(str, parseKeywords[curr].name);
-
-       if (diff == 0)
-           return curr;
-       if (diff < 0)
-           end = curr - 1;
-       else
-           start = curr + 1;
-    } while (start <= end);
-
-    return -1;
+       int start = 0;
+       int end = sizeof parseKeywords / sizeof parseKeywords[0] - 1;
+
+       do {
+               int curr = start + (end - start) / 2;
+               int diff = strcmp(str, parseKeywords[curr].name);
+
+               if (diff == 0)
+                       return curr;
+               if (diff < 0)
+                       end = curr - 1;
+               else
+                       start = curr + 1;
+       } while (start <= end);
+
+       return -1;
 }
 
 static void
 PrintLocation(FILE *f, const char *fname, size_t lineno)
 {
-       char dirbuf[MAXPATHLEN+1];
+       char dirbuf[MAXPATHLEN + 1];
        const char *dir, *base;
        void *dir_freeIt, *base_freeIt;
 
@@ -680,7 +680,7 @@
        if (opts.debug_file != stderr && opts.debug_file != stdout) {
                va_start(ap, fmt);
                ParseVErrorInternal(opts.debug_file, fname, lineno, type,
-                                   fmt, ap);
+                   fmt, ap);
                va_end(ap);
        }
 }
@@ -715,7 +715,7 @@
        if (opts.debug_file != stderr && opts.debug_file != stdout) {
                va_start(ap, fmt);
                ParseVErrorInternal(opts.debug_file, fname, lineno, type,
-                                   fmt, ap);
+                   fmt, ap);
                va_end(ap);
        }
 }
@@ -726,28 +726,28 @@
 static Boolean
 ParseMessage(const char *directive)
 {



Home | Main Index | Thread Index | Old Index