]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
cdefs.h: Define __COLD
authorSergey Bugaev <bugaevc@gmail.com>
Thu, 27 Apr 2023 14:42:11 +0000 (17:42 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 29 Apr 2023 15:01:52 +0000 (17:01 +0200)
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>
misc/sys/cdefs.h

index 23ec0ebd2ac8a6e50054810787a7493a32b6578c..9a07e297a6c250acf89ee240f76d49250cd6f575 100644 (file)
 #  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                                              \
 # define __THROW
 # define __THROWNL
 # define __NTH(fct)    fct
+# define __COLD
 
 #endif /* GCC || clang.  */