Skip to content

Consider adding -Werror=unguarded-availability-new to compiler flags for Apple platforms #100384

Closed
@indygreg

Description

@indygreg

Feature or enhancement

Runtime crashes like #97897 could be prevented by turning clang's unguaded-availability-new warning into a fatal compile error. This can be done by adding -Werror=unguarded-availability-new to compiler flags.

Essentially what this warning does is cross reference undefined symbols against symbols defined in the targeted Apple SDK. If it sees a symbol introduced in a newer SDK version and that symbol isn't weakly referenced/linked, you get a warning. -Werror upconverts it to a fatal compiler error.

If you add this flag to release builds, the compiler prevents you from shipping binaries that ship unguarded symbol usage for targeted SDK versions. i.e. it prevents run-time crashes when binaries run on older Apple OS versions.

If you enable this setting today, you may find the 3.8 branch isn't properly gating use of mkfifoat and mknodat. (Although this may be an oddity from python-build-standalone and not a CPython bug.)

cc @ned-deily


The advantages of having this additional warning is to catch regressions such as:

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions