Skip to content

Commit 9d3a8f4

Browse files
authored
pythongh-100384: Error on unguarded-availability in macOS builds (python#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.
1 parent f420bdd commit 9d3a8f4

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

.github/workflows/reusable-macos.yml

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
brew link --overwrite tcl-tk@8
4646
- name: Configure CPython
4747
run: |
48+
MACOSX_DEPLOYMENT_TARGET=10.15 \
4849
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
4950
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
5051
./configure \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Error on ``unguarded-availability`` in macOS builds, preventing invalid
2+
use of symbols that are not available in older versions of the OS.

configure

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+7
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,13 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
26032603
esac
26042604
AC_MSG_RESULT([$CC])
26052605
2606+
# Error on unguarded use of new symbols, which will fail at runtime for
2607+
# users on older versions of macOS
2608+
AX_CHECK_COMPILE_FLAG([-Wunguarded-availability],
2609+
[AS_VAR_APPEND([CFLAGS_NODIST], [" -Werror=unguarded-availability"])],
2610+
[],
2611+
[-Werror])
2612+
26062613
LIPO_INTEL64_FLAGS=""
26072614
if test "${enable_universalsdk}"
26082615
then

0 commit comments

Comments
 (0)