perf test workload: Use unsigned int in code_with_type instead of uint
Arnaldo Carvalho de Melo
maintainerPATCH 1/1 perf test workload: Use unsigned int in code_with_type instead of uint
The declaration of the Rust helper test_rs() uses "uint", a BSD-ism that lives in <sys/types.h>, so on glibc it is only visible by
accident: glibc's <stdlib.h> includes <sys/types.h>, where uint is exposed under __USE_MISC, which is on by default.
musl does none of that: its <stdlib.h> doesn't include <sys/types.h> and it typedefs uint there only when _GNU_SOURCE/_BSD_SOURCE is defined, while nothing else in this translation unit includes <sys/types.h>. Building it on Alpine therefore fails with:
tests/workloads/code_with_type.c:9:21: error: unknown type name 'uint'; did you mean 'int'? tests/workloads/code_with_type.c:39:17: error: implicit declaration of function 'test_rs' [-Wimplicit-function-declaration]
The second error is a consequence of the first one: with the declaration at line 9 rejected, the call at line 39 has no prototype, which is an error since gcc 14.
The breakage is only visible when rustc is present, because tests/workloads/Build adds code_with_type.o when CONFIG_RUST_SUPPORT is detected, and tools/build/feature only checks for "rustc --version". That is why alpine:3.23 and alpine:3.24 fail while alpine:3.22 and alpine:edge, lacking rustc, build fine and hide it.
Use unsigned int, which needs no header at all.
--- tools/perf/tests/workloads/code_with_type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/workloads/code_with_type.c +1 -1
@@ -6,7 +6,7 @@#include <linux/compiler.h> #include "../tests.h" -extern void test_rs (uint count); +extern void test_rs (unsigned int count);static volatile sig_atomic_t done;
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 23 lines
The declaration of the Rust helper
test_rs()uses "uint", a BSD-ism that lives in <sys/types.h>, so on glibc it is only visible by
accident: glibc's <stdlib.h> includes <sys/types.h>, where uint is exposed under__USE_MISC, which is on by default.musl does none of that: its <
stdlib.h> doesn't include <sys/types.h> and it typedefs uint there only when _GNU_SOURCE/_BSD_SOURCE is defined, while nothing else in this translation unit includes <sys/types.h>. Building it on Alpine therefore fails with:
tests/workloads/code_with_type.c:9:21: error: unknown type name 'uint'; did you mean 'int'?tests/workloads/code_with_type.c:39:17: error: implicit declaration of function 'test_rs' [-Wimplicit-function-declaration]The second error is a consequence of the first one: with the declaration at line 9 rejected, the call at line 39 has no prototype, which is an error since gcc 14.
The breakage is only visible when rustc is present, because tests/workloads/Build adds code_with_type.o when
CONFIG_RUST_SUPPORTis detected, andtools/build/featureonly checks for "rustc --version". That is why alpine:3.23 and alpine:3.24 fail while alpine:3.22 and alpine:edge, lacking rustc, build fine and hide it.
Quoted 6 lines
Use unsigned int, which needs no header at all.
Fixes 2e05bb52a12d3 ("perf test workload: Add code_with_type test workload")Cc Dmitrii Dolgov <[email protected]>Assisted-by LLMSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/araUAt-S6YM_bbAf@x2?part=1
Quoted 24 lines · Arnaldo Carvalho de Melo
The declaration of the Rust helper
test_rs()uses "uint", a BSD-ism that lives in <sys/types.h>, so on glibc it is only visible by
accident: glibc's <stdlib.h> includes <sys/types.h>, where uint is exposed under__USE_MISC, which is on by default.musl does none of that: its <
stdlib.h> doesn't include <sys/types.h> and it typedefs uint there only when _GNU_SOURCE/_BSD_SOURCE is defined, while nothing else in this translation unit includes <sys/types.h>. Building it on Alpine therefore fails with:
tests/workloads/code_with_type.c:9:21: error: unknown type name 'uint'; did you mean 'int'?tests/workloads/code_with_type.c:39:17: error: implicit declaration of function 'test_rs' [-Wimplicit-function-declaration]The second error is a consequence of the first one: with the declaration at line 9 rejected, the call at line 39 has no prototype, which is an error since gcc 14.
The breakage is only visible when rustc is present, because tests/workloads/Build adds code_with_type.o when
CONFIG_RUST_SUPPORTis detected, andtools/build/featureonly checks for "rustc --version". That is why alpine:3.23 and alpine:3.24 fail while alpine:3.22 and alpine:edge, lacking rustc, build fine and hide it.
Quoted 6 lines
Use unsigned int, which needs no header at all.
Fixes 2e05bb52a12d3 ("perf test workload: Add code_with_type test workload")Cc Dmitrii Dolgov <[email protected]>Assisted-by LLMSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Thanks,
Ian
Quoted 20 lines
--- tools/perf/tests/workloads/code_with_type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/workloads/code_with_type.c +1
-2@@ -6,7 +6,7 @@#include <linux/compiler.h> #include "../tests.h" -extern void test_rs (uint count); +extern void test_rs (unsigned int count);static volatile sig_atomic_t done; --2.55.0
Quoted 23 lines · Arnaldo Carvalho de Melo
The declaration of the Rust helper
test_rs()uses "uint", a BSD-ism that lives in <sys/types.h>, so on glibc it is only visible by
accident: glibc's <stdlib.h> includes <sys/types.h>, where uint is exposed under__USE_MISC, which is on by default.musl does none of that: its <
stdlib.h> doesn't include <sys/types.h> and it typedefs uint there only when _GNU_SOURCE/_BSD_SOURCE is defined, while nothing else in this translation unit includes <sys/types.h>. Building it on Alpine therefore fails with:
tests/workloads/code_with_type.c:9:21: error: unknown type name 'uint'; did you mean 'int'?tests/workloads/code_with_type.c:39:17: error: implicit declaration of function 'test_rs' [-Wimplicit-function-declaration]The second error is a consequence of the first one: with the declaration at line 9 rejected, the call at line 39 has no prototype, which is an error since gcc 14.
The breakage is only visible when rustc is present, because tests/workloads/Build adds code_with_type.o when
CONFIG_RUST_SUPPORTis detected, andtools/build/featureonly checks for "rustc --version". That is why alpine:3.23 and alpine:3.24 fail while alpine:3.22 and alpine:edge, lacking rustc, build fine and hide it.
Quoted 6 lines
Use unsigned int, which needs no header at all.
Fixes 2e05bb52a12d3 ("perf test workload: Add code_with_type test workload")Cc Dmitrii Dolgov <[email protected]>Assisted-by LLMSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Thanks,
Namhyung
Quoted 20 lines
--- tools/perf/tests/workloads/code_with_type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/workloads/code_with_type.c +1
-1@@ -6,7 +6,7 @@#include <linux/compiler.h> #include "../tests.h" -extern void test_rs (uint count); +extern void test_rs (unsigned int count);static volatile sig_atomic_t done;Signature · 1 line
2.55.0