[libcxx-commits] [PATCH] D99515: [libc++] Build and test with -Wundef warning. NFC.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 30 05:51:31 PDT 2021
ldionne added inline comments.
================
Comment at: libcxx/include/__config:187
+# ifdef __apple_build_version__
+# define _LIBCPP_CLANG_VER 0
+# else
----------------
I fear this will have the consequence to disable any feature guarded by `#if _LIBCPP_CLANG_VER > XXXX` on AppleClang, even if the compiler is perfectly able to handle that feature.
Edit: I looked and this doesn't seem to be an issue, but I would still suggest the following:
```
#if defined(__clang__) && !defined(__apple_build_version__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
#elif defined(__apple_build_version__)
# define _LIBCPP_COMPILER_CLANG_BASED
# define _LIBCPP_APPLE_CLANG_VER (__clang_major__ * 100) + __clang_minor__
#elif ...
```
Notice the rename of `_LIBCPP_COMPILER_CLANG` to `_LIBCPP_COMPILER_CLANG_BASED`. In the few places where we currently use `_LIBCPP_COMPILER_CLANG`, it seems like what we really want to ask is whether the compiler is Clang-like and supports Clang-like features, which is the case on both LLVM Clang and Apple Clang.
Introducing a different macro `_LIBCPP_APPLE_CLANG_VER` also makes it clear that we consider it a different compiler.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99515/new/
https://reviews.llvm.org/D99515
More information about the libcxx-commits
mailing list