-
Notifications
You must be signed in to change notification settings - Fork 220
Fix error at Ruby CI #2445
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
Fix error at Ruby CI #2445
Conversation
src/lexstate.c
Outdated
rbs_token_t NullToken = { .type = NullType, .range = {} }; | ||
rbs_token_t NullToken = { .type = NullType, .range = {0} }; |
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.
You'll need to make the same change in 2 other places:
Line 3418 in 6c08f20
.constant_pool = {}, |
rbs/src/util/rbs_constant_pool.c
Line 99 in 6c08f20
static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = {}; |
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.
Can't we reuse NULL_RANGE
defined 3 lines under if we move the line?
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.
Reusing NULL_RANGE
didn't work with clang-15, on GitHub Actions... 😢
``` error C2059: syntax error: '}' ```
405356c
to
5f78a6b
Compare
I've been trying a CI task to compile the library without C23 extensions, but not finished yet... |
8df7b12
to
ccdef8b
Compare
@@ -106,3 +106,31 @@ jobs: | |||
- run: bundle exec rake test:valgrind | |||
env: | |||
RUBY_FREE_AT_EXIT: 1 | |||
C99_compile: |
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.
This job compiles the extension without C23 extensions to ensure it compiles with C99 compilers.
To compile it with clang
, not gcc
, the macos platform is used.
@@ -0,0 +1,10 @@ | |||
#ifdef __clang__ |
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.
Including ruby.h
caused compilation errors without C23 extensions. This macro is to suppress diagnostics in the header files.
@@ -183,4 +183,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan | |||
return ID2SYM(rb_intern3((const char *) constant->start, constant->length, ctx.encoding)); | |||
} | |||
} | |||
|
|||
rb_raise(rb_eRuntimeError, "Unknown node type: %d", instance->type); |
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.
GCC reports warning: control reaches end of non-void function [-Wreturn-type]
diagnostic here.
@@ -13,5 +13,9 @@ | |||
|
|||
append_cflags ['-std=gnu99', '-Wimplicit-fallthrough', '-Wunused-result'] | |||
append_cflags ['-O0', '-g'] if ENV['DEBUG'] | |||
if ENV["TEST_NO_C23"] |
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.
Using append_cflags
doesn't work because the compilation with -Wc2x-extensions
fails. (I guess this is because ruby.h
issues diagnostics without C23 extensions.)
This PR is to fix build errors which is reported in ruby/ruby#13237.
compile_c99
Rake task