ruby-serialport icon indicating copy to clipboard operation
ruby-serialport copied to clipboard

posix_serialport_impl.c: error: incompatible pointer to integer

Open listout opened this issue 2 years ago • 3 comments
trafficstars

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.

listout avatar Jul 22 '23 15:07 listout

@hparra Do you have a plan to fix this?

natpicone avatar Oct 27 '23 13:10 natpicone

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

tenderlove avatar Feb 15 '24 17:02 tenderlove

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

larskanis avatar Sep 23 '24 12:09 larskanis