Commit 003c3022
003c30228b13Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
build: silence gcc -Wformat-truncation on benign ivar/path snprintf builds
A full gcc rebuild prints -Wformat-truncation warnings on snprintf calls like
snprintf(buf, sizeof buf, "@%s", name) (analyze_scope.c, codegen_stmt.c,
main.c path resolution). The buffers are sized for real identifiers and paths;
the truncation can't happen in practice. The warning is FORTIFY-driven and fires
independently of -Wall under _FORTIFY_SOURCE, so the existing -Wno-all does not
cover it.
Add -Wno-format-truncation to CFLAGS alongside the other paranoia suppressions.
gcc recognizes it; clang lacks the flag and ignores it via the existing
-Wno-unknown-warning-option.
optcarrot checksum 59662, build clean (0 warnings) on gcc.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 003c30228b13
- Parent
- d65f6c70249a
common.mkmodifiedView file
# `-Wno-alloc-size-larger-than` silences a gcc 13+ paranoia warning on the# inlined `h->cap *= 2` in sp_*Hash_grow; `-Wno-unknown-warning-option`# keeps clang (which lacks that flag) from turning it into a -Werror fail.# `-Wno-format-truncation` silences gcc's FORTIFY-driven paranoia on benign# `snprintf(buf, sizeof buf, "@%s", name)` ivar/path builds (the buffers are# sized for real identifiers; the warning fires independently of -Wall under# _FORTIFY_SOURCE, so -Wno-all does not cover it). clang lacks the flag and# ignores it via -Wno-unknown-warning-option above.OPT ?= -O2CFLAGS = $(OPT) -Wno-all -Wno-unknown-warning-option -Wno-alloc-size-larger-thanCFLAGS = $(OPT) -Wno-all -Wno-unknown-warning-option -Wno-alloc-size-larger-than -Wno-format-truncation# Bootstrap-only flags: the legacy compiler runs on the developer's# machine only, so -O3 -flto buys ~5-10% wall-clock without constraining