In non-debugging mode make this define (void)0 instead of nothing. This

helps to catch bugs like the below with clang.

	if (cond);		<--- note the trailing ;
	   something();

Approved by:	ed (mentor)
Discussed on:	current@
This commit is contained in:
Roman Divacky 2009-06-21 09:01:12 +00:00
parent 2b7d10c225
commit 20a0556c59
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194578
6 changed files with 27 additions and 27 deletions

View File

@ -147,13 +147,13 @@ void ktr_tracepoint(u_int mask, const char *file, int line,
#define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0)
#define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, p2, p3, p4, p5, 0)
#else /* KTR */
#define CTR0(m, d)
#define CTR1(m, d, p1)
#define CTR2(m, d, p1, p2)
#define CTR3(m, d, p1, p2, p3)
#define CTR4(m, d, p1, p2, p3, p4)
#define CTR5(m, d, p1, p2, p3, p4, p5)
#define CTR6(m, d, p1, p2, p3, p4, p5, p6)
#define CTR0(m, d) (void)0
#define CTR1(m, d, p1) (void)0
#define CTR2(m, d, p1, p2) (void)0
#define CTR3(m, d, p1, p2, p3) (void)0
#define CTR4(m, d, p1, p2, p3, p4) (void)0
#define CTR5(m, d, p1, p2, p3, p4, p5) (void)0
#define CTR6(m, d, p1, p2, p3, p4, p5, p6) (void)0
#endif /* KTR */
#define TR0(d) CTR0(KTR_GEN, d)

View File

@ -283,21 +283,21 @@ void witness_thread_exit(struct thread *);
witness_line(lock)
#else /* WITNESS */
#define WITNESS_INIT(lock, type)
#define WITNESS_DESTROY(lock)
#define WITNESS_INIT(lock, type) (void)0
#define WITNESS_DESTROY(lock) (void)0
#define WITNESS_DEFINEORDER(lock1, lock2) 0
#define WITNESS_CHECKORDER(lock, flags, file, line, interlock)
#define WITNESS_LOCK(lock, flags, file, line)
#define WITNESS_UPGRADE(lock, flags, file, line)
#define WITNESS_DOWNGRADE(lock, flags, file, line)
#define WITNESS_UNLOCK(lock, flags, file, line)
#define WITNESS_CHECKORDER(lock, flags, file, line, interlock) (void)0
#define WITNESS_LOCK(lock, flags, file, line) (void)0
#define WITNESS_UPGRADE(lock, flags, file, line) (void)0
#define WITNESS_DOWNGRADE(lock, flags, file, line) (void)0
#define WITNESS_UNLOCK(lock, flags, file, line) (void)0
#define WITNESS_CHECK(flags, lock, fmt, ...) 0
#define WITNESS_WARN(flags, lock, fmt, ...)
#define WITNESS_SAVE_DECL(n)
#define WITNESS_SAVE(lock, n)
#define WITNESS_RESTORE(lock, n)
#define WITNESS_NORELEASE(lock)
#define WITNESS_RELEASEOK(lock)
#define WITNESS_WARN(flags, lock, fmt, ...) (void)0
#define WITNESS_SAVE_DECL(n) (void)0
#define WITNESS_SAVE(lock, n) (void)0
#define WITNESS_RESTORE(lock, n) (void)0
#define WITNESS_NORELEASE(lock) (void)0
#define WITNESS_RELEASEOK(lock) (void)0
#define WITNESS_FILE(lock) ("?")
#define WITNESS_LINE(lock) (0)
#endif /* WITNESS */

View File

@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct lock_object *lo, int *contested,
#else /* !LOCK_PROFILING */
#define lock_profile_release_lock(lo)
#define lock_profile_obtain_lock_failed(lo, contested, waittime)
#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line)
#define lock_profile_thread_exit(td)
#define lock_profile_release_lock(lo) (void)0
#define lock_profile_obtain_lock_failed(lo, contested, waittime) (void)0
#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line) (void)0
#define lock_profile_thread_exit(td) (void)0
#endif /* !LOCK_PROFILING */

View File

@ -438,7 +438,7 @@ struct mtx_args {
#define GIANT_REQUIRED mtx_assert(&Giant, MA_OWNED)
#else /* INVARIANTS */
#define mtx_assert(m, what)
#define mtx_assert(m, what) (void)0
#define GIANT_REQUIRED
#endif /* INVARIANTS */

View File

@ -173,7 +173,7 @@ extern long sched_switch_stats[SWT_COUNT];
#else
#define SCHED_STAT_DEFINE_VAR(name, descr, ptr)
#define SCHED_STAT_DEFINE(name, descr)
#define SCHED_STAT_INC(var)
#define SCHED_STAT_INC(var) (void)0
#endif
/*

View File

@ -293,7 +293,7 @@ __sx_sunlock(struct sx *sx, const char *file, int line)
#ifdef INVARIANTS
#define sx_assert(sx, what) _sx_assert((sx), (what), LOCK_FILE, LOCK_LINE)
#else
#define sx_assert(sx, what)
#define sx_assert(sx, what) (void)0
#endif
#endif /* _KERNEL */