@@ -838,21 +838,33 @@ typedef __char32_t char32_t;
838
838
# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++2b-extensions" )
839
839
#endif
840
840
841
+ // Clang modules take a significant compile time hit when pushing and popping diagnostics.
842
+ // Since all the headers are marked as system headers in the modulemap, we can simply disable this
843
+ // pushing and popping when building with clang modules.
844
+ # if !__has_feature(modules)
845
+ # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
846
+ _LIBCPP_DIAGNOSTIC_PUSH \
847
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++11-extensions" ) \
848
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
849
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
850
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
851
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
852
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
853
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
854
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
855
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++23-extensions" )
856
+ # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
857
+ # else
858
+ # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
859
+ # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS
860
+ # endif
861
+
841
862
// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
842
863
// clang-format off
843
- # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_DIAGNOSTIC_PUSH \
844
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++11-extensions" ) \
845
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
846
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
847
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
848
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
849
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
850
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
851
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
852
- _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++23-extensions" ) \
864
+ # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
853
865
namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
854
866
inline namespace _LIBCPP_ABI_NAMESPACE {
855
- # define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_DIAGNOSTIC_POP
867
+ # define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_POP_EXTENSION_DIAGNOSTICS
856
868
857
869
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
858
870
inline namespace __fs { namespace filesystem {
0 commit comments