usr.sbin: remove unnecessary CONSTCOND, lint no longer needs it

Since 2021-01-31, lint no longer requires a CONSTCOND comment in a
do-while-0 statement since this is a common code pattern, especially in
statement-like macros.

sed -i -E 's,} while \(/\* ?CONSTCOND ?\*/ ?0\),} while (0),' */*.[ch]
This commit is contained in:
rillig 2021-11-27 22:30:25 +00:00
parent 1d6b489c6e
commit 6f4965e060
12 changed files with 46 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: envstat.c,v 1.100 2020/11/14 16:32:53 mlelstv Exp $ */
/* $NetBSD: envstat.c,v 1.101 2021/11/27 22:30:25 rillig Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: envstat.c,v 1.100 2020/11/14 16:32:53 mlelstv Exp $");
__RCSID("$NetBSD: envstat.c,v 1.101 2021/11/27 22:30:25 rillig Exp $");
#endif /* not lint */
#include <stdio.h>
@ -986,7 +986,7 @@ do { \
ilen = 9; \
} else \
ilen += 9; \
} while (/* CONSTCOND */ 0)
} while (0)
/* temperatures */
} else if (strcmp(sensor->type, "Temperature") == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: apropos-utils.c,v 1.47 2019/08/18 09:14:30 abhinav Exp $ */
/* $NetBSD: apropos-utils.c,v 1.48 2021/11/27 22:30:25 rillig Exp $ */
/*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
* All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: apropos-utils.c,v 1.47 2019/08/18 09:14:30 abhinav Exp $");
__RCSID("$NetBSD: apropos-utils.c,v 1.48 2021/11/27 22:30:25 rillig Exp $");
#include <sys/queue.h>
#include <sys/stat.h>
@ -784,7 +784,7 @@ get_escaped_html_string(const char *src, size_t *slen)
do { \
memcpy(dst, (a), sizeof(a) - 1); \
dst += sizeof(a) - 1; \
} while (/*CONSTCOND*/0)
} while (0)
ddst = dst = emalloc(*slen + count * 5 + 1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ndp.c,v 1.58 2020/09/15 10:11:35 roy Exp $ */
/* $NetBSD: ndp.c,v 1.59 2021/11/27 22:30:25 rillig Exp $ */
/* $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $ */
/*
@ -812,7 +812,7 @@ ifinfo(char *ifname, int argc, char **argv)
newflags |= (f);\
flagset = true; \
}\
} while (/*CONSTCOND*/0)
} while (0)
/*
* XXX: this macro is not 100% correct, in that it matches "nud" against
* "nudbogus". But we just let it go since this is minor.
@ -833,7 +833,7 @@ ifinfo(char *ifname, int argc, char **argv)
v = newval; \
valset = true; \
} \
} while (/*CONSTCOND*/0)
} while (0)
#ifdef ND6_IFF_IFDISABLED
SETFLAG("disabled", ND6_IFF_IFDISABLED);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsd.c,v 1.73 2020/09/17 12:48:12 christos Exp $ */
/* $NetBSD: nfsd.c,v 1.74 2021/11/27 22:30:25 rillig Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
#if 0
static char sccsid[] = "@(#)nfsd.c 8.9 (Berkeley) 3/29/95";
#else
__RCSID("$NetBSD: nfsd.c,v 1.73 2020/09/17 12:48:12 christos Exp $");
__RCSID("$NetBSD: nfsd.c,v 1.74 2021/11/27 22:30:25 rillig Exp $");
#endif
#endif /* not lint */
@ -114,7 +114,7 @@ do { \
} else { \
syslog(e, s, ## args); \
} \
} while (/*CONSTCOND*/0)
} while (0)
static void nonfs(int);
__dead static void usage(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $ */
/* $NetBSD: pstat.c,v 1.133 2021/11/27 22:30:26 rillig Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\
#if 0
static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95";
#else
__RCSID("$NetBSD: pstat.c,v 1.132 2021/04/12 05:11:09 mrg Exp $");
__RCSID("$NetBSD: pstat.c,v 1.133 2021/11/27 22:30:26 rillig Exp $");
#endif
#endif /* not lint */
@ -135,13 +135,13 @@ struct flagbit_desc {
#define KGET2(addr, p, s, msg) do { \
if (kvm_read(kd, (u_long)(addr), p, s) != s) \
warnx("cannot read %s: %s", msg, kvm_geterr(kd)); \
} while (/* CONSTCOND */0)
} while (0)
#define KGETRET(addr, p, s, msg) do { \
if (kvm_read(kd, (u_long)(addr), p, s) != s) { \
warnx("cannot read %s: %s", msg, kvm_geterr(kd)); \
return (0); \
} \
} while (/* CONSTCOND */0)
} while (0)
#if 1 /* This is copied from vmstat/vmstat.c */
/*
@ -158,7 +158,7 @@ struct flagbit_desc {
(val)) - (width); \
if ((ovflw) < 0) \
(ovflw) = 0; \
} while (/* CONSTCOND */0)
} while (0)
#endif
void filemode(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pwd_mkdb.c,v 1.58 2017/05/04 16:26:09 sevan Exp $ */
/* $NetBSD: pwd_mkdb.c,v 1.59 2021/11/27 22:30:26 rillig Exp $ */
/*
* Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@ __COPYRIGHT("@(#) Copyright (c) 2000, 2009\
The NetBSD Foundation, Inc. All rights reserved.\
Copyright (c) 1991, 1993, 1994\
The Regents of the University of California. All rights reserved.");
__RCSID("$NetBSD: pwd_mkdb.c,v 1.58 2017/05/04 16:26:09 sevan Exp $");
__RCSID("$NetBSD: pwd_mkdb.c,v 1.59 2021/11/27 22:30:26 rillig Exp $");
#endif /* not lint */
#if HAVE_NBTOOL_CONFIG_H
@ -850,7 +850,7 @@ putdbents(struct pwddb *db, struct passwd *pw, const char *passwd, int flags,
(void)memmove(p, &pwvar, sizeof(pwvar)); \
p += sizeof(pwvar); \
} \
} while (/*CONSTCOND*/0)
} while (0)
/* Create insecure data. */
p = buf;
@ -1007,7 +1007,7 @@ getdbent(struct pwddb *db, int type, void *keyp, struct passwd **tpwd)
if (lorder != BYTE_ORDER) \
pwvar = SWAP(pwvar); \
} \
} while (/*CONSTCOND*/0)
} while (0)
READPWTIMEVAR(pwd.pw_change);

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.c,v 1.46 2021/03/23 18:16:53 christos Exp $ */
/* $NetBSD: config.c,v 1.47 2021/11/27 22:30:26 rillig Exp $ */
/* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */
/*
@ -178,13 +178,13 @@ getconfig(const char *intface, int exithard)
goto errexit; \
} \
var = t; \
} while (/*CONSTCOND*/0)
} while (0)
#define MAYHAVE(var, cap, def) \
do { \
if ((var = agetnum(cap)) < 0) \
var = def; \
} while (/*CONSTCOND*/0)
} while (0)
#define ELM_MALLOC(p) \
do { \
@ -1072,7 +1072,7 @@ make_packet(struct rainfo *rainfo)
__func__, __LINE__, packlen); \
exit(EXIT_FAILURE); \
} \
} while (/*CONSTCOND*/0)
} while (0)
/*
* construct the packet
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: sign.c,v 1.7 2018/02/06 21:36:46 christos Exp $ */
/* $NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: sign.c,v 1.7 2018/02/06 21:36:46 christos Exp $");
__RCSID("$NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $");
#ifndef DISABLE_SIGN
#include "syslogd.h"
@ -313,14 +313,14 @@ sign_sg_init(struct filed *Files)
logerror("Unable to allocate memory"); \
return false; \
} \
} while (/*CONSTCOND*/0)
} while (0)
#define ALLOC_SG(x) do { \
ALLOC_OR_FALSE(x); \
(x)->last_msg_num = 1; /* cf. section 4.2.5 */ \
STAILQ_INIT(&(x)->hashes); \
STAILQ_INIT(&(x)->files); \
} while (/*CONSTCOND*/0)
} while (0)
/* alloc(fq) and add to SGs file queue */
#define ASSIGN_FQ() do { \
@ -329,7 +329,7 @@ sign_sg_init(struct filed *Files)
f->f_sg = newsg; \
DPRINTF(D_SIGN, "SG@%p <--> f@%p\n", newsg, f); \
STAILQ_INSERT_TAIL(&newsg->files, fq, entries); \
} while (/*CONSTCOND*/0)
} while (0)
switch (GlobalSign.sg) {
case 0:

View File

@ -1,4 +1,4 @@
/* $NetBSD: sign.h,v 1.2 2008/11/07 07:36:38 minskim Exp $ */
/* $NetBSD: sign.h,v 1.3 2021/11/27 22:30:26 rillig Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -126,7 +126,7 @@
ERR_error_string(ERR_get_error(), NULL)); \
return 1; \
} \
} while (/*CONSTCOND*/0)
} while (0)
/* structs use uint_fast64_t in different places because the standard
* requires values in interval [0:9999999999 = SIGN_MAX_COUNT] */

View File

@ -1,4 +1,4 @@
/* $NetBSD: syslogd.c,v 1.137 2021/08/13 20:19:14 andvar Exp $ */
/* $NetBSD: syslogd.c,v 1.138 2021/11/27 22:30:26 rillig Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993, 1994\
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
__RCSID("$NetBSD: syslogd.c,v 1.137 2021/08/13 20:19:14 andvar Exp $");
__RCSID("$NetBSD: syslogd.c,v 1.138 2021/11/27 22:30:26 rillig Exp $");
#endif
#endif /* not lint */
@ -3518,7 +3518,7 @@ init(int fd, short event, void *ev)
} \
src->f_qsize = 0; \
src->f_qelements = 0; \
} while (/*CONSTCOND*/0)
} while (0)
/*
* Free old log files.

View File

@ -1,4 +1,4 @@
/* $NetBSD: syslogd.h,v 1.8 2019/02/11 19:45:54 mrg Exp $ */
/* $NetBSD: syslogd.h,v 1.9 2021/11/27 22:30:26 rillig Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -163,7 +163,7 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
if (event_add(x, NULL) == -1) { \
DPRINTF(D_EVENT, "Failure in event_add()\n"); \
} \
} while (/*CONSTCOND*/0)
} while (0)
#define RETRYEVENT_ADD(x) do { \
struct timeval _tv; \
_tv.tv_sec = 0; \
@ -172,13 +172,13 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
if (event_add(x, &_tv) == -1) { \
DPRINTF(D_EVENT, "Failure in event_add()\n"); \
} \
} while (/*CONSTCOND*/0)
} while (0)
#define DEL_EVENT(x) do { \
DPRINTF(D_MEM2, "DEL_EVENT(%s@%p)\n", #x, x); \
if ((x) && (event_del(x) == -1)) { \
DPRINTF(D_EVENT, "Failure in event_del()\n"); \
} \
} while (/*CONSTCOND*/0)
} while (0)
/* safe calls to free() */
#define FREEPTR(x) if (x) { \
@ -213,7 +213,7 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
message_allqueues_purge(); \
} \
DPRINTF(D_MEM2, "MALLOC(%s@%p, %zu)\n", #ptr, ptr, size); \
} while (/*CONSTCOND*/0)
} while (0)
#define CALLOC(ptr, size) do { \
while(!(ptr = calloc(1, size))) { \
@ -221,7 +221,7 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
message_allqueues_purge(); \
} \
DPRINTF(D_MEM2, "CALLOC(%s@%p, %zu)\n", #ptr, ptr, size); \
} while (/*CONSTCOND*/0)
} while (0)
/* define strlen(NULL) to be 0 */
#define SAFEstrlen(x) ((x) ? strlen(x) : 0)
@ -232,7 +232,7 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
sigaddset(&newmask, SIGHUP); \
sigaddset(&newmask, SIGALRM); \
sigprocmask(SIG_BLOCK, &newmask, &omask); \
} while (/*CONSTCOND*/0)
} while (0)
#define RESTORE_SIGNALS(omask) sigprocmask(SIG_SETMASK, &omask, NULL)
@ -240,7 +240,7 @@ void dbprintf(const char *, const char *, size_t, const char *, ...)
#define SEND_QUEUE(f) do { \
if ((f)->f_qelements) \
send_queue(0, 0, f); \
} while (/*CONSTCOND*/0)
} while (0)
#define MAXUNAMES 20 /* maximum number of user names */
#define BSD_TIMESTAMPLEN (14+1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tls.c,v 1.18 2021/09/16 22:19:12 andvar Exp $ */
/* $NetBSD: tls.c,v 1.19 2021/11/27 22:30:26 rillig Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: tls.c,v 1.18 2021/09/16 22:19:12 andvar Exp $");
__RCSID("$NetBSD: tls.c,v 1.19 2021/11/27 22:30:26 rillig Exp $");
#ifndef DISABLE_TLS
#include <sys/stat.h>
@ -123,7 +123,7 @@ out:
TLS_CONN_STATES[x], TLS_CONN_STATES[y]); \
(x) = (y); \
} \
} while (/*CONSTCOND*/0)
} while (0)
static unsigned
getVerifySetting(const char *x509verifystring)