]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/cgo/internal/testgodefs/testdata/bitfields.go
misc/cgo: move easy tests to cmd/cgo/internal
[gostls13.git] / src / cmd / cgo / internal / testgodefs / testdata / bitfields.go
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build ignore
6
7 package main
8
9 // This file tests that we don't generate an incorrect field location
10 // for a bitfield that appears aligned.
11
12 /*
13 struct bitfields {
14     unsigned int B1     :  5;
15     unsigned int B2     :  1;
16     unsigned int B3     :  1;
17     unsigned int B4     :  1;
18     unsigned int Short1 : 16; // misaligned on 8 bit boundary
19     unsigned int B5     :  1;
20     unsigned int B6     :  1;
21     unsigned int B7     :  1;
22     unsigned int B8     :  1;
23     unsigned int B9     :  1;
24     unsigned int B10    :  3;
25     unsigned int Short2 : 16; // alignment is OK
26     unsigned int Short3 : 16; // alignment is OK
27 };
28 */
29 import "C"
30
31 type bitfields C.struct_bitfields