mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] tools build: Fix timerfd feature detection with clang
@ 2026-09-10 21:39 Ian Rogers
  2026-09-12 20:15 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2026-09-10 21:39 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
	linux-perf-users, linux-kernel, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, llvm

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@google.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] tools build: Fix timerfd feature detection with clang
  2026-09-10 21:39 [PATCH v1] tools build: Fix timerfd feature detection with clang Ian Rogers
@ 2026-09-12 20:15 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-09-12 20:15 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Jiri Olsa,
	Adrian Hunter, James Clark, linux-perf-users, linux-kernel,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	llvm

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@google.com>

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-12 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 21:39 [PATCH v1] tools build: Fix timerfd feature detection with clang Ian Rogers
2026-09-12 20:15 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®