[前][次][番号順一覧][スレッド一覧]

ruby-changes:60490

From: Takashi <ko1@a...>
Date: Tue, 24 Mar 2020 14:36:24 +0900 (JST)
Subject: [ruby-changes:60490] 5b3157a511 (master): Make file names and variable names consistent

https://git.ruby-lang.org/ruby.git/commit/?id=5b3157a511

From 5b3157a51177b56fd79d4f4e3cb08e0a6459944f Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Mon, 23 Mar 2020 22:31:38 -0700
Subject: Make file names and variable names consistent


diff --git a/common.mk b/common.mk
index 8c50172..d05a2df 100644
--- a/common.mk
+++ b/common.mk
@@ -224,9 +224,9 @@ mjit_config.h: Makefile https://github.com/ruby/ruby/blob/trunk/common.mk#L224
 # Other `-Dxxx`s preceding `-DMJIT_HEADER` will be removed in transform_mjit_header.rb.
 # So `-DMJIT_HEADER` should be passed first when rb_mjit_header.h is generated.
 $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time: probes.h vm.$(OBJEXT) \
-		$(TIMESTAMPDIR)/$(arch)/.time $(srcdir)/tool/mjit_without_tabs.rb
+		$(TIMESTAMPDIR)/$(arch)/.time $(srcdir)/tool/mjit_tabs.rb
 	$(ECHO) building $(@F:.time=.h)
-	$(Q) $(BASERUBY) $(srcdir)/tool/mjit_without_tabs.rb "$(MJIT_WITHOUT_TABS)" \
+	$(Q) $(BASERUBY) $(srcdir)/tool/mjit_tabs.rb "$(MJIT_TABS)" \
 		$(CPP) -DMJIT_HEADER $(MJIT_HEADER_FLAGS) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/vm.c $(CPPOUTFLAG)$(@F:.time=.h).new
 	$(Q) $(IFCHANGE) "--timestamp=$@" $(@F:.time=.h) $(@F:.time=.h).new
 
diff --git a/configure.ac b/configure.ac
index 6b57ea5..5bc9380 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2616,9 +2616,9 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L2616
 LIBEXT=a
 
 AC_ARG_WITH(mjit-tabs,
-    AS_HELP_STRING([--without-tabs-mjit], [expand tabs in mjit header]),
-    [AS_IF([test $withval = no], [MJIT_WITHOUT_TABS=true])])
-AC_SUBST(MJIT_WITHOUT_TABS)dnl
+    AS_HELP_STRING([--without-mjit-tabs], [expand tabs in mjit header]),
+    [AS_IF([test $withval = no], [MJIT_TABS=false])])
+AC_SUBST(MJIT_TABS)dnl
 AC_SUBST(DLDFLAGS)dnl
 AC_SUBST(ARCH_FLAG)dnl
 AC_SUBST(MJIT_HEADER_FLAGS)dnl
diff --git a/template/Makefile.in b/template/Makefile.in
index 831e3c6..c527834 100644
--- a/template/Makefile.in
+++ b/template/Makefile.in
@@ -102,7 +102,7 @@ MJIT_HEADER   = rb_mjit_header.h https://github.com/ruby/ruby/blob/trunk/template/Makefile.in#L102
 MJIT_MIN_HEADER_NAME = rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h
 MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/$(MJIT_MIN_HEADER_NAME)
 MJIT_HEADER_BUILD_DIR = $(EXTOUT)/include/$(arch)
-MJIT_WITHOUT_TABS=@MJIT_WITHOUT_TABS@
+MJIT_TABS=@MJIT_TABS@
 LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
 EXTLDFLAGS = @EXTLDFLAGS@
 XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
diff --git a/tool/mjit_tabs.rb b/tool/mjit_tabs.rb
new file mode 100644
index 0000000..8b91af2
--- /dev/null
+++ b/tool/mjit_tabs.rb
@@ -0,0 +1,65 @@ https://github.com/ruby/ruby/blob/trunk/tool/mjit_tabs.rb#L1
+# frozen_string_literal: true
+# This is a script to run a command in ARGV, expanding tabs in some files
+# included by vm.c to normalize indentation of MJIT header. You can enable
+# this feature by passing `--without-mjit-tabs` in configure.
+#
+# Note that preprocessor of GCC converts a hard tab to one spaces, where
+# we expect it to be shown as 8 spaces. To obviate this script, we need
+# to convert all tabs to spaces in these files.
+
+require 'fileutils'
+
+EXPAND_TARGETS = %w[
+  vm*.*
+  include/ruby/ruby.h
+]
+
+# These files have no hard tab indentations. Skip normalizing these files from the glob result.
+SKIPPED_FILES = %w[
+  vm_callinfo.h
+  vm_debug.h
+  vm_exec.h
+  vm_opts.h
+]
+
+srcdir = File.expand_path('..', __dir__)
+targets = EXPAND_TARGETS.flat_map { |t| Dir.glob(File.join(srcdir, t)) } - SKIPPED_FILES.map { |f| File.join(srcdir, f) }
+sources = {}
+mtimes = {}
+
+mjit_tabs, *command = ARGV
+
+targets.each do |target|
+  next if mjit_tabs != 'false'
+  unless File.writable?(target)
+    puts "tool/mjit_without_tabs.rb: Skipping #{target.dump} as it's not writable."
+    next
+  end
+  source = File.read(target)
+  begin
+    expanded = source.gsub(/^\t+/) { |tab| ' ' * 8 * tab.length }
+  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}."
+    next
+  end
+
+  sources[target] = source
+  mtimes[target] = File.mtime(target)
+
+  if sources[target] == expanded
+    puts "#{target.dump} has no hard tab indentation. This should be ignored in tool/mjit_without_tabs.rb."
+  end
+  File.write(target, expanded)
+  FileUtils.touch(target, mtime: mtimes[target])
+end
+
+result = system(*command)
+
+targets.each do |target|
+  if sources.key?(target)
+    File.write(target, sources[target])
+    FileUtils.touch(target, mtime: mtimes.fetch(target))
+  end
+end
+
+exit result
diff --git a/tool/mjit_without_tabs.rb b/tool/mjit_without_tabs.rb
deleted file mode 100644
index bc2ca77..0000000
--- a/tool/mjit_without_tabs.rb
+++ /dev/null
@@ -1,65 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/mjit_tabs.rb#L0
-# frozen_string_literal: true
-# This is a script to run a command in ARGV, expanding tabs in some files
-# included by vm.c to normalize indentation of MJIT header. You can disable
-# this feature by setting MJIT_WITHOUT_TABS=false make variable.
-#
-# Note that preprocessor of GCC converts a hard tab to one spaces, where
-# we expect it to be shown as 8 spaces. To obviate this script, we need
-# to convert all tabs to spaces in these files.
-
-require 'fileutils'
-
-EXPAND_TARGETS = %w[
-  vm*.*
-  include/ruby/ruby.h
-]
-
-# These files have no hard tab indentations. Skip normalizing these files from the glob result.
-SKIPPED_FILES = %w[
-  vm_callinfo.h
-  vm_debug.h
-  vm_exec.h
-  vm_opts.h
-]
-
-srcdir = File.expand_path('..', __dir__)
-targets = EXPAND_TARGETS.flat_map { |t| Dir.glob(File.join(srcdir, t)) } - SKIPPED_FILES.map { |f| File.join(srcdir, f) }
-sources = {}
-mtimes = {}
-
-flag, *command = ARGV
-
-targets.each do |target|
-  next if flag != 'true'
-  unless File.writable?(target)
-    puts "tool/mjit_without_tabs.rb: Skipping #{target.dump} as it's not writable."
-    next
-  end
-  source = File.read(target)
-  begin
-    expanded = source.gsub(/^\t+/) { |tab| ' ' * 8 * tab.length }
-  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}."
-    next
-  end
-
-  sources[target] = source
-  mtimes[target] = File.mtime(target)
-
-  if sources[target] == expanded
-    puts "#{target.dump} has no hard tab indentation. This should be ignored in tool/mjit_without_tabs.rb."
-  end
-  File.write(target, expanded)
-  FileUtils.touch(target, mtime: mtimes[target])
-end
-
-result = system(*command)
-
-targets.each do |target|
-  if sources.key?(target)
-    File.write(target, sources[target])
-    FileUtils.touch(target, mtime: mtimes.fetch(target))
-  end
-end
-
-exit result
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]