summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-09-01 19:13:37 +0200
committerLennart Poettering <lennart@poettering.net>2008-09-01 19:13:37 +0200
commite015879bb86662703850b7bcd13b46649f1628b8 (patch)
tree05c1aef10c71b0a694e8a3c7a94500558697dd72
parent82ea8dde8abc51165a781c69bc3b38034d62d969 (diff)
add malloc related gcc attribute macros
-rw-r--r--src/pulse/gccmacro.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h
index e4062033..0533b109 100644
--- a/src/pulse/gccmacro.h
+++ b/src/pulse/gccmacro.h
@@ -93,4 +93,24 @@
#endif
#endif
+#ifndef PA_GCC_ALLOC_SIZE
+#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
+#define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
+#define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
+#else
+/** Macro for usage of GCC's alloc_size attribute */
+#define PA_GCC_ALLOC_SIZE(x)
+#define PA_GCC_ALLOC_SIZE2(x,y)
+#endif
+#endif
+
+#ifndef PA_GCC_MALLOC
+#ifdef __GNUCC__
+#define PA_GCC_MALLOC __attribute__ ((malloc))
+#else
+/** Macro for usage of GCC's malloc attribute */
+#define PA_GCC_MALLOC
+#endif
+#endif
+
#endif