Aaron Ballman | 416b127 | 2015-05-11 14:09:50 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple arm-unknown-linux -verify -E %s -o - | FileCheck %s |
Jean-Daniel Dupas | 7598fad | 2012-03-01 17:45:53 +0000 | [diff] [blame] | 2 | |
| 3 | // CHECK: always_inline |
| 4 | #if __has_attribute(always_inline) |
| 5 | int always_inline(); |
Jean-Daniel Dupas | 908f130 | 2012-03-01 14:53:16 +0000 | [diff] [blame] | 6 | #endif |
| 7 | |
Jean-Daniel Dupas | 7598fad | 2012-03-01 17:45:53 +0000 | [diff] [blame] | 8 | // CHECK: __always_inline__ |
| 9 | #if __has_attribute(__always_inline__) |
| 10 | int __always_inline__(); |
Jean-Daniel Dupas | 908f130 | 2012-03-01 14:53:16 +0000 | [diff] [blame] | 11 | #endif |
| 12 | |
Jean-Daniel Dupas | 7598fad | 2012-03-01 17:45:53 +0000 | [diff] [blame] | 13 | // CHECK: no_dummy_attribute |
| 14 | #if !__has_attribute(dummy_attribute) |
| 15 | int no_dummy_attribute(); |
| 16 | #endif |
| 17 | |
| 18 | // CHECK: has_has_attribute |
| 19 | #ifdef __has_attribute |
| 20 | int has_has_attribute(); |
| 21 | #endif |
| 22 | |
| 23 | // CHECK: has_something_we_dont_have |
| 24 | #if !__has_attribute(something_we_dont_have) |
| 25 | int has_something_we_dont_have(); |
Jean-Daniel Dupas | 908f130 | 2012-03-01 14:53:16 +0000 | [diff] [blame] | 26 | #endif |
Fariborz Jahanian | 7513fa3 | 2012-08-13 21:15:02 +0000 | [diff] [blame] | 27 | |
| 28 | // rdar://10253857 |
| 29 | #if __has_attribute(__const) |
| 30 | int fn3() __attribute__ ((__const)); |
| 31 | #endif |
| 32 | |
| 33 | #if __has_attribute(const) |
| 34 | static int constFunction() __attribute__((const)); |
| 35 | #endif |
| 36 | |
Richard Smith | baf2912 | 2013-07-09 00:57:56 +0000 | [diff] [blame] | 37 | // CHECK: has_no_volatile_attribute |
| 38 | #if !__has_attribute(volatile) |
| 39 | int has_no_volatile_attribute(); |
| 40 | #endif |
Aaron Ballman | 0fa06d8 | 2014-01-09 22:57:44 +0000 | [diff] [blame] | 41 | |
| 42 | // CHECK: has_arm_interrupt |
| 43 | #if __has_attribute(interrupt) |
| 44 | int has_arm_interrupt(); |
| 45 | #endif |
| 46 | |
| 47 | // CHECK: does_not_have_dllexport |
| 48 | #if !__has_attribute(dllexport) |
| 49 | int does_not_have_dllexport(); |
| 50 | #endif |
Aaron Ballman | a6f759e | 2014-12-05 15:24:55 +0000 | [diff] [blame] | 51 | |
| 52 | // CHECK: does_not_have_uuid |
| 53 | #if !__has_attribute(uuid) |
| 54 | int does_not_have_uuid |
| 55 | #endif |
Aaron Ballman | 416b127 | 2015-05-11 14:09:50 +0000 | [diff] [blame] | 56 | |
Richard Smith | 4d247e7 | 2016-04-16 00:07:09 +0000 | [diff] [blame] | 57 | #if __has_cpp_attribute(selectany) // expected-error {{function-like macro '__has_cpp_attribute' is not defined}} |
Aaron Ballman | 416b127 | 2015-05-11 14:09:50 +0000 | [diff] [blame] | 58 | #endif |