1 // First check compiling and printing of this file.
3 // RUN: %clang_cc1 -verify -ast-print %s > %t.c
4 // RUN: FileCheck --check-prefixes=CHECK,PRINT %s --input-file %t.c
6 // Now check compiling and printing of the printed file.
8 // RUN: echo "// expected""-warning@* 6 {{'T' is deprecated}}" >> %t.c
9 // RUN: echo "// expected""-note@* 6 {{'T' has been explicitly marked deprecated here}}" >> %t.c
11 // RUN: %clang_cc1 -verify -ast-print -Wno-strict-prototypes %t.c \
12 // RUN: | FileCheck --check-prefixes=CHECK,PRINT %s
16 // CHECK-LABEL: defFirst
19 // PRINT-DAG: __attribute__((aligned(16)))
20 // PRINT-DAG: __attribute__((deprecated("")))
25 // expected-warning@+2 {{'T' is deprecated}}
26 // expected-note@+1 2 {{'T' has been explicitly marked deprecated here}}
27 enum __attribute__((aligned(16))) __attribute__((deprecated(""))) T
{
31 // PRINT-NEXT: enum T *p1;
32 enum T
*p1
; // expected-warning {{'T' is deprecated}}
35 // CHECK-LABEL: defLast
37 // PRINT-NEXT: enum __attribute__((aligned(16))) T *p0;
38 enum __attribute__((aligned(16))) T
*p0
;
40 // PRINT-NEXT: enum __attribute__((deprecated(""))) T {
44 // expected-warning@+2 {{'T' is deprecated}}
45 // expected-note@+1 {{'T' has been explicitly marked deprecated here}}
46 enum __attribute__((deprecated(""))) T
{ E0
, E1
} *p1
;
49 // CHECK-LABEL: defMiddle
50 void defMiddle(void) {
51 // PRINT-NEXT: enum __attribute__((deprecated(""))) T *p0;
52 // expected-warning@+2 {{'T' is deprecated}}
53 // expected-note@+1 3 {{'T' has been explicitly marked deprecated here}}
54 enum __attribute__((deprecated(""))) T
*p0
;
56 // PRINT-NEXT: enum __attribute__((aligned(16))) T {
60 enum __attribute__((aligned(16))) T
{ E0
, E1
} *p1
; // expected-warning {{'T' is deprecated}}
62 // PRINT-NEXT: enum T *p2;
63 enum T
*p2
; // expected-warning {{'T' is deprecated}}
66 // CHECK-LABEL: declsOnly
67 void declsOnly(void) {
68 // FIXME: For some reason, attributes are ignored if they're not on the first
69 // declaration and not on the definition.
71 // PRINT-NEXT: enum __attribute__((aligned)) T *p0;
72 enum __attribute__((aligned
)) T
*p0
;
74 // PRINT-NEXT: enum T *p1;
75 enum __attribute__((may_alias
)) T
*p1
;
77 // PRINT-NEXT: enum T *p2;
80 // PRINT-NEXT: enum T *p3;
81 enum __attribute__((deprecated(""))) T
*p3
;
83 // PRINT-NEXT: enum T *p4;
87 // Check that tag decl groups stay together in decl contexts.
89 // PRINT-LABEL: enum DeclGroupAtFileScope {
90 // PRINT-NEXT: DeclGroupAtFileScope0
91 // PRINT-NEXT: } *DeclGroupAtFileScopePtr;
92 enum DeclGroupAtFileScope
{ DeclGroupAtFileScope0
} *DeclGroupAtFileScopePtr
;
94 // PRINT-LABEL: struct DeclGroupInMemberList
95 struct DeclGroupInMemberList
{
96 // PRINT-NEXT: enum T1 {
100 // PRINT-NEXT: enum T2 {
102 // PRINT-NEXT: } *p1, *p2;
103 enum T2
{ T20
} *p1
, *p2
;
107 enum fixedEnum
: int { fixedEnumerator
};
108 // PRINT-LABEL: enum fixedEnum : int {
109 // PRINT-NEXT: fixedEnumerator