aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Hillegeer <nicolas@hillegeer.com>2014-03-31 18:39:51 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-31 18:42:17 -0300
commitf5db0d01bacc1cebf53bd1e3e2ce79b66116d8cb (patch)
tree7e6846523c3441e219894f225fcd031deb66b83a
parent5d30654512f1e40479e32f2c02a59fa84bb9118f (diff)
downloadrneovim-f5db0d01bacc1cebf53bd1e3e2ce79b66116d8cb.tar.gz
rneovim-f5db0d01bacc1cebf53bd1e3e2ce79b66116d8cb.tar.bz2
rneovim-f5db0d01bacc1cebf53bd1e3e2ce79b66116d8cb.zip
func-attr: clang 3.5 doesn't support alloc_size
The attribute was removed in commit c047507 in the clang repository as it was never properly implemented anyway. This fixes compiling with clang 3.5. Fixes issue #429
-rw-r--r--src/func_attr.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/func_attr.h b/src/func_attr.h
index 9a08dd62ab..34023f05d8 100644
--- a/src/func_attr.h
+++ b/src/func_attr.h
@@ -29,8 +29,6 @@
// (not definition), like so:
// void myfunc(void) FUNC_ATTR_ALWAYS_INLINE;
#define FUNC_ATTR_MALLOC __attribute__((malloc))
- #define FUNC_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
- #define FUNC_ATTR_ALLOC_SIZE_PROD(x,y) __attribute__((alloc_size(x,y)))
#define FUNC_ATTR_ALLOC_ALIGN(x) __attribute__((alloc_align(x)))
#define FUNC_ATTR_PURE __attribute__ ((pure))
#define FUNC_ATTR_CONST __attribute__((const))
@@ -43,15 +41,43 @@
// intel only
#else
// gcc only
+ #define FUNC_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
+ #define FUNC_ATTR_ALLOC_SIZE_PROD(x,y) __attribute__((alloc_size(x,y)))
#endif
-#else
+#endif
+
+// define function attributes that haven't been defined for this specific
+// compiler.
+
+#ifndef FUNC_ATTR_MALLOC
#define FUNC_ATTR_MALLOC
+#endif
+
+#ifndef FUNC_ATTR_ALLOC_SIZE
#define FUNC_ATTR_ALLOC_SIZE(x)
+#endif
+
+#ifndef FUNC_ATTR_ALLOC_SIZE_PROD
#define FUNC_ATTR_ALLOC_SIZE_PROD(x,y)
+#endif
+
+#ifndef FUNC_ATTR_ALLOC_ALIGN
#define FUNC_ATTR_ALLOC_ALIGN(x)
+#endif
+
+#ifndef FUNC_ATTR_PURE
#define FUNC_ATTR_PURE
+#endif
+
+#ifndef FUNC_ATTR_CONST
#define FUNC_ATTR_CONST
+#endif
+
+#ifndef FUNC_ATTR_WARN_UNUSED_RESULT
#define FUNC_ATTR_WARN_UNUSED_RESULT
+#endif
+
+#ifndef FUNC_ATTR_ALWAYS_INLINE
#define FUNC_ATTR_ALWAYS_INLINE
#endif