зеркало из https://github.com/github/ruby.git
tool/leaked-globals: ignore function typedef [ci skip]
This commit is contained in:
Родитель
06b62cbbdd
Коммит
418b03c750
|
@ -704,4 +704,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) PLATFORM=$(hdrdir)/ruby/$(PLATFORM_DIR).h $(srcdir)/configure.ac $(COMMONOBJS)
|
||||
$(Q) $(XRUBY) $(tooldir)/leaked-globals NM="$(NM) -Pgp" SYMBOL_PREFIX=$(SYMBOL_PREFIX) PLATFORM=$(hdrdir)/ruby/$(PLATFORM_DIR).h $(srcdir)/configure.ac $(COMMONOBJS)
|
||||
|
|
|
@ -29,8 +29,9 @@ if platform and !platform.empty?
|
|||
else
|
||||
REPLACE.concat(
|
||||
h .gsub(%r[/\*.*?\*/]m, " ") # delete block comments
|
||||
.gsub(%r[//.*], ' ') # delete oneline comments
|
||||
.gsub(%r[//.*], " ") # delete oneline comments
|
||||
.gsub(/^\s*#.*(?:\\\n.*)*/, "") # delete preprocessor directives
|
||||
.gsub(/(?:\A|;)\K\s*typedef\s.*?;/m, "")
|
||||
.scan(/\b((?!rb_|DEPRECATED|_)\w+)\s*\(.*\);/)
|
||||
.flatten)
|
||||
end
|
||||
|
@ -44,7 +45,7 @@ ARGV.reject! do |n|
|
|||
end
|
||||
print "Checking leaked global symbols..."
|
||||
STDOUT.flush
|
||||
IO.foreach("|#{NM} -Pgp #{ARGV.join(' ')}") do |line|
|
||||
IO.foreach("|#{NM} #{ARGV.join(' ')}") do |line|
|
||||
n, t, = line.split
|
||||
next unless /[A-TV-Z]/ =~ t
|
||||
next unless n.sub!(/^#{SYMBOL_PREFIX}/o, "")
|
||||
|
|
Загрузка…
Ссылка в новой задаче