diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index d5e6aae8bc6726..0e3b2e17c29927 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -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: | diff --git a/configure.ac b/configure.ac index 2d9ccf1442920e..31b90fb664ecd9 100644 --- a/configure.ac +++ b/configure.ac @@ -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/ *$//'` diff --git a/debug.c b/debug.c index 1a2c27a5be5e15..730f860e7af988 100644 --- a/debug.c +++ b/debug.c @@ -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 @@ -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; } @@ -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 { @@ -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); } diff --git a/gc.c b/gc.c index 4e1bb39e21f0b9..c0f8eebbab0137 100644 --- a/gc.c +++ b/gc.c @@ -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); } } @@ -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; @@ -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 { \ diff --git a/io.c b/io.c index cf95db70df961e..0ac78e96cca28d 100644 --- a/io.c +++ b/io.c @@ -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; } diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 85f23b2596bed7..403d80b48cd91f 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -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] diff --git a/template/Makefile.in b/template/Makefile.in index 0b7b50e3aa3340..8e93efc310cd97 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -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 diff --git a/test/prism/ruby/ruby_parser_test.rb b/test/prism/ruby/ruby_parser_test.rb index 6e4ba8ce16f25f..25107978f3828c 100644 --- a/test/prism/ruby/ruby_parser_test.rb +++ b/test/prism/ruby/ruby_parser_test.rb @@ -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 diff --git a/test/test_bundled_gems.rb b/test/test_bundled_gems.rb index 6e25df9b01f82d..e44c8348adc7bf 100644 --- a/test/test_bundled_gems.rb +++ b/test/test_bundled_gems.rb @@ -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: {})