From: "jeremyevans0 (Jeremy Evans)" Date: 2022-05-25T18:39:20+00:00 Subject: [ruby-core:108702] [Ruby master Bug#18785] RbConfig::MAKEFILE_CONFIG["warnflags"] contains "-Wno-cast-function-type" which is not compatible with clang 13.0.0 Issue #18785 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Feedback dorianmariefr (Dorian Mari��) wrote in #note-2: > Should the fix be backported? If you can bisect and find the fixing commit, we can mark it for backporting. Whether to backport is always up to the branch maintainer. ---------------------------------------- Bug #18785: RbConfig::MAKEFILE_CONFIG["warnflags"] contains "-Wno-cast-function-type" which is not compatible with clang 13.0.0 https://bugs.ruby-lang.org/issues/18785#change-97746 * Author: dorianmariefr (Dorian Mari��) * Status: Feedback * Priority: Normal * ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Hi, I was having an issue installing the curses gem: https://github.com/ruby/curses/issues/41#issuecomment-1127293843 A minimal reproduction script is: ```ruby require "mkmf" curses = ["ncurses.h"] convertible_int('chtype', [["#undef MOUSE_MOVED\n"]]+curses) ``` Then in the output of mkmf.log https://gist.github.com/b938f83aac977cd6db2a2e216b6ff17b There is: ``` DYLD_FALLBACK_LIBRARY_PATH=.:/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib "clang -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/arm64-darwin21 -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/ruby/backward -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0 -I. -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -fno-common -pipe -Werror -c conftest.c" error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option] checked program was: /* begin */ 1: #include "ruby.h" 2:�� 3: #undef MOUSE_MOVED 4:�� 5: #include 6:�� 7: typedef chtype rbcv_typedef_; 8:�� 9: extern rbcv_typedef_ foo(); 10: extern unsigned long long foo(); /* end */ -------------------- ``` In particular the -Wno-cast-function-type is not compatible with clang 13.0.0 ``` clang -v Apple clang version 13.0.0 (clang-1300.0.27.3) Target: arm64-apple-darwin21.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin ``` After debugging, it seems to be coming from `RbConfig::MAKEFILE_CONFIG["warnflags"]`: ``` > RbConfig::MAKEFILE_CONFIG["warnflags"] => "-Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef" ``` Another project had the same issue and the solution seems to be doing feature detection: https://github.com/tarantool/tarantool/commit/a8c214c2ddf151139b7be70c95328a3a15fe29e2 ``` check_c_compiler_flag("-Wno-cast-function-type" CC_HAS_WNO_CAST_FUNCTION_TYPE) # ... if (CC_HAS_WNO_CAST_FUNCTION_TYPE) add_compile_flags("C;CXX" "-Wno-cast-function-type") endif() ``` -- https://bugs.ruby-lang.org/ Unsubscribe: