xref: /rk3399_ARM-atf/include/lib/libc/cdefs.h (revision 4fed6933825b928aecd6d90453fc444bd1bfdda3)
1 /*
2  * Copyright (c) 2018-2025, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef CDEFS_H
8 #define CDEFS_H
9 
10 #define __dead2		__attribute__((__noreturn__))
11 #define __deprecated	__attribute__((__deprecated__))
12 #define __packed	__attribute__((__packed__))
13 #define __used		__attribute__((__used__))
14 #define __unused	__attribute__((__unused__))
15 #define __maybe_unused	__attribute__((__unused__))
16 #define __aligned(x)	__attribute__((__aligned__(x)))
17 #define __section(x)	__attribute__((__section__(x)))
18 #define __fallthrough	__attribute__((__fallthrough__))
19 #define __noinline	__attribute__((__noinline__))
20 #define __pure		__attribute__((__pure__))
21 #if ENABLE_PAUTH
22 #define __no_pauth	__attribute__((target("branch-protection=none")))
23 #else
24 #define __no_pauth
25 #endif
26 #if !ENABLE_FEAT_MORELLO
27 #define __capability
28 #endif
29 #if RECLAIM_INIT_CODE
30 /*
31  * Add each function to a section that is unique so the functions can still
32  * be garbage collected.
33  *
34  * NOTICE: for this to work, these functions will NOT be inlined.
35  * TODO: the noinline attribute can be removed if RECLAIM_INIT_CODE is made
36  * platform agnostic and called after bl31_main(). Then, top-level functions
37  * (those that can't be inlined like bl31_main()) can be annotated with __init
38  * and noinline can be removed.
39  */
40 #define __init		__section(".text.init." __FILE__ "." __XSTRING(__LINE__)) __noinline
41 #else
42 #define __init
43 #endif
44 
45 #define __printflike(fmtarg, firstvararg) \
46 		__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
47 
48 #define __weak_reference(sym, alias)	\
49 	__asm__(".weak alias");		\
50 	__asm__(".equ alias, sym")
51 
52 #define __STRING(x)	#x
53 #define __XSTRING(x)	__STRING(x)
54 
55 #define __predict_true(exp)     (exp)
56 #define __predict_false(exp)    (exp)
57 
58 #endif /* CDEFS_H */
59