ruby-changes:50117
From: k0kubun <ko1@a...>
Date: Tue, 6 Feb 2018 00:39:59 +0900 (JST)
Subject: [ruby-changes:50117] k0kubun:r62235 (trunk): transform_mjit_header.rb: restrict transformation
k0kubun 2018-02-06 00:39:55 +0900 (Tue, 06 Feb 2018) New Revision: 62235 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62235 Log: transform_mjit_header.rb: restrict transformation to whitelisted patterns. This fix is for NetBSD. [Bug #14439] Modified files: trunk/tool/transform_mjit_header.rb Index: tool/transform_mjit_header.rb =================================================================== --- tool/transform_mjit_header.rb (revision 62234) +++ tool/transform_mjit_header.rb (revision 62235) @@ -11,6 +11,7 @@ module MJITHeader https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L11 ATTR_VALUE_REGEXP = /[^()]|\([^()]*\)/ ATTR_REGEXP = /__attribute__\s*\(\((#{ATTR_VALUE_REGEXP})*\)\)/ FUNC_HEADER_REGEXP = /\A(\s*#{ATTR_REGEXP})*[^\[{(]*\((#{ATTR_REGEXP}|[^()])*\)(\s*#{ATTR_REGEXP})*\s*/ + TARGET_NAME_REGEXP = /\A(rb|ruby|vm|insn|attr)_/ # For MinGW's ras.h. Those macros have its name in its definition and can't be preprocessed multiple times. RECURSIVE_MACROS = %w[ @@ -167,6 +168,11 @@ while (decl_range = MJITHeader.find_decl https://github.com/ruby/ruby/blob/trunk/tool/transform_mjit_header.rb#L168 code[decl_range] = "static inline #{decl}" elsif (match = /#{MJITHeader::FUNC_HEADER_REGEXP}{/.match(decl)) && (header = match[0]) !~ /static/ + unless decl_name.match(MJITHeader::TARGET_NAME_REGEXP) + puts "#{PROGRAM}: SKIPPED to transform #{decl_name}" + next + end + extern_names << decl_name decl[match.begin(0)...match.end(0)] = '' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/