xref: /aosp_15_r20/external/clang/test/Preprocessor/has_attribute.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple arm-unknown-linux -verify -E %s -o - | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // CHECK: always_inline
4*67e74705SXin Li #if __has_attribute(always_inline)
5*67e74705SXin Li int always_inline();
6*67e74705SXin Li #endif
7*67e74705SXin Li 
8*67e74705SXin Li // CHECK: __always_inline__
9*67e74705SXin Li #if __has_attribute(__always_inline__)
10*67e74705SXin Li int __always_inline__();
11*67e74705SXin Li #endif
12*67e74705SXin Li 
13*67e74705SXin Li // CHECK: no_dummy_attribute
14*67e74705SXin Li #if !__has_attribute(dummy_attribute)
15*67e74705SXin Li int no_dummy_attribute();
16*67e74705SXin Li #endif
17*67e74705SXin Li 
18*67e74705SXin Li // CHECK: has_has_attribute
19*67e74705SXin Li #ifdef __has_attribute
20*67e74705SXin Li int has_has_attribute();
21*67e74705SXin Li #endif
22*67e74705SXin Li 
23*67e74705SXin Li // CHECK: has_something_we_dont_have
24*67e74705SXin Li #if !__has_attribute(something_we_dont_have)
25*67e74705SXin Li int has_something_we_dont_have();
26*67e74705SXin Li #endif
27*67e74705SXin Li 
28*67e74705SXin Li // rdar://10253857
29*67e74705SXin Li #if __has_attribute(__const)
30*67e74705SXin Li  int fn3() __attribute__ ((__const));
31*67e74705SXin Li #endif
32*67e74705SXin Li 
33*67e74705SXin Li #if __has_attribute(const)
34*67e74705SXin Li  static int constFunction() __attribute__((const));
35*67e74705SXin Li #endif
36*67e74705SXin Li 
37*67e74705SXin Li // CHECK: has_no_volatile_attribute
38*67e74705SXin Li #if !__has_attribute(volatile)
39*67e74705SXin Li int has_no_volatile_attribute();
40*67e74705SXin Li #endif
41*67e74705SXin Li 
42*67e74705SXin Li // CHECK: has_arm_interrupt
43*67e74705SXin Li #if __has_attribute(interrupt)
44*67e74705SXin Li   int has_arm_interrupt();
45*67e74705SXin Li #endif
46*67e74705SXin Li 
47*67e74705SXin Li // CHECK: does_not_have_dllexport
48*67e74705SXin Li #if !__has_attribute(dllexport)
49*67e74705SXin Li   int does_not_have_dllexport();
50*67e74705SXin Li #endif
51*67e74705SXin Li 
52*67e74705SXin Li // CHECK: does_not_have_uuid
53*67e74705SXin Li #if !__has_attribute(uuid)
54*67e74705SXin Li   int does_not_have_uuid
55*67e74705SXin Li #endif
56*67e74705SXin Li 
57*67e74705SXin Li #if __has_cpp_attribute(selectany) // expected-error {{function-like macro '__has_cpp_attribute' is not defined}}
58*67e74705SXin Li #endif
59