Source-Changes-HG archive

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

[src/trunk]: src/usr.bin usr.bin: remove unnecessary CONSTCOND, lint no longe...



details:   https://anonhg.NetBSD.org/src/rev/dc738c081916
branches:  trunk
changeset: 1026528:dc738c081916
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 22:16:41 2021 +0000

description:
usr.bin: 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.

diffstat:

 usr.bin/cdplay/cdplay.c     |   6 +++---
 usr.bin/fdformat/fdformat.c |   8 ++++----
 usr.bin/mail/sig.c          |   6 +++---
 usr.bin/midiplay/midiplay.c |   6 +++---
 usr.bin/su/su_pam.c         |   8 ++++----
 usr.bin/vmstat/drvstats.c   |  10 +++++-----
 usr.bin/vmstat/vmstat.c     |   8 ++++----
 7 files changed, 26 insertions(+), 26 deletions(-)

diffs (231 lines):

diff -r bf7d42f637f0 -r dc738c081916 usr.bin/cdplay/cdplay.c
--- a/usr.bin/cdplay/cdplay.c   Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/cdplay/cdplay.c   Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdplay.c,v 1.50 2020/10/18 21:58:32 rillig Exp $       */
+/*     $NetBSD: cdplay.c,v 1.51 2021/11/27 22:16:41 rillig Exp $       */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Andrew Doran.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: cdplay.c,v 1.50 2020/10/18 21:58:32 rillig Exp $");
+__RCSID("$NetBSD: cdplay.c,v 1.51 2021/11/27 22:16:41 rillig Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -130,7 +130,7 @@
                        fd = -1;                \
                } else                          \
                        warn("ioctl(" #ctl ")");\
-       } while (/* CONSTCOND */ 0)
+       } while (0)
 
 #define CDDA_SIZE      2352
 
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/fdformat/fdformat.c
--- a/usr.bin/fdformat/fdformat.c       Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/fdformat/fdformat.c       Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdformat.c,v 1.17 2016/09/05 00:40:28 sevan Exp $      */
+/*     $NetBSD: fdformat.c,v 1.18 2021/11/27 22:16:41 rillig Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdformat.c,v 1.17 2016/09/05 00:40:28 sevan Exp $");
+__RCSID("$NetBSD: fdformat.c,v 1.18 2021/11/27 22:16:41 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -135,7 +135,7 @@
                        # which, optarg);                       \
                parms.which = tmplong;                          \
                parmmask |= MASK_##maskn;                       \
-       } while (/* CONSTCOND */0)
+       } while (0)
 
 #define getparm(structname, maskname)                          \
        do {                                                    \
@@ -144,7 +144,7 @@
                            " missing for type `%s'", optarg);  \
                parms.structname = tmplong;                     \
                parmmask |= MASK_ ## maskname;                  \
-       } while (/* CONSTCOND */0)
+       } while (0)
 
 
 #define copyparm(which, mask)                                  \
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/mail/sig.c
--- a/usr.bin/mail/sig.c        Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/mail/sig.c        Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig.c,v 1.3 2012/06/12 19:03:26 christos Exp $ */
+/*     $NetBSD: sig.c,v 1.4 2021/11/27 22:16:41 rillig Exp $   */
 
 /*
  * Copyright (c) 1980, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sig.c,v 1.3 2012/06/12 19:03:26 christos Exp $");
+__RCSID("$NetBSD: sig.c,v 1.4 2021/11/27 22:16:41 rillig Exp $");
 #endif /* not lint */
 
 #include <assert.h>
@@ -63,7 +63,7 @@
 #define SIGQUEUE_INIT(p)  do {\
        (p)->qe_first = NULL;\
        (p)->qe_last = &((p)->qe_first);\
-  } while (/*CONSTCOND*/ 0)
+  } while (0)
 
 /*
  * The routines alloc_entry() and free_entry() manage the queue
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/midiplay/midiplay.c
--- a/usr.bin/midiplay/midiplay.c       Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/midiplay/midiplay.c       Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midiplay.c,v 1.33 2019/02/01 08:37:21 mrg Exp $        */
+/*     $NetBSD: midiplay.c,v 1.34 2021/11/27 22:16:41 rillig Exp $     */
 
 /*
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: midiplay.c,v 1.33 2019/02/01 08:37:21 mrg Exp $");
+__RCSID("$NetBSD: midiplay.c,v 1.34 2021/11/27 22:16:41 rillig Exp $");
 #endif
 
 
@@ -842,7 +842,7 @@
     struct track *_t = t[i].indirect; \
     t[i].indirect = t[j].indirect; \
     t[j].indirect = _t; \
-} while (/*CONSTCOND*/ 0)
+} while (0)
 
 static void
 Heapify(struct track *t, int ntrks, int node)
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/su/su_pam.c
--- a/usr.bin/su/su_pam.c       Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/su/su_pam.c       Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: su_pam.c,v 1.22 2021/09/10 21:52:18 rillig Exp $       */
+/*     $NetBSD: su_pam.c,v 1.23 2021/11/27 22:16:42 rillig Exp $       */
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)su.c       8.3 (Berkeley) 4/2/94";*/
 #else
-__RCSID("$NetBSD: su_pam.c,v 1.22 2021/09/10 21:52:18 rillig Exp $");
+__RCSID("$NetBSD: su_pam.c,v 1.23 2021/11/27 22:16:42 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -293,12 +293,12 @@
 #define ERRX_PAM_END(args) do {                        \
        (void)pam_end(pamh, pam_err);           \
        errx args;                              \
-} while (/* CONSTCOND */0)
+} while (0)
 
 #define ERR_PAM_END(args) do {                 \
        (void)pam_end(pamh, pam_err);           \
        err args;                               \
-} while (/* CONSTCOND */0)
+} while (0)
 
        /* force the usage of specified class */
        if (class) {
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/vmstat/drvstats.c
--- a/usr.bin/vmstat/drvstats.c Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/vmstat/drvstats.c Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drvstats.c,v 1.13 2019/06/30 19:57:24 he Exp $ */
+/*     $NetBSD: drvstats.c,v 1.14 2021/11/27 22:16:42 rillig Exp $     */
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -64,7 +64,7 @@
 #define        timerset(tvp, uvp) do {                                         \
        ((uvp)->tv_sec = (tvp)->tv_sec);                                \
        ((uvp)->tv_usec = (tvp)->tv_usec);                              \
-} while (/* CONSTCOND */0)
+} while (0)
 
 /*
  * Take the delta between the present values and the last recorded
@@ -81,7 +81,7 @@
        tmp = cur.fld;                                                  \
        cur.fld -= last.fld;                                            \
        last.fld = tmp;                                                 \
-} while (/* CONSTCOND */0)
+} while (0)
 
 #define DELTA(x) do {                                                  \
                timerclear(&tmp_timer);                                 \
@@ -89,7 +89,7 @@
                timersub(&tmp_timer, &(last.x), &(cur.x));              \
                timerclear(&(last.x));                                  \
                timerset(&tmp_timer, &(last.x));                        \
-} while (/* CONSTCOND */0)
+} while (0)
 
        for (i = 0; i < ndrive; i++) {
                struct timeval  tmp_timer;
@@ -194,7 +194,7 @@
 #define COPYT(x,k,l) do {                                              \
                cur.x[k].tv_sec = drives[l].x##_sec;                    \
                cur.x[k].tv_usec = drives[l].x##_usec;                  \
-} while (/* CONSTCOND */0)
+} while (0)
 
        for (i = 0, j = 0; i < ndrive && j < count; i++) {
 
diff -r bf7d42f637f0 -r dc738c081916 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c   Sat Nov 27 22:04:02 2021 +0000
+++ b/usr.bin/vmstat/vmstat.c   Sat Nov 27 22:16:41 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.247 2021/08/22 22:24:12 rillig Exp $ */
+/* $NetBSD: vmstat.c,v 1.248 2021/11/27 22:16:42 rillig Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c   8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.247 2021/08/22 22:24:12 rillig Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.248 2021/11/27 22:16:42 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -285,7 +285,7 @@
            (val)) - (width);                           \
        if ((ovflw) < 0)                                \
                (ovflw) = 0;                            \
-} while (/* CONSTCOND */0)
+} while (0)
 
 void   cpustats(int *);
 void   cpucounters(struct cpu_counter *);
@@ -1372,7 +1372,7 @@
                            (int)total_max, counttotal,
                            (int)rate_max, counttotal / uptime);
                return;
-       } while (/*CONSTCOND*/ 0);
+       } while (0);
 
        if (type == EVCNT_TYPE_ANY)
                (void)printf("%-34s %16s %8s %s\n", "event", "total", "rate",



Home | Main Index | Thread Index | Old Index