1 // RUN: %clang_cc1 -triple i386-unknown-unknown -fms-compatibility -std=c++11 -E %s -o - | FileCheck %s 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 unless it is for gnu. 25 // CHECK: does_not_have___clang___fallthrough 26 #if !__has_cpp_attribute(__clang__::fallthrough) 27 int does_not_have___clang___fallthrough(); 28 #endif 29 // CHECK: has_gnu_const 30 #if __has_cpp_attribute(__gnu__::__const__) 31 int has_gnu_const(); 32 #endif 33 34 // Test that C++11, target-specific attributes behave properly. 35 36 // CHECK: does_not_have_mips16 37 #if !__has_cpp_attribute(gnu::mips16) 38 int does_not_have_mips16(); 39 #endif 40 41 // Test that the version numbers of attributes listed in SD-6 are supported 42 // correctly. 43 44 // CHECK: has_cxx11_carries_dep_vers 45 #if __has_cpp_attribute(carries_dependency) == 200809 46 int has_cxx11_carries_dep_vers(); 47 #endif 48 49 // CHECK: has_cxx11_noreturn_vers 50 #if __has_cpp_attribute(noreturn) == 200809 51 int has_cxx11_noreturn_vers(); 52 #endif 53 54 // CHECK: has_cxx14_deprecated_vers 55 #if __has_cpp_attribute(deprecated) == 201309 56 int has_cxx14_deprecated_vers(); 57 #endif 58 59 // CHECK: has_cxx1z_nodiscard 60 #if __has_cpp_attribute(nodiscard) == 201603 61 int has_cxx1z_nodiscard(); 62 #endif 63 64 // CHECK: has_cxx1z_fallthrough 65 #if __has_cpp_attribute(fallthrough) == 201603 66 int has_cxx1z_fallthrough(); 67 #endif 68 69 // CHECK: has_declspec_uuid 70 #if __has_declspec_attribute(uuid) 71 int has_declspec_uuid(); 72 #endif 73 74 // CHECK: has_declspec_uuid2 75 #if __has_declspec_attribute(__uuid__) 76 int has_declspec_uuid2(); 77 #endif 78 79 // CHECK: does_not_have_declspec_fallthrough 80 #if !__has_declspec_attribute(fallthrough) 81 int does_not_have_declspec_fallthrough(); 82 #endif 83