@@ -787,6 +787,23 @@ typedef __char32_t char32_t;
787
787
# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
788
788
# endif
789
789
790
+ # ifdef _LIBCPP_COMPILER_CLANG_BASED
791
+ # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" clang diagnostic push" )
792
+ # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" clang diagnostic pop" )
793
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(clang diagnostic ignored str))
794
+ # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
795
+ # elif defined(_LIBCPP_COMPILER_GCC)
796
+ # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" GCC diagnostic push" )
797
+ # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" GCC diagnostic pop" )
798
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
799
+ # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(GCC diagnostic ignored str))
800
+ # else
801
+ # define _LIBCPP_DIAGNOSTIC_PUSH
802
+ # define _LIBCPP_DIAGNOSTIC_POP
803
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
804
+ # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
805
+ # endif
806
+
790
807
# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
791
808
# define _LIBCPP_HARDENING_SIG f
792
809
# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
@@ -879,16 +896,33 @@ typedef __char32_t char32_t;
879
896
# define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
880
897
# define _VSTD std
881
898
899
+ // TODO: Remove this workaround once we drop support for Clang 16
900
+ #if __has_warning("-Wc++23-extensions")
901
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++23-extensions" )
902
+ #else
903
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++2b-extensions" )
904
+ #endif
905
+
882
906
// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
883
907
// clang-format off
884
- # define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
908
+ # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_DIAGNOSTIC_PUSH \
909
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++11-extensions" ) \
910
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
911
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
912
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
913
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
914
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
915
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
916
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
917
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++23-extensions" ) \
918
+ namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
885
919
inline namespace _LIBCPP_ABI_NAMESPACE {
886
- # define _LIBCPP_END_NAMESPACE_STD }}
920
+ # define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_DIAGNOSTIC_POP
887
921
888
922
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
889
923
inline namespace __fs { namespace filesystem {
890
924
891
- # define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }}
925
+ # define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD
892
926
// clang-format on
893
927
894
928
# if __has_attribute(__enable_if__)
@@ -1328,23 +1362,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1328
1362
// the ABI inconsistent.
1329
1363
# endif
1330
1364
1331
- # ifdef _LIBCPP_COMPILER_CLANG_BASED
1332
- # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" clang diagnostic push" )
1333
- # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" clang diagnostic pop" )
1334
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(clang diagnostic ignored str))
1335
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
1336
- # elif defined(_LIBCPP_COMPILER_GCC)
1337
- # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" GCC diagnostic push" )
1338
- # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" GCC diagnostic pop" )
1339
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
1340
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(GCC diagnostic ignored str))
1341
- # else
1342
- # define _LIBCPP_DIAGNOSTIC_PUSH
1343
- # define _LIBCPP_DIAGNOSTIC_POP
1344
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
1345
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
1346
- # endif
1347
-
1348
1365
// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these
1349
1366
// functions is gradually being added to existing C libraries. The conditions
1350
1367
// below check for known C library versions and conditions under which these
0 commit comments