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

ruby-changes:50098

From: nobu <ko1@a...>
Date: Mon, 5 Feb 2018 11:07:54 +0900 (JST)
Subject: [ruby-changes:50098] nobu:r62216 (trunk): transform_mjit_header.rb: take program name from $0

nobu	2018-02-05 11:07:49 +0900 (Mon, 05 Feb 2018)

  New Revision: 62216

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62216

  Log:
    transform_mjit_header.rb: take program name from $0

  Modified files:
    trunk/tool/transform_mjit_header.rb
Index: tool/transform_mjit_header.rb
===================================================================
--- tool/transform_mjit_header.rb	(revision 62215)
+++ tool/transform_mjit_header.rb	(revision 62216)
@@ -5,6 +5,8 @@ https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L5
 require 'fileutils'
 require 'tempfile'
 
+PROGRAM = File.basename($0, ".*")
+
 module MJITHeader
   ATTR_VALUE_REGEXP  = /[^()]|\([^()]*\)/
   ATTR_REGEXP        = /__attribute__\s*\(\((#{ATTR_VALUE_REGEXP})*\)\)/
@@ -115,7 +117,7 @@ module MJITHeader https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L117
 end
 
 if ARGV.size != 3
-  abort 'Usage: transform_mjit_header.rb <c-compiler> <header file> <out>'
+  abort "Usage: #{$0} <c-compiler> <header file> <out>"
 end
 
 cc      = ARGV[0]
@@ -153,12 +155,12 @@ while (decl_range = MJITHeader.find_decl https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L155
   decl_name = MJITHeader.decl_name_of(decl)
 
   if MJITHeader::IGNORED_FUNCTIONS.include?(decl_name) && /#{MJITHeader::FUNC_HEADER_REGEXP}{/.match(decl)
-    puts "transform_mjit_header: changing definition of '#{decl_name}' to declaration"
+    puts "#{PROGRAM}: changing definition of '#{decl_name}' to declaration"
     code[decl_range] = decl.sub(/{.+}/m, ';')
   elsif extern_names.include?(decl_name) && (decl =~ /#{MJITHeader::FUNC_HEADER_REGEXP};/)
     decl.sub!(/(extern|static|inline) /, ' ')
     unless decl_name =~ /\Aattr_\w+_\w+\z/ # skip too-many false-positive warnings in insns_info.inc.
-      puts "transform_mjit_header: making declaration of '#{decl_name}' static inline"
+      puts "#{PROGRAM}: making declaration of '#{decl_name}' static inline"
     end
 
     code[decl_range] = "static inline #{decl}"
@@ -172,7 +174,7 @@ while (decl_range = MJITHeader.find_decl https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L174
 
     header.sub!(/(extern|inline) /, ' ')
     unless decl_name =~ /\Aattr_\w+_\w+\z/ # skip too-many false-positive warnings in insns_info.inc.
-      puts "transform_mjit_header: making external definition of '#{decl_name}' static inline"
+      puts "#{PROGRAM}: making external definition of '#{decl_name}' static inline"
     end
     code[decl_range] = "static inline #{header}#{decl}"
   end

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

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