[PATCH v1 35/35] Assume __has_attribute(__returns_nonnull__)

Alejandro Colomar alx@kernel.org
Sun Nov 9 21:54:17 GMT 2025


We already assume GCC is at least GCC 5,
and we also assume that Clang is at least Clang 4.

Clang added support for __attribute__((__returns_nonnull__)) in
Clang 3.5:

llvm.git dbf62e3eee51 (2014-01-20; "Wire up basic parser/sema support for attribute 'returns_nonnull'.")

	$ git describe --contains dbf62e3eee51
	llvmorg-3.5.0-rc1~13296

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 76ee6c275e..afb44fda6c 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -439,11 +439,7 @@
 /* The returns_nonnull function attribute marks the return type of the function
    as always being non-null.  */
 #ifndef __returns_nonnull
-# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
 # define __returns_nonnull __attribute__ ((__returns_nonnull__))
-# else
-# define __returns_nonnull
-# endif
 #endif
 
 /* If fortification mode, we warn about unused results of certain
-- 
2.51.0



More information about the Libc-alpha mailing list