ruby-changes:58638
From: Koichi <ko1@a...>
Date: Fri, 8 Nov 2019 15:29:22 +0900 (JST)
Subject: [ruby-changes:58638] 2eb02dfd3b (master): Stop compiling if type mismatch was found.
https://git.ruby-lang.org/ruby.git/commit/?id=2eb02dfd3b From 2eb02dfd3b650b54d6f3f5a63541e8165c997edd Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 8 Nov 2019 15:13:24 +0900 Subject: Stop compiling if type mismatch was found. If there is a type mismatch between expected builtin function type and actual function type, C compiler shows warning. For example, `__builtin_func(1, 2)` expects `func(rb_ec_t*, VALUE self, VALUE p1, VALUE p2)` function definition. However, it is easy to overlook "warning" messages. So this patch changes to stop compiling as an error if there is a mismatch. diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index 91a66b1..dafab79f 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -56,9 +56,15 @@ def mk_builtin_header file https://github.com/ruby/ruby/blob/trunk/tool/mk_builtin_loader.rb#L56 f.puts f.puts " // arity_check" + f.puts "COMPILER_WARNING_PUSH" + f.puts "#if GCC_VERSION_SINCE(5, 1, 0) || __clang__" + f.puts "COMPILER_WARNING_ERROR(-Wincompatible-pointer-types)" + f.puts "#endif" bs.each{|func, argc| f.puts " if (0) rb_builtin_function_check_arity#{argc}(#{func});" } + f.puts "COMPILER_WARNING_POP" + path = File.expand_path(file) f.puts -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/