Fix _LIBCPP_ENABLE_ASSERTIONS warning on Apple Clang#14548
Fix _LIBCPP_ENABLE_ASSERTIONS warning on Apple Clang#14548jpakkane merged 1 commit intomesonbuild:masterfrom
Conversation
libc++ deprecated _LIBCPP_ENABLE_ASSERTIONS from version 18. However, the libc++ shipped with Apple Clang backported that deprecation in version 17 already, which is the version which Apple currently ships for macOS. This PR changes the _LIBCPP_ENABLE_ASSERTIONS deprecation check to use version ">=17" on Apple Clang.
|
Before this PR: Log showing compiler output when building one of my projects with Meson 1.8.0After this PR: Log showing compiler output when building the same project with this fix |
| return [] | ||
|
|
||
| def is_libcpp_enable_assertions_deprecated(self) -> bool: | ||
| return version_compare(self.version, ">=18") |
There was a problem hiding this comment.
This checks clang version and not libc++ version, right? They might mismatch so this check is technically incorrect, especially on systems with more than one version of clang installed.
(This is the previous behavior so it's probably fine to keep it here, just noting)
There was a problem hiding this comment.
Yeah, I noticed that too. In principle, we would want the check to be: "if libc++ >= 18 is used, or Apple's libc++ >=17 is used, use _LIBCPP_HARDENING_MODE instead of _LIBCPP_ENABLE_ASSERTIONS".
There was a problem hiding this comment.
That merits a comment, but it's already handled in my pending refactoring of it.
|
@jpakkane In future, please at least CC me on a PR if I'm assigned to the issue it fixes. |
|
Hey @eli-schwartz. Sorry for the ping, but Apple started shipping a newer compiler with Xcode 26 beta, which includes a change that makes defining |
|
Ten minutes before your comment, we released a maintenance 1.8.2 :( I could queue it for the next maintenance release but it's not gonna be out today... |
|
I think this is a good time to sponsor @eli-schwartz (as @codehivetx) — thanks for your work 💟 |
|
Note 1.8.3 is out with this fix. :) |
libc++ deprecated
_LIBCPP_ENABLE_ASSERTIONSfrom version 18. However, the libc++ shipped with Apple Clang backported that deprecation in version 17 already, which is the version which Apple currently ships for macOS. This PR changes the_LIBCPP_ENABLE_ASSERTIONSdeprecation check to use version">=17"on Apple Clang.I decided to do this by adding a
is_libcpp_enable_assertions_deprecatedmethod toClangCPPCompiler, whose default behavior is to compare the version against">=18", but which gets overridden byAppleClangCPPCompilerto check against">=17". This felt fairly clean to me and avoided hard-coding macOS/Apple specific quirks into the generalClangCPPCompilerclass.Fixes #14440.