mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Make --without-mjit-tabs work again
vm_sync.{c,h} don't have tabs
This commit is contained in:
parent
b9019c1ae8
commit
0d32a18f5b
1 changed files with 5 additions and 3 deletions
|
@ -20,6 +20,8 @@ SKIPPED_FILES = %w[
|
||||||
vm_debug.h
|
vm_debug.h
|
||||||
vm_exec.h
|
vm_exec.h
|
||||||
vm_opts.h
|
vm_opts.h
|
||||||
|
vm_sync.h
|
||||||
|
vm_sync.c
|
||||||
]
|
]
|
||||||
|
|
||||||
srcdir = File.expand_path('..', __dir__)
|
srcdir = File.expand_path('..', __dir__)
|
||||||
|
@ -32,14 +34,14 @@ mjit_tabs, *command = ARGV
|
||||||
targets.each do |target|
|
targets.each do |target|
|
||||||
next if mjit_tabs != 'false'
|
next if mjit_tabs != 'false'
|
||||||
unless File.writable?(target)
|
unless File.writable?(target)
|
||||||
puts "tool/mjit_without_tabs.rb: Skipping #{target.dump} as it's not writable."
|
puts "tool/mjit_tabs.rb: Skipping #{target.dump} as it's not writable."
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
source = File.read(target)
|
source = File.read(target)
|
||||||
begin
|
begin
|
||||||
expanded = source.gsub(/^\t+/) { |tab| ' ' * 8 * tab.length }
|
expanded = source.gsub(/^\t+/) { |tab| ' ' * 8 * tab.length }
|
||||||
rescue ArgumentError # invalid byte sequence in UTF-8 (Travis, RubyCI)
|
rescue ArgumentError # invalid byte sequence in UTF-8 (Travis, RubyCI)
|
||||||
puts "tool/mjit_without_tabs.rb: Skipping #{target.dump} as the encoding is #{source.encoding}."
|
puts "tool/mjit_tabs.rb: Skipping #{target.dump} as the encoding is #{source.encoding}."
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ targets.each do |target|
|
||||||
mtimes[target] = File.mtime(target)
|
mtimes[target] = File.mtime(target)
|
||||||
|
|
||||||
if sources[target] == expanded
|
if sources[target] == expanded
|
||||||
puts "#{target.dump} has no hard tab indentation. This should be ignored in tool/mjit_without_tabs.rb."
|
puts "#{target.dump} has no hard tab indentation. This should be ignored in tool/mjit_tabs.rb."
|
||||||
end
|
end
|
||||||
File.write(target, expanded)
|
File.write(target, expanded)
|
||||||
FileUtils.touch(target, mtime: mtimes[target])
|
FileUtils.touch(target, mtime: mtimes[target])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue