aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor/has-attribute.c
blob: 3149cbfa6338ce730c03a80b9782786bf5c8bb96 (plain)
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
52
53
54
55
56
#ifndef __has_attribute
__has_attribute()??? Quesako?
#define __has_attribute(x) 0
#else
"has __has_attribute(), yeah!"
#endif

123 __has_attribute(nothinx) def

#if __has_attribute(nothinx)
#error "not a attribute!"
#endif

#if 1					\
 && __has_attribute(packed)		\
 && __has_attribute(aligned)		\
 && __has_attribute(const)		\
 && __has_attribute(pure)		\
 && __has_attribute(noreturn)		\
 && __has_attribute(designated_init)	\
 && __has_attribute(transparent_union)	\

"ok gcc"
#endif

#if 1					\
 && __has_attribute(fastcall)		\

"ok gcc ignore"
#endif

#if 1					\
 && __has_attribute(nocast)		\
 && __has_attribute(noderef)		\
 && __has_attribute(safe)		\
 && __has_attribute(force)		\
 && __has_attribute(bitwise)		\
 && __has_attribute(address_space)	\
 && __has_attribute(context)		\

"ok sparse specific"
#endif

/*
 * check-name: has-attribute
 * check-command: sparse -E $file
 *
 * check-output-start

"has __has_attribute(), yeah!"
123 0 def
"ok gcc"
"ok gcc ignore"
"ok sparse specific"
 * check-output-end
 */