Commit 7ca77176
7ca7717619d5Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 4 files · +2 added · ~2 modified
Description
Fix StringIO putc / fsync / volatile-receiver
Three related StringIO codegen gaps:
- putc:
io.putc "A"passed the string's char* straight into sp_StringIO_putc's int64_t codepoint param (makes integer from pointer without a cast). A String arg now contributes its first byte (CRuby writes the first char); an Integer arg stays the codepoint. - fsync: was unresolved (emitted 0 with a warning). It is a no-op returning 0, matching CRuby's StringIO#fsync.
- volatile: a StringIO local inside a setjmp-bearing function
(begin/rescue) is emitted
volatile sp_StringIO *, but the sp_StringIO_* helpers take a plainsp_StringIO *, so every call tripped -Wdiscarded-qualifiers (an error under the test harness's -Werror). compile_stringio_method_expr now casts the receiver to a plain pointer once, covering all methods (identity cast when not volatile).
analyze types fsync int alongside the other StringIO int accessors.
Full suite green (711).
Fixes #1136 Fixes #1140 Fixes #1141
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 7ca7717619d5
- Parent
- c5a9c6e1d664
spinel_analyze.rbmodifiedView file
@@ -6812,7 +6812,7 @@
68126812
if mname == "string" || mname == "read" || mname == "gets" || mname == "getc"68136813
return "string"68146814
end6815-
if mname == "pos" || mname == "tell" || mname == "size" || mname == "length" || mname == "write" || mname == "putc" || mname == "getbyte" || mname == "lineno"6815+
if mname == "pos" || mname == "tell" || mname == "size" || mname == "length" || mname == "write" || mname == "putc" || mname == "getbyte" || mname == "lineno" || mname == "fsync"68166816
return "int"68176817
end68186818
if mname == "eof?" || mname == "closed?" || mname == "sync" || mname == "isatty"spinel_codegen.rbmodifiedView file
Loading diff…
test/stringio_putc_fsync.rbaddedView file
Loading diff…
test/stringio_putc_fsync.rb.expectedaddedView file
Loading diff…