Minor style cleanup

We prefer 'while (0)' to 'while(0)' according to grep and stlye(9)'s
space after keyword rule. Remove a few stragglers of the latter.
Many of these usages were inconsistent within the file.

MFC After:		3 days
Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2021-04-18 11:10:59 -06:00
parent 6525c2d4de
commit f1f9870668
12 changed files with 20 additions and 19 deletions

View File

@ -222,7 +222,7 @@ SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW,
knote_enqueue((kn)); \ knote_enqueue((kn)); \
if (!(islock)) \ if (!(islock)) \
KQ_UNLOCK((kn)->kn_kq); \ KQ_UNLOCK((kn)->kn_kq); \
} while(0) } while (0)
#define KQ_LOCK(kq) do { \ #define KQ_LOCK(kq) do { \
mtx_lock(&(kq)->kq_lock); \ mtx_lock(&(kq)->kq_lock); \
} while (0) } while (0)
@ -312,7 +312,7 @@ kn_leave_flux(struct knote *kn)
knl->kl_assert_lock((knl)->kl_lockarg, LA_UNLOCKED); \ knl->kl_assert_lock((knl)->kl_lockarg, LA_UNLOCKED); \
} while (0) } while (0)
#else /* !INVARIANTS */ #else /* !INVARIANTS */
#define KNL_ASSERT_LOCKED(knl) do {} while(0) #define KNL_ASSERT_LOCKED(knl) do {} while (0)
#define KNL_ASSERT_UNLOCKED(knl) do {} while (0) #define KNL_ASSERT_UNLOCKED(knl) do {} while (0)
#endif /* INVARIANTS */ #endif /* INVARIANTS */

View File

@ -131,7 +131,7 @@ retry: \
} \ } \
} \ } \
(a) = next_file_id; \ (a) = next_file_id; \
} while(0) } while (0)
/* XXX wrong name; we're looking at version provision tags here, not modules */ /* XXX wrong name; we're looking at version provision tags here, not modules */
typedef TAILQ_HEAD(, modlist) modlisthead_t; typedef TAILQ_HEAD(, modlist) modlisthead_t;

View File

