aboutsummaryrefslogtreecommitdiff
path: root/include/apos/attrs.h
blob: 3825eceb1636e331a53fecdd4cdad66f75d0a843 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef APOS_COMPILER_ATTRIBUTES_H
#define APOS_COMPILER_ATTRIBUTES_H

/**
 * @file attrs.h
 * Attribute shorthands.
 */

/* TODO: figure out which attributes are necessary and which are good to have */
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif

#define __section(section) __attribute__((__section__(section)))
#define __fmt(x, y)        __attribute__((format(__printf__, x, y)))
#define __aligned(a)       __attribute__((aligned(a)))
#define __noinline         __attribute__((noinline))
#define __noreturn         __attribute__((noreturn))
#define __packed           __attribute__((packed))
#define __weak             __attribute__((weak))

#define __main             __section(".kernel.start") __noinline
#define __init             __section(".init.start") __noinline

#endif /* APOS_COMPILER_ATTRIBUTES_H */