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

posix_serialport_impl.c: error: incompatible pointer to integer #74

Open
listout opened this issue Jul 22, 2023 · 3 comments
Open

posix_serialport_impl.c: error: incompatible pointer to integer #74

listout opened this issue Jul 22, 2023 · 3 comments

Comments

@listout
Copy link

listout commented Jul 22, 2023

Clang 15 has enabled -Werror=int-conversion by default. Hence, we now get

posix_serialport_impl.c:113:13: error: incompatible pointer to integer
conversion passing 'struct RFile *' to parameter of type 'VALUE'
(aka 'unsigned long') [-Wint-conversion]
OBJSETUP(sp, class, T_FILE);
^~
This commit should fix this build error.

First discovered: https://bugs.gentoo.org/883127

diff --git a/ext/native/posix_serialport_impl.c b/ext/native/posix_serialport_impl.c
index 2f9325e..b43be30 100644
--- a/ext/native/posix_serialport_impl.c
+++ b/ext/native/posix_serialport_impl.c
@@ -110,7 +110,7 @@ VALUE sp_create_impl(class, _port)
    struct termios params;
 
    NEWOBJ(sp, struct RFile);
-   OBJSETUP(sp, class, T_FILE);
+   OBJSETUP((VALUE)sp, class, T_FILE);
    MakeOpenFile((VALUE) sp, fp);
 
    switch(TYPE(_port))

Fixes it.

Would love to send in PR, just don't have a access to fork the repo.

@natpicone
Copy link

@hparra Do you have a plan to fix this?

@tenderlove
Copy link
Collaborator

If you need to do serial port work, please try this gem. I don't want to maintain the serialport gem anymore and have developed an alternative

@larskanis
Copy link

As a quick workaround you can use either:
gem install serialport -- --with-cflags=-Wno-int-conversion
or with bundler:
bundle config build.serialport -- --with-cflags=-Wno-int-conversion

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

No branches or pull requests

4 participants