Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-unknown-unknown -fms-compatibility -std=c++11 -E %s -o - | FileCheck %s |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 2 | |
| 3 | // CHECK: has_cxx11_carries_dep |
| 4 | #if __has_cpp_attribute(carries_dependency) |
| 5 | int has_cxx11_carries_dep(); |
| 6 | #endif |
| 7 | |
| 8 | // CHECK: has_clang_fallthrough_1 |
| 9 | #if __has_cpp_attribute(clang::fallthrough) |
| 10 | int has_clang_fallthrough_1(); |
| 11 | #endif |
| 12 | |
| 13 | // CHECK: does_not_have_selectany |
| 14 | #if !__has_cpp_attribute(selectany) |
| 15 | int does_not_have_selectany(); |
| 16 | #endif |
| 17 | |
| 18 | // The attribute name can be bracketed with double underscores. |
| 19 | // CHECK: has_clang_fallthrough_2 |
| 20 | #if __has_cpp_attribute(clang::__fallthrough__) |
| 21 | int has_clang_fallthrough_2(); |
| 22 | #endif |
| 23 | |
| 24 | // The scope cannot be bracketed with double underscores. |
| 25 | // CHECK: does_not_have___clang___fallthrough |
| 26 | #if !__has_cpp_attribute(__clang__::fallthrough) |
| 27 | int does_not_have___clang___fallthrough(); |
| 28 | #endif |
| 29 | |
| 30 | // Test that C++11, target-specific attributes behave properly. |
| 31 | |
| 32 | // CHECK: does_not_have_mips16 |
| 33 | #if !__has_cpp_attribute(gnu::mips16) |
| 34 | int does_not_have_mips16(); |
| 35 | #endif |
| 36 | |
| 37 | // Test that the version numbers of attributes listed in SD-6 are supported |
| 38 | // correctly. |
| 39 | |
| 40 | // CHECK: has_cxx11_carries_dep_vers |
| 41 | #if __has_cpp_attribute(carries_dependency) == 200809 |
| 42 | int has_cxx11_carries_dep_vers(); |
| 43 | #endif |
| 44 | |
| 45 | // CHECK: has_cxx11_noreturn_vers |
| 46 | #if __has_cpp_attribute(noreturn) == 200809 |
| 47 | int has_cxx11_noreturn_vers(); |
| 48 | #endif |
| 49 | |
| 50 | // CHECK: has_cxx14_deprecated_vers |
| 51 | #if __has_cpp_attribute(deprecated) == 201309 |
| 52 | int has_cxx14_deprecated_vers(); |
| 53 | #endif |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 54 | |
| 55 | // CHECK: has_declspec_uuid |
| 56 | #if __has_declspec_attribute(uuid) |
| 57 | int has_declspec_uuid(); |
| 58 | #endif |
| 59 | |
| 60 | // CHECK: has_declspec_uuid2 |
| 61 | #if __has_declspec_attribute(__uuid__) |
| 62 | int has_declspec_uuid2(); |
| 63 | #endif |
| 64 | |
| 65 | // CHECK: does_not_have_declspec_fallthrough |
| 66 | #if !__has_declspec_attribute(fallthrough) |
| 67 | int does_not_have_declspec_fallthrough(); |
| 68 | #endif |