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: 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
parent 94cb4cef59
commit 1c67c46efb

View file

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