Module Name:    src
Committed By:   apb
Date:           Sun Oct  5 14:13:15 UTC 2014

Modified Files:
        src/sys/fs/puffs: puffs_sys.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/fs/puffs/puffs_sys.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/puffs/puffs_sys.h
diff -u src/sys/fs/puffs/puffs_sys.h:1.86 src/sys/fs/puffs/puffs_sys.h:1.87
--- src/sys/fs/puffs/puffs_sys.h:1.86	Thu Aug 28 08:29:50 2014
+++ src/sys/fs/puffs/puffs_sys.h	Sun Oct  5 14:13:14 2014
@@ -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 @@ extern struct pool puffs_vapool;
 
 #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))

Reply via email to