1 // RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s
2 //
3 // CHECK: int x __attribute__((aligned(4)));
4 int x __attribute__((aligned(4)));
5 
6 // FIXME: Print this at a valid location for a __declspec attr.
7 // CHECK: int y __declspec(align(4));
8 __declspec(align(4)) int y;
9 
10 // CHECK: int z {{\[}}[gnu::aligned(4)]];
11 int z [[gnu::aligned(4)]];
12 
13 // CHECK: __attribute__((deprecated("warning")));
14 int a __attribute__((deprecated("warning")));
15 
16 // CHECK: int b {{\[}}[gnu::deprecated("warning")]];
17 int b [[gnu::deprecated("warning")]];
18 
19 // CHECK: __declspec(deprecated("warning"))
20 __declspec(deprecated("warning")) int c;
21 
22 // CHECK: int d {{\[}}[deprecated("warning")]];
23 int d [[deprecated("warning")]];
24 
25 // CHECK: __attribute__((deprecated("warning", "fixit")));
26 int e __attribute__((deprecated("warning", "fixit")));
27 
28 // CHECK: int cxx11_alignas alignas(4);
29 alignas(4) int cxx11_alignas;
30 
31 // CHECK: int c11_alignas _Alignas(alignof(int));
32 _Alignas(int) int c11_alignas;
33 
34 // CHECK: void foo() __attribute__((const));
35 void foo() __attribute__((const));
36 
37 // CHECK: void bar() __attribute__((__const));
38 void bar() __attribute__((__const));
39 
40 // FIXME: It's unfortunate that the string literal prints with the below three
41 // cases given that the string is only exposed via the [[nodiscard]] spelling.
42 // CHECK: int f1() __attribute__((warn_unused_result("")));
43 int f1() __attribute__((warn_unused_result));
44 
45 // CHECK: {{\[}}[clang::warn_unused_result("")]];
46 int f2 [[clang::warn_unused_result]] ();
47 
48 // CHECK: {{\[}}[gnu::warn_unused_result("")]];
49 int f3 [[gnu::warn_unused_result]] ();
50 
51 // FIXME: ast-print need to print C++11
52 // attribute after function declare-id.
53 // CHECK: {{\[}}[noreturn]];
54 void f4 [[noreturn]] ();
55 
56 // CHECK: __attribute__((gnu_inline));
57 inline void f6() __attribute__((gnu_inline));
58 
59 // CHECK: {{\[}}[gnu::gnu_inline]];
60 inline void f7 [[gnu::gnu_inline]] ();
61 
62 // arguments printing
63 // CHECK: __attribute__((format(printf, 2, 3)));
64 void f8 (void *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
65 
66 // CHECK: int m __attribute__((aligned(4
67 // CHECK: int n alignas(4
68 // CHECK: static int f() __attribute__((pure))
69 // CHECK: static int g() {{\[}}[gnu::pure]]
70 template <typename T> struct S {
71   __attribute__((aligned(4))) int m;
72   alignas(4) int n;
fS73   __attribute__((pure)) static int f() {
74     return 0;
75   }
gS76   [[gnu::pure]] static int g() {
77     return 1;
78   }
79 };
80 
81 // CHECK: int m __attribute__((aligned(4
82 // CHECK: int n alignas(4
83 // CHECK: static int f() __attribute__((pure))
84 // CHECK: static int g() {{\[}}[gnu::pure]]
85 template struct S<int>;
86 
87 // CHECK: using Small2 {{\[}}[gnu::mode(byte)]] = int;
88 using Small2 [[gnu::mode(byte)]] = int;
89