Conversation
|
Thank you very much for the patch. I backported it to SWIG3 (used by libsigrok due to https://sigrok.org/bugzilla/show_bug.cgi?id=1468) and was able to compile libsigrok. There are few warnings that you might be interested in |
|
The deprecation warnings regarding |
|
Is there a way to find out when a certain Ruby version is supported by |
4fc9ced to
4105416
Compare
| - compiler: gcc | ||
| os: linux | ||
| env: SWIGLANG=ruby VER=2.7.0 | ||
| sudo: required | ||
| dist: xenial |
There was a problem hiding this comment.
I've added in ruby-2.7 testing on Travis to master in 5259082. Can you please remove the changes to .travis.yml and push an updated patch? Then we can then see how your patch performs using 2.7.0p0 on Travis. Thanks.
There was a problem hiding this comment.
Actually Travis ran its tests just fine 3 hours ago with my newly committed change (where "2.7.0" instead of "2.7" is requested), see https://travis-ci.org/swig/swig/jobs/631045861?utm_medium=notification&utm_source=github_status .
Sorry for not stating this good news already. How shall we proceed now?
There was a problem hiding this comment.
Nice one, I don't know how you found that was supported as rvm list known doesn't include 2.7.0p0, just 2.7[.0-preview1]. Anyway, either approach tests what we want which is good.
There was a problem hiding this comment.
Just a gut feeling that there might be some fallback for fully specified version strings. However the final patch does not include that one in favor of your more elaborate solution and to resolve the conflicts.
4105416 to
ffb4a2b
Compare
This commit fixes the signatures of various callback methods and cleans up the macro definitions used for casting callbacks. Note that the transparent version of the macro RUBY_METHOD_FUNC is currently masked behind RUBY_DEVEL, see commit ruby/ruby@1d91fea In order to still support strict signature checking and prevent nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to be replaced with VALUEFUNC.
ffb4a2b to
00e291b
Compare
|
Now I also adapted the code for Ruby global variables for Ruby 2.7 (and it actually became shorter and hopefully easier to read), and fixed the excessive white spaces in the macro definitions (therefore the second push). |
|
I know the existing macros |
|
Ok, makes sense, I will change it. |
|
It really doesn't matter in this case. |
| @@ -110,26 +110,18 @@ | |||
| * can be passed as an argument to API functions like Data_Wrap_Struct() | |||
| * and Data_Make_Struct(). | |||
| */ | |||
There was a problem hiding this comment.
The comment above needs updating. I think the 1st two lines should be replaced with something like:
The following macros are for backwards compatibility and using strictly correct function signatures in C++
when Ruby 2.7 removed ANYARGS and replaced callback function signatures with explicit types.
Is this your understanding as well? Feel free to reword.
There was a problem hiding this comment.
True, I missed that, but I will have to postpone the change until tomorrow...
There was a problem hiding this comment.
Fixed it, and learned something about "function declarators with empty parentheses" (https://stackoverflow.com/a/20835620) used in the Ruby C API for C (not C++) extensively before version 2.7. That's why there is this additional condition regarding C++ in the macro definition block.
The macros for casting function pointers are now fully described and also clarify why the macros act transparently for C even before Ruby 2.7. In addition, an "if (CPlusPlus)" was removed in the code generator for global variables in order to keep the distinction between C and C++ in one place, which is at the definition of said macros.
Because swig 4.0.1 doesn't support Ruby 2.7 yet, stop testing Ruby 2.7. See also: swig/swig#1692
This commit fixes the signatures of various callback methods
based on https://github.com/ruby/ruby/pull/2404/files?file-filters%5B%5D=.h
and cleans up the macro definitions used for casting callbacks.
Note that the transparent version of the macro RUBY_METHOD_FUNC
is currently masked behind RUBY_DEVEL, see commit
ruby/ruby@1d91fea
In order to still support strict signature checking and prevent
nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to
be replaced with VALUEFUNC.
This commit also fixes issue #1689.