xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/has_attribute.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm-unknown-linux -E %s -o - | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // CHECK: always_inline
4f4a2713aSLionel Sambuc #if __has_attribute(always_inline)
5f4a2713aSLionel Sambuc int always_inline();
6f4a2713aSLionel Sambuc #endif
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc // CHECK: __always_inline__
9f4a2713aSLionel Sambuc #if __has_attribute(__always_inline__)
10f4a2713aSLionel Sambuc int __always_inline__();
11f4a2713aSLionel Sambuc #endif
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc // CHECK: no_dummy_attribute
14f4a2713aSLionel Sambuc #if !__has_attribute(dummy_attribute)
15f4a2713aSLionel Sambuc int no_dummy_attribute();
16f4a2713aSLionel Sambuc #endif
17f4a2713aSLionel Sambuc 
18f4a2713aSLionel Sambuc // CHECK: has_has_attribute
19f4a2713aSLionel Sambuc #ifdef __has_attribute
20f4a2713aSLionel Sambuc int has_has_attribute();
21f4a2713aSLionel Sambuc #endif
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc // CHECK: has_something_we_dont_have
24f4a2713aSLionel Sambuc #if !__has_attribute(something_we_dont_have)
25f4a2713aSLionel Sambuc int has_something_we_dont_have();
26f4a2713aSLionel Sambuc #endif
27f4a2713aSLionel Sambuc 
28f4a2713aSLionel Sambuc // rdar://10253857
29f4a2713aSLionel Sambuc #if __has_attribute(__const)
30f4a2713aSLionel Sambuc  int fn3() __attribute__ ((__const));
31f4a2713aSLionel Sambuc #endif
32f4a2713aSLionel Sambuc 
33f4a2713aSLionel Sambuc #if __has_attribute(const)
34f4a2713aSLionel Sambuc  static int constFunction() __attribute__((const));
35f4a2713aSLionel Sambuc #endif
36f4a2713aSLionel Sambuc 
37f4a2713aSLionel Sambuc // CHECK: has_no_volatile_attribute
38f4a2713aSLionel Sambuc #if !__has_attribute(volatile)
39f4a2713aSLionel Sambuc int has_no_volatile_attribute();
40f4a2713aSLionel Sambuc #endif
41*0a6a1f1dSLionel Sambuc 
42*0a6a1f1dSLionel Sambuc // CHECK: has_arm_interrupt
43*0a6a1f1dSLionel Sambuc #if __has_attribute(interrupt)
44*0a6a1f1dSLionel Sambuc   int has_arm_interrupt();
45*0a6a1f1dSLionel Sambuc #endif
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc // CHECK: does_not_have_dllexport
48*0a6a1f1dSLionel Sambuc #if !__has_attribute(dllexport)
49*0a6a1f1dSLionel Sambuc   int does_not_have_dllexport();
50*0a6a1f1dSLionel Sambuc #endif
51*0a6a1f1dSLionel Sambuc 
52*0a6a1f1dSLionel Sambuc // CHECK: does_not_have_uuid
53*0a6a1f1dSLionel Sambuc #if !__has_attribute(uuid)
54*0a6a1f1dSLionel Sambuc   int does_not_have_uuid
55*0a6a1f1dSLionel Sambuc #endif
56