xref: /arm-trusted-firmware/include/lib/libc/cdefs.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  */
6*91f16700Schasinglulu 
7*91f16700Schasinglulu #ifndef CDEFS_H
8*91f16700Schasinglulu #define CDEFS_H
9*91f16700Schasinglulu 
10*91f16700Schasinglulu #define __dead2		__attribute__((__noreturn__))
11*91f16700Schasinglulu #define __deprecated	__attribute__((__deprecated__))
12*91f16700Schasinglulu #define __packed	__attribute__((__packed__))
13*91f16700Schasinglulu #define __used		__attribute__((__used__))
14*91f16700Schasinglulu #define __unused	__attribute__((__unused__))
15*91f16700Schasinglulu #define __maybe_unused	__attribute__((__unused__))
16*91f16700Schasinglulu #define __aligned(x)	__attribute__((__aligned__(x)))
17*91f16700Schasinglulu #define __section(x)	__attribute__((__section__(x)))
18*91f16700Schasinglulu #define __fallthrough	__attribute__((__fallthrough__))
19*91f16700Schasinglulu #if RECLAIM_INIT_CODE
20*91f16700Schasinglulu /*
21*91f16700Schasinglulu  * Add each function to a section that is unique so the functions can still
22*91f16700Schasinglulu  * be garbage collected
23*91f16700Schasinglulu  */
24*91f16700Schasinglulu #define __init		__section(".text.init." __FILE__ "." __XSTRING(__LINE__))
25*91f16700Schasinglulu #else
26*91f16700Schasinglulu #define __init
27*91f16700Schasinglulu #endif
28*91f16700Schasinglulu 
29*91f16700Schasinglulu #define __printflike(fmtarg, firstvararg) \
30*91f16700Schasinglulu 		__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
31*91f16700Schasinglulu 
32*91f16700Schasinglulu #define __weak_reference(sym, alias)	\
33*91f16700Schasinglulu 	__asm__(".weak alias");		\
34*91f16700Schasinglulu 	__asm__(".equ alias, sym")
35*91f16700Schasinglulu 
36*91f16700Schasinglulu #define __STRING(x)	#x
37*91f16700Schasinglulu #define __XSTRING(x)	__STRING(x)
38*91f16700Schasinglulu 
39*91f16700Schasinglulu #endif /* CDEFS_H */
40