drivers: Flag mixed declarations and code

Adding the build flag '-Werror=declaration-after-statement' to prevent
mixing variable definitions within the body of code. Ideally, we would
enable this for all kernels, but in the latest upstream Linux kernels
this flag has been removed from the kernel build to allow for scope
based declarations in some contexts. However, even in the upstream
kernel declaring variables at the start of the scope is recommended. Add
this flag for noble kernels to ensure that this recommendation is
followed for OOT drivers.

Link: https://lore.kernel.org/lkml/20230612093537.693926033@infradead.org/
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I29648ec41d5a5afb06a41b209c025c7b3fa77e85
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3338231
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-04-07 12:27:30 +01:00
parent 53584a0920
commit af058279c6

View File

@@ -3,6 +3,8 @@
# Kernel Noble specific environment variables to configure the OOT modules
subdir-ccflags-y += -Werror=declaration-after-statement
export NV_OOT_IVC_EXT_SKIP_BUILD=y
export NV_OOT_TEGRA_HV_SKIP_BUILD=y
export NV_OOT_TEGRA_BPMP_SKIP_BUILD=y
export NV_OOT_TEGRA_BPMP_SKIP_BUILD=y