aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-06-21 09:01:12 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-06-21 09:01:12 +0000
commit20a0556c59332912ec603b3d3164fa9176cec8b6 (patch)
tree04572ff6acc27b683f08d6ed71bcd534579198ed
parent2b7d10c225f7a5c9d8ea6864c5df462cf120bb6b (diff)
downloadsrc-20a0556c59332912ec603b3d3164fa9176cec8b6.tar.gz
src-20a0556c59332912ec603b3d3164fa9176cec8b6.zip
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@
Notes
Notes: svn path=/head/; revision=194578
-rw-r--r--sys/sys/ktr.h14
-rw-r--r--sys/sys/lock.h26
-rw-r--r--sys/sys/lock_profile.h8
-rw-r--r--sys/sys/mutex.h2
-rw-r--r--sys/sys/sched.h2
-rw-r--r--sys/sys/sx.h2
6 files changed, 27 insertions, 27 deletions
diff --git a/sys/sys/ktr.h b/sys/sys/ktr.h
index 403caa3b230e..10a983b4a384 100644
--- a/sys/sys/ktr.h
+++ b/sys/sys/ktr.h
@@ -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)
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 19d38548cb59..9e47ab4b41db 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -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 */
diff --git a/sys/sys/lock_profile.h b/sys/sys/lock_profile.h
index 7b36ed5d0b97..bf73ca14d62a 100644
--- a/sys/sys/lock_profile.h
+++ b/sys/sys/lock_profile.h
@@ -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 */
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 40795fca2e55..929bf4397220 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -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 */
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 198d96e6ac40..9d2a34af2a0f 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -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
/*
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index 11e61f69611a..4ff693bf14ea 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -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 */