Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compilers: cpp: improve libc++ vs libstdc++ detection (again)
The previous approach wasn't great because you couldn't control what the detected C++ stdlib impl was. We just had a preference list we tweaked the searched order for per OS. That doesn't work great for e.g. Gentoo with libc++ or Gentoo Prefix on macOS where we might be using libstdc++ even though the host is libc++. Jonathan Wakely, the libstdc++ maintainer, gave a helpful answer on how to best detect libc++ vs libstdc++ via macros on SO [0]. Implement it. TL;DR: Use <version> from C++20 if we can, use <ciso646> otherwise. Check for _LIBCPP_VERSION as libstdc++ doesn't always define a macro. [0] https://stackoverflow.com/a/31658120 Signed-off-by: Sam James <[email protected]> Signed-off-by: Eli Schwartz <[email protected]>
- Loading branch information