Module Name: src
Committed By: rillig
Date: Wed Dec 15 12:24:13 UTC 2021
Modified Files:
src/usr.bin/make: arch.c compat.c cond.c dir.c hash.c job.c job.h lst.h
main.c suff.c util.c
Log Message:
make: use consistent indentation for statements and continuations
No binary change, except for line numbers in assertions in suff.c.
To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/arch.c
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/make/compat.c
cvs rdiff -u -r1.304 -r1.305 src/usr.bin/make/cond.c
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/make/dir.c
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/make/hash.c
cvs rdiff -u -r1.441 -r1.442 src/usr.bin/make/job.c
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/make/job.h
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/make/lst.h
cvs rdiff -u -r1.545 -r1.546 src/usr.bin/make/main.c
cvs rdiff -u -r1.358 -r1.359 src/usr.bin/make/suff.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.207 src/usr.bin/make/arch.c:1.208
--- src/usr.bin/make/arch.c:1.207 Sun Dec 12 23:47:21 2021
+++ src/usr.bin/make/arch.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.207 2021/12/12 23:47:21 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.208 2021/12/15 12:24:13 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.207 2021/12/12 23:47:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.208 2021/12/15 12:24:13 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -287,8 +287,8 @@ Arch_ParseArchive(char **pp, GNodeList *
*/
if (*cp == '\0') {
Parse_Error(PARSE_FATAL,
- "No closing parenthesis "
- "in archive specification");
+ "No closing parenthesis "
+ "in archive specification");
return false;
}
@@ -625,7 +625,7 @@ ArchSVR4Entry(Arch *ar, char *inout_name
if (ar->fnametab != NULL) {
DEBUG0(ARCH,
- "Attempted to redefine an SVR4 name table\n");
+ "Attempted to redefine an SVR4 name table\n");
return -1;
}
@@ -646,8 +646,9 @@ ArchSVR4Entry(Arch *ar, char *inout_name
entry++;
*ptr = '\0';
}
- DEBUG1(ARCH, "Found svr4 archive name table with %lu entries\n",
- (unsigned long)entry);
+ DEBUG1(ARCH,
+ "Found svr4 archive name table with %lu entries\n",
+ (unsigned long)entry);
return 0;
}
@@ -661,7 +662,7 @@ ArchSVR4Entry(Arch *ar, char *inout_name
}
if (entry >= ar->fnamesize) {
DEBUG2(ARCH, "SVR4 entry offset %s is greater than %lu\n",
- inout_name, (unsigned long)ar->fnamesize);
+ inout_name, (unsigned long)ar->fnamesize);
return 2;
}
@@ -762,9 +763,9 @@ ArchFindMember(const char *archive, cons
}
DEBUG5(ARCH, "Reading archive %s member %.*s mtime %.*s\n",
- archive,
- (int)sizeof out_arh->ar_name, out_arh->ar_name,
- (int)sizeof out_arh->ar_date, out_arh->ar_date);
+ archive,
+ (int)sizeof out_arh->ar_name, out_arh->ar_name,
+ (int)sizeof out_arh->ar_date, out_arh->ar_date);
if (ArchiveMember_HasName(out_arh, member, len)) {
/*
@@ -865,7 +866,7 @@ Arch_Touch(GNode *gn)
struct ar_hdr arh;
f = ArchFindMember(GNode_VarArchive(gn), GNode_VarMember(gn), &arh,
- "r+");
+ "r+");
if (f == NULL)
return;
Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.230 src/usr.bin/make/compat.c:1.231
--- src/usr.bin/make/compat.c:1.230 Wed Dec 15 10:04:49 2021
+++ src/usr.bin/make/compat.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.230 2021/12/15 10:04:49 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.231 2021/12/15 12:24:13 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.230 2021/12/15 10:04:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.231 2021/12/15 12:24:13 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -404,7 +404,7 @@ Compat_RunCommand(const char *cmdp, GNod
status = WEXITSTATUS(reason); /* exited */
#if defined(USE_META) && defined(USE_FILEMON_ONCE)
if (useMeta) {
- meta_cmd_finish(NULL);
+ meta_cmd_finish(NULL);
}
#endif
if (status != 0) {
@@ -734,7 +734,7 @@ Compat_Run(GNodeList *targs)
printf("`%s' is up to date.\n", gn->name);
} else if (gn->made == ABORTED) {
printf("`%s' not remade because of errors.\n",
- gn->name);
+ gn->name);
}
if (GNode_IsError(gn) && errorNode == NULL)
errorNode = gn;
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.304 src/usr.bin/make/cond.c:1.305
--- src/usr.bin/make/cond.c:1.304 Mon Dec 13 07:47:07 2021
+++ src/usr.bin/make/cond.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.304 2021/12/13 07:47:07 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 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.304 2021/12/13 07:47:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -317,7 +317,7 @@ FuncExists(const char *arg)
path = Dir_FindFile(arg, &dirSearchPath);
DEBUG2(COND, "exists(%s) result is \"%s\"\n",
- arg, path != NULL ? path : "");
+ arg, path != NULL ? path : "");
result = path != NULL;
free(path);
return result;
@@ -1212,7 +1212,7 @@ Cond_EvalLine(const char *line)
} else {
if (state & IFS_SEEN_ELSE)
Parse_Error(PARSE_WARNING,
- "extra else");
+ "extra else");
state = IFS_WAS_ACTIVE | IFS_SEEN_ELSE;
}
cond_states[cond_depth] = state;
@@ -1261,8 +1261,7 @@ Cond_EvalLine(const char *line)
*/
cond_states_cap += 32;
cond_states = bmake_realloc(cond_states,
- cond_states_cap *
- sizeof *cond_states);
+ cond_states_cap * sizeof *cond_states);
}
state = cond_states[cond_depth];
cond_depth++;
@@ -1301,7 +1300,7 @@ Cond_restore_depth(unsigned int saved_de
if (open_conds != 0 || saved_depth > cond_depth) {
Parse_Error(PARSE_FATAL, "%u open conditional%s",
- open_conds, open_conds == 1 ? "" : "s");
+ open_conds, open_conds == 1 ? "" : "s");
cond_depth = cond_min_depth;
}
Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.275 src/usr.bin/make/dir.c:1.276
--- src/usr.bin/make/dir.c:1.275 Sun Nov 28 21:46:17 2021
+++ src/usr.bin/make/dir.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.275 2021/11/28 21:46:17 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.276 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: dir.c,v 1.275 2021/11/28 21:46:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.276 2021/12/15 12:24:13 rillig Exp $");
/*
* A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -672,8 +672,8 @@ DirMatchFiles(const char *pattern, Cache
{
char *fullName = isDot
- ? bmake_strdup(base)
- : str_concat3(dirName, "/", base);
+ ? bmake_strdup(base)
+ : str_concat3(dirName, "/", base);
Lst_Append(expansions, fullName);
}
}
@@ -792,7 +792,7 @@ DirExpandCurly(const char *word, const c
size_t piece_len = (size_t)(piece_end - piece);
char *file = concat3(prefix, prefix_len, piece, piece_len,
- suffix, suffix_len);
+ suffix, suffix_len);
if (contains_wildcard(file)) {
SearchPath_Expand(path, file, expansions);
@@ -984,8 +984,9 @@ static char *
DirLookupSubdir(CachedDir *dir, const char *name)
{
struct cached_stat cst;
- char *file = dir == dot ? bmake_strdup(name)
- : str_concat3(dir->name, "/", name);
+ char *file = dir == dot
+ ? bmake_strdup(name)
+ : str_concat3(dir->name, "/", name);
DEBUG1(DIR, "checking %s ...\n", file);
@@ -1424,9 +1425,9 @@ ResolveMovedDepends(GNode *gn)
gn->path = bmake_strdup(fullName);
if (!Job_RunTarget(".STALE", gn->fname))
fprintf(stdout, /* XXX: Why stdout? */
- "%s: %s, %d: ignoring stale %s for %s, found %s\n",
- progname, gn->fname, gn->lineno,
- makeDependfile, gn->name, fullName);
+ "%s: %s, %d: ignoring stale %s for %s, found %s\n",
+ progname, gn->fname, gn->lineno,
+ makeDependfile, gn->name, fullName);
return fullName;
}
Index: src/usr.bin/make/hash.c
diff -u src/usr.bin/make/hash.c:1.67 src/usr.bin/make/hash.c:1.68
--- src/usr.bin/make/hash.c:1.67 Wed Dec 15 10:07:53 2021
+++ src/usr.bin/make/hash.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hash.c,v 1.67 2021/12/15 10:07:53 rillig Exp $ */
+/* $NetBSD: hash.c,v 1.68 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -74,7 +74,7 @@
#include "make.h"
/* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: hash.c,v 1.67 2021/12/15 10:07:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: hash.c,v 1.68 2021/12/15 12:24:13 rillig Exp $");
/*
* The ratio of # entries to # buckets at which we rebuild the table to
@@ -360,5 +360,5 @@ void
HashTable_DebugStats(HashTable *t, const char *name)
{
DEBUG4(HASH, "HashTable %s: size=%u numEntries=%u maxchain=%u\n",
- name, t->bucketsSize, t->numEntries, t->maxchain);
+ name, t->bucketsSize, t->numEntries, t->maxchain);
}
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.441 src/usr.bin/make/job.c:1.442
--- src/usr.bin/make/job.c:1.441 Wed Dec 15 10:04:49 2021
+++ src/usr.bin/make/job.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.441 2021/12/15 10:04:49 rillig Exp $ */
+/* $NetBSD: job.c,v 1.442 2021/12/15 12:24:13 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.441 2021/12/15 10:04:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.442 2021/12/15 12:24:13 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -2818,7 +2818,7 @@ Job_TempFile(const char *pattern, char *
JobSigLock(&mask);
fd = mkTempFile(pattern, tfile, tfile_sz);
if (tfile != NULL && !DEBUG(SCRIPT))
- unlink(tfile);
+ unlink(tfile);
JobSigUnlock(&mask);
return fd;
Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.75 src/usr.bin/make/job.h:1.76
--- src/usr.bin/make/job.h:1.75 Wed Dec 15 12:08:25 2021
+++ src/usr.bin/make/job.h Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: job.h,v 1.75 2021/12/15 12:08:25 rillig Exp $ */
+/* $NetBSD: job.h,v 1.76 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,16 +92,15 @@
#define pollfd emul_pollfd
struct emul_pollfd {
- int fd;
- short events;
- short revents;
+ int fd;
+ short events;
+ short revents;
};
#define POLLIN 0x0001
#define POLLOUT 0x0004
-int
-emul_poll(struct pollfd *fd, int nfd, int timeout);
+int emul_poll(struct pollfd *, int, int);
#endif
/*
Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.101 src/usr.bin/make/lst.h:1.102
--- src/usr.bin/make/lst.h:1.101 Wed Dec 15 12:08:25 2021
+++ src/usr.bin/make/lst.h Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.101 2021/12/15 12:08:25 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.102 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -158,7 +158,8 @@ void LstNode_SetNull(ListNode *);
/* Add a datum at the tail of the queue. */
MAKE_INLINE void
-Lst_Enqueue(List *list, void *datum) {
+Lst_Enqueue(List *list, void *datum)
+{
Lst_Append(list, datum);
}
@@ -193,7 +194,8 @@ void *Vector_Push(Vector *);
void *Vector_Pop(Vector *);
MAKE_INLINE void
-Vector_Done(Vector *v) {
+Vector_Done(Vector *v)
+{
free(v->items);
}
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.545 src/usr.bin/make/main.c:1.546
--- src/usr.bin/make/main.c:1.545 Wed Dec 15 11:01:39 2021
+++ src/usr.bin/make/main.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.545 2021/12/15 11:01:39 rillig Exp $ */
+/* $NetBSD: main.c,v 1.546 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.545 2021/12/15 11:01:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.546 2021/12/15 12:24:13 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -465,7 +465,8 @@ MainParseArg(char c, const char *argvalu
MainParseArgChdir(argvalue);
break;
case 'D':
- if (argvalue[0] == '\0') return false;
+ if (argvalue[0] == '\0')
+ return false;
Global_SetExpand(argvalue, "1");
Global_Append(MAKEFLAGS, "-D");
Global_Append(MAKEFLAGS, argvalue);
@@ -1720,7 +1721,7 @@ ReadMakefile(const char *fname)
name = Dir_FindFile(fname, parseIncPath);
if (name == NULL) {
SearchPath *sysInc = Lst_IsEmpty(&sysIncPath->dirs)
- ? defSysIncPath : sysIncPath;
+ ? defSysIncPath : sysIncPath;
name = Dir_FindFile(fname, sysInc);
}
if (name == NULL || (fd = open(name, O_RDONLY)) == -1) {
@@ -2149,7 +2150,7 @@ PrintOnError(GNode *gn, const char *msg)
{
char *errorVarsValues;
(void)Var_Subst("${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
- SCOPE_GLOBAL, VARE_WANTRES, &errorVarsValues);
+ SCOPE_GLOBAL, VARE_WANTRES, &errorVarsValues);
/* TODO: handle errors */
printf("%s", errorVarsValues);
free(errorVarsValues);
@@ -2228,8 +2229,8 @@ mkTempFile(const char *pattern, char *tf
if (tmpdir == NULL)
tmpdir = getTmpdir();
if (tfile == NULL) {
- tfile = tbuf;
- tfile_sz = sizeof tbuf;
+ tfile = tbuf;
+ tfile_sz = sizeof tbuf;
}
if (pattern[0] == '/') {
snprintf(tfile, tfile_sz, "%s", pattern);
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.358 src/usr.bin/make/suff.c:1.359
--- src/usr.bin/make/suff.c:1.358 Mon Dec 13 00:33:33 2021
+++ src/usr.bin/make/suff.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.358 2021/12/13 00:33:33 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.359 2021/12/15 12:24:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.358 2021/12/13 00:33:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.359 2021/12/15 12:24:13 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -1767,8 +1767,7 @@ FindDepsRegularPath(GNode *gn, Candidate
free(gn->path);
gn->path = Dir_FindFile(gn->name,
- (targ == NULL ? &dirSearchPath :
- targ->suff->searchPath));
+ targ == NULL ? &dirSearchPath : targ->suff->searchPath);
if (gn->path == NULL)
return;
Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.76 src/usr.bin/make/util.c:1.77
--- src/usr.bin/make/util.c:1.76 Wed Feb 3 08:00:36 2021
+++ src/usr.bin/make/util.c Wed Dec 15 12:24:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.76 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: util.c,v 1.77 2021/12/15 12:24:13 rillig Exp $ */
/*
* Missing stuff from OS's
@@ -15,7 +15,7 @@
#include "make.h"
-MAKE_RCSID("$NetBSD: util.c,v 1.76 2021/02/03 08:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.77 2021/12/15 12:24:13 rillig Exp $");
#if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
extern int errno, sys_nerr;
@@ -24,12 +24,12 @@ extern char *sys_errlist[];
char *
strerror(int e)
{
- static char buf[100];
- if (e < 0 || e >= sys_nerr) {
- snprintf(buf, sizeof buf, "Unknown error %d", e);
- return buf;
- } else
- return sys_errlist[e];
+ static char buf[100];
+ if (e < 0 || e >= sys_nerr) {
+ snprintf(buf, sizeof buf, "Unknown error %d", e);
+ return buf;
+ } else
+ return sys_errlist[e];
}
#endif
@@ -59,9 +59,9 @@ findenv(const char *name, int *offset)
char *
getenv(const char *name)
{
- int offset;
+ int offset;
- return findenv(name, &offset);
+ return findenv(name, &offset);
}
int
@@ -161,15 +161,15 @@ main(int argc, char *argv[])
static char *
strrcpy(char *ptr, char *str)
{
- int len = strlen(str);
+ int len = strlen(str);
- while (len != 0)
- *--ptr = str[--len];
+ while (len != 0)
+ *--ptr = str[--len];
- return ptr;
-} /* end strrcpy */
+ return ptr;
+}
-char *sys_siglist[] = {
+char *sys_siglist[] = {
"Signal 0",
"Hangup", /* SIGHUP */
"Interrupt", /* SIGINT */
@@ -218,7 +218,7 @@ char *sys_siglist[] = {
int
killpg(int pid, int sig)
{
- return kill(-pid, sig);
+ return kill(-pid, sig);
}
#if !defined(BSD) && !defined(d_fileno)
@@ -376,7 +376,7 @@ vsnprintf(char *s, size_t n, const char
fakebuf._cnt++;
putc('\0', &fakebuf);
if (fakebuf._cnt < 0)
- fakebuf._cnt = 0;
+ fakebuf._cnt = 0;
return n - fakebuf._cnt - 1;
#else
::: "error: vsnprintf must be available";