@ -558,7 +558,7 @@ sx_drop_critical(uintptr_t x, bool *in_critical, int *extra_work)
} }
} }
#else #else
#define sx_drop_critical(x, in_critical, extra_work) do { } while(0) #define sx_drop_critical(x, in_critical, extra_work) do { } while (0)
#endif #endif
/* /*

View File

@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$");
else \ else \
error = (action); \ error = (action); \
return (error); \ return (error); \
} while(0) } while (0)
int int
proc_read_regs(struct thread *td, struct reg *regs) proc_read_regs(struct thread *td, struct reg *regs)

View File

@ -81,7 +81,7 @@ static uma_zone_t ttyoutq_zone;
uma_zfree(ttyoutq_zone, tob); \ uma_zfree(ttyoutq_zone, tob); \
else \ else \
TTYOUTQ_INSERT_TAIL(to, tob); \ TTYOUTQ_INSERT_TAIL(to, tob); \
} while(0) } while (0)
void void
ttyoutq_flush(struct ttyoutq *to) ttyoutq_flush(struct ttyoutq *to)

View File

@ -60,9 +60,10 @@
.udata = (f), \ .udata = (f), \
.ext = {0}, \ .ext = {0}, \
}; \ }; \
} while(0) } while (0)
#else /* Pre-C99 or not STDC (e.g., C++) */ #else /* Pre-C99 or not STDC (e.g., C++) */
/* The definition of the local variable kevp could possibly conflict /*
* The definition of the local variable kevp could possibly conflict
* with a user-defined value passed in parameters a-f. * with a user-defined value passed in parameters a-f.
*/ */
#define EV_SET(kevp_, a, b, c, d, e, f) do { \ #define EV_SET(kevp_, a, b, c, d, e, f) do { \
@ -77,7 +78,7 @@
(kevp)->ext[1] = 0; \ (kevp)->ext[1] = 0; \
(kevp)->ext[2] = 0; \ (kevp)->ext[2] = 0; \
(kevp)->ext[3] = 0; \ (kevp)->ext[3] = 0; \
} while(0) } while (0)
#endif #endif
struct kevent { struct kevent {

View File

@ -147,7 +147,7 @@ do { \
\ \
if ((_el = eventhandler_find_list(#name)) != NULL) \ if ((_el = eventhandler_find_list(#name)) != NULL) \
eventhandler_deregister(_el, tag); \ eventhandler_deregister(_el, tag); \
} while(0) } while (0)
#define EVENTHANDLER_DEREGISTER_NOWAIT(name, tag) \ #define EVENTHANDLER_DEREGISTER_NOWAIT(name, tag) \
do { \ do { \
@ -155,7 +155,7 @@ do { \
\ \
if ((_el = eventhandler_find_list(#name)) != NULL) \ if ((_el = eventhandler_find_list(#name)) != NULL) \
eventhandler_deregister_nowait(_el, tag); \ eventhandler_deregister_nowait(_el, tag); \
} while(0) } while (0)
eventhandler_tag eventhandler_register(struct eventhandler_list *list, eventhandler_tag eventhandler_register(struct eventhandler_list *list,
const char *name, void *func, void *arg, int priority); const char *name, void *func, void *arg, int priority);

View File

@ -82,7 +82,7 @@ void ktr_tracepoint(uint64_t mask, const char *file, int line,
ktr_tracepoint((m), __FILE__, __LINE__, format, \ ktr_tracepoint((m), __FILE__, __LINE__, format, \
(u_long)(p1), (u_long)(p2), (u_long)(p3), \ (u_long)(p1), (u_long)(p2), (u_long)(p3), \
(u_long)(p4), (u_long)(p5), (u_long)(p6)); \ (u_long)(p4), (u_long)(p5), (u_long)(p6)); \
} while(0) } while (0)
#define CTR0(m, format) CTR6(m, format, 0, 0, 0, 0, 0, 0) #define CTR0(m, format) CTR6(m, format, 0, 0, 0, 0, 0, 0)
#define CTR1(m, format, p1) CTR6(m, format, p1, 0, 0, 0, 0, 0) #define CTR1(m, format, p1) CTR6(m, format, p1, 0, 0, 0, 0, 0)
#define CTR2(m, format, p1, p2) CTR6(m, format, p1, p2, 0, 0, 0, 0) #define CTR2(m, format, p1, p2) CTR6(m, format, p1, p2, 0, 0, 0, 0)

View File

@ -164,7 +164,7 @@ extern uintptr_t dpcpu_off[];
CPU_FOREACH(_i) { \ CPU_FOREACH(_i) { \
bzero(DPCPU_ID_PTR(_i, n), sizeof(*DPCPU_PTR(n))); \ bzero(DPCPU_ID_PTR(_i, n), sizeof(*DPCPU_PTR(n))); \
} \ } \
} while(0) } while (0)
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -501,7 +501,7 @@ typedef u64q_t umaxq_t;
#define Q_QADDSUBQ(a, b, eop) \ #define Q_QADDSUBQ(a, b, eop) \
({ \ ({ \
int _aserr; \ int _aserr; \
if ((_aserr = Q_NORMPREC(a, b))) while(0); /* NOP */ \ if ((_aserr = Q_NORMPREC(a, b))) while (0); /* NOP */ \
else if ((eop) == '+') { \ else if ((eop) == '+') { \
if (Q_IFMAXVAL(*(a)) - Q_GIFABSVAL(b) < Q_GIFVAL(*(a))) \ if (Q_IFMAXVAL(*(a)) - Q_GIFABSVAL(b) < Q_GIFVAL(*(a))) \
_aserr = EOVERFLOW; /* [+/-a + +b] > max(a) */ \ _aserr = EOVERFLOW; /* [+/-a + +b] > max(a) */ \
@ -523,7 +523,7 @@ typedef u64q_t umaxq_t;
#define Q_QDIVQ(a, b) \ #define Q_QDIVQ(a, b) \
({ \ ({ \
int _err; \ int _err; \
if ((_err = Q_NORMPREC(a, b))) while(0); /* NOP */ \ if ((_err = Q_NORMPREC(a, b))) while (0); /* NOP */ \
else if (Q_GIFABSVAL(b) == 0 || (!Q_SIGNED(*(a)) && Q_LTZ(b))) \ else if (Q_GIFABSVAL(b) == 0 || (!Q_SIGNED(*(a)) && Q_LTZ(b))) \
_err = EINVAL; /* Divide by zero or cannot represent. */\ _err = EINVAL; /* Divide by zero or cannot represent. */\
/* XXXLAS: Handle overflow. */ \ /* XXXLAS: Handle overflow. */ \
@ -539,7 +539,7 @@ typedef u64q_t umaxq_t;
#define Q_QMULQ(a, b) \ #define Q_QMULQ(a, b) \
({ \ ({ \
int _mulerr; \ int _mulerr; \
if ((_mulerr = Q_NORMPREC(a, b))) while(0); /* NOP */ \ if ((_mulerr = Q_NORMPREC(a, b))) while (0); /* NOP */ \
else if (!Q_SIGNED(*(a)) && Q_LTZ(b)) \ else if (!Q_SIGNED(*(a)) && Q_LTZ(b)) \
_mulerr = EINVAL; \ _mulerr = EINVAL; \
else if (Q_GIFABSVAL(b) != 0 && \ else if (Q_GIFABSVAL(b) != 0 && \

View File

@ -301,14 +301,14 @@ sigsetmasked(sigset_t *set, sigset_t *mask)
#define ksiginfo_init(ksi) \ #define ksiginfo_init(ksi) \
do { \ do { \
bzero(ksi, sizeof(ksiginfo_t)); \ bzero(ksi, sizeof(ksiginfo_t)); \
} while(0) } while (0)
#define ksiginfo_init_trap(ksi) \ #define ksiginfo_init_trap(ksi) \
do { \ do { \
ksiginfo_t *kp = ksi; \ ksiginfo_t *kp = ksi; \
bzero(kp, sizeof(ksiginfo_t)); \ bzero(kp, sizeof(ksiginfo_t)); \
kp->ksi_flags |= KSI_TRAP; \ kp->ksi_flags |= KSI_TRAP; \
} while(0) } while (0)
static __inline void static __inline void
ksiginfo_copy(ksiginfo_t *src, ksiginfo_t *dst) ksiginfo_copy(ksiginfo_t *src, ksiginfo_t *dst)

View File

@ -65,7 +65,7 @@ void stack_ktr(u_int, const char *, int, const struct stack *,
#define CTRSTACK(m, st, depth) do { \ #define CTRSTACK(m, st, depth) do { \
if (KTR_COMPILE & (m)) \ if (KTR_COMPILE & (m)) \
stack_ktr((m), __FILE__, __LINE__, st, depth); \ stack_ktr((m), __FILE__, __LINE__, st, depth); \
} while(0) } while (0)
#else #else
#define CTRSTACK(m, st, depth) #define CTRSTACK(m, st, depth)
#endif #endif