ruby-changes:50107
From: k0kubun <ko1@a...>
Date: Mon, 5 Feb 2018 21:05:10 +0900 (JST)
Subject: [ruby-changes:50107] k0kubun:r62225 (trunk): transform_mjit_header.rb: remove predefined macros
k0kubun 2018-02-05 21:05:04 +0900 (Mon, 05 Feb 2018) New Revision: 62225 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62225 Log: transform_mjit_header.rb: remove predefined macros semi-automatically. This is basically for icc's __DATE__, __TIME__, and many other families. It causes an error by predefined macro redefinition. Modified files: trunk/tool/transform_mjit_header.rb Index: tool/transform_mjit_header.rb =================================================================== --- tool/transform_mjit_header.rb (revision 62224) +++ tool/transform_mjit_header.rb (revision 62225) @@ -93,10 +93,9 @@ module MJITHeader https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L93 code.gsub!(/^#define #{Regexp.union(RECURSIVE_MACROS)} .*$/, '') end - # -dD outputs those macros, and it produces redefinition warnings - def self.remove_default_macros!(code) - code.gsub!(/^#define __STDC_.+$/, '') - code.gsub!(/^#define assert\([^\)]+\) .+$/, '') + # -dD outputs those macros, and it produces redefinition warnings or errors + def self.remove_predefined_macros!(code) + code.sub!(/\A(#define [^\n]+|\n)*(#define MJIT_HEADER 1\n)/, '\2') end # This makes easier to process code @@ -132,7 +131,7 @@ end https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L131 if MJITHeader.windows? MJITHeader.remove_harmful_macros!(code) end -MJITHeader.remove_default_macros!(code) +MJITHeader.remove_predefined_macros!(code) # Check initial file correctness MJITHeader.check_code!(code, cc, cflags, 'initial') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/