transform_mjit_header.rb: workaround for Solaris 10 with old GCC

* tool/transform_mjit_header.rb (MJITHeader.conflicting_types?):
  Add workaround for Solaris 10 with old GCC (4.6.2), that is
  essentially the same as for AIX (commit r62326), but probably
  due to different GCC versions, different error message is shown.
  [Bug #14751] [ruby-dev:50541]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ngoto 2018-05-11 16:47:38 +00:00
Родитель 94cb4cef59
Коммит 1c67c46efb
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -160,13 +160,17 @@ module MJITHeader
SUPPORTED_CC_MACROS.any? { |macro| code =~ /^#\s*define\s+#{Regexp.escape(macro)}\b/ }
end
# This checks if syntax check outputs "error: conflicting types for 'restrict'".
# If it's true, this script regards platform as AIX and add -std=c99 as workaround.
# This checks if syntax check outputs one of the following messages.
# "error: conflicting types for 'restrict'"
# "error: redefinition of parameter 'restrict'"
# If it's true, this script regards platform as AIX or Solaris and adds -std=c99 as workaround.
def self.conflicting_types?(code, cc, cflags)
with_code(code) do |path|
cmd = "#{cc} #{cflags} #{path}"
out = IO.popen(cmd, err: [:child, :out], &:read)
!$?.success? && out.match?(/error: conflicting types for '[^']+'/)
!$?.success? &&
(out.match?(/error: conflicting types for '[^']+'/) ||
out.match?(/error: redefinition of parameter '[^']+'/))
end
end