Commit d4fec1563f for ffmpeg
commit d4fec1563f7dc41ef6ecef6eea6dbca658744ac5
Author: Jun Zhao <barryjzhao@tencent.com>
Date: Fri Nov 13 14:07:07 2026 +0800
configure: also warn about large stack frames with clang
-Wstack-usage is GCC-only; Clang rejects it, so check_warning() silently
skips it and Clang builds get no guard against stack frames exceeding
the 120 KiB threshold (chosen for musl's 128 KiB default thread stacks).
Fall back to -Wframe-larger-than=122880 when -Wstack-usage=122880 is not
supported. With check_warning() now reporting the C probe result, GCC
stays on -Wstack-usage=122880 without enabling both options and warning
twice, while Clang picks up -Wframe-larger-than=122880.
Unlike -Wstack-usage=, -Wframe-larger-than= only accounts for static
frame allocations (excluding VLAs / alloca). Note that clang-cl accepts
the flag in the driver without forwarding -fwarn-stack-size= to -cc1, so
clang-cl and MSVC remain uncovered as before.
Suggested-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
diff --git a/configure b/configure
index 65fc2c3a39..48a506bc2f 100755
--- a/configure
+++ b/configure
@@ -7858,7 +7858,9 @@ check_warning -Wempty-body
# Warn about excessive stack usage, using a 120 KiB per-function threshold.
# This roughly matches the default thread stack size on Musl, which is 128 KiB,
# leaving some headroom for caller frames.
-check_warning -Wstack-usage=122880
+if ! check_warning -Wstack-usage=122880; then
+ check_warning -Wframe-larger-than=122880
+fi
# GCC accepts warning option level 5 here to warn about all fallthroughs
# that are not explicitly marked with the appropriate attribute