1 // RUN: %clang_cc1 -triple=x86_64-none-none -Wpadded -Wpacked -verify %s -emit-llvm-only
5 short s
; // expected-warning {{padding struct 'S1' with 1 byte to align 's'}}
6 long l
; // expected-warning {{padding struct 'S1' with 4 bytes to align 'l'}}
9 struct S2
{ // expected-warning {{padding size of 'S2' with 3 bytes to alignment boundary}}
17 } __attribute__((packed
));
20 int i
; // expected-warning {{packed attribute is unnecessary for 'i'}}
22 } __attribute__((packed
));
29 } u
; // expected-warning {{padding struct 'S5' with 3 bytes to align 'u'}}
32 struct S6
{ // expected-warning {{padding size of 'S6' with 30 bits to alignment boundary}}
36 struct S7
{ // expected-warning {{padding size of 'S7' with 7 bytes to alignment boundary}}
46 int i
; // expected-warning {{padding struct 'S8' with 3 bytes to align 'i'}}
49 struct S9
{ // expected-warning {{packed attribute is unnecessary for 'S9'}}
50 int x
; // expected-warning {{packed attribute is unnecessary for 'x'}}
51 int y
; // expected-warning {{packed attribute is unnecessary for 'y'}}
52 } __attribute__((packed
));
54 struct S10
{ // expected-warning {{packed attribute is unnecessary for 'S10'}}
55 int x
; // expected-warning {{packed attribute is unnecessary for 'x'}}
57 } __attribute__((packed
));
63 } __attribute__((packed
));
67 char c
; // expected-warning {{padding struct 'S12' with 7 bits to align 'c'}}
70 struct S13
{ // expected-warning {{padding size of 'S13' with 6 bits to alignment boundary}}
72 bool b
: 10; // expected-warning {{size of bit-field 'b' (10 bits) exceeds the size of its type}}
75 // The warnings are emitted when the layout of the structs is computed, so we have to use them.
76 void f(S1
*, S2
*, S3
*, S4
*, S5
*, S6
*, S7
*, S8
*, S9
*, S10
*, S11
*, S12
*, S13
*) { }