blob: 75e9bbbbd5f6c624b5ae776e00e4cc76a594cc12 [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
Imre Kisa57a7102024-06-04 17:02:46 +02002 * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
Imre Kisf55f2aa2024-05-28 15:55:19 +02003 *
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#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
28
29#define __printflike(fmtarg, firstvararg) \
30 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
31
Imre Kisf55f2aa2024-05-28 15:55:19 +020032#define __STRING(x) #x
33#define __XSTRING(x) __STRING(x)
34
35#endif /* CDEFS_H */