ruby-changes:64627
From: Nobuyoshi <ko1@a...>
Date: Sun, 27 Dec 2020 17:51:50 +0900 (JST)
Subject: [ruby-changes:64627] 260d626ef6 (master): Ignore symbols declared in the platform header
https://git.ruby-lang.org/ruby.git/commit/?id=260d626ef6 From 260d626ef69336530b636e2b14b75479f869e8dc Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 27 Dec 2020 14:58:00 +0900 Subject: Ignore symbols declared in the platform header diff --git a/template/Makefile.in b/template/Makefile.in index f5a3149..1f91152 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -684,4 +684,4 @@ mjit_build_dir.$(SOEXT): $(MJIT_MIN_HEADER) $(srcdir)/ruby-runner.c ruby-runner. https://github.com/ruby/ruby/blob/trunk/template/Makefile.in#L684 # yes-test-basic: leaked-globals leaked-globals: $(COMMONOBJS) prog $(tooldir)/leaked-globals PHONY - $(Q) $(XRUBY) $(tooldir)/leaked-globals NM=$(NM) SYMBOL_PREFIX=$(SYMBOL_PREFIX) $(srcdir)/configure.ac $(COMMONOBJS) + $(Q) $(XRUBY) $(tooldir)/leaked-globals NM=$(NM) SYMBOL_PREFIX=$(SYMBOL_PREFIX) PLATFORM=$(hdrdir)/ruby/$(PLATFORM_DIR).h $(srcdir)/configure.ac $(COMMONOBJS) diff --git a/tool/leaked-globals b/tool/leaked-globals index 0d8c3c4..7ed81b1 100755 --- a/tool/leaked-globals +++ b/tool/leaked-globals @@ -7,6 +7,8 @@ until ARGV.empty? https://github.com/ruby/ruby/blob/trunk/tool/leaked-globals#L7 SYMBOL_PREFIX = $1 when /\ANM=(.*)/ # may be multiple words NM = $1 + when /\APLATFORM=(.+)?/ + platform = $1 else break end @@ -20,6 +22,19 @@ config_code = File.read(config) https://github.com/ruby/ruby/blob/trunk/tool/leaked-globals#L22 REPLACE = config_code.scan(/\bAC_(?:REPLACE|CHECK)_FUNCS?\((\w+)/).flatten # REPLACE << 'memcmp' if /\bAC_FUNC_MEMCMP\b/ =~ config_code REPLACE.push('main', 'DllMain') +if platform and !platform.empty? + begin + h = File.read(platform) + rescue Errno::ENOENT + else + REPLACE.concat( + h .gsub(%r[/\*.*?\*/]m, " ") # delete block comments + .gsub(%r[//.*], ' ') # delete oneline comments + .gsub(/^\s*#.*(?:\\\n.*)*/, "") # delete preprocessor directives + .scan(/\b((?!rb_|DEPRECATED|_)\w+)\s*\(.*\);/) + .flatten) + end +end missing = File.dirname(config) + "/missing/" ARGV.reject! do |n| unless (src = Dir.glob(missing + File.basename(n, ".*") + ".[cS]")).empty? -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/