public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] cdefs.h: Define __COLD
@ 2023-04-29 13:12 Sergey Bugaev
  2023-04-29 13:12 ` [PATCH 2/3] hurd: Mark error functions as __COLD Sergey Bugaev
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sergey Bugaev @ 2023-04-29 13:12 UTC (permalink / raw)
  To: libc-alpha; +Cc: bug-hurd, Samuel Thibault

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-05-02  6:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 13:12 [PATCH 1/3] cdefs.h: Define __COLD Sergey Bugaev
2023-04-29 13:12 ` [PATCH 2/3] hurd: Mark error functions as __COLD Sergey Bugaev
2023-04-29 15:04   ` Samuel Thibault
2023-04-29 13:12 ` [PATCH 3/3] Mark various cold " Sergey Bugaev
2023-04-29 15:06   ` Samuel Thibault
2023-05-01 16:15     ` Siddhesh Poyarekar
2023-05-01 17:38       ` Samuel Thibault
2023-05-01 21:52   ` Cristian Rodríguez
2023-05-01 21:54     ` Samuel Thibault
2023-05-02  6:45       ` Sergey Bugaev
2023-04-29 13:20 ` [PATCH] cdefs.h: Define __COLD Sergey Bugaev
2023-04-29 15:02   ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).