ruby-serialport
ruby-serialport copied to clipboard
posix_serialport_impl.c: error: incompatible pointer to integer
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.
@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
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