Re: [PATCH v1] selftests: cachestat: Fix warning on declaration under label

From: lianux

Date: Mon Sep 29 2025 - 23:32:06 EST


From: wang lian <lianux.mm@xxxxxxxxx>

Reviewed-by: wang lian <lianux.mm@xxxxxxxxx>

> Fix warning caused from declaration under a case label. The proper way
> is to declare variable at the beginning of the function. The warning
> came from running clang using LLVM=1; and is as follows:
> --
> -test_cachestat.c:260:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
> 260 | char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE,
> |
>
> Signed-off-by: Sidharth Seela <sidharthseela@xxxxxxxxx>

Best regards,
wang lian