KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Various common macros used throughout the codebase More...
Files | |
file | cdefs.h |
Definitions for builtin attributes and compiler directives. | |
Macros | |
#define | __noreturn __attribute__((__noreturn__)) |
Identify a function that will never return. | |
#define | __pure __attribute__((__const__)) |
Identify a function that has no side effects other than its return, and only uses its arguments for any work. | |
#define | __unused __attribute__((__unused__)) |
Identify a function or variable that may be unused. | |
#define | __used __attribute__((used)) |
Prevent a symbol from being removed from the binary. | |
#define | __weak __attribute__((weak)) |
Identify a function or variable that may be overridden by another symbol. | |
#define | __dead2 __noreturn /* BSD compat */ |
Alias for __noreturn. | |
#define | __pure2 __pure /* ditto */ |
Alias for __pure. | |
#define | __likely(exp) __builtin_expect(!!(exp), 1) |
Directive to inform the compiler the condition is in the likely path. | |
#define | __unlikely(exp) __builtin_expect(!!(exp), 0) |
Directive to inform the compiler the condition is in the unlikely path. | |
#define | __deprecated __attribute__((deprecated)) |
Mark something as deprecated. | |
#define | __depr(m) __attribute__((deprecated(m))) |
Mark something as deprecated, with an informative message. | |
#define | __printflike(fmtarg, firstvararg) __attribute__((__format__ (__printf__, fmtarg, firstvararg))) |
Identify a function as accepting formatting like printf(). | |
#define | __scanflike(fmtarg, firstvararg) __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) |
Identify a function as accepting formatting like scanf(). | |
#define | __fallthrough /* Fall through */ |
#define | __always_inline inline __attribute__((__always_inline__)) |
Ask the compiler to always inline a given function. | |
#define | __no_inline __attribute__((__noinline__)) |
Ask the compiler to never inline a given function. | |
#define | __RESTRICT |
#define | __extension__ |
#define | inline __inline__ |
Various common macros used throughout the codebase
#define __always_inline inline __attribute__((__always_inline__)) |
Ask the compiler to always inline a given function.
#define __dead2 __noreturn /* BSD compat */ |
Alias for __noreturn.
For BSD compatibility.
#define __depr | ( | m | ) | __attribute__((deprecated(m))) |
Mark something as deprecated, with an informative message.
This should be used to warn users that a function/type/etc will be removed in a future version of KOS and to suggest an alternative that they can use instead.
m | A string literal that is included with the warning message at compile time. |
#define __deprecated __attribute__((deprecated)) |
Mark something as deprecated.
This should be used to warn users that a function/type/etc will be removed in a future version of KOS.
#define __extension__ |
#define __fallthrough /* Fall through */ |
#define __likely | ( | exp | ) | __builtin_expect(!!(exp), 1) |
Directive to inform the compiler the condition is in the likely path.
This can be used around conditionals or loops to help inform the compiler which path to optimize for as the common-case.
exp | Boolean expression which expected to be true. |
#define __no_inline __attribute__((__noinline__)) |
Ask the compiler to never inline a given function.
#define __noreturn __attribute__((__noreturn__)) |
Identify a function that will never return.
#define __printflike | ( | fmtarg, | |
firstvararg ) __attribute__((__format__ (__printf__, fmtarg, firstvararg))) |
Identify a function as accepting formatting like printf().
Using this macro allows GCC to typecheck calls to printf-like functions, which can aid in finding mistakes.
fmtarg | The argument number (1-based) of the format string. |
firstvararg | The argument number of the first vararg (the ...). |
#define __pure __attribute__((__const__)) |
Identify a function that has no side effects other than its return, and only uses its arguments for any work.
#define __RESTRICT |
#define __scanflike | ( | fmtarg, | |
firstvararg ) __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) |
Identify a function as accepting formatting like scanf().
Using this macro allows GCC to typecheck calls to scanf-like functions, which can aid in finding mistakes.
fmtarg | The argument number (1-based) of the format string. |
firstvararg | The argument number of the first vararg (the ...). |
#define __unlikely | ( | exp | ) | __builtin_expect(!!(exp), 0) |
Directive to inform the compiler the condition is in the unlikely path.
This can be used around conditionals or loops to help inform the compiler which path to optimize against as the infrequent-case.
exp | Boolean expression which is expected to be false. |
#define __unused __attribute__((__unused__)) |
Identify a function or variable that may be unused.
#define __used __attribute__((used)) |
Prevent a symbol from being removed from the binary.
#define __weak __attribute__((weak)) |
Identify a function or variable that may be overridden by another symbol.
#define inline __inline__ |