Add M_ATTR_COLD_FUNCTION attribute

This commit is contained in:
Patrick Pelissier committed 2023-04-16 19:15:22 +02:00
1 parent ae81271b2a
commit e3e94ca238
1 file changed
+11
+11
View File
@@ -126,10 +126,21 @@
# define M_ATTR_NO_RETURN _Noreturn
#elif defined(__GNUC__)
# define M_ATTR_NO_RETURN __attribute__ ((noreturn))
#elif defined(_MSC_VER)
# define M_ATTR_NO_RETURN __declspec(noreturn)
#else
# define M_ATTR_NO_RETURN
#endif
/* The cold attribute on functions is used to inform the compiler
that the function is unlikely to be executed. */
#if defined(__GNUC__)
# define M_ATTR_COLD_FUNCTION __attribute__ ((cold))
#else
# define M_ATTR_COLD_FUNCTION
#endif
/* Ignore some warnings detected by some compilers in the library.
* Whatever we do, there is some warnings that cannot be fixed.
* So they are ignored in order to avoid polluting the user with