mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ignore symbols declared in the platform header
This commit is contained in:
parent
366b58d7ca
commit
260d626ef6
2 changed files with 16 additions and 1 deletions
|
@ -684,4 +684,4 @@ mjit_build_dir.$(SOEXT): $(MJIT_MIN_HEADER) $(srcdir)/ruby-runner.c ruby-runner.
|
|||
|
||||
# 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)
|
||||
|
|
|
@ -7,6 +7,8 @@ until ARGV.empty?
|
|||
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)
|
|||
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?
|
||||
|
|
Loading…
Add table
Reference in a new issue