Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build warnings #561

Merged
merged 4 commits into from
Feb 14, 2025
Merged

Fix build warnings #561

merged 4 commits into from
Feb 14, 2025

Conversation

tavip
Copy link
Member

@tavip tavip commented Feb 12, 2025

This patchset fixes a few (benign) build warnings that are triggered with new compilers.

Octavian Purdila (4):
lkl: fix redundant generic-y build warnings
lkl: posix: implement wrapper for timer callback
lkl: posix: add thread wrapper function
lkl: syscalls: use void pointers to store syscall handlers

arch/lkl/include/asm/Kbuild | 43 -------------------
arch/lkl/include/uapi/asm/Kbuild | 1 -
arch/lkl/kernel/syscalls.c | 11 ++---
tools/lkl/lib/posix-host.c | 74 +++++++++++++++++++++++++-------
4 files changed, 65 insertions(+), 64 deletions(-)

Remove a few redundant generic-y statements.

Signed-off-by: Octavian Purdila <[email protected]>
Implement a wrapper for the timer callback to fix the following
compile warning:

lib/posix-host.c:383:42: warning: cast between incompatible \
 function  types from ‘void (*)(void *)’ to ‘void (*)(union sigval)’ \
 [-Wcast-function-type]
  383 |                 .sigev_notify_function = (void (*)(union sigval))fn,
      |                                          ^

Signed-off-by: Octavian Purdila <[email protected]>
Add thread wrapper function. Fixes the following compile warning:

lib/posix-host.c: In function ‘thread_create’:
lib/posix-host.c:195:56: warning: cast between incompatible function \
 types from ‘void (*)(void *)’ to ‘void * (*)(void *)’ [-Wcast-function-type]
  195 |         if (WARN_PTHREAD(pthread_create(&thread, NULL, (void* (*)(void *))fn, arg)))
      |                                                        ^
lib/posix-host.c:77:41: note: in definition of macro ‘WARN_PTHREAD’
   77 | #define WARN_PTHREAD(exp) _warn_pthread(exp, #exp)
      |                                         ^~~

Signed-off-by: Octavian Purdila <[email protected]>
This fixes a bunch of Wcast-function-type compile warnings:

arch/lkl/kernel/syscalls.c:27:35: warning: cast between incompatible function types from ‘long int (*)(pid_t,  pid_t,  int,  long unsigned int,  long unsigned int)’ {aka ‘long int (*)(int,  int,  int,  long unsigned int,  long unsigned int)’} to ‘long int (*)(void)’ [-Wcast-function-type]
   27 | #define __SYSCALL(nr, sym) [nr] = (syscall_handler_t)sym,
      |                                   ^
./include/uapi/asm-generic/unistd.h:662:1: note: in expansion of macro ‘__SYSCALL’
  662 | __SYSCALL(__NR_kcmp, sys_kcmp)
      | ^~~~~~~~~

Signed-off-by: Octavian Purdila <[email protected]>
@tavip tavip force-pushed the fix-build-warnings branch from 9ff627c to 75f1587 Compare February 12, 2025 19:38
@tavip tavip requested a review from thehajime February 12, 2025 20:08
Copy link
Member

@thehajime thehajime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks !

@thehajime thehajime merged commit 1848ab8 into lkl:master Feb 14, 2025
13 of 14 checks passed
@ddiss
Copy link

ddiss commented Feb 14, 2025

A little late here, sorry, but I think it should be possible to drop the extra heap alloc/free for posix timers by removing the unused callback parameter. I'll submit a new PR...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants