Re: [PATCH v1] tools build: Fix timerfd feature detection with clang
From: Arnaldo Carvalho de Melo
Date: Sat Sep 12 2026 - 16:22:17 EST
On Thu, Sep 10, 2026 at 02:39:07PM -0700, Ian Rogers wrote:
> Clang's uninitialized-const-pointer warning causes a feature test to
> fail when building perf with clang. This disables support for 'perf
> kvm stat live'. Add default initialization to new_value as a
> workaround.
>
> test-timerfd.c:15:30: error: variable 'new_value' is uninitialized when passed
> as a const pointer argument here
> [-Werror,-Wuninitialized-const-pointer]
> 15 | if (timerfd_settime(fd, 0, &new_value, NULL) != 0)
> | ^~~~~~~~~
> 1 error generated.
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo
> ---
> tools/build/feature/test-timerfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/build/feature/test-timerfd.c b/tools/build/feature/test-timerfd.c
> index 9c72c697a9df..f88e8cc63ef3 100644
> --- a/tools/build/feature/test-timerfd.c
> +++ b/tools/build/feature/test-timerfd.c
> @@ -6,7 +6,7 @@
>
> int main(void)
> {
> - struct itimerspec new_value;
> + struct itimerspec new_value = {};
>
> int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
> if (fd < 0)
> --
> 2.55.0.1007.g17ff1f9808-goog
>