1 // RUN: %clang_cc1 -triple i386-unknown-unknown -fms-compatibility -std=c++11 -E -P %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM --implicit-check-not=:
2 // RUN: %clang_cc1 -triple i386-windows -fms-compatibility -std=c++11 -E -P %s -o - | FileCheck %s --check-prefixes=CHECK,WINDOWS --implicit-check-not=:
3 
4 #define CXX11(x) x: __has_cpp_attribute(x)
5 
6 // CHECK: clang::fallthrough: 201603L
7 CXX11(clang::fallthrough)
8 
9 // CHECK: selectany: 0
10 CXX11(selectany)
11 
12 // The attribute name can be bracketed with double underscores.
13 // CHECK: clang::__fallthrough__: 201603L
14 CXX11(clang::__fallthrough__)
15 
16 // The scope cannot be bracketed with double underscores unless it is
17 // for gnu or clang.
18 // CHECK: __gsl__::suppress: 0
19 CXX11(__gsl__::suppress)
20 
21 // We do somewhat support the __clang__ vendor namespace, but it is a
22 // predefined macro and thus we encourage users to use _Clang instead.
23 // Because of this, we do not support __has_cpp_attribute for that
24 // vendor namespace.
25 //
26 // Note, we can't use CXX11 here because it will expand __clang__ to 1
27 // too early.
28 // CHECK: 1::fallthrough: 0
29 __clang__::fallthrough: __has_cpp_attribute(__clang__::fallthrough)
30 
31 // CHECK: _Clang::fallthrough: 201603L
32 CXX11(_Clang::fallthrough)
33 
34 // CHECK: __nodiscard__: 201907L
35 CXX11(__nodiscard__)
36 
37 // CHECK: __gnu__::__const__: 1
38 CXX11(__gnu__::__const__)
39 
40 // Test that C++11, target-specific attributes behave properly.
41 
42 // CHECK: gnu::mips16: 0
43 CXX11(gnu::mips16)
44 
45 // Test for standard attributes as listed in C++2a [cpp.cond] paragraph 6.
46 
47 CXX11(assert)
48 CXX11(carries_dependency)
49 CXX11(deprecated)
50 CXX11(ensures)
51 CXX11(expects)
52 CXX11(fallthrough)
53 CXX11(likely)
54 CXX11(maybe_unused)
55 CXX11(no_unique_address)
56 CXX11(nodiscard)
57 CXX11(noreturn)
58 CXX11(unlikely)
59 // FIXME(201806L) CHECK: assert: 0
60 // CHECK: carries_dependency: 200809L
61 // CHECK: deprecated: 201309L
62 // FIXME(201806L) CHECK: ensures: 0
63 // FIXME(201806L) CHECK: expects: 0
64 // CHECK: fallthrough: 201603L
65 // CHECK: likely: 201803L
66 // CHECK: maybe_unused: 201603L
67 // ITANIUM: no_unique_address: 201803L
68 // WINDOWS: no_unique_address: 0
69 // CHECK: nodiscard: 201907L
70 // CHECK: noreturn: 200809L
71 // CHECK: unlikely: 201803L
72 
73 // Test for Microsoft __declspec attributes
74 
75 #define DECLSPEC(x) x: __has_declspec_attribute(x)
76 
77 // CHECK: uuid: 1
78 // CHECK: __uuid__: 1
79 DECLSPEC(uuid)
80 DECLSPEC(__uuid__)
81 
82 // CHECK: fallthrough: 0
83 DECLSPEC(fallthrough)
84