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.
This commit is contained in:
Koichi Sasada 2019-11-08 15:13:24 +09:00
Родитель 0ad0a8ff58
Коммит 2eb02dfd3b
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -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