Commit b7dda7f4
b7dda7f451b8Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
fix: cast ivar to void* in emitted gc_scan calls to silence -Wdiscarded-qualifiers
sp_gc_mark takes void*, but we passed const-qualified ivars (e.g. const char *), so gcc warned on every emitted mark site. sp_gc_mark does write to the mark byte at obj[-1], but that byte sits outside the const string's payload, so the cast is sound. Add an explicit (void *) cast at the call site.
Clears dozens of warnings from the bootstrap build; no code-size or runtime impact. Bootstrap still self-reproduces.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- b7dda7f451b8
- Parent
- 6361855bcdb0
spinel_codegen.rbmodifiedView file
@@ -9010,7 +9010,7 @@
90109010
while j < names.length90119011
if j < types.length90129012
if ivar_is_gc_ptr(types[j]) == 19013-
emit_raw(" if (self->" + sanitize_ivar(names[j]) + ") sp_gc_mark(self->" + sanitize_ivar(names[j]) + ");")9013+
emit_raw(" if (self->" + sanitize_ivar(names[j]) + ") sp_gc_mark((void *)self->" + sanitize_ivar(names[j]) + ");")90149014
end90159015
end90169016
j = j + 1@@ -9025,7 +9025,7 @@
90259025
while pj < pnames.length90269026
if pj < ptypes.length90279027
if ivar_is_gc_ptr(ptypes[pj]) == 19028-
emit_raw(" if (self->" + sanitize_ivar(pnames[pj]) + ") sp_gc_mark(self->" + sanitize_ivar(pnames[pj]) + ");")9028+
emit_raw(" if (self->" + sanitize_ivar(pnames[pj]) + ") sp_gc_mark((void *)self->" + sanitize_ivar(pnames[pj]) + ");")90299029
end90309030
end90319031
pj = pj + 1