Fix thread arg type for pthread_setname_np#237
Open
ghpzin wants to merge 1 commit inton64dev:masterfrom
Open
Conversation
- change `thread` arg type to `cen64_thread` instead of `cen64_thread *`
(`pthread_t` instead of `pthread_t *`) according to definition of
`pthread_setname_np` from `<pthread.h>`:
`int pthread_setname_np(pthread_t thread, const char *name);`
fixes gcc14 errors:
```
/build/source/cen64.c:475:24: error: passing argument 1 of 'cen64_thread_setname' makes pointer from integer without a cast [-Wint-conversion]
475 | cen64_thread_setname(thread, "device");
| ^~~~~~
| |
| cen64_thread {aka long unsigned int}
In file included from /build/source/device/device.h:26,
from /build/source/cen64.c:15:
/build/source/os/posix/thread.h:59:54: note: expected 'cen64_thread *' {aka 'long unsigned int *'} but argument is of type 'cen64_thread' {aka 'lo>
59 | static inline int cen64_thread_setname(cen64_thread *t, const char *name) {
| ~~~~~~~~~~~~~~^
```
- add cast to `cen64_thread` from NULL where `cen64_thread` is called
with it, fixes gcc14 errors:
```
/build/source/gdb/gdb.c:82:24: error: passing argument 1 of 'cen64_thread_setname' makes integer from pointer without a cast [-Wint-conversion]
82 | cen64_thread_setname(NULL, "gdb");
| ^~~~
| |
| void *
/build/source/os/posix/thread.h:59:53: note: expected 'cen64_thread' {aka 'long unsigned int'} but argument is of type 'void *'
59 | static inline int cen64_thread_setname(cen64_thread t, const char *name) {
| ~~~~~~~~~~~~~^
```
Merged
13 tasks
ghpzin
added a commit
to ghpzin/nixpkgs
that referenced
this pull request
Mar 25, 2025
- add patch from unmerged upstream PR (only `bus/controller.c`, other changes are already applied in master): n64dev/cen64@f13bdf9 fixes error from gcc14: `error: initialization of ... from incompatible pointer type` - add patch from unmerged upstream PR: n64dev/cen64#237 fixes errors from gcc14: `error: passing argument 1 of 'cen64_thread_setname' makes pointer from integer without a cast [-Wint-conversion]` `error: passing argument 1 of 'cen64_thread_setname' makes integer from pointer without a cast [-Wint-conversion]`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
threadarg type tocen64_threadinstead ofcen64_thread *(pthread_tinstead ofpthread_t *) according to definition ofpthread_setname_npfrom<pthread.h>:int pthread_setname_np(pthread_t thread, const char *name);fixes gcc14 errors:
cen64_threadfrom NULL wherecen64_threadis called with it, fixes gcc14 errors:This combined with part from #191:
f13bdf9
adding casts in
bus/controller.c(other changes from that commit seem to be already inmaster) should makecen64build with gcc14