tools build: Fix timerfd feature detection with clang
PATCH 1/1 tools build: Fix timerfd feature detection with clang
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.
--- tools/build/feature/test-timerfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/test-timerfd.c +1 -1
@@ -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 )
Signature · 1 line
2.55.0.1007.g17ff1f9808-goog
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
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_valueas a workaround.
Quoted 8 lines
test-timerfd.c:15:30: error: variable '
new_value' is uninitialized when passedas 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 <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Arnaldo Carvalho de Melo
AppliedQuoted 5 lines · Ian Rogers
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_valueas a workaround.
Quoted 8 lines
test-timerfd.c:15:30: error: variable '
new_value' is uninitialized when passedas 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 <[email protected]>
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo
Quoted 20 lines
--- tools/build/feature/test-timerfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/build/feature/test-timerfd.c +1
-1@@ -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 )Signature · 1 line
2.55.0.1007.g17ff1f9808-goog