PR #26025 opened by Jun Zhao (mypopydev) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26025 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26025.patch
-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). Use -Wframe-larger-than=122880 on Clang while keeping GCC on -Wstack-usage=122880, which also tracks dynamic stack allocations. Because GCC accepts -Wframe-larger-than= as well, guard the two checks with an explicit compiler branch so GCC does not enable both and warn twice. Use "elif enabled clang" rather than an unconditional "else": clang-cl (probed as cc_type=msvc) accepts -Wframe-larger-than= in the driver without passing -fwarn-stack-size= to -cc1, so an "else" branch would only add an ineffective flag there. Note that Clang measures static frame size after inlining (and under LTO defers the diagnostic to link time without source line info), whereas clang-cl and MSVC remain uncovered as before. GCC behaviour is unchanged. Signed-off-by: Jun Zhao <[email protected]> # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 343a4c0a9f00028556d6e01ba8e31f2cb84169e8 Mon Sep 17 00:00:00 2001 From: Jun Zhao <[email protected]> Date: Fri, 13 Nov 2026 14:07:07 +0800 Subject: [PATCH] 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). Use -Wframe-larger-than=122880 on Clang while keeping GCC on -Wstack-usage=122880, which also tracks dynamic stack allocations. Because GCC accepts -Wframe-larger-than= as well, guard the two checks with an explicit compiler branch so GCC does not enable both and warn twice. Use "elif enabled clang" rather than an unconditional "else": clang-cl (probed as cc_type=msvc) accepts -Wframe-larger-than= in the driver without passing -fwarn-stack-size= to -cc1, so an "else" branch would only add an ineffective flag there. Note that Clang measures static frame size after inlining (and under LTO defers the diagnostic to link time without source line info), whereas clang-cl and MSVC remain uncovered as before. GCC behaviour is unchanged. Signed-off-by: Jun Zhao <[email protected]> --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 69793448886..f4c350f0bb3 100755 --- a/configure +++ b/configure @@ -7858,7 +7858,13 @@ 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 +# Clang does not implement -Wstack-usage; use -Wframe-larger-than there +# instead (static frame size, measured after inlining). +if enabled gcc; then + check_warning -Wstack-usage=122880 +elif enabled clang; 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 -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
