Win: Strip CRs from cpp and nm output

The combination of mingw tools and cygin/msys2 ruby leaves CRs.
This commit is contained in:
Nobuyoshi Nakada 2025-07-31 16:45:09 +09:00 committed by Nobuyoshi Nakada
parent 6c24904a69
commit b3598cf2a3
2 changed files with 5 additions and 2 deletions

View file

@ -9,6 +9,7 @@ while /\A(\w+)=(.*)/ =~ ARGV[0]
end end
if inc = arg['i'] if inc = arg['i']
src = inc == '-' ? STDIN.read : File.read(inc) src = inc == '-' ? STDIN.read : File.read(inc)
src.tr!("\r", " ")
src.gsub!(/^#.*\n/, '') src.gsub!(/^#.*\n/, '')
else else
src = "" src = ""

View file

@ -146,7 +146,9 @@ class Exports::Cygwin < Exports
end end
def each_line(objs, &block) def each_line(objs, &block)
IO.foreach("|#{self.class.nm} --extern-only --defined-only #{objs.join(' ')}", &block) IO.popen(%W[#{self.class.nm} --extern-only --defined-only] + objs) do |f|
f.each(&block)
end
end end
def each_export(objs) def each_export(objs)
@ -155,7 +157,7 @@ class Exports::Cygwin < Exports
re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!#{PrivateNames}).*)$/ re = /\s(?:(T)|[[:upper:]])\s#{symprefix}((?!#{PrivateNames}).*)$/
objdump(objs) do |l| objdump(objs) do |l|
next if /@.*@/ =~ l next if /@.*@/ =~ l
yield $2, !$1 if re =~ l yield $2.strip, !$1 if re =~ l
end end
end end
end end