From f1b327f8d5c8de7bf7fae99e85765d0954a25bac Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 6 Oct 2018 12:31:09 +0100 Subject: include/c: use returns_nonnull function attribute in xalloc.h Let the compiler optimize based on the knowledge that the return value will never be null. Reference: https://patchwork.ozlabs.org/patch/281112/#631159 Signed-off-by: Sami Kerola --- include/c.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/c.h') diff --git a/include/c.h b/include/c.h index b769b5843..8b2a2d19a 100644 --- a/include/c.h +++ b/include/c.h @@ -80,6 +80,12 @@ # endif #endif +#if (__GNUC__ >= 5) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ >= 9)) +# define __ul_returns_nonnull __attribute__((returns_nonnull)) +#else +# define __ul_returns_nonnull +#endif + /* * Force a compilation error if condition is true, but also produce a * result (of value 0 and type size_t), so the expression can be used -- cgit v1.2.3-55-g7522