From 4eda9b07e5f25565333fdd8eed4e33850bd0f828 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 28 Dec 2015 12:58:10 +0100 Subject: prog: don't serialize paddings Paddings in serialized programs are unnecessary and confusing. Instead restore them implicitly. Also use [,,,,] for arrays. --- sys/decl.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sys/decl.go') diff --git a/sys/decl.go b/sys/decl.go index 82f1871e1..af3202ae2 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -23,6 +23,13 @@ type Type interface { Align() uintptr } +func IsPad(t Type) bool { + if ct, ok := t.(ConstType); ok && ct.IsPad { + return true + } + return false +} + type TypeCommon struct { TypeName string IsOptional bool @@ -313,6 +320,7 @@ type ConstType struct { TypeCommon TypeSize uintptr Val uintptr + IsPad bool } func (t ConstType) Size() uintptr { @@ -654,5 +662,6 @@ func makePad(sz uintptr) Type { TypeCommon: TypeCommon{TypeName: "pad", IsOptional: false}, TypeSize: sz, Val: 0, + IsPad: true, } } -- cgit mrf-deployment