Suppress useless linker warnings totally on macOS

This commit is contained in:
Nobuyoshi Nakada 2024-04-19 16:33:16 +09:00
parent 74cd61fb96
commit 7951b349ab
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -427,15 +427,22 @@ AS_CASE(["$build_os"],
# default spec.
# Xcode linker warns for deprecated architecture and wrongly
# installed TBD files.
CC_WRAPPER="" CC_NO_WRAPPER="$CC"
AC_MSG_CHECKING(for $CC linker warning)
suppress_ld_waring=no
echo 'int main(void) {return 0;}' > conftest.c
AS_IF([$CC -framework Foundation -o conftest conftest.c 2>&1 |
grep -e '^ld: warning: ignoring duplicate libraries:' \
-e '^ld: warning: text-based stub file' >/dev/null], [
CC_WRAPPER=`cd -P "${tooldir}" && pwd`/darwin-cc
CC="$CC_WRAPPER $CC"
AS_IF([$CC -framework Foundation -o conftest -ggdb3 conftest.c 2>&1 |
grep \
-e '^ld: warning: ignoring duplicate libraries:' \
-e '^ld: warning: text-based stub file' \
-e '^ld: warning: -multiply_defined is obsolete' \
-e "^warning: '\.debug_macinfo'" \
-e '^note: while processing' \
>/dev/null], [
suppress_ld_waring=yes
])
rm -fr conftest*
test $suppress_ld_waring = yes && warnflags="${warnflags:+${warnflags} }-Wl,-w"
AC_MSG_RESULT($suppress_ld_waring)
])
AS_CASE(["$target_os"],
[wasi*], [
@ -1768,7 +1775,7 @@ AC_CACHE_CHECK(for function name string predefined identifier,
[AS_CASE(["$target_os"],[openbsd*],[
rb_cv_function_name_string=__func__
],[
rb_cv_function_name_string=no
rb_cv_function_name_string=no
RUBY_WERROR_FLAG([
for func in __func__ __FUNCTION__; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>]],
@ -1776,7 +1783,8 @@ AC_CACHE_CHECK(for function name string predefined identifier,
[rb_cv_function_name_string=$func
break])
done
])])]
])
])]
)
AS_IF([test "$rb_cv_function_name_string" != no], [
AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])