Warning, /include/c++/v1/__cxx03/cstddef is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP___CXX03_CSTDDEF
0011 #define _LIBCPP___CXX03_CSTDDEF
0012
0013 /*
0014 cstddef synopsis
0015
0016 Macros:
0017
0018 offsetof(type,member-designator)
0019 NULL
0020
0021 namespace std
0022 {
0023
0024 Types:
0025
0026 ptrdiff_t
0027 size_t
0028 max_align_t // C++11
0029 nullptr_t
0030 byte // C++17
0031
0032 } // std
0033
0034 */
0035
0036 #include <__cxx03/__config>
0037 #include <__cxx03/__type_traits/enable_if.h>
0038 #include <__cxx03/__type_traits/integral_constant.h>
0039 #include <__cxx03/__type_traits/is_integral.h>
0040 #include <__cxx03/version>
0041
0042 #include <__cxx03/stddef.h>
0043
0044 #ifndef _LIBCPP___CXX03_STDDEF_H
0045 # error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header. \
0046 This usually means that your header search paths are not configured properly. \
0047 The header search paths should contain the C++ Standard Library headers before \
0048 any C Standard Library, and you are probably using compiler flags that make that \
0049 not be the case.
0050 #endif
0051
0052 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0053 # pragma GCC system_header
0054 #endif
0055
0056 _LIBCPP_BEGIN_NAMESPACE_STD
0057
0058 using ::nullptr_t;
0059 using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
0060 using ::size_t _LIBCPP_USING_IF_EXISTS;
0061
0062 #if !defined(_LIBCPP_CXX03_LANG)
0063 using ::max_align_t _LIBCPP_USING_IF_EXISTS;
0064 #endif
0065
0066 _LIBCPP_END_NAMESPACE_STD
0067
0068 #if _LIBCPP_STD_VER >= 17
0069 namespace std // purposefully not versioned
0070 {
0071 enum class byte : unsigned char {};
0072
0073 _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
0074 return static_cast<byte>(
0075 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
0076 }
0077
0078 _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept {
0079 return __lhs = __lhs | __rhs;
0080 }
0081
0082 _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
0083 return static_cast<byte>(
0084 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
0085 }
0086
0087 _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept {
0088 return __lhs = __lhs & __rhs;
0089 }
0090
0091 _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
0092 return static_cast<byte>(
0093 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
0094 }
0095
0096 _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept {
0097 return __lhs = __lhs ^ __rhs;
0098 }
0099
0100 _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept {
0101 return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
0102 }
0103
0104 template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
0105 _LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift) noexcept {
0106 return __lhs = __lhs << __shift;
0107 }
0108
0109 template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
0110 _LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept {
0111 return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift));
0112 }
0113
0114 template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
0115 _LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift) noexcept {
0116 return __lhs = __lhs >> __shift;
0117 }
0118
0119 template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
0120 _LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept {
0121 return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift));
0122 }
0123
0124 template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
0125 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Integer to_integer(byte __b) noexcept {
0126 return static_cast<_Integer>(__b);
0127 }
0128
0129 } // namespace std
0130
0131 #endif
0132
0133 #endif // _LIBCPP___CXX03_CSTDDEF