From 99a1d896bca1c2e1068646eed50b02314673236c Mon Sep 17 00:00:00 2001 From: Nicolas Trangez Date: Sun, 30 Oct 2022 22:56:24 +0100 Subject: rts: add and use `STG_RETURNS_NONNULL` See: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-returns_005fnonnull-function-attribute See: https://gitlab.haskell.org/ghc/ghc/-/issues/22381 --- rts/include/Stg.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rts/include') diff --git a/rts/include/Stg.h b/rts/include/Stg.h index 5b5ba3ddb7..bd15e73cda 100644 --- a/rts/include/Stg.h +++ b/rts/include/Stg.h @@ -294,6 +294,15 @@ # define STG_ALLOC_SIZE2(position1, position2) #endif +/* + * https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-returns_005fnonnull-function-attribute + */ +#if stg__has_attribute(__returns_nonnull__) +# define STG_RETURNS_NONNULL __attribute__((__returns_nonnull__)) +#else +# define STG_RETURNS_NONNULL +#endif + /* ----------------------------------------------------------------------------- Global type definitions -------------------------------------------------------------------------- */ -- cgit v1.2.1