diff options
author | Sami Kerola | 2018-10-06 13:31:09 +0200 |
---|---|---|
committer | Sami Kerola | 2018-11-21 21:54:18 +0100 |
commit | f1b327f8d5c8de7bf7fae99e85765d0954a25bac (patch) | |
tree | 775dc313067395bf7efea88b1119d754211b8e6f /include/c.h | |
parent | libblkid: add check for DRBD9 (diff) | |
download | kernel-qcow2-util-linux-f1b327f8d5c8de7bf7fae99e85765d0954a25bac.tar.gz kernel-qcow2-util-linux-f1b327f8d5c8de7bf7fae99e85765d0954a25bac.tar.xz kernel-qcow2-util-linux-f1b327f8d5c8de7bf7fae99e85765d0954a25bac.zip |
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 <kerolasa@iki.fi>
Diffstat (limited to 'include/c.h')
-rw-r--r-- | include/c.h | 6 |
1 files changed, 6 insertions, 0 deletions
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 |