-
Notifications
You must be signed in to change notification settings - Fork 1
fix: compilation of ios_parser on Ruby 3.1+ #13
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
Conversation
Fix initialize function signature for Ruby 3.x compatibility where the
arity checks are enforced. This is done by removing unused input_text
parameter to match arity 0 declaration.
Fixes:
```
In file included from /usr/local/include/ruby-3.1.0/ruby/ruby.h:26,
from /usr/local/include/ruby-3.1.0/ruby.h:38,
from ../../../../ext/ios_parser/c_lexer/lexer.c:1:
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'Init_c_lexer':
/usr/local/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: error: passing argument 3 of 'rb_define_method_00' from incompatible pointer type [-Wincompatible-pointer-types]
287 | , mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
| ^~~~~~
| |
| VALUE (*)(VALUE, VALUE) {aka long unsigned int (*)(long unsigned int, long unsigned int)}
../../../../ext/ios_parser/c_lexer/lexer.c:610:5: note: in expansion of macro 'rb_define_method'
610 | rb_define_method(rb_cCLexer, "initialize", initialize, 0);
/usr/local/include/ruby-3.1.0/ruby/internal/anyargs.h:276:21: note: expected 'VALUE (*)(VALUE)' {aka 'long unsigned int (*)(long unsigned int)'} but argument is of type 'VALUE (*)(VALUE, VALUE)' {aka 'long unsigned int (*)(long unsigned int, long unsigned int)'}
276 | RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
| ^~~~~~~~~~~~~~~~
/usr/local/include/ruby-3.1.0/ruby/internal/anyargs.h:254:41: note: in definition of macro 'RBIMPL_ANYARGS_DECL'
254 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
| ^~~
At top level: | ^~~~~~~~~~~~~~~~
```
Fixes:
```
compiling ../../../../ext/ios_parser/c_lexer/lexer.c
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_word':
../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
41 | #define IS_DIGIT(C) '0' <= C && C <= '9'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT'
43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C)
| ^~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD'
306 | if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD'
306 | if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:306:9: note: in expansion of macro 'IS_WORD'
306 | if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_decimal':
../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
41 | #define IS_DIGIT(C) '0' <= C && C <= '9'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT'
43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C)
| ^~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD'
320 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD'
320 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:320:16: note: in expansion of macro 'IS_WORD'
320 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_integer':
../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
41 | #define IS_DIGIT(C) '0' <= C && C <= '9'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT'
43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C)
| ^~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD'
342 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD'
342 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:342:16: note: in expansion of macro 'IS_WORD'
342 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'is_banner_end_char':
../../../../ext/ios_parser/c_lexer/lexer.c:408:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
408 | (0 < lex->pos && '\n' == lex->text[lex->pos - 1] ||
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c: In function 'process_root':
../../../../ext/ios_parser/c_lexer/lexer.c:41:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
41 | #define IS_DIGIT(C) '0' <= C && C <= '9'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:43:25: note: in expansion of macro 'IS_DIGIT'
43 | #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C)
| ^~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:25: note: in expansion of macro 'IS_DECIMAL'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD'
519 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:34: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD'
519 | } else if (IS_WORD(c)) {
| ^~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:44:58: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
44 | #define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z'
| ~~~~~~~~~^~~~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:46:42: note: in expansion of macro 'IS_LETTER'
46 | #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C)
| ^~~~~~~~~
../../../../ext/ios_parser/c_lexer/lexer.c:519:16: note: in expansion of macro 'IS_WORD'
519 | } else if (IS_WORD(c)) {
| ^~~~~~~
```
1bd079a to
d656931
Compare
d656931 to
735a97f
Compare
|
Hi again BM, happy to take on maintainership duties if it helps. |
bjmllr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
|
Hey folks, hope you had some happy holidays! Released as 0.9.1 at https://rubygems.org/gems/ios_parser/versions/0.9.1 Send me an email if you want push access on rubygems.org - my username at my username dot com |
Hello @bjmllr ! :-)
This PR fixes function signature for
initializemethod so that the gem compiles with newer versions of ruby.The second commit is mostly to silence the
-Wparentheseswarnings.If you could release new version post-merge, I'd greatly appreciate your help.
thanks,
Marek