From: Alejandro Colomar Date: Sun, 26 Nov 2023 17:38:40 +0000 (+0100) Subject: lib/attr.h: Add ATTR_STRING() attribute macro X-Git-Tag: 4.15.0-rc1~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a61cf0068bf8b56dec5a1d42c9e9701199fcbb0f;p=thirdparty%2Fshadow.git lib/attr.h: Add ATTR_STRING() attribute macro It signals that a function parameter is a string _before_ the call. Suggested-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/lib/attr.h b/lib/attr.h index 56a2e0c9d..b1f153c7e 100644 --- a/lib/attr.h +++ b/lib/attr.h @@ -21,5 +21,11 @@ # define ATTR_MALLOC(deallocator) #endif +#if (__GNUC__ >= 14) +# define ATTR_STRING(...) [[gnu::null_terminated_string_arg(__VA_ARGS__)]] +#else +# define ATTR_STRING(...) +#endif + #endif // include guard