From 1de4965018c57bba9b3040b6704c65ecc0cbd77c Mon Sep 17 00:00:00 2001 From: "mark.yang" Date: Wed, 26 Mar 2025 16:34:09 +0900 Subject: [PATCH] cpulimit: fix build with gcc-15 * to fix: Error occurs in gcc 15.0.1 environment. busy.c: In function 'main': busy.c:20:58: error: passing argument 3 of 'pthread_create' from incompatible pointer type [-Wincompatible-pointer-types] 20 | if ((ret = pthread_create(&thread, NULL, loop, NULL)) != 0) | ^~~~ | | | void * (*)(void) In file included from busy.c:3: recipe-sysroot/usr/include/pthread.h:204:36: note: expected 'void * (*)(void *)' but argument is of type 'void * (*)(void)' 204 | void *(*__start_routine) (void *), | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ busy.c:6:7: note: 'loop' declared here 6 | void *loop() | ^~~~ Signed-off-by: mark.yang Signed-off-by: Khem Raj --- ...-Fix-incompatible-pointer-type-error.patch | 51 +++++++++++++++++++ .../recipes-support/cpulimit/cpulimit_0.2.bb | 1 + 2 files changed, 52 insertions(+) create mode 100644 meta-oe/recipes-support/cpulimit/cpulimit/0002-busy.c-Fix-incompatible-pointer-type-error.patch diff --git a/meta-oe/recipes-support/cpulimit/cpulimit/0002-busy.c-Fix-incompatible-pointer-type-error.patch b/meta-oe/recipes-support/cpulimit/cpulimit/0002-busy.c-Fix-incompatible-pointer-type-error.patch new file mode 100644 index 0000000000..c75cbe1950 --- /dev/null +++ b/meta-oe/recipes-support/cpulimit/cpulimit/0002-busy.c-Fix-incompatible-pointer-type-error.patch @@ -0,0 +1,51 @@ +From 86b71c49a373f78920d78c0e88f530f476b4fe70 Mon Sep 17 00:00:00 2001 +From: "mark.yang" +Date: Wed, 26 Mar 2025 15:57:54 +0900 +Subject: [PATCH] busy.c: Fix incompatible pointer type error. + +Error occurs in gcc 15.0.1 environment. +busy.c: In function 'main': +busy.c:20:58: error: passing argument 3 of 'pthread_create' from incompatible pointer type [-Wincompatible-pointer-types] + 20 | if ((ret = pthread_create(&thread, NULL, loop, NULL)) != 0) + | ^~~~ + | | + | void * (*)(void) +In file included from busy.c:3: +recipe-sysroot/usr/include/pthread.h:204:36: note: expected 'void * (*)(void *)' but argument is of type 'void * (*)(void)' + 204 | void *(*__start_routine) (void *), + | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ +busy.c:6:7: note: 'loop' declared here + 6 | void *loop() + | ^~~~ + +Set loop parameter to void* since it requires void* type argument. + +Signed-off-by: mark.yang + +Upstream-Status: Inactive-Upstream [lastcommit: 9 Years ago and lastrelease: 9 Years ago] +--- + tests/busy.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/busy.c b/tests/busy.c +index b3afb7c..2d726eb 100644 +--- a/tests/busy.c ++++ b/tests/busy.c +@@ -3,7 +3,7 @@ + #include + #include + +-void *loop() ++void *loop(void *arg) + { + while(1); + } +@@ -23,7 +23,7 @@ int main(int argc, char **argv) { + exit(1); + } + } +- loop(); ++ loop(NULL); + return 0; + } + \ No newline at end of file diff --git a/meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb b/meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb index f88d3b6ca1..ee2f91343e 100644 --- a/meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb +++ b/meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb @@ -7,6 +7,7 @@ SRCREV ?= "f4d2682804931e7aea02a869137344bb5452a3cd" SRC_URI = "git://github.com/opsengine/cpulimit.git;protocol=https;branch=master \ file://0001-Remove-sys-sysctl.h-and-add-missing-libgen.h-include.patch \ + file://0002-busy.c-Fix-incompatible-pointer-type-error.patch \ " S = "${WORKDIR}/git"