[libcxx-commits] [libcxx] f886dfe - [libc++] Don't push and pop extensions diagnostics when using clang modules (#85917)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 23 05:54:38 PDT 2024
Author: Nikolas Klauser
Date: 2024-03-23T13:54:35+01:00
New Revision: f886dfed3ae6cf70827cedc8d8aefde6250a239b
URL: https://github.com/llvm/llvm-project/commit/f886dfed3ae6cf70827cedc8d8aefde6250a239b
DIFF: https://github.com/llvm/llvm-project/commit/f886dfed3ae6cf70827cedc8d8aefde6250a239b.diff
LOG: [libc++] Don't push and pop extensions diagnostics when using clang modules (#85917)
Clang modules take a significant compile time hit when pushing and
popping diagnostics. Since all the headers are marked as system headers
in the modulemap, we can simply disable this pushing and popping when
building with clang modules.
Added:
Modified:
libcxx/include/__config
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 132cace3d5b2c4..af44af203e7cfc 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -838,21 +838,33 @@ typedef __char32_t char32_t;
# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++2b-extensions")
#endif
+// Clang modules take a significant compile time hit when pushing and popping diagnostics.
+// Since all the headers are marked as system headers in the modulemap, we can simply disable this
+// pushing and popping when building with clang modules.
+# if !__has_feature(modules)
+# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
+ _LIBCPP_DIAGNOSTIC_PUSH \
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
+# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
+# else
+# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
+# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS
+# endif
+
// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
// clang-format off
-# define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_DIAGNOSTIC_PUSH \
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \
+# define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
inline namespace _LIBCPP_ABI_NAMESPACE {
-# define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_DIAGNOSTIC_POP
+# define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_POP_EXTENSION_DIAGNOSTICS
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
inline namespace __fs { namespace filesystem {
More information about the libcxx-commits
mailing list