blob: 81587831cb5770c2fc979b271960c3dff46a763b [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library test.conformance;
type PaddingBetweenFieldsInt8Int16 = struct {
a int8;
b int16;
};
type PaddingBetweenFieldsInt8Int32 = struct {
a int8;
b int32;
};
type PaddingBetweenFieldsInt8Int64 = struct {
a int8;
b int64;
};
type PaddingBetweenFieldsInt16Int32 = struct {
a int16;
b int32;
};
type PaddingBetweenFieldsInt16Int64 = struct {
a int16;
b int64;
};
type PaddingBetweenFieldsInt32Int64 = struct {
a int32;
b int64;
};
type Struct1Byte = struct {
a int8;
};
type Struct2Byte = struct {
a int16;
};
type Struct3Byte = struct {
a int16;
b int8;
};
type Struct4Byte = struct {
a int32;
};
type Struct5Byte = struct {
a int32;
b int8;
};
type Struct6Byte = struct {
a int32;
b int16;
};
type Struct7Byte = struct {
a int32;
b int16;
c int8;
};
type Struct8Byte = struct {
a int64;
};
type PaddingEndOfInlineObject1Byte = struct {
a Struct1Byte;
};
type PaddingEndOfInlineObject2Byte = struct {
a Struct2Byte;
};
type PaddingEndOfInlineObject3Byte = struct {
a Struct3Byte;
};
type PaddingEndOfInlineObject4Byte = struct {
a Struct4Byte;
};
type PaddingEndOfInlineObject5Byte = struct {
a Struct5Byte;
};
type PaddingEndOfInlineObject6Byte = struct {
a Struct6Byte;
};
type PaddingEndOfInlineObject7Byte = struct {
a Struct7Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject1Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct1Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject2Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct2Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject3Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct3Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject4Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct4Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject5Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct5Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject6Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct6Byte;
};
type PaddingEndOfInlineObjectBeforeNextObject7Byte = struct {
out_of_line box<Struct8Byte>;
in_line Struct7Byte;
};
type PaddingEndOfOutOfLineObject1Byte = struct {
out_of_line box<Struct1Byte>;
};
type PaddingEndOfOutOfLineObject2Byte = struct {
out_of_line box<Struct2Byte>;
};
type PaddingEndOfOutOfLineObject3Byte = struct {
out_of_line box<Struct3Byte>;
};
type PaddingEndOfOutOfLineObject4Byte = struct {
out_of_line box<Struct4Byte>;
};
type PaddingEndOfOutOfLineObject5Byte = struct {
out_of_line box<Struct5Byte>;
};
type PaddingEndOfOutOfLineObject6Byte = struct {
out_of_line box<Struct6Byte>;
};
type PaddingEndOfOutOfLineObject7Byte = struct {
out_of_line box<Struct7Byte>;
};
type PaddingInBetweenOutOfLineObjects1Byte = struct {
first box<Struct1Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects2Byte = struct {
first box<Struct2Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects3Byte = struct {
first box<Struct3Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects4Byte = struct {
first box<Struct4Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects5Byte = struct {
first box<Struct5Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects6Byte = struct {
first box<Struct6Byte>;
second box<Struct8Byte>;
};
type PaddingInBetweenOutOfLineObjects7Byte = struct {
first box<Struct7Byte>;
second box<Struct8Byte>;
};
// In case unions use a different out-of-line implementation than structs,
// spot check padding.
type PaddedUnion = strict union {
1: field int8;
};
type PaddedUnionStruct = struct {
u PaddedUnion;
};
// In case tables use a different out-of-line implementation than structs,
// spot check padding.
type PaddedTable = table {
1: field int8;
};
type PaddedTableStruct = struct {
t PaddedTable;
};
type UnionInlinePadding = strict union {
1: three_padding_bytes uint8;
2: two_padding_bytes uint16;
3: one_padding_byte array<uint8, 3>;
};
type UnionInlinePaddingStruct = struct {
u UnionInlinePadding;
};
// Bindings might generate an 4 byte padding mask for this struct,
// which is wrong because the struct has alignment 2 and might
// be used at a non 4 byte aligned offset.
type PaddingAlignment2MaskMayBe4Bytes = struct {
a uint8;
b uint16;
c uint16;
};
type PaddingAlignment2MaskMayBe4BytesVector = struct {
v vector<PaddingAlignment2MaskMayBe4Bytes>;
};
// Bindings might generate an 8 byte padding mask for this struct,
// which is wrong because the struct has alignment 4 and might
// be used at a non 8 byte aligned offset.
type PaddingAlignment4MaskMayBe8Bytes = struct {
a uint8;
b uint32;
c uint32;
};
type PaddingAlignment4MaskMayBe8BytesVector = struct {
v vector<PaddingAlignment4MaskMayBe8Bytes>;
};