Commit 7751669a
7751669a7dadMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Keep generated C clang -Werror-clean: range float arg + unused-value
clang's default -Werror set is broader than gcc's (which the build runs with -Wno-all), so two patterns failed only the clang test job:
-
(1..).include?(2.4)emitted sp_range_include(&r, 2.4) -- an implicit float-literal->mrb_int conversion (-Wliteral-conversion). Emit an explicit (mrb_int) cast for a float arg, matching gcc's truncation. -
A discarded value-producing statement-expression (e.g. the
({ ...; v; })forFiber[:k] = vin statement position) trips -Wunused-value. The value is intentionally dropped and behaviour is gated by the output diff, so suppress -Wunused-value in the generated-C test build (TEST_WARN_SUPPRESS) rather than risk a codegen change that mistypes the same statement-expr in value position.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 7751669a7dad
- Parent
- ab8238525325
MakefilemodifiedView file
endifTEST_TARGETS := $(patsubst test/%.rb,build/test-results/%.ok,$(TESTS))# Warnings the generated-C -Werror check should not gate on. clang enables# -Wunused-value by default (gcc only under -Wall, which the build disables),# so a discarded value-producing statement-expression -- e.g. the# `({ ...; v; })` emitted for `Fiber[:k] = v` in statement position -- fails# CI under clang while gcc is silent. The value is intentionally discarded;# behaviour is still gated by the output diff. Keep this list minimal.TEST_WARN_SUPPRESS := -Wno-unused-value# `make test` always runs fresh: it wipes the prior `.ok` stamps first,# then runs the suite. (The old incremental `test` + `retest` split is# gone — a stale `.ok` reading PASS was a recurring foot-gun.) if [ -f "$<.args" ]; then args=$$(cat "$<.args"); fi; \ $(SPINEL) "$<" -c --no-line-map -o "$$cfile" 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib -c "$$cfile" -o "$$cfile.o" 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(TEST_WARN_SUPPRESS) $(SEC_FLAGS) -Ilib -c "$$cfile" -o "$$cfile.o" 2>/dev/null && \ $(CC) $(CFLAGS) "$$cfile.o" $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o "$$bin" 2>/dev/null; \ if [ $$? -eq 0 ]; then \ if [ -f "$<.expected" ]; then \ bn=$$(basename "$$f" .rb); \ if [ "$$tty" = 1 ]; then printf '\r\033[K [%d/%d] %s' "$$i" "$$total" "$$bn"; fi; \ $(TIMEOUT10) $(SPINEL) "$$f" -c --no-line-map -o /tmp/_sp_b.c 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(SEC_FLAGS) -Ilib -c /tmp/_sp_b.c -o /tmp/_sp_b.c.o 2>/dev/null && \ $(CC) $(CFLAGS) -Werror $(TEST_WARN_SUPPRESS) $(SEC_FLAGS) -Ilib -c /tmp/_sp_b.c -o /tmp/_sp_b.c.o 2>/dev/null && \ $(CC) $(CFLAGS) /tmp/_sp_b.c.o $(SP_RT_LIB) $(LDFLAGS) -lm $(GC_FLAGS) -o /tmp/_sp_b_bin$(EXE) 2>/dev/null; \ if [ $$? -eq 0 ]; then \ $(TIMEOUT60) $(REF_RUBY) "$$f" >/tmp/_sp_b_exp 2>/dev/null; \src/codegen_call.cmodifiedView file
Loading diff…