summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-03-22 20:20:26 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-03-22 20:20:27 -0700
commitd059714746466b4062545719f2e81ca612aa22f3 (patch)
tree37fa8fb2459013bb44e380f25e493b98020382d5
parent21d8e6924844d592ff2d5a2e7309457eb92e66f6 (diff)
Disable run_without_tabs when there's no -ggdb3
in debugflags, as requested by nobu I actually wanted to check debugflags directly rather than MJIT_DEBUGFLAGS because debugflags is always used but MJIT_DEBUGFLAGS may not be always used. But I couldn't find a better way to check debugflags.
-rw-r--r--common.mk2
-rw-r--r--tool/run_without_tabs.rb11
2 files changed, 10 insertions, 3 deletions
diff --git a/common.mk b/common.mk
index 25937135d7..ded8e70c99 100644
--- a/common.mk
+++ b/common.mk
@@ -226,7 +226,7 @@ mjit_config.h: Makefile
$(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time: probes.h vm.$(OBJEXT) \
$(TIMESTAMPDIR)/$(arch)/.time $(srcdir)/tool/run_without_tabs.rb
$(ECHO) building $(@F:.time=.h)
- $(Q) $(BASERUBY) $(srcdir)/tool/run_without_tabs.rb \
+ $(Q) $(BASERUBY) $(srcdir)/tool/run_without_tabs.rb $(MJIT_DEBUGFLAGS) -- \
$(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/tool/run_without_tabs.rb b/tool/run_without_tabs.rb
index cf27f099c7..aa5fb7f798 100644
--- a/tool/run_without_tabs.rb
+++ b/tool/run_without_tabs.rb
@@ -1,6 +1,7 @@
# 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.
+# included by vm.c to normalize indentation of MJIT header when debugflags
+# is -ggdb3 (default).
#
# 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
@@ -21,12 +22,18 @@ SKIPPED_FILES = %w[
vm_opts.h
]
+unless split_index = ARGV.index('--')
+ abort "Usage: #{$0} [debugflags] -- [cmmand...]"
+end
+debugflags, command = ARGV[0...split_index], ARGV[(split_index + 1)..-1]
+
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 = {}
targets.each do |target|
+ next unless debugflags.include?('-ggdb3')
unless File.writable?(target)
puts "tool/run_without_tabs.rb: Skipping #{target.dump} as it's not writable."
next
@@ -49,7 +56,7 @@ targets.each do |target|
FileUtils.touch(target, mtime: mtimes[target])
end
-result = system(*ARGV)
+result = system(*command)
targets.each do |target|
if sources.key?(target)