[pulseaudio-discuss] [PATCH 2/6] macro: Add macro PA_USED

Peter Meerwald pmeerw at pmeerw.net
Sun Nov 9 08:59:22 PST 2014


the macro PA_USED may be used to suppress a warning when a variable
is not used, or assigned and never used; this typically happens
when the only use of the variable is within an assert() that can
be optimized away (i.e. with NDEBUG set)

has an effect with GCC only

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulsecore/macro.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index e36b6ce..21c3e6c 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -77,6 +77,12 @@ static inline size_t PA_PAGE_ALIGN(size_t l) {
     return (l + PA_PAGE_SIZE - 1) & ~(PA_PAGE_SIZE - 1);
 }
 
+#if defined(__GNUC__)
+    #define PA_UNUSED __attribute__ ((unused))
+#else
+    #define PA_UNUSED
+#endif
+
 #define PA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
 
 #if defined(__GNUC__)
-- 
1.9.1



More information about the pulseaudio-discuss mailing list