PR #24705 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24705
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24705.patch

GCC warns when a warning option is valid for another language and no -W
option controls that warning, so after 45ec2cae19 dropped -Werror from
the probe, -Wno-pointer-sign passed the C++ check and ended up in
CXXFLAGS. Clang likewise only warns about unknown warning options.
-Werror covers both, so use it directly instead of the Clang specific
-Werror= flags, and translate it to -WX for MSVC, which does not accept
the GCC spelling.

Using -Werror already includes more specific warnigns, so remove
`unknown_warning_cflags` and just use -Werror.


From 80984b268ce56f366a5d4bb499b21043765e7388 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Sat, 26 Sep 2026 06:43:15 +0200
Subject: [PATCH] configure: probe warning options with -Werror
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GCC warns when a warning option is valid for another language and no -W
option controls that warning, so after 45ec2cae19 dropped -Werror from
the probe, -Wno-pointer-sign passed the C++ check and ended up in
CXXFLAGS. Clang likewise only warns about unknown warning options.
-Werror covers both, so use it directly instead of the Clang specific
-Werror= flags, and translate it to -WX for MSVC, which does not accept
the GCC spelling.

Using -Werror already includes more specific warnigns, so remove
`unknown_warning_cflags` and just use -Werror.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 configure | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index c588508f8a..58833057e0 100755
--- a/configure
+++ b/configure
@@ -5166,6 +5166,7 @@ msvc_common_flags(){
             # generic catch all at the bottom will print the original flag.
             -Wall)                ;;
             -Wextra)              ;;
+            -Werror)              echo -WX ;;
             -std=c*)              echo /std:${flag#-std=};;
             # Common flags
             -fomit-frame-pointer) ;;
@@ -7812,18 +7813,11 @@ fi
 
 enabled debug && add_allcflags -g"$debuglevel" && add_asflags -g"$debuglevel"
 
-for lang in c cxx; do
-    test_${lang}flags -Werror=unused-command-line-argument &&
-        append unknown_warning_${lang}flags 
"-Werror=unused-command-line-argument"
-    test_${lang}flags -Werror=unknown-warning-option &&
-        append unknown_warning_${lang}flags "-Werror=unknown-warning-option"
-done
-
 check_warning(){
     warning_flag=$1
     flag_to_add=${2:-$1}
-    test_cflags $unknown_warning_cflags $warning_flag && add_cflags 
$flag_to_add
-    test_cxxflags $unknown_warning_cxxflags $warning_flag && add_cxxflags 
$flag_to_add
+    test_cflags -Werror $warning_flag && add_cflags $flag_to_add
+    test_cxxflags -Werror $warning_flag && add_cxxflags $flag_to_add
 }
 
 check_disable_warning(){
@@ -7833,7 +7827,7 @@ check_disable_warning(){
 
 check_c_warning(){
     warning_flag=$1
-    test_cflags $unknown_warning_cflags $warning_flag && add_cflags 
$warning_flag
+    test_cflags -Werror $warning_flag && add_cflags $warning_flag
 }
 
 # add some useful compiler flags if supported
@@ -7880,7 +7874,7 @@ check_disable_warning 
-Wno-microsoft-enum-forward-reference
 
 check_disable_warning_headers(){
     warning_flag=-W${1#-Wno-}
-    test_cflags $unknown_warning_cflags $warning_flag && add_cflags_headers $1
+    test_cflags -Werror $warning_flag && add_cflags_headers $1
 }
 
 check_disable_warning_headers -Wno-deprecated-declarations
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to