summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler.h1
-rw-r--r--util.h8
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler.h b/compiler.h
index a6bf3a6..3559050 100644
--- a/compiler.h
+++ b/compiler.h
@@ -21,6 +21,7 @@
#ifdef __GNUC__
# define __noreturn __attribute__((noreturn))
+# define __warn_unused_result __attribute__((warn_unused_result))
# define __packed __attribute__((packed))
# define __unused __attribute__((unused))
# ifndef offsetof
diff --git a/util.h b/util.h
index d4933c4..0c3d263 100644
--- a/util.h
+++ b/util.h
@@ -58,10 +58,10 @@ static inline void __noreturn panic(const char *fmt, ...)
exit(EXIT_FAILURE);
}
-void *xmalloc(size_t size);
-void *xzalloc(size_t size);
-void *xrealloc(void *ptr, size_t size);
-char *xstrdup(const char *s);
+void *xmalloc(size_t size) __warn_unused_result;
+void *xzalloc(size_t size) __warn_unused_result;
+void *xrealloc(void *ptr, size_t size) __warn_unused_result;
+char *xstrdup(const char *s) __warn_unused_result;
static inline bool xstreq(const char *str1, const char *str2)
{