1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

transform_mjit_header.rb: separate macro and code

* tool/transform_mjit_header.rb (separate_macro_and_code): return
  macro and code separately as the name, and concat before output.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-02-05 00:52:45 +00:00
parent a38b3307b6
commit 70ae83f8e1

View file

@ -99,7 +99,7 @@ module MJITHeader
# This makes easier to process code
def self.separate_macro_and_code(code)
code.lines.partition { |l| !l.start_with?('#') }.flatten.join('')
code.lines.partition { |l| l.start_with?('#') }.map! {|lines| lines.join('')}
end
def self.write(code, out)
@ -142,7 +142,7 @@ if MJITHeader.windows? # transformation is broken with Windows headers for now
end
puts "\nTransforming external functions to static:"
code = MJITHeader.separate_macro_and_code(code) # note: this does not work on MinGW
macro, code = MJITHeader.separate_macro_and_code(code) # note: this does not work on MinGW
stop_pos = -1
extern_names = []
@ -178,6 +178,8 @@ while (decl_range = MJITHeader.find_decl(code, stop_pos))
end
end
code << macro
# Check the final file correctness
MJITHeader.check_code!(code, cc, cflags, 'final')