Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/puffs Safer definitions of DPRINTF and DPRINTF_VERBOSE.



details:   https://anonhg.NetBSD.org/src/rev/5f3f4bc88245
branches:  trunk
changeset: 802855:5f3f4bc88245
user:      apb <apb%NetBSD.org@localhost>
date:      Sun Oct 05 14:13:14 2014 +0000

description:
Safer definitions of DPRINTF and DPRINTF_VERBOSE.

In the PUFFSDEBUG case, wrap do { ... } while (/*CONSTCOND*/0)
around the definitions.  In the non-PUFFSDEBUG case, define them
as ((void)0) instead of as empty.

diffstat:

 sys/fs/puffs/puffs_sys.h |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (29 lines):

diff -r ffd5238b8d92 -r 5f3f4bc88245 sys/fs/puffs/puffs_sys.h
--- a/sys/fs/puffs/puffs_sys.h  Sun Oct 05 13:27:33 2014 +0000
+++ b/sys/fs/puffs/puffs_sys.h  Sun Oct 05 14:13:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_sys.h,v 1.86 2014/08/28 08:29:50 hannken Exp $   */
+/*     $NetBSD: puffs_sys.h,v 1.87 2014/10/05 14:13:14 apb Exp $       */
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -63,11 +63,15 @@
 
 #ifdef PUFFSDEBUG
 extern int puffsdebug; /* puffs_subr.c */
-#define DPRINTF(x) if (puffsdebug > 0) printf x
-#define DPRINTF_VERBOSE(x) if (puffsdebug > 1) printf x
+#define DPRINTF(x) do { \
+               if (puffsdebug > 0) printf x; \
+       while (/*CONSTCOND*/0)
+#define DPRINTF_VERBOSE(x) do { \
+               if (puffsdebug > 1) printf x; \
+       while (/*CONSTCOND*/0)
 #else
-#define DPRINTF(x)
-#define DPRINTF_VERBOSE(x)
+#define DPRINTF(x) ((void)0)
+#define DPRINTF_VERBOSE(x) ((void)0)
 #endif
 
 #define MPTOPUFFSMP(mp) ((struct puffs_mount *)((mp)->mnt_data))



Home | Main Index | Thread Index | Old Index