summaryrefslogtreecommitdiffstats
path: root/config.h.in
blob: 59956d47701b1f655bce87b3ee311e5ae9dec93b (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef PTXMC_CONFIG_H_INCLUDED
#define PTXMC_CONFIG_H_INCLUDED

#mesondefine HAS_ATTR_WUR
#mesondefine HAS_ATTR_ALWAYS_INLINE
#mesondefine HAS_ATTR_MALLOC
#mesondefine HAS_ATTR_FORMAT
#mesondefine HAS_RESTRICT

#ifdef HAS_ATTR_WUR
#define ATTR_WUR __attribute__((warn_unused_result))
#else
#define ATTR_WUR
#endif

#ifdef HAS_ATTR_ALWAYS_INLINE
#define ATTR_ALWAYS_INLINE __attribute__((always_inline))
#else
#define ATTR_ALWAYS_INLINE
#endif

#ifdef HAS_ATTR_MALLOC
#define ATTR_MALLOC(_x)
#else
#define ATTR_MALLOC(_x) __attribute__((malloc _x)) 
#endif

#ifdef HAS_ATTR_FORMAT
#define ATTR_FORMAT(_x) __attribute__((format _x))
#else
#define ATTR_FORMAT(_x)
#endif

#ifdef HAS_RESTRICT
#define PTX_RESTRICT restrict
#else
#define PTX_RESTRICT
#endif

/* meson doesn't support this one yet :( */
#ifdef __has_attribute
# if __has_attribute(access)
#  define ATTR_ACCESS(_x) __attribute__((access _x))
# else
#  define ATTR_ACCESS(_x)
# endif
#else
#define ATTR_ACCESS(_x)
#endif

#endif /* include guard */