Commit 3aba184e
3aba184ef222Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 3 files · ~3 modified
Description
fix: silence clang -Wstring-plus-int on the immortal-string idiom
The runtime header and codegen output use the idiom ("\xff" "literal" + 1) to mark a string literal as immortal (the 0xff prefix byte tells the GC scanner this is a literal pointer rather than a heap-allocated string). Apple clang flags this pattern with -Wstring-plus-int, and the Makefile test/bench rules combine that with -Werror, which was turning every test and bench into a compile error on macOS. Reported in #6.
Pass -Wno-string-plus-int unconditionally in CFLAGS, the spinel driver script, and spinel.bat. gcc does not have this warning but accepts the flag silently, so it is safe everywhere. Linux builds remain green (77 tests pass, 55 benches pass).
A more thorough fix that rewrites the idiom to (&("\xff" "literal")[1]) form (which clang understands as ordinary array indexing) is tracked separately and will eliminate the need for this flag.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 3aba184ef222
- Parent
- ca696c5e1515
MakefilemodifiedView file
# make clean Remove built binariesCC ?= ccCFLAGS = -O2 -Wno-all# -Wno-string-plus-int silences clang's warning on the immortal-string# idiom ("\xff" "literal" + 1). gcc doesn't have this warning but accepts# the flag silently, so it is safe to apply unconditionally.CFLAGS = -O2 -Wno-all -Wno-string-plus-int# Per-function sections allow the linker to strip unused bigint/regexp# functions from the final binary (supported since GCC 2.7 / binutils 2.17).SEC_FLAGS = -ffunction-sections -fdata-sectionsspinelmodifiedView file
Loading diff…
spinel.batmodifiedView file
Loading diff…