Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
uses: cygwin/cygwin-install-action@master
with:
packages: ruby gcc-core make autoconf libtool libssl-devel libyaml-devel libffi-devel zlib-devel rubygems
site: |
https://cygwin.osuosl.org/
- name: configure
run: |
Expand Down
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4342,8 +4342,7 @@ AS_IF([test -n "${LIBS}"], [
MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'`
])
LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)"
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
CPPFLAGS="$CPPFLAGS "'$(DEFS) ${cppflags}'
AS_IF([test -n "${cflags+set}"], [
cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'`
CFLAGS=`echo " $CFLAGS " | sed "s|$cflagspat"'|${cflags}|;s/^ *//;s/ *$//'`
Expand Down
10 changes: 5 additions & 5 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ setup_debug_log_filter(void)

if (len >= MAX_DEBUG_LOG_FILTER_LEN) {
fprintf(stderr, "too long: %s (max:%d)\n", str, MAX_DEBUG_LOG_FILTER_LEN - 1);
exit(1);
exit(EXIT_FAILURE);
}

// body
Expand Down Expand Up @@ -396,7 +396,7 @@ setup_debug_log(void)
debug_log.mem = (char *)malloc(MAX_DEBUG_LOG * MAX_DEBUG_LOG_MESSAGE_LEN);
if (debug_log.mem == NULL) {
fprintf(stderr, "setup_debug_log failed (can't allocate memory)\n");
exit(1);
exit(EXIT_FAILURE);
}
ruby_debug_log_mode |= ruby_debug_log_memory;
}
Expand Down Expand Up @@ -424,7 +424,7 @@ setup_debug_log(void)
break;
default:
fprintf(stderr, "can not parse RUBY_DEBUG_LOG filename: %s\n", log_config);
exit(1);
exit(EXIT_FAILURE);
}
}
else {
Expand All @@ -433,13 +433,13 @@ setup_debug_log(void)

if (j >= DEBUG_LOG_MAX_PATH) {
fprintf(stderr, "RUBY_DEBUG_LOG=%s is too long\n", log_config);
exit(1);
exit(EXIT_FAILURE);
}
}

if ((debug_log.output = fopen(debug_log.output_file, "w")) == NULL) {
fprintf(stderr, "can not open %s for RUBY_DEBUG_LOG\n", log_config);
exit(1);
exit(EXIT_FAILURE);
}
setvbuf(debug_log.output, NULL, _IONBF, 0);
}
Expand Down
6 changes: 3 additions & 3 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ ruby_modular_gc_init(void)
break;
default:
fprintf(stderr, "Only alphanumeric, dash, and underscore is allowed in "RUBY_GC_LIBRARY"\n");
exit(1);
exit(EXIT_FAILURE);
}
}

Expand Down Expand Up @@ -761,7 +761,7 @@ ruby_modular_gc_init(void)
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
if (!handle) {
fprintf(stderr, "ruby_modular_gc_init: Shared library %s cannot be opened: %s\n", gc_so_path, dlerror());
exit(1);
exit(EXIT_FAILURE);
}

gc_functions.modular_gc_loaded_p = true;
Expand All @@ -773,7 +773,7 @@ ruby_modular_gc_init(void)
gc_functions.name = dlsym(handle, func_name); \
if (!gc_functions.name) { \
fprintf(stderr, "ruby_modular_gc_init: %s function not exported by library %s\n", func_name, gc_so_path); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} \
else { \
Expand Down
2 changes: 1 addition & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -8079,7 +8079,7 @@ popen_finish(VALUE port, VALUE klass)
rb_protect(rb_yield, Qnil, NULL);
rb_io_flush(rb_ractor_stdout());
rb_io_flush(rb_ractor_stderr());
_exit(0);
_exit(EXIT_SUCCESS);
}
return Qnil;
}
Expand Down
9 changes: 3 additions & 6 deletions lib/bundled_gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,10 @@ def self.warning?(name, specs: nil)
return if specs.include?(name)

# Don't warn if a hyphenated gem provides this feature
# (e.g., benchmark-ips provides benchmark/ips, not the benchmark gem)
# (e.g., benchmark-ips provides benchmark/ips, benchmark/timing, etc.)
if subfeature
feature_parts = feature.split("/")
if feature_parts.size >= 2
hyphenated_gem = "#{feature_parts[0]}-#{feature_parts[1]}"
return if specs.include?(hyphenated_gem)
end
prefix = feature.split("/").first + "-"
return if specs.any? { |spec, _| spec.start_with?(prefix) }
end

return if WARNED[name]
Expand Down
12 changes: 11 additions & 1 deletion template/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,17 @@ _PREFIXED_SYMBOL = TOKEN_PASTE($(SYMBOL_PREFIX),name)

.d.h:
@$(ECHO) translating probes $<
$(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) $(CPPFLAGS) -s $<
$(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) `echo "$(CPPFLAGS)" | \
sed -e "s/^/\n/" \
-e ": loop" \
-e " s/\n\(\('[^']*'\|[^ ']*\)*\)/\1\n/" \
-e " /^\(-[DU]\|'-[DU]\).*/P" \
-e " s/^..*\n/\n/" \
-e " T" \
-e " s/\n */\n/" \
-e "t loop" \
-e "s/.*//" \
` -s $<
$(Q) sed -e 's/RUBY_/RUBY_DTRACE_/g' -e 's/PROBES_H_TMP/RUBY_PROBES_H/' -e 's/(char \*/(const char */g' -e 's/, char \*/, const char */g' $@.tmp > $@
$(Q) $(RM) $@.tmp

Expand Down
7 changes: 1 addition & 6 deletions test/prism/ruby/ruby_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,11 @@ class RubyParserTest < TestCase

"3.3-4.0/void_value.txt",

"3.4/circular_parameters.txt",

"4.0/endless_methods_command_call.txt",
"4.0/leading_logical.txt",

# https://bugs.ruby-lang.org/issues/21168#note-5
"command_method_call_2.txt",
]

Fixture.each(except: failures) do |fixture|
Fixture.each_for_version(version: "3.3", except: failures) do |fixture|
define_method(fixture.test_name) do
assert_ruby_parser(fixture, todos.include?(fixture.path))
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_bundled_gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def test_no_warning_for_hyphenated_gem
assert_nil Gem::BUNDLED_GEMS.warning?("benchmark/ips", specs: {"benchmark-ips" => true})
end

def test_no_warning_for_subfeatures_of_hyphenated_gem
# When benchmark-ips gem is in specs, requiring any "benchmark/*" subfeature
# should not warn, since hyphenated gems may provide multiple files
# (e.g., benchmark-ips provides benchmark/ips, benchmark/timing, benchmark/compare)
assert_nil Gem::BUNDLED_GEMS.warning?("benchmark/timing", specs: {"benchmark-ips" => true})
assert_nil Gem::BUNDLED_GEMS.warning?("benchmark/compare", specs: {"benchmark-ips" => true})
end

def test_warning_without_hyphenated_gem
# When benchmark-ips is NOT in specs, requiring "benchmark/ips" should warn
warning = Gem::BUNDLED_GEMS.warning?("benchmark/ips", specs: {})
Expand Down