Skip to content

Commit

Permalink
[libc++][C++03] Add #if 0 to the experimental/ and ext/ headers as we…
Browse files Browse the repository at this point in the history
…ll (llvm#119541)

This has already been done for the most headers in
llvm#119234, but I
forgot to also do it for the experimental/ and ext/ headers.

This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
  • Loading branch information
philnik777 authored Dec 11, 2024
1 parent ad0fbb0 commit 323bedd
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 154 deletions.
43 changes: 23 additions & 20 deletions libcxx/include/experimental/iterator
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,25 @@ namespace std {
*/

#include <__config>
#include <__memory/addressof.h>
#include <__ostream/basic_ostream.h>
#include <__string/char_traits.h>
#include <__type_traits/decay.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <iterator>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if 0
#else // 0
# include <__config>
# include <__memory/addressof.h>
# include <__ostream/basic_ostream.h>
# include <__string/char_traits.h>
# include <__type_traits/decay.h>
# include <__utility/forward.h>
# include <__utility/move.h>
# include <iterator>

# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>
# include <__undef_macros>

#if _LIBCPP_STD_VER >= 14
# if _LIBCPP_STD_VER >= 14

_LIBCPP_BEGIN_NAMESPACE_LFTS

Expand Down Expand Up @@ -117,14 +119,15 @@ make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {

_LIBCPP_END_NAMESPACE_LFTS

#endif // _LIBCPP_STD_VER >= 14
# endif // _LIBCPP_STD_VER >= 14

_LIBCPP_POP_MACROS

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <iosfwd>
# include <type_traits>
#endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <iosfwd>
# include <type_traits>
# endif
#endif // 0

#endif // _LIBCPP_EXPERIMENTAL_ITERATOR
55 changes: 29 additions & 26 deletions libcxx/include/experimental/memory
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,29 @@ public:
}
*/

#include <__config>
#include <__cstddef/nullptr_t.h>
#include <__cstddef/size_t.h>
#include <__functional/hash.h>
#include <__functional/operations.h>
#include <__type_traits/add_lvalue_reference.h>
#include <__type_traits/add_pointer.h>
#include <__type_traits/common_type.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
#include <version>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

#ifdef _LIBCPP_ENABLE_EXPERIMENTAL
#if 0
#else // 0
# include <__config>
# include <__cstddef/nullptr_t.h>
# include <__cstddef/size_t.h>
# include <__functional/hash.h>
# include <__functional/operations.h>
# include <__type_traits/add_lvalue_reference.h>
# include <__type_traits/add_pointer.h>
# include <__type_traits/common_type.h>
# include <__type_traits/enable_if.h>
# include <__type_traits/is_convertible.h>
# include <version>

# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

# ifdef _LIBCPP_ENABLE_EXPERIMENTAL

_LIBCPP_BEGIN_NAMESPACE_LFTS_V2

# if _LIBCPP_STD_VER >= 17
# if _LIBCPP_STD_VER >= 17

template <class _Wp>
class observer_ptr {
Expand Down Expand Up @@ -172,30 +174,31 @@ _LIBCPP_HIDE_FROM_ABI bool operator>=(observer_ptr<_W1> __a, observer_ptr<_W2> _
return !(__a < __b);
}

# endif // _LIBCPP_STD_VER >= 17
# endif // _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_LFTS_V2

_LIBCPP_BEGIN_NAMESPACE_STD

// hash

# if _LIBCPP_STD_VER >= 17
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
struct hash<experimental::observer_ptr<_Tp>> {
_LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::observer_ptr<_Tp>& __ptr) const noexcept {
return hash<_Tp*>()(__ptr.get());
}
};
# endif // _LIBCPP_STD_VER >= 17
# endif // _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP_ENABLE_EXPERIMENTAL
# endif // _LIBCPP_ENABLE_EXPERIMENTAL

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <limits>
#endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <limits>
# endif
#endif // 0

#endif /* _LIBCPP_EXPERIMENTAL_MEMORY */
73 changes: 38 additions & 35 deletions libcxx/include/experimental/propagate_const
Original file line number Diff line number Diff line change
Expand Up @@ -107,39 +107,41 @@
*/

#include <__config>
#include <__cstddef/nullptr_t.h>
#include <__cstddef/size_t.h>
#include <__functional/operations.h>
#include <__fwd/functional.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_pointer.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_swappable.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_pointer.h>
#include <__type_traits/remove_reference.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
#include <version>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if 0
#else // 0
# include <__config>
# include <__cstddef/nullptr_t.h>
# include <__cstddef/size_t.h>
# include <__functional/operations.h>
# include <__fwd/functional.h>
# include <__type_traits/conditional.h>
# include <__type_traits/decay.h>
# include <__type_traits/enable_if.h>
# include <__type_traits/is_array.h>
# include <__type_traits/is_constructible.h>
# include <__type_traits/is_convertible.h>
# include <__type_traits/is_function.h>
# include <__type_traits/is_pointer.h>
# include <__type_traits/is_reference.h>
# include <__type_traits/is_same.h>
# include <__type_traits/is_swappable.h>
# include <__type_traits/remove_cv.h>
# include <__type_traits/remove_pointer.h>
# include <__type_traits/remove_reference.h>
# include <__utility/declval.h>
# include <__utility/forward.h>
# include <__utility/move.h>
# include <__utility/swap.h>
# include <version>

# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>
# include <__undef_macros>

#if _LIBCPP_STD_VER >= 14
# if _LIBCPP_STD_VER >= 14

_LIBCPP_BEGIN_NAMESPACE_LFTS_V2

Expand Down Expand Up @@ -481,13 +483,14 @@ struct greater_equal<experimental::propagate_const<_Tp>> {

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP_STD_VER >= 14
# endif // _LIBCPP_STD_VER >= 14

_LIBCPP_POP_MACROS

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <type_traits>
#endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# include <type_traits>
# endif
#endif // 0

#endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
29 changes: 16 additions & 13 deletions libcxx/include/experimental/simd
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ inline namespace parallelism_v2 {
# pragma GCC system_header
#endif

#include <__config>
#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/scalar.h>
#include <experimental/__simd/simd.h>
#include <experimental/__simd/simd_mask.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/vec_ext.h>

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
#endif
#if 0
#else // 0
# include <__config>
# include <experimental/__simd/aligned_tag.h>
# include <experimental/__simd/declaration.h>
# include <experimental/__simd/reference.h>
# include <experimental/__simd/scalar.h>
# include <experimental/__simd/simd.h>
# include <experimental/__simd/simd_mask.h>
# include <experimental/__simd/traits.h>
# include <experimental/__simd/vec_ext.h>

# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# endif
#endif // 0

#endif /* _LIBCPP_EXPERIMENTAL_SIMD */
25 changes: 14 additions & 11 deletions libcxx/include/experimental/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,18 @@ inline namespace fundamentals_v1 {
*/

#include <__config>
#if 0
#else // 0
# include <__config>

#if _LIBCPP_STD_VER >= 14
# if _LIBCPP_STD_VER >= 14

# include <initializer_list>
# include <type_traits>
# include <initializer_list>
# include <type_traits>

# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

_LIBCPP_BEGIN_NAMESPACE_LFTS

Expand Down Expand Up @@ -148,10 +150,11 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar

_LIBCPP_END_NAMESPACE_LFTS

# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# endif

#endif /* _LIBCPP_STD_VER >= 14 */
# endif /* _LIBCPP_STD_VER >= 14 */
#endif // 0

#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
19 changes: 11 additions & 8 deletions libcxx/include/experimental/utility
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@ inline namespace fundamentals_v1 {
*/

#include <__config>
#include <utility>
#if 0
#else // 0
# include <__config>
# include <utility>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif

_LIBCPP_BEGIN_NAMESPACE_LFTS

struct _LIBCPP_TEMPLATE_VIS erased_type {};

_LIBCPP_END_NAMESPACE_LFTS

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
#endif
# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
# endif
#endif // 0

#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
Loading

0 comments on commit 323bedd

Please sign in to comment.