@@ -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
@@ -874,16 +891,33 @@ typedef __char32_t char32_t;
874
891
# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
875
892
# endif
876
893
894
+ // TODO: Remove this workaround once we drop support for Clang 16
895
+ #if __has_warning("-Wc++23-extensions")
896
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++23-extensions" )
897
+ #else
898
+ # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++2b-extensions" )
899
+ #endif
900
+
877
901
// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
878
902
// clang-format off
879
- # define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
903
+ # define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_DIAGNOSTIC_PUSH \
904
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (" -Wc++11-extensions" ) \
905
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
906
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
907
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
908
+ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION \
909
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++14-extensions" ) \
910
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++17-extensions" ) \
911
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++20-extensions" ) \
912
+ _LIBCPP_GCC_DIAGNOSTIC_IGNORED(" -Wc++23-extensions" ) \
913
+ namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
880
914
inline namespace _LIBCPP_ABI_NAMESPACE {
881
- # define _LIBCPP_END_NAMESPACE_STD }}
915
+ # define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_DIAGNOSTIC_POP
882
916
883
917
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
884
918
inline namespace __fs { namespace filesystem {
885
919
886
- # define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }}
920
+ # define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD
887
921
// clang-format on
888
922
889
923
# if __has_attribute(__enable_if__)
@@ -1323,23 +1357,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
1323
1357
// the ABI inconsistent.
1324
1358
# endif
1325
1359
1326
- # ifdef _LIBCPP_COMPILER_CLANG_BASED
1327
- # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" clang diagnostic push" )
1328
- # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" clang diagnostic pop" )
1329
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(clang diagnostic ignored str))
1330
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
1331
- # elif defined(_LIBCPP_COMPILER_GCC)
1332
- # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma (" GCC diagnostic push" )
1333
- # define _LIBCPP_DIAGNOSTIC_POP _Pragma (" GCC diagnostic pop" )
1334
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
1335
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str ) _Pragma (_LIBCPP_TOSTRING(GCC diagnostic ignored str))
1336
- # else
1337
- # define _LIBCPP_DIAGNOSTIC_PUSH
1338
- # define _LIBCPP_DIAGNOSTIC_POP
1339
- # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED (str )
1340
- # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED (str )
1341
- # endif
1342
-
1343
1360
// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these
1344
1361
// functions is gradually being added to existing C libraries. The conditions
1345
1362
// below check for known C library versions and conditions under which these
0 commit comments