blob: b11d0727dc2080fb8f60b18611c87f2f8dd5dd0c [file] [log] [blame]
Antonio Nino Diaz1b465f82018-08-13 19:51:26 +01001/*
Govindraj Rajaeee28e72023-08-01 15:52:40 -05002 * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
Antonio Nino Diaz1b465f82018-08-13 19:51:26 +01003 *
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__))
Yann Gautierc92490b2022-08-29 09:33:46 +020015#define __maybe_unused __attribute__((__unused__))
Antonio Nino Diaz1b465f82018-08-13 19:51:26 +010016#define __aligned(x) __attribute__((__aligned__(x)))
17#define __section(x) __attribute__((__section__(x)))
Andre Przywara108e30b2023-02-21 12:05:29 +000018#define __fallthrough __attribute__((__fallthrough__))
Daniel Boulby468f0d72018-09-18 11:45:51 +010019#if RECLAIM_INIT_CODE
20/*
21 * Add each function to a section that is unique so the functions can still
22 * be garbage collected
23 */
24#define __init __section(".text.init." __FILE__ "." __XSTRING(__LINE__))
25#else
26#define __init
27#endif
Antonio Nino Diaz1b465f82018-08-13 19:51:26 +010028
29#define __printflike(fmtarg, firstvararg) \
30 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
31
32#define __weak_reference(sym, alias) \
33 __asm__(".weak alias"); \
34 __asm__(".equ alias, sym")
35
36#define __STRING(x) #x
37#define __XSTRING(x) __STRING(x)
38
39#endif /* CDEFS_H */