diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-21 19:25:45 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-21 19:26:16 +0900 |
commit | 418b03c750ab8c5742670d0d06ab84a3132f64dd (patch) | |
tree | fbdd64e7c6e7a1a6d773a787e51c34ea22f43aad | |
parent | 06b62cbbdd560c6210d48a50ba99cfdc2f110dfe (diff) |
tool/leaked-globals: ignore function typedef [ci skip]
-rw-r--r-- | template/Makefile.in | 2 | ||||
-rwxr-xr-x | tool/leaked-globals | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/template/Makefile.in b/template/Makefile.in index d638a31af5..72aba2d3e9 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -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) diff --git a/tool/leaked-globals b/tool/leaked-globals index d95f3794e8..083f658fb1 100755 --- a/tool/leaked-globals +++ b/tool/leaked-globals @@ -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, "") |