Skip to content

Commit a8f0a5b

Browse files
committed
lexer.c: fix initialize function signature
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: | ^~~~~~~~~~~~~~~~ ```
1 parent 6d7477b commit a8f0a5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ext/ios_parser/c_lexer/lexer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static VALUE allocate(VALUE klass) {
201201
return Data_Wrap_Struct(klass, mark, deallocate, lex);
202202
}
203203

204-
static VALUE initialize(VALUE self, VALUE input_text) {
204+
static VALUE initialize(VALUE self) {
205205
LexInfo *lex;
206206
Data_Get_Struct(self, LexInfo, lex);
207207

0 commit comments

Comments
 (0)