]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h: Add ATTR_STRING() attribute macro
authorAlejandro Colomar <alx@kernel.org>
Sun, 26 Nov 2023 17:38:40 +0000 (18:38 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 4 Dec 2023 11:22:47 +0000 (12:22 +0100)
It signals that a function parameter is a string _before_ the call.

Suggested-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/attr.h

index 56a2e0c9d14eb58659c4222dffc1791f85f95285..b1f153c7e42dcf7fa4eafdb9e55cde4c361730bf 100644 (file)
 # 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