4 * Various compiler features
7 #ifndef _KLIBC_COMPILER_H
8 #define _KLIBC_COMPILER_H
10 /* Specific calling conventions */
13 # define __cdecl __attribute__((cdecl,regparm(0)))
15 /* Most other C compilers have __cdecl as a keyword */
19 /* How to declare a function that *must* be inlined */
21 # if __GNUC_MAJOR__ >= 3
22 # define __must_inline static __inline__ __attribute__((always_inline))
24 # define __must_inline extern __inline__
27 # define __must_inline inline /* Just hope this works... */
30 /* How to declare a function that does not return */
32 # define __noreturn void __attribute__((noreturn))
34 # define __noreturn void
37 /* How to declare a "constant" function (a function in the
38 mathematical sense) */
40 # define __constfunc __attribute__((const))
45 /* Format attribute */
47 # define __formatfunc(t,f,a) __attribute__((format(t,f,a)))
49 # define __formatfunc(t,f,a)
53 #if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95))
54 # define __likely(x) __builtin_expect((x), 1)
55 # define __unlikely(x) __builtin_expect((x), 0)
57 # define __likely(x) (x)
58 # define __unlikely(x) (x)
61 /* Possibly unused function */
63 # define __unusedfunc __attribute__((unused))