Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Don't push and pop extensions diagnostics when using clang modules #85917

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -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)
philnik777 marked this conversation as resolved.
Show resolved Hide resolved
# 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 {
Expand Down
Loading