[parted-devel] [PATCH] maint: make PED_ASSERT and PED_DEBUG if-safe
Colin Watson
cjwatson at ubuntu.com
Tue Apr 20 12:01:33 UTC 2010
Constructions such as:
if (foo)
PED_DEBUG (0, "foo");
else
PED_DEBUG (0, "not foo");
did not compile reliably, depending on the configuration. Make this
work.
* include/parted/debug.h [DEBUG && __GNUC__ && !__JSFTRACE__]
(PED_DEBUG): Remove trailing semicolon.
[!DEBUG] (PED_ASSERT): Use do-while rather than while.
[!DEBUG] (PED_DEBUG): Likewise.
---
include/parted/debug.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/parted/debug.h b/include/parted/debug.h
index bbba09e..c0da54a 100644
--- a/include/parted/debug.h
+++ b/include/parted/debug.h
@@ -39,7 +39,7 @@ ped_assert ( const char* cond_text,
#define PED_DEBUG(level, ...) \
ped_debug ( level, __FILE__, __LINE__, __PRETTY_FUNCTION__, \
- __VA_ARGS__ );
+ __VA_ARGS__ )
#define PED_ASSERT(cond, action) \
do { \
@@ -79,8 +79,8 @@ static void PED_DEBUG (int level, ...)
#else /* !DEBUG */
-#define PED_ASSERT(cond, action) while (0) {}
-#define PED_DEBUG(level, ...) while (0) {}
+#define PED_ASSERT(cond, action) do {} while (0)
+#define PED_DEBUG(level, ...) do {} while (0)
#endif /* DEBUG */
--
1.7.0.4
More information about the parted-devel
mailing list