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 incompatible function pointer types issue #1263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chenrui333
Copy link

While upgrading rust to the latest release, saw the incompatible pointer type issue when building against latest xcode.

util/events/libuv/Process.c:29:51: error: incompatible function pointer types passing 'Process_OnExitCallback' (aka 'void (*)(long long, int)') to parameter of type 'void (*)(long, int)' [-Wincompatible-function-pointer-types]
    return Rffi_spawn(binaryPath, args, i, alloc, callback);
                                                  ^~~~~~~~
./rust/cjdns_sys/Rffi.h:127:27: note: passing argument to parameter 'cb' here
                   void (*cb)(long, int));
                          ^

```
util/events/libuv/Process.c:29:51: error: incompatible function pointer types passing 'Process_OnExitCallback' (aka 'void (*)(long long, int)') to parameter of type 'void (*)(long, int)' [-Wincompatible-function-pointer-types]
    return Rffi_spawn(binaryPath, args, i, alloc, callback);
                                                  ^~~~~~~~
./rust/cjdns_sys/Rffi.h:127:27: note: passing argument to parameter 'cb' here
                   void (*cb)(long, int));
                          ^
```

Signed-off-by: Rui Chen <[email protected]>
@chenrui333
Copy link
Author

cc @cjdelisle

@@ -18,6 +18,11 @@
#include "util/Bits.h"
#include "util/Identity.h"

void Process_OnExitCallbackWrapper(long pid, int exitCode) {
long long pidLongLong = (long long) pid;
Copy link
Owner

Choose a reason for hiding this comment

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

Should be casted to an int64_t because that is not guaranteed to be a long long. On 64 bit machines it is usually a long and I believe on some machines it is possible that long long is uint128_t.

@cjdelisle
Copy link
Owner

Please note that in crashey branch, this logic is already gone because libuv is gone.

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