From 491919b14f915df3e3b76960582e0dbb8427e259 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 15 May 2019 13:45:42 +0200 Subject: pkg/compiler: work around 0-array-size errors due to missing consts A const can be used as array size. Then if the const is not present on all arches, compiler will produce an error about 0-sized-array. There is no easy way to work around this for a user. Use value of 1 for missing consts. It's just a bit safer. --- sys/linux/gen/arm64.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/gen/arm64.go b/sys/linux/gen/arm64.go index 0d0dc14c3..593da6216 100644 --- a/sys/linux/gen/arm64.go +++ b/sys/linux/gen/arm64.go @@ -11022,13 +11022,13 @@ var structDescs_arm64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "reserved", TypeSize: 2}, BitfieldLen: 12, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 2}, BitfieldOff: 12, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 2}, BitfieldOff: 12, BitfieldLen: 4}, Val: 1}, &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "mac", IsVarlen: true}, Kind: 1, RangeEnd: 20}, }}}, {Key: StructKey{Name: "mptcp_add_addr_option"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "mptcp_add_addr_option", IsVarlen: true}, Fields: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}, Val: 1}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "version", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "addr_id", TypeSize: 1}}}, &UnionType{Key: StructKey{Name: "ipv4_addr"}, FldName: "address"}, @@ -11039,7 +11039,7 @@ var structDescs_arm64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "version", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Val: 1}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "flags", TypeSize: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64be", FldName: "sender", TypeSize: 8}, ArgFormat: 1}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "receiver", IsVarlen: true}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64be", TypeSize: 8}, ArgFormat: 1}}, Kind: 1, RangeEnd: 1}, @@ -11053,27 +11053,27 @@ var structDescs_arm64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "reserved", TypeSize: 2}, BitfieldLen: 12, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 2}, BitfieldOff: 12, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 2}, BitfieldOff: 12, BitfieldLen: 4}, Val: 1}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "key", TypeSize: 8}}}, }}}, {Key: StructKey{Name: "mptcp_mp_join_option"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "mptcp_mp_join_option", TypeSize: 3}, Fields: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "flags", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Val: 1}, }}}, {Key: StructKey{Name: "mptcp_remove_addr_option"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "mptcp_remove_addr_option", IsVarlen: true}, Fields: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "reserved", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Val: 1}, &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "addrs_id", IsVarlen: true}}, }}}, {Key: StructKey{Name: "mptcp_syn_option"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "mptcp_syn_option", TypeSize: 12}, Fields: []Type{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "flags", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Val: 1}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "addr_id", TypeSize: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "token", TypeSize: 4}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "nonce", TypeSize: 4}}}, @@ -11082,7 +11082,7 @@ var structDescs_arm64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 1}}, Val: 30}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "length", TypeSize: 1}}, Path: []string{"parent"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "flags", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, - &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "subtype", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}, Val: 1}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "addr_id", TypeSize: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mac", TypeSize: 8}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "nonce", TypeSize: 4}}}, @@ -50848,4 +50848,4 @@ var consts_arm64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm64 = "2ad9682cfcaa80da61b92de0ec6ac412968a2a6f" +const revision_arm64 = "2985c756052d76b2393a2556b2caf5a8e0e54d0c" -- cgit mrf-deployment