Skip to content

Commit 46746f6

Browse files
committed
ppc fix
1 parent 80cfcb0 commit 46746f6

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

vlib/builtin/closure/closure.c.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ pub const closure_thunk = $if ppc64le {
4141
0xa6, 0x03, 0xc9, 0x7d, // mtctr %r14
4242
0x20, 0x04, 0x80, 0x4e, // bctr
4343
]!
44-
} $else $if ppc {
44+
} $else $if !ppc64le && !amd64 && !i386 && !arm64 && !arm32 && !rv64 && !rv32 && !s390x && !loongarch64 {
45+
// ppc (32-bit PowerPC) - expressed as negation of all other arches for bootstrap compat
4546
[
4647
u8(0x7c), 0x08, 0x02, 0xa6, // mflr %r0
4748
0x48, 0x00, 0x00, 0x05, // bl here
@@ -115,7 +116,8 @@ pub const closure_thunk = $if ppc64le {
115116

116117
// NOTE: Keep the first branch as the longest byte sequence. In translated/bootstrap C mode
117118
// (`vc/v.c`), V emits a fixed C array whose size is inferred from the first branch.
118-
const closure_get_data_bytes = $if ppc {
119+
const closure_get_data_bytes = $if !ppc64le && !amd64 && !i386 && !arm64 && !arm32 && !rv64 && !rv32 && !s390x && !loongarch64 {
120+
// ppc (32-bit PowerPC) - expressed as negation of all other arches for bootstrap compat
119121
[
120122
u8(0x94), 0x21, 0xff, 0xf0, // stwu %r1, -16(%r1)
121123
0xd9, 0xc1, 0x00, 0x08, // stfd %f14, 8(%r1)

vlib/orm/orm_func.v

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,12 @@ fn struct_meta[T]() []TableField {
450450
}
451451
}
452452

453-
mut field_type := field.unaliased_typ
454-
if field.unaliased_typ == 0 {
455-
field_type = field.typ
456-
}
457-
if field.unaliased_typ is time.Time {
453+
mut field_type := field.typ
454+
if typeof(field).name.contains('time.Time') {
458455
field_type = time_
459-
} else if field.unaliased_typ is $struct {
456+
} else if field.is_struct {
460457
field_type = type_idx['int']
461-
} else if field.unaliased_typ is $enum {
458+
} else if field.is_enum {
462459
field_type = enum_
463460
}
464461

vlib/v/checker/struct.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,17 @@ fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
130130
c.expected_type = field.typ
131131
field.default_expr_typ = c.expr(mut field.default_expr)
132132
if field.typ.is_ptr() != field.default_expr_typ.is_ptr() {
133+
def_expr_pos := field.default_expr.pos()
133134
match field.default_expr {
134135
ast.CallExpr {
135136
err_desc := if field.typ.is_ptr() { 'is' } else { 'is not' }
136137
val_desc := if field.default_expr_typ.is_ptr() { 'is' } else { 'is not' }
137138
c.error('field ${err_desc} reference but default value ${val_desc} reference',
138-
field.default_expr.pos)
139+
def_expr_pos)
139140
}
140141
ast.StructInit {
141142
c.error('reference field must be initialized with reference',
142-
field.default_expr.pos)
143+
def_expr_pos)
143144
}
144145
else {}
145146
}

vlib/x/json2/decode.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ fn (mut decoder Decoder) decode_value[T](mut val T) ! {
682682
}
683683
}
684684

685-
fn (mut decoder Decoder) decode_string[T](mut _val T) ! {
685+
fn (mut decoder Decoder) decode_string[T](mut val T) ! {
686686
string_info := decoder.current_node.value
687687

688688
if string_info.value_kind == .string {
@@ -1046,7 +1046,7 @@ fn parse_integer_number[T](str string) !T {
10461046

10471047
// use pointer instead of mut so enum cast works
10481048
@[unsafe]
1049-
fn (mut decoder Decoder) decode_number[T](_val &T) ! {
1049+
fn (mut decoder Decoder) decode_number[T](val &T) ! {
10501050
number_info := decoder.current_node.value
10511051
str := decoder.json[number_info.position..number_info.position + number_info.length]
10521052
$match T.unaliased_typ {

0 commit comments

Comments
 (0)