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

Use the correct type for function passed to pthread_create. #1171

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

gordonmessmer
Copy link
Contributor

Description

This patch modifies the thread function in two test files, so that it matches the expected prototype for an argument to pthread_create. This fixes a build failure with gcc 15:

heap-non-main.c: In function ‘main’:
heap-non-main.c:27:40: error: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types]
   27 |         pthread_create(&thread1, NULL, thread, NULL);
      |                                        ^~~~~~
      |                                        |
      |                                        void * (*)(void)
In file included from heap-non-main.c:8:
/usr/include/pthread.h:204:36: note: expected ‘void * (*)(void *)’ but argument is of type ‘void * (*)(void)’
  204 |                            void *(*__start_routine) (void *),
      |                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
heap-non-main.c:11:7: note: ‘thread’ declared here
   11 | void *thread()
      |       ^~~~~~

Checklist

  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • If my change adds new code, adequate tests have been added.
  • I have read and agree to the CONTRIBUTING document.

Copy link

🤖 Coverage update for bf0a6db 🟢

Old New
Commit 7638efe bf0a6db
Score 71.1152% 71.1152% (0)

@Grazfather Grazfather merged commit c430473 into hugsy:main Feb 12, 2025
7 checks passed
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.

2 participants