1 // RUN: %clang_cc1 %s -ast-print -verify > %t.c
2 // RUN: FileCheck %s --input-file %t.c
4 // RUN: echo >> %t.c "// expected""-warning@* {{use of GNU old-style field designator extension}}"
5 // RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes' is deprecated}}"
6 // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes' has been explicitly marked deprecated here}}"
7 // RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes2' is deprecated}}"
8 // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes2' has been explicitly marked deprecated here}}"
9 // RUN: echo >> %t.c "// expected""-warning@* {{'EnumWithAttributes3' is deprecated}}"
10 // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes3' has been explicitly marked deprecated here}}"
11 // RUN: %clang_cc1 -fsyntax-only %t.c -verify
13 typedef void func_typedef(void);
16 typedef void func_t(int x
);
27 // This used to crash clang.
31 int foo(const struct blah
*b
) {
32 // CHECK: return b->b;
36 int arr(int a
[static 3]) {
37 // CHECK: int a[static 3]
41 int rarr(int a
[restrict
static 3]) {
42 // CHECK: int a[restrict static 3]
46 int varr(int n
, int a
[static n
]) {
47 // CHECK: int a[static n]
51 int rvarr(int n
, int a
[restrict
static n
]) {
52 // CHECK: int a[restrict static n]
56 // CHECK: typedef struct {
59 } T
__attribute__ ((__aligned__
));
61 // CHECK: struct __attribute__((visibility("default"))) S;
62 struct __attribute__((visibility("default"))) S
;
69 // CHECK: struct pair_t p = {a: 3, .b = 4};
70 struct pair_t p
= {a
: 3, .b
= 4}; // expected-warning {{use of GNU old-style field designator extension}}
72 void initializers(void) {
73 // CHECK: int *x = ((void *)0), *y = ((void *)0);
74 int *x
= ((void *)0), *y
= ((void *)0);
78 // CHECK: } z = {(struct Z){}};
82 // CHECK-LABEL: enum __attribute__((deprecated(""))) EnumWithAttributes {
83 enum EnumWithAttributes
{ // expected-warning {{'EnumWithAttributes' is deprecated}}
84 // CHECK-NEXT: EnumWithAttributesFoo __attribute__((deprecated(""))),
85 EnumWithAttributesFoo
__attribute__((deprecated
)),
86 // CHECK-NEXT: EnumWithAttributesBar __attribute__((unavailable(""))) = 50
87 EnumWithAttributesBar
__attribute__((unavailable
)) = 50
88 // CHECK-NEXT: } *EnumWithAttributesPtr;
89 } __attribute__((deprecated
)) *EnumWithAttributesPtr
; // expected-note {{'EnumWithAttributes' has been explicitly marked deprecated here}}
91 // CHECK-LABEL: enum __attribute__((deprecated(""))) EnumWithAttributes2 *EnumWithAttributes2Ptr;
92 // expected-warning@+2 {{'EnumWithAttributes2' is deprecated}}
93 // expected-note@+1 {{'EnumWithAttributes2' has been explicitly marked deprecated here}}
94 enum __attribute__((deprecated
)) EnumWithAttributes2
*EnumWithAttributes2Ptr
;
96 // CHECK-LABEL: EnumWithAttributes3Fn
97 void EnumWithAttributes3Fn(void) {
98 // CHECK-NEXT: enum __attribute__((deprecated(""))) EnumWithAttributes3 *EnumWithAttributes3Ptr;
99 // expected-warning@+2 {{'EnumWithAttributes3' is deprecated}}
100 // expected-note@+1 {{'EnumWithAttributes3' has been explicitly marked deprecated here}}
101 enum __attribute__((deprecated
)) EnumWithAttributes3
*EnumWithAttributes3Ptr
;
102 // Printing must not put the attribute after the tag where it would apply to
103 // the variable instead of the type, and then our deprecation warning would
104 // move to this use of the variable.
105 void *p
= EnumWithAttributes3Ptr
;