xref: /illumos-gate/usr/src/tools/smatch/src/validation/preprocessor/has-attribute.c (revision 440a8a36792bdf9ef51639066aab0b7771ffcab8)
1 #ifndef __has_attribute
2 __has_attribute()??? Quesako?
3 #define __has_attribute(x) 0
4 #else
5 "has __has_attribute(), yeah!"
6 #endif
7 
8 123 __has_attribute(nothinx) def
9 
10 #if __has_attribute(nothinx)
11 #error "not a attribute!"
12 #endif
13 
14 #if 1					\
15  && __has_attribute(packed)		\
16  && __has_attribute(aligned)		\
17  && __has_attribute(const)		\
18  && __has_attribute(pure)		\
19  && __has_attribute(noreturn)		\
20  && __has_attribute(designated_init)	\
21  && __has_attribute(transparent_union)	\
22 
23 "ok gcc"
24 #endif
25 
26 #if 1					\
27  && __has_attribute(fastcall)		\
28 
29 "ok gcc ignore"
30 #endif
31 
32 #if 1					\
33  && __has_attribute(nocast)		\
34  && __has_attribute(noderef)		\
35  && __has_attribute(safe)		\
36  && __has_attribute(force)		\
37  && __has_attribute(bitwise)		\
38  && __has_attribute(address_space)	\
39  && __has_attribute(context)		\
40 
41 "ok sparse specific"
42 #endif
43 
44 /*
45  * check-name: has-attribute
46  * check-command: sparse -E $file
47  *
48  * check-output-start
49 
50 "has __has_attribute(), yeah!"
51 123 0 def
52 "ok gcc"
53 "ok gcc ignore"
54 "ok sparse specific"
55  * check-output-end
56  */
57