mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
Introduce cold function attribute
Attribute to deemphasize certain code paths. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
@@ -285,6 +285,22 @@ size_t strnlen(const char *s, size_t maxlen);
|
||||
# define no_return void
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How to tell the compiler that a function is unlikely to be executed.
|
||||
* This differs from unlikely() in that it is applied to a function call,
|
||||
* not a boolean condition.
|
||||
*/
|
||||
#ifndef HAVE_FUNC_ATTRIBUTE_COLD
|
||||
# define unlikely_func __attribute__((cold))
|
||||
#else
|
||||
# define unlikely_func
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A fatal function is both unlikely and no_return
|
||||
*/
|
||||
#define fatal_func no_return unlikely_func
|
||||
|
||||
/*
|
||||
* How to tell the compiler that a function takes a printf-like string
|
||||
*/
|
||||
|
Reference in New Issue
Block a user