]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h: format_attr(): Use it also with Clang
authorAlejandro Colomar <alx@kernel.org>
Thu, 7 Aug 2025 12:32:11 +0000 (14:32 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 28 Nov 2025 02:35:26 +0000 (20:35 -0600)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/attr.h

index a77e3e35f7270ddf58770041a24cfc9369616ea5..a60b9f2cb32d733c66118f078ba310b56d18dd5b 100644 (file)
 # define NORETURN
 #endif
 
-#if (__GNUC__ >= 10)
+#if __has_c_attribute(gnu::format)
 # define format_attr(type, fmt, va)  [[gnu::format(type, fmt, va)]]
+#else
+# define format_attr(type, fmt, va)
+#endif
+
+#if (__GNUC__ >= 10)
 # define ATTR_ACCESS(...)            [[gnu::access(__VA_ARGS__)]]
 # define ATTR_ALLOC_SIZE(...)        [[gnu::alloc_size(__VA_ARGS__)]]
 #else
-# define format_attr(type, fmt, va)
 # define ATTR_ACCESS(...)
 # define ATTR_ALLOC_SIZE(...)
 #endif