hparra / ruby-serialport

ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports

Home Page:http://rubygems.org/gems/serialport

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

posix_serialport_impl.c: error: incompatible pointer to integer

listout opened this issue · comments

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.

@hparra Do you have a plan to fix this?

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