From a8f0a5bb5ac48b0d3067c8f741ef31f87405314d Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Thu, 18 Dec 2025 10:45:47 +0000 Subject: [PATCH 1/4] 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: | ^~~~~~~~~~~~~~~~ ``` --- ext/ios_parser/c_lexer/lexer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ios_parser/c_lexer/lexer.c b/ext/ios_parser/c_lexer/lexer.c index 3c056c7..df65401 100644 --- a/ext/ios_parser/c_lexer/lexer.c +++ b/ext/ios_parser/c_lexer/lexer.c @@ -201,7 +201,7 @@ static VALUE allocate(VALUE klass) { return Data_Wrap_Struct(klass, mark, deallocate, lex); } -static VALUE initialize(VALUE self, VALUE input_text) { +static VALUE initialize(VALUE self) { LexInfo *lex; Data_Get_Struct(self, LexInfo, lex); From 6046db1567eb453bffd6e9d40d2892459c21e0f9 Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Thu, 18 Dec 2025 10:54:21 +0000 Subject: [PATCH 2/4] fix: parentheses warnings 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)) { | ^~~~~~~ ``` --- ext/ios_parser/c_lexer/lexer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/ios_parser/c_lexer/lexer.c b/ext/ios_parser/c_lexer/lexer.c index df65401..d5601e8 100644 --- a/ext/ios_parser/c_lexer/lexer.c +++ b/ext/ios_parser/c_lexer/lexer.c @@ -38,10 +38,10 @@ typedef struct LexInfo LexInfo; #define IS_SPACE(C) C == ' ' || C == '\t' || C == '\r' #define IS_NEWLINE(C) C == '\n' #define IS_COMMENT(C) C == '!' -#define IS_DIGIT(C) '0' <= C && C <= '9' +#define IS_DIGIT(C) (('0' <= C) && (C <= '9')) #define IS_DOT(C) C == '.' #define IS_DECIMAL(C) IS_DIGIT(C) || IS_DOT(C) -#define IS_LETTER(C) 'a' <= C && C <= 'z' || 'A' <= C && C <= 'Z' +#define IS_LETTER(C) (('a' <= C) && (C <= 'z')) || (('A' <= C) && (C <= 'Z')) #define IS_PUNCT(C) strchr("-+$:/,()|*#=<>!\"\\&@;%~{}'\"?[]_^`", C) #define IS_WORD(C) IS_DECIMAL(C) || IS_LETTER(C) || IS_PUNCT(C) #define IS_LEAD_ZERO(C) C == '0' @@ -405,7 +405,7 @@ static void start_certificate(LexInfo *lex) { int is_banner_end_char(LexInfo *lex) { return CURRENT_CHAR(lex) == lex->banner_delimiter && - (0 < lex->pos && '\n' == lex->text[lex->pos - 1] || + ((0 < lex->pos && '\n' == lex->text[lex->pos - 1]) || '\n' == lex->text[lex->pos + 1]); } From 735a97f189e26e43baf0b510bec19b154ed1b676 Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Thu, 18 Dec 2025 11:04:01 +0000 Subject: [PATCH 3/4] CI: drop unsupported jruby versions Reference: https://github.com/ruby/setup-ruby?tab=readme-ov-file#supported-versions Specific combinations: https://github.com/ruby/ruby-builder/releases/tag/toolcache --- .github/workflows/ruby.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index b5732e1..98954cf 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -18,7 +18,7 @@ permissions: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: ruby-version: @@ -32,9 +32,8 @@ jobs: - '2.7' - '3.0' - '3.1' - - jruby-9.1.17.0 - - jruby-9.2.21.0 - - jruby-9.3.6.0 + - jruby-9.4.7.0 + - jruby-10.0.2.0 steps: - uses: actions/checkout@v3 From 66d6492a32cc690b608855a65018efff9aefad9f Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Thu, 18 Dec 2025 11:22:59 +0000 Subject: [PATCH 4/4] bump version to 0.9.1 --- lib/ios_parser/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ios_parser/version.rb b/lib/ios_parser/version.rb index 658d7ad..7c2b07b 100644 --- a/lib/ios_parser/version.rb +++ b/lib/ios_parser/version.rb @@ -1,7 +1,7 @@ module IOSParser class << self def version - '0.9.0' + '0.9.1' end end end