2013-01-29 09:24:26 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s
|
2013-02-01 09:19:17 +08:00
|
|
|
//
|
|
|
|
// CHECK: int x __attribute__((aligned(4)));
|
2013-01-25 00:46:58 +08:00
|
|
|
int x __attribute__((aligned(4)));
|
|
|
|
|
2013-01-29 09:24:26 +08:00
|
|
|
// FIXME: Print this at a valid location for a __declspec attr.
|
2013-02-01 09:19:17 +08:00
|
|
|
// CHECK: int y __declspec(align(4));
|
2013-01-29 09:24:26 +08:00
|
|
|
__declspec(align(4)) int y;
|
2013-01-25 00:46:58 +08:00
|
|
|
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: int z {{\[}}[gnu::aligned(4)]];
|
2013-01-25 00:46:58 +08:00
|
|
|
int z [[gnu::aligned(4)]];
|
|
|
|
|
|
|
|
// CHECK: __attribute__((deprecated("warning")));
|
|
|
|
int a __attribute__((deprecated("warning")));
|
|
|
|
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: int b {{\[}}[gnu::deprecated("warning")]];
|
2013-01-25 00:46:58 +08:00
|
|
|
int b [[gnu::deprecated("warning")]];
|
|
|
|
|
2013-02-01 09:19:17 +08:00
|
|
|
// CHECK: int cxx11_alignas alignas(4);
|
2013-01-29 09:48:07 +08:00
|
|
|
alignas(4) int cxx11_alignas;
|
|
|
|
|
2013-02-01 09:19:17 +08:00
|
|
|
// CHECK: int c11_alignas _Alignas(alignof(int));
|
2013-01-29 09:48:07 +08:00
|
|
|
_Alignas(int) int c11_alignas;
|
|
|
|
|
2013-01-25 00:46:58 +08:00
|
|
|
// CHECK: void foo() __attribute__((const));
|
|
|
|
void foo() __attribute__((const));
|
|
|
|
|
|
|
|
// CHECK: void bar() __attribute__((__const));
|
|
|
|
void bar() __attribute__((__const));
|
|
|
|
|
|
|
|
// CHECK: int f1() __attribute__((warn_unused_result));
|
|
|
|
int f1() __attribute__((warn_unused_result));
|
|
|
|
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: {{\[}}[clang::warn_unused_result]];
|
2013-01-25 00:46:58 +08:00
|
|
|
int f2 [[clang::warn_unused_result]] ();
|
|
|
|
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: {{\[}}[gnu::warn_unused_result]];
|
2013-01-25 00:46:58 +08:00
|
|
|
int f3 [[gnu::warn_unused_result]] ();
|
|
|
|
|
|
|
|
// FIXME: ast-print need to print C++11
|
|
|
|
// attribute after function declare-id.
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: {{\[}}[noreturn]];
|
2013-01-25 00:46:58 +08:00
|
|
|
void f4 [[noreturn]] ();
|
|
|
|
|
|
|
|
// CHECK: __attribute__((gnu_inline));
|
|
|
|
inline void f6() __attribute__((gnu_inline));
|
|
|
|
|
2013-02-26 10:00:13 +08:00
|
|
|
// CHECK: {{\[}}[gnu::gnu_inline]];
|
2013-01-25 00:46:58 +08:00
|
|
|
inline void f7 [[gnu::gnu_inline]] ();
|
|
|
|
|
|
|
|
// arguments printing
|
2013-09-04 05:02:22 +08:00
|
|
|
// CHECK: __attribute__((format(printf, 2, 3)));
|
2013-01-25 00:46:58 +08:00
|
|
|
void f8 (void *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
|
2013-01-29 12:21:28 +08:00
|
|
|
|
|
|
|
// CHECK: int m __attribute__((aligned(4
|
|
|
|
// CHECK: int n alignas(4
|
|
|
|
// CHECK: static int f() __attribute__((pure))
|
|
|
|
// CHECK: static int g() {{\[}}[gnu::pure]]
|
|
|
|
template <typename T> struct S {
|
|
|
|
__attribute__((aligned(4))) int m;
|
|
|
|
alignas(4) int n;
|
|
|
|
__attribute__((pure)) static int f() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
[[gnu::pure]] static int g() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: int m __attribute__((aligned(4
|
|
|
|
// CHECK: int n alignas(4
|
|
|
|
// CHECK: static int f() __attribute__((pure))
|
|
|
|
// CHECK: static int g() {{\[}}[gnu::pure]]
|
|
|
|
template struct S<int>;
|
2013-06-20 20:46:19 +08:00
|
|
|
|
|
|
|
// CHECK: using Small2 {{\[}}[gnu::mode(byte)]] = int;
|
|
|
|
using Small2 [[gnu::mode(byte)]] = int;
|