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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-02-05 12:05:04 +00:00
Родитель a3225c6eba
Коммит 70a7bc3967
1 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -93,10 +93,9 @@ module MJITHeader
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
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')