diff mbox series

[meta-oe] cpulimit: fix build with gcc-15

Message ID 20250326073409.3683022-1-mark.yang@lge.com
State Accepted
Headers show
Series [meta-oe] cpulimit: fix build with gcc-15 | expand

Commit Message

mark yang March 26, 2025, 7:34 a.m. UTC
From: "mark.yang" <mark.yang@lge.com>

* 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 <mark.yang@lge.com>
---
 ...-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 mbox series

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" <mark.yang@lge.com>
+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 <mark.yang@lge.com>
+
+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 <pthread.h>
+ #include <unistd.h>
+ 
+-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"