brintos

brintos / llvm-project-archived public Read only

0
0
Text · 900 B · f9882d0 Raw
42 lines · cpp
1// RUN: %clang_cc1 -triple=x86_64-none-none -Wpadded-bitfield -verify=expected %s -emit-llvm-only2 3struct S1 {4  unsigned a : 1;5  unsigned long long : 0; // expected-warning {{padding struct 'S1' with 63 bits to align anonymous bit-field}}6};7 8struct S2 {9  unsigned a : 1;10  unsigned long long b : 64; // expected-warning {{padding struct 'S2' with 63 bits to align 'b'}}11};12 13struct S3 {14  char a : 1;15  short b : 16; // expected-warning {{padding struct 'S3' with 15 bits to align 'b'}}16};17 18struct [[gnu::packed]] S4 {19  char a : 1;20  short b : 16;21};22 23struct S5 {24  unsigned a : 1;25  unsigned long long b : 63;26};27 28struct S6 {29  unsigned a : 1;30  unsigned long long b;31};32 33struct S7 {34  int word;35  struct {36    int filler __attribute__ ((aligned (8)));37  };38};39 40// The warnings are emitted when the layout of the structs is computed, so we have to use them.41void f(S1, S2, S3, S4, S5, S6, S7){}42