Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin usr.sbin: remove unnecessary CONSTCOND, lint no lon...



details:   https://anonhg.NetBSD.org/src/rev/e268200616aa
branches:  trunk
changeset: 1026529:e268200616aa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 22:30:25 2021 +0000

description:
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]

diffstat:

 usr.sbin/envstat/envstat.c         |   6 +++---
 usr.sbin/makemandb/apropos-utils.c |   6 +++---
 usr.sbin/ndp/ndp.c                 |   6 +++---
 usr.sbin/nfsd/nfsd.c               |   6 +++---
 usr.sbin/pstat/pstat.c             |  10 +++++-----
 usr.sbin/pwd_mkdb/pwd_mkdb.c       |   8 ++++----
 usr.sbin/rtadvd/config.c           |   8 ++++----
 usr.sbin/syslogd/sign.c            |  10 +++++-----
 usr.sbin/syslogd/sign.h            |   4 ++--
 usr.sbin/syslogd/syslogd.c         |   6 +++---
 usr.sbin/syslogd/syslogd.h         |  16 ++++++++--------
 usr.sbin/syslogd/tls.c             |   6 +++---
 12 files changed, 46 insertions(+), 46 deletions(-)

diffs (truncated from 407 to 300 lines):

diff -r dc738c081916 -r e268200616aa usr.sbin/envstat/envstat.c
--- a/usr.sbin/envstat/envstat.c        Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/envstat/envstat.c        Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
                ilen = 9;                                       \
        } else                                                  \
                ilen += 9;                                      \
-} while (/* CONSTCOND */ 0)
+} while (0)
 
                /* temperatures */
                } else if (strcmp(sensor->type, "Temperature") == 0) {
diff -r dc738c081916 -r e268200616aa usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c        Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c        Sat Nov 27 22:30:25 2021 +0000
@@ -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@localhost>
  * 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 @@
     do {                                       \
        memcpy(dst, (a), sizeof(a) - 1);        \
        dst += sizeof(a) - 1;                   \
-    } while (/*CONSTCOND*/0)
+    } while (0)
 
 
        ddst = dst = emalloc(*slen + count * 5 + 1);
diff -r dc738c081916 -r e268200616aa usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c        Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/ndp/ndp.c        Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
                                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 @@
                        v = newval; \
                        valset = true; \
                } \
-       } while (/*CONSTCOND*/0)
+       } while (0)
 
 #ifdef ND6_IFF_IFDISABLED
                SETFLAG("disabled", ND6_IFF_IFDISABLED);
diff -r dc738c081916 -r e268200616aa usr.sbin/nfsd/nfsd.c
--- a/usr.sbin/nfsd/nfsd.c      Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/nfsd/nfsd.c      Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
 #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 @@
        } else {                                                        \
                syslog(e, s, ## args);                                  \
        }                                                               \
-} while (/*CONSTCOND*/0)
+} while (0)
 
 static void    nonfs(int);
 __dead static void     usage(void);
diff -r dc738c081916 -r e268200616aa usr.sbin/pstat/pstat.c
--- a/usr.sbin/pstat/pstat.c    Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/pstat/pstat.c    Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
 #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 @@
 #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 @@
            (val)) - (width);                           \
        if ((ovflw) < 0)                                \
                (ovflw) = 0;                            \
-} while (/* CONSTCOND */0)
+} while (0)
 #endif
 
 void   filemode(void);
diff -r dc738c081916 -r e268200616aa usr.sbin/pwd_mkdb/pwd_mkdb.c
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c      Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c      Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
  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 @@
                        (void)memmove(p, &pwvar, sizeof(pwvar)); \
                        p += sizeof(pwvar); \
                } \
-       } while (/*CONSTCOND*/0)
+       } while (0)
 
        /* Create insecure data. */
        p = buf;
@@ -1007,7 +1007,7 @@
                        if (lorder != BYTE_ORDER) \
                                pwvar = SWAP(pwvar); \
                } \
-       } while (/*CONSTCOND*/0)
+       } while (0)
                
        READPWTIMEVAR(pwd.pw_change);
 
diff -r dc738c081916 -r e268200616aa usr.sbin/rtadvd/config.c
--- a/usr.sbin/rtadvd/config.c  Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/rtadvd/config.c  Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
                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 @@
                            __func__, __LINE__, packlen); \
                        exit(EXIT_FAILURE); \
                } \
-       } while (/*CONSTCOND*/0)
+       } while (0)
        /*
         * construct the packet
         */
diff -r dc738c081916 -r e268200616aa usr.sbin/syslogd/sign.c
--- a/usr.sbin/syslogd/sign.c   Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/syslogd/sign.c   Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
                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 @@
        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:
diff -r dc738c081916 -r e268200616aa usr.sbin/syslogd/sign.h
--- a/usr.sbin/syslogd/sign.h   Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/syslogd/sign.h   Sat Nov 27 22:30:25 2021 +0000
@@ -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] */
diff -r dc738c081916 -r e268200616aa usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c        Sat Nov 27 22:16:41 2021 +0000
+++ b/usr.sbin/syslogd/syslogd.c        Sat Nov 27 22:30:25 2021 +0000
@@ -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 @@
 #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 */



Home | Main Index | Thread Index | Old Index