Disable function attributes on unsupported compilers
[tinc] / src / xalloc.h
index da74ce1..96b9592 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "system.h"
 
-static inline void *xmalloc(size_t n) __attribute__((__malloc__));
+static inline void *xmalloc(size_t n) ATTR_MALLOC;
 static inline void *xmalloc(size_t n) {
        void *p = malloc(n);
 
@@ -34,7 +34,7 @@ static inline void *xmalloc(size_t n) {
        return p;
 }
 
-static inline void *xzalloc(size_t n) __attribute__((__malloc__));
+static inline void *xzalloc(size_t n) ATTR_MALLOC;
 static inline void *xzalloc(size_t n) {
        void *p = calloc(1, n);
 
@@ -55,7 +55,7 @@ static inline void *xrealloc(void *p, size_t n) {
        return p;
 }
 
-static inline char *xstrdup(const char *s) __attribute__((__malloc__)) __attribute((__nonnull__));
+static inline char *xstrdup(const char *s) ATTR_MALLOC ATTR_NONNULL;
 static inline char *xstrdup(const char *s) {
        char *p = strdup(s);
 
@@ -87,7 +87,7 @@ static inline int xvasprintf(char **strp, const char *fmt, va_list ap) {
        return result;
 }
 
-static inline int xasprintf(char **strp, const char *fmt, ...) __attribute__((__format__(printf, 2, 3)));
+static inline int xasprintf(char **strp, const char *fmt, ...) ATTR_FORMAT(printf, 2, 3);
 static inline int xasprintf(char **strp, const char *fmt, ...) {
        va_list ap;
        va_start(ap, fmt);