Commit b8883315

b88833151a0dMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

Merge pull request #478 from ryanseys/rs/bigint-volatile-cleanup

fix(codegen): cast bigint locals to silence volatile-discard warnings

Details

Commit
b88833151a0d
Parent
9f13ca038688
Merge parent
e848e6cdfeb1

spinel_codegen.rbmodifiedView file

@@ -12168,11 +12168,13 @@
1216812168
1216912169 # Bigint methods
1217012170 if recv_type == "bigint"
12171+ # Cast away volatile from bigint locals (see compile_bigint_arg).
12172+ rc_b = "(sp_Bigint *)" + rc
1217112173 if mname == "to_s"
12172- return "sp_bigint_to_s(" + rc + ")"
12174+ return "sp_bigint_to_s(" + rc_b + ")"
1217312175 end
1217412176 if mname == "to_i"
12175- return "sp_bigint_to_int(" + rc + ")"
12177+ return "sp_bigint_to_int(" + rc_b + ")"
1217612178 end
1217712179 end
1217812180
@@ -26693,7 +26695,8 @@
2669326695 next
2669426696 end
2669526697 if at == "bigint"
26696- emit(" { const char *_bs = sp_bigint_to_s(" + val + "); fputs(_bs, stdout); putchar('" + bsl_n + "'); }")
26698+ # Cast away volatile from bigint locals (see compile_bigint_arg).
26699+ emit(" { const char *_bs = sp_bigint_to_s((sp_Bigint *)" + val + "); fputs(_bs, stdout); putchar('" + bsl_n + "'); }")
2669726700 k = k + 1
2669826701 next
2669926702 end
@@ -26811,7 +26814,8 @@
2681126814 at = infer_type(aid)
2681226815 val = compile_expr(aid)
2681326816 if at == "bigint"
26814- emit(" fputs(sp_bigint_to_s(" + val + "), stdout);")
26817+ # Cast away volatile from bigint locals (see compile_bigint_arg).
26818+ emit(" fputs(sp_bigint_to_s((sp_Bigint *)" + val + "), stdout);")
2681526819 k = k + 1
2681626820 next
2681726821 end