[PATCH v1 34/35] Assume __has_attribute(__alloc_size__)
Alejandro Colomar
alx@kernel.org
Sun Nov 9 21:54:14 GMT 2025
We already assume that GCC is at least GCC 5,
and we also assume that Clang is at least Clang 4.
Clang added support for __attribute__((__alloc_size__())) in
Clang 4.0.0:
llvm.git a747027bc645 (2016-12-20; "Add the alloc_size attribute to clang.")
$ git describe --contains a747027bc645
llvmorg-4.0.0-rc1~1659
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
misc/sys/cdefs.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 07eddbef74..76ee6c275e 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -382,12 +382,8 @@
/* Tell the compiler which arguments to an allocation function
indicate the size of the allocation. */
-#if __GNUC_PREREQ (4, 3)
# define __attribute_alloc_size__(params) \
__attribute__ ((__alloc_size__ params))
-#else
-# define __attribute_alloc_size__(params) /* Ignore. */
-#endif
/* Tell the compiler which argument to an allocation function
indicates the alignment of the allocation. */
--
2.51.0
More information about the Libc-alpha
mailing list