diff mbox series

[FFmpeg-devel,2/2] configure: allow mixed declarations and code for Objective-C

Message ID D4FRJ0AYLBXS.1UO17SRARJJNE@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] configure: fix passing Objective-C flags | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 25, 2024, 11:43 p.m. UTC
Mixing declarations and code is quite common in Objective-C (as can be
seen by the number of warnings we have for this in Objective-C files)
and forcing to not do it usually results in worse code, with unnecessary
widely scoped variables, which in turn makes variable shadowing and
accidentally using the wrong variable more common and harder to notice.
---
 configure | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Zhao Zhili Oct. 3, 2024, 4:26 p.m. UTC | #1
> On Sep 26, 2024, at 07:43, Marvin Scholz <epirat07@gmail.com> wrote:
> 
> Mixing declarations and code is quite common in Objective-C (as can be
> seen by the number of warnings we have for this in Objective-C files)
> and forcing to not do it usually results in worse code, with unnecessary
> widely scoped variables, which in turn makes variable shadowing and
> accidentally using the wrong variable more common and harder to notice.
> ---
> configure | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/configure b/configure
> index 0c57dda85b..f630470b68 100755
> --- a/configure
> +++ b/configure
> @@ -7445,6 +7445,10 @@ check_disable_warning -Wno-unused-const-variable
> check_disable_warning -Wno-bool-operation
> check_disable_warning -Wno-char-subscripts
> 
> +# Disable mixed decl and code warning for Objective-C
> +test_objcflags $unknown_warning_flags '-Wdeclaration-after-statement' &&
> +    add_objcflags '-Wno-declaration-after-statement'
> +

LGTM, thanks.

> check_disable_warning_headers(){
>     warning_flag=-W${1#-Wno-}
>     test_cflags $warning_flag && add_cflags_headers $1
> -- 
> 2.39.3 (Apple Git-146)
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/configure b/configure
index 0c57dda85b..f630470b68 100755
--- a/configure
+++ b/configure
@@ -7445,6 +7445,10 @@  check_disable_warning -Wno-unused-const-variable
 check_disable_warning -Wno-bool-operation
 check_disable_warning -Wno-char-subscripts
 
+# Disable mixed decl and code warning for Objective-C
+test_objcflags $unknown_warning_flags '-Wdeclaration-after-statement' &&
+    add_objcflags '-Wno-declaration-after-statement'
+
 check_disable_warning_headers(){
     warning_flag=-W${1#-Wno-}
     test_cflags $warning_flag && add_cflags_headers $1