pm-qa: fix build with gcc-15.0.1

* fix following error:
  http://errors.yoctoproject.org/Errors/Details/850314
    utils/uevent_reader.c: In function 'main':
    utils/uevent_reader.c:33:24: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
    33 |         signal(SIGINT, exit_handler);
        |                        ^~~~~~~~~~~~
        |                        |
        |                        void (*)(void)
    In file included from utils/uevent_reader.c:4:
    TOPDIR/tmp/work/core2-64-oe-linux/pm-qa/0.5.2/recipe-sysroot/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
    88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
        |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
    utils/uevent_reader.c:15:6: note: 'exit_handler' declared here
    15 | void exit_handler()
        |      ^~~~~~~~~~~~
    TOPDIR/tmp/work/core2-64-oe-linux/pm-qa/0.5.2/recipe-sysroot/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
    72 | typedef void (*__sighandler_t) (int);
        |                ^~~~~~~~~~~~~~
    make: *** [<builtin>: utils/uevent_reader] Error 1

  Set PATCHTOOL to git because this recipe compiles all .c files including those in .pc/ directory which causes build errors.
  .pc/0001-fix-build-with-gcc-15-Wincompatible-pointer-types-er.patch/utils/uevent_reader.c:15:6: note: 'exit_handler' declared here
   15 | void exit_handler()

Signed-off-by: mark.yang <mark.yang@lge.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
mark.yang
2025-04-02 17:56:30 +09:00
committed by Khem Raj
parent b0b2efe4e4
commit a0b88afd79
2 changed files with 75 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
From b6b968d1c8fbba79b33d63874b551225e663435e Mon Sep 17 00:00:00 2001
From: "mark.yang" <mark.yang@lge.com>
Date: Wed, 2 Apr 2025 16:59:00 +0900
Subject: [PATCH] fix build with gcc-15 -Wincompatible-pointer-types error
See more details: http://errors.yoctoproject.org/Errors/Details/850314
utils/uevent_reader.c:33:24: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
33 | signal(SIGINT, exit_handler);
| ^~~~~~~~~~~~
| |
| void (*)(void)
In file included from utils/uevent_reader.c:4:
TOPDIR/tmp/work/core2-64-oe-linux/pm-qa/0.5.2/recipe-sysroot/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
| ~~~~~~~~~~~~~~~^~~~~~~~~
utils/uevent_reader.c:15:6: note: 'exit_handler' declared here
15 | void exit_handler()
| ^~~~~~~~~~~~
TOPDIR/tmp/work/core2-64-oe-linux/pm-qa/0.5.2/recipe-sysroot/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
72 | typedef void (*__sighandler_t) (int);
| ^~~~~~~~~~~~~~
* Set the parameter of exit_handler() to int.
Changed to use exit_handler(0).
The parameter is not used inside exit_handler() anyway.
Upstream-Status: Inactive-Upstream [lastrelease: 6 years ago]
Signed-off-by: mark.yang <mark.yang@lge.com>
---
utils/uevent_reader.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/utils/uevent_reader.c b/utils/uevent_reader.c
index afbb426..75d445c 100644
--- a/utils/uevent_reader.c
+++ b/utils/uevent_reader.c
@@ -12,7 +12,7 @@
FILE *fp;
-void exit_handler()
+void exit_handler(int sig)
{
fprintf(stdout, "exiting from uevent reader...\n");
fclose(fp);
@@ -42,20 +42,20 @@ int main(int argc, char *argv[])
pfd.fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (pfd.fd == -1) {
perror("error: socket()");
- exit_handler();
+ exit_handler(0);
}
if (bind(pfd.fd, (struct sockaddr *) &nls,
sizeof(struct sockaddr_nl))) {
perror("error : bind()");
- exit_handler();
+ exit_handler(0);
}
while (-1 != poll(&pfd, 1, -1)) {
int i, len = recv(pfd.fd, buf, sizeof(buf), MSG_DONTWAIT);
if (len == -1) {
perror("error : recv()");
- exit_handler();
+ exit_handler(0);
}
i = 0;

View File

@@ -10,12 +10,17 @@ BRANCH ?= "master"
SRCREV = "05710ec5032be4c8edafb4109d4d908d31243906"
SRC_URI = "git://git.linaro.org/power/pm-qa.git;protocol=git;branch=${BRANCH}"
SRC_URI = " \
git://git.linaro.org/power/pm-qa.git;protocol=git;branch=${BRANCH} \
file://0001-fix-build-with-gcc-15-Wincompatible-pointer-types-er.patch \
"
S = "${WORKDIR}/git"
CFLAGS += "-pthread"
PATCHTOOL = "git"
do_compile () {
# Find all the .c files in this project and build them.
for x in `find . -name "*.c"`