diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2016-09-19 16:43:44 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2016-09-19 16:43:44 +0200 |
| commit | 551c2aa7e421a329397f97aff5fb7be9a76f4398 (patch) | |
| tree | 358960ba19f9493a1197e0564d6c4e20b38fdfda /sys | |
| parent | 36d9371a19f15ff74081b908a52a2fc8a4d7a641 (diff) | |
sys: delete Size() and Align() methods for struct and union
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/decl.go | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/sys/decl.go b/sys/decl.go index a447948bc..a9f9d1ad3 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -276,27 +276,11 @@ type StructType struct { } func (t *StructType) Size() uintptr { - if !t.padded { - panic("struct is not padded yet") - } - var size uintptr - for _, f := range t.Fields { - size += f.Size() - } - return size + panic("not called") } func (t *StructType) Align() uintptr { - if t.align != 0 { - return t.align // overrided by user attribute - } - var align uintptr - for _, f := range t.Fields { - if a1 := f.Align(); align < a1 { - align = a1 - } - } - return align + panic("not called") } type UnionType struct { @@ -306,26 +290,11 @@ type UnionType struct { } func (t *UnionType) Size() uintptr { - if t.varlen { - panic("union size is not statically known") - } - size := t.Options[0].Size() - for _, opt := range t.Options { - if size < opt.Size() { - size = opt.Size() - } - } - return size + panic("not called") } func (t *UnionType) Align() uintptr { - var align uintptr - for _, opt := range t.Options { - if a1 := opt.Align(); align < a1 { - align = a1 - } - } - return align + panic("not called") } type Dir int |
