From 2eb02dfd3b650b54d6f3f5a63541e8165c997edd Mon Sep 17 00:00:00 2001 From: Koichi Sasada 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. --- tool/mk_builtin_loader.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tool') diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index 91a66b16b4..dafab79fd0 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -56,9 +56,15 @@ def mk_builtin_header file 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 v1.2.3