Skip to content

Conversation

@stevekeay
Copy link

lexer.new is called without arguments, and is defined with a stated arity of zero in the C code:

rb_define_method(rb_cCLexer, "initialize", initialize, 0);

On this basis, the function signature appears to be incorrect. Removing the superfluous parameter fixes a build error that prevented this gem from being built on recent build environments.

stevekeay added 2 commits July 4, 2025 11:50
lexer.new is called without arguments, and is defined with a stated
arity of zero in the C code.  On this basis, the function signature was
incorrect.  Removing the superfluous parameter fixes the following build
error on debian trixie:

In file included from /builder/.asdf/installs/ruby/3.4.4/include/ruby-3.4.0/ruby/ruby.h:27:
/builder/.asdf/installs/ruby/3.4.4/include/ruby-3.4.0/ruby/internal/anyargs.h:291:135: error: passing argument 3 of ‘rb_define_method_00’ from incompatible pointer type [-Wincompatible-pointer-types]
  291 | #define rb_define_method(klass, 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);
      |     ^~~~~~~~~~~~~~~~
/builder/.asdf/installs/ruby/3.4.4/include/ruby-3.4.0/ruby/internal/anyargs.h:280: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)’}
  280 | RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
      |                     ^~~~~~~~~~~~~~~~
/builder/.asdf/installs/ruby/3.4.4/include/ruby-3.4.0/ruby/internal/anyargs.h:258:41: note: in definition of macro ‘RBIMPL_ANYARGS_DECL’
  258 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
      |                                         ^~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
gmake: *** [Makefile:251: lexer.o] Error 1
rake aborted!
@stevekeay stevekeay closed this Jul 17, 2025
@stevekeay stevekeay deleted the fix-c-lexer branch July 17, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant