bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] cdefs.h: Define __COLD


From: Sergey Bugaev
Subject: [PATCH 1/3] cdefs.h: Define __COLD
Date: Sat, 29 Apr 2023 16:12:21 +0300

This expands to __attribute__ ((cold)) when supported. It should be
used to mark up functions that are invoked rarely.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---

I can change __COLD to __attribute_cold__ if that is preferred.

 misc/sys/cdefs.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 23ec0ebd..8eec4b94 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -98,6 +98,12 @@
 #  endif
 # endif
 
+# if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__)
+#  define __COLD       __attribute__ ((__cold__))
+# else
+#  define __COLD
+# endif
+
 #else  /* Not GCC or clang.  */
 
 # if (defined __cplusplus                                              \
-- 
2.40.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]