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.
Unified · Split
| @@ -7500,6 +7500,10 @@ check_disable_warning -Wno-bool-operation · 7499 unmodified lines | ||
| 7500 | 7500 | check_disable_warning -Wno-char-subscripts |
| 7501 | 7501 | check_disable_warning -Wno-implicit-const-int-float-conversion |
| 7502 | 7502 | |
| 7503 | +# Disable mixed decl and code warning for Objective-C | |
| 7504 | +test_objcflags $unknown_warning_flags '-Wdeclaration-after-statement' && | |
| 7505 | + add_objcflags '-Wno-declaration-after-statement' | |
| 7506 | + | |
| 7503 | 7507 | check_disable_warning_headers(){ |
| 7504 | 7508 | warning_flag=-W${1#-Wno-} |
| 7505 | 7509 | test_cflags $warning_flag && add_cflags_headers $1 |