fix -cstrict

This commit is contained in:
kbkpbot 2025-09-12 13:41:50 +08:00
parent 97780a65f6
commit b5ee3d374b
3 changed files with 9 additions and 9 deletions

View file

@ -1,11 +1,11 @@
vlib/v/checker/tests/enum_field_overflow.vv:3:10: error: enum value `2147483647` overflows the enum type `int`, values of which have to be in [-2147483648, 2147483647] vlib/v/checker/tests/enum_field_overflow.vv:3:10: error: enum value `2147483647` overflows the enum type `i32`, values of which have to be in [-2147483648, 2147483647]
1 | enum Color { 1 | enum Color as i32 {
2 | red 2 | red
3 | green = 2147483647 3 | green = 2147483647
| ~~~~~~~~~~ | ~~~~~~~~~~
4 | blue 4 | blue
5 | } 5 | }
vlib/v/checker/tests/enum_field_overflow.vv:4:2: error: enum value overflows type `int`, which has a maximum value of 2147483647 vlib/v/checker/tests/enum_field_overflow.vv:4:2: error: enum value overflows type `i32`, which has a maximum value of 2147483647
2 | red 2 | red
3 | green = 2147483647 3 | green = 2147483647
4 | blue 4 | blue

View file

@ -1,5 +1,5 @@
vlib/v/checker/tests/enum_field_value_overflow.vv:3:10: error: enum value `2147483648` overflows the enum type `int`, values of which have to be in [-2147483648, 2147483647] vlib/v/checker/tests/enum_field_value_overflow.vv:3:10: error: enum value `2147483648` overflows the enum type `i32`, values of which have to be in [-2147483648, 2147483647]
1 | enum Color { 1 | enum Color as i32 {
2 | red 2 | red
3 | green = 2147483648 3 | green = 2147483648
| ~~~~~~~~~~ | ~~~~~~~~~~
@ -40,8 +40,8 @@ vlib/v/checker/tests/enum_field_value_overflow.vv:21:10: error: enum value `3276
| ~~~~~ | ~~~~~
22 | blue 22 | blue
23 | } 23 | }
vlib/v/checker/tests/enum_field_value_overflow.vv:27:10: error: enum value `2147483648` overflows the enum type `int`, values of which have to be in [-2147483648, 2147483647] vlib/v/checker/tests/enum_field_value_overflow.vv:27:10: error: enum value `2147483648` overflows the enum type `i32`, values of which have to be in [-2147483648, 2147483647]
25 | enum ColorI32 { 25 | enum ColorI32 as i32 {
26 | red 26 | red
27 | green = 2147483648 27 | green = 2147483648
| ~~~~~~~~~~ | ~~~~~~~~~~

View file

@ -8316,9 +8316,9 @@ return ${cast_shared_struct_str};
} }
iin_idx := already_generated_mwrappers[interface_index_name] - iinidx_minimum_base iin_idx := already_generated_mwrappers[interface_index_name] - iinidx_minimum_base
if g.pref.build_mode != .build_module { if g.pref.build_mode != .build_module {
sb.writeln('${g.static_modifier}const int ${interface_index_name} = ${iin_idx};') sb.writeln('${g.static_modifier}const u32 ${interface_index_name} = ${iin_idx};')
} else { } else {
sb.writeln('extern const int ${interface_index_name};') sb.writeln('extern const u32 ${interface_index_name};')
} }
} }
for vtyp, variants in inter_info.conversions { for vtyp, variants in inter_info.conversions {