mirror of https://github.com/python/cpython.git
gh-100384: Error on `unguarded-availability` in macOS builds (#128155)
Generate a build error on ``unguarded-availability`` in portable macOS builds (i.e. using MACOSX_DEPLOYMENT_TARGET), preventing invalid use of symbols that are not available in older versions of the OS.
This commit is contained in:
parent
f420bdd29f
commit
9d3a8f4949
|
@ -45,6 +45,7 @@ jobs:
|
|||
brew link --overwrite tcl-tk@8
|
||||
- name: Configure CPython
|
||||
run: |
|
||||
MACOSX_DEPLOYMENT_TARGET=10.15 \
|
||||
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
|
||||
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
|
||||
./configure \
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Error on ``unguarded-availability`` in macOS builds, preventing invalid
|
||||
use of symbols that are not available in older versions of the OS.
|
|
@ -10406,6 +10406,47 @@ printf %s "checking which compiler should be used... " >&6; }
|
|||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
|
||||
printf "%s\n" "$CC" >&6; }
|
||||
|
||||
# Error on unguarded use of new symbols, which will fail at runtime for
|
||||
# users on older versions of macOS
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunguarded-availability" >&5
|
||||
printf %s "checking whether C compiler accepts -Wunguarded-availability... " >&6; }
|
||||
if test ${ax_cv_check_cflags__Werror__Wunguarded_availability+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Werror -Wunguarded-availability"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
ax_cv_check_cflags__Werror__Wunguarded_availability=yes
|
||||
else $as_nop
|
||||
ax_cv_check_cflags__Werror__Wunguarded_availability=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__Wunguarded_availability" >&5
|
||||
printf "%s\n" "$ax_cv_check_cflags__Werror__Wunguarded_availability" >&6; }
|
||||
if test "x$ax_cv_check_cflags__Werror__Wunguarded_availability" = xyes
|
||||
then :
|
||||
as_fn_append CFLAGS_NODIST " -Werror=unguarded-availability"
|
||||
else $as_nop
|
||||
:
|
||||
fi
|
||||
|
||||
|
||||
LIPO_INTEL64_FLAGS=""
|
||||
if test "${enable_universalsdk}"
|
||||
then
|
||||
|
|
|
@ -2603,6 +2603,13 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
|
|||
esac
|
||||
AC_MSG_RESULT([$CC])
|
||||
|
||||
# Error on unguarded use of new symbols, which will fail at runtime for
|
||||
# users on older versions of macOS
|
||||
AX_CHECK_COMPILE_FLAG([-Wunguarded-availability],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" -Werror=unguarded-availability"])],
|
||||
[],
|
||||
[-Werror])
|
||||
|
||||
LIPO_INTEL64_FLAGS=""
|
||||
if test "${enable_universalsdk}"
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue