File tree Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %clang_cl -Wpadded -Wno-msvc-not-found -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
2+ // RUN: %clang -Wpadded -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
3+
4+ struct __attribute__ ((ms_struct)) AlignedStruct {
5+ char c;
6+ alignas (8 ) int i;
7+ };
8+
9+ int main () {AlignedStruct s;}
10+
11+ // WARN: warning: padding struct 'AlignedStruct' with 7 bytes to align 'i'
12+ // WARN: warning: padding size of 'AlignedStruct' with 4 bytes to alignment boundary
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cl -Wpadded -Wno-msvc-not-found -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
2+
3+ struct __attribute__ ((ms_struct)) BitfieldStruct {
4+ char c : 1 ;
5+ int : 0 ;
6+ char i;
7+ };
8+
9+ int main () {BitfieldStruct s;}
10+
11+ // WARN: warning: padding struct 'BitfieldStruct' with 31 bits to align anonymous bit-field
12+ // WARN: warning: padding size of 'BitfieldStruct' with 3 bytes to alignment boundary
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cl -Wpadded -Wno-msvc-not-found -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
2+ // RUN: %clang -Wpadded -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
3+
4+ struct Base {
5+ int b;
6+ };
7+
8+ struct Derived : public Base {
9+ char c;
10+ };
11+
12+ int main () {Derived d;}
13+ // WARN: warning: padding size of 'Derived' with 3 bytes to alignment boundary
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cl -Wpadded -Wno-msvc-not-found -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
2+ // RUN: %clang -Wpadded -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
3+
4+ union __attribute__ ((ms_struct)) Union {
5+ char c;
6+ long long u;
7+ };
8+
9+ struct __attribute__ ((ms_struct)) StructWithUnion {
10+ char c;
11+ int : 0 ;
12+ Union t;
13+ short i;
14+ };
15+
16+ int main () { StructWithUnion s; }
17+
18+ // WARN: warning: padding struct 'StructWithUnion' with 7 bytes to align 't'
19+ // WARN: warning: padding size of 'StructWithUnion' with 6 bytes to alignment boundary
Original file line number Diff line number Diff line change 11// RUN: %clang_cl -Wpadded -Wno-msvc-not-found -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
2+ // RUN: %clang -Wpadded -fsyntax-only -- %s 2>&1 | FileCheck -check-prefix=WARN %s
23
3- struct Foo {
4+ struct __attribute__ ((ms_struct)) Foo {
45 int b : 1 ;
56 char a;
67};
You can’t perform that action at this time.
0 commit comments