Author: rdivacky
Date: Sun Jun 21 09:01:12 2009
New Revision: 194578
URL: http://svn.freebsd.org/changeset/base/194578

Log:
  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@

Modified:
  head/sys/sys/ktr.h
  head/sys/sys/lock.h
  head/sys/sys/lock_profile.h
  head/sys/sys/mutex.h
  head/sys/sys/sched.h
  head/sys/sys/sx.h

Modified: head/sys/sys/ktr.h
==============================================================================
--- head/sys/sys/ktr.h  Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/ktr.h  Sun Jun 21 09:01:12 2009        (r194578)
@@ -147,13 +147,13 @@ void      ktr_tracepoint(u_int mask, const ch
 #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)

Modified: head/sys/sys/lock.h
==============================================================================
--- head/sys/sys/lock.h Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/lock.h Sun Jun 21 09:01:12 2009        (r194578)
@@ -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 */

Modified: head/sys/sys/lock_profile.h
==============================================================================
--- head/sys/sys/lock_profile.h Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/lock_profile.h Sun Jun 21 09:01:12 2009        (r194578)
@@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct l
 
 #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 */
 

Modified: head/sys/sys/mutex.h
==============================================================================
--- head/sys/sys/mutex.h        Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/mutex.h        Sun Jun 21 09:01:12 2009        (r194578)
@@ -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 */
 

Modified: head/sys/sys/sched.h
==============================================================================
--- head/sys/sys/sched.h        Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/sched.h        Sun Jun 21 09:01:12 2009        (r194578)
@@ -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
 
 /*

Modified: head/sys/sys/sx.h
==============================================================================
--- head/sys/sys/sx.h   Sun Jun 21 08:49:06 2009        (r194577)
+++ head/sys/sys/sx.h   Sun Jun 21 09:01:12 2009        (r194578)
@@ -293,7 +293,7 @@ __sx_sunlock(struct sx *sx, const char *
 #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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to