]> gcc.gnu.org Git - gcc.git/blame - libstdc++-v3/include/c_global/cstddef
testsuite/gfortran.dg/open_errors_2.f90: Remove now-redundant file deletion
[gcc.git] / libstdc++-v3 / include / c_global / cstddef
CommitLineData
af13a7a6
BK
1// -*- C++ -*- forwarding header.
2
a945c346 3// Copyright (C) 1997-2024 Free Software Foundation, Inc.
af13a7a6
BK
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
af13a7a6
BK
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
748086b7
JJ
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
af13a7a6
BK
24
25/** @file cstddef
8e32aa11 26 * This is a Standard C++ Library file. You should @c \#include this file
2a60a9f6 27 * in your programs, rather than any of the @a *.h implementation files.
af13a7a6
BK
28 *
29 * This is the C++ version of the Standard C Library header @c stddef.h,
30 * and its contents are (mostly) the same as that header, but are all
31 * contained in the namespace @c std (except for names which are defined
32 * as macros in C).
33 */
34
35//
36// ISO C++ 14882: 18.1 Types
37//
38
899e00eb
PC
39#ifndef _GLIBCXX_CSTDDEF
40#define _GLIBCXX_CSTDDEF 1
41
63a598de 42#ifdef _GLIBCXX_SYSHDR
af13a7a6 43#pragma GCC system_header
63a598de 44#endif
af13a7a6 45
5f6dd593
BE
46#undef __need_wchar_t
47#undef __need_ptrdiff_t
48#undef __need_size_t
49#undef __need_NULL
50#undef __need_wint_t
af13a7a6 51#include <bits/c++config.h>
ddbfe947 52#include <stddef.h>
899e00eb 53
083b7f28
AA
54#define __glibcxx_want_byte
55#include <bits/version.h>
56
d3a7302e
JM
57#pragma GCC diagnostic push
58#pragma GCC diagnostic ignored "-Wpedantic" // __int128
59
daf69489
JW
60extern "C++"
61{
899e00eb
PC
62#if __cplusplus >= 201103L
63namespace std
64{
65 // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h.
66 using ::max_align_t;
67}
daf69489 68#endif // C++11
899e00eb 69
083b7f28 70#ifdef __cpp_lib_byte // C++ >= 17
e0472d7e
JW
71namespace std
72{
a01fc83f 73_GLIBCXX_BEGIN_NAMESPACE_VERSION
e0472d7e
JW
74 /// std::byte
75 enum class byte : unsigned char {};
76
58078de7 77 template<typename _IntegerType> struct __byte_operand { };
e0472d7e
JW
78 template<> struct __byte_operand<bool> { using __type = byte; };
79 template<> struct __byte_operand<char> { using __type = byte; };
80 template<> struct __byte_operand<signed char> { using __type = byte; };
81 template<> struct __byte_operand<unsigned char> { using __type = byte; };
e0472d7e 82 template<> struct __byte_operand<wchar_t> { using __type = byte; };
c124af93
TH
83#ifdef _GLIBCXX_USE_CHAR8_T
84 template<> struct __byte_operand<char8_t> { using __type = byte; };
e0472d7e
JW
85#endif
86 template<> struct __byte_operand<char16_t> { using __type = byte; };
87 template<> struct __byte_operand<char32_t> { using __type = byte; };
88 template<> struct __byte_operand<short> { using __type = byte; };
89 template<> struct __byte_operand<unsigned short> { using __type = byte; };
90 template<> struct __byte_operand<int> { using __type = byte; };
91 template<> struct __byte_operand<unsigned int> { using __type = byte; };
92 template<> struct __byte_operand<long> { using __type = byte; };
93 template<> struct __byte_operand<unsigned long> { using __type = byte; };
94 template<> struct __byte_operand<long long> { using __type = byte; };
95 template<> struct __byte_operand<unsigned long long> { using __type = byte; };
96#if defined(__GLIBCXX_TYPE_INT_N_0)
97 template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_0>
98 { using __type = byte; };
99 template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_0>
100 { using __type = byte; };
101#endif
102#if defined(__GLIBCXX_TYPE_INT_N_1)
103 template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_1>
104 { using __type = byte; };
105 template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_1>
106 { using __type = byte; };
107#endif
108#if defined(__GLIBCXX_TYPE_INT_N_2)
109 template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_2>
110 { using __type = byte; };
111 template<> struct __byte_operand<unsigned __GLIBCXX_TYPE_INT_N_2>
112 { using __type = byte; };
113#endif
114 template<typename _IntegerType>
115 struct __byte_operand<const _IntegerType>
116 : __byte_operand<_IntegerType> { };
117 template<typename _IntegerType>
118 struct __byte_operand<volatile _IntegerType>
119 : __byte_operand<_IntegerType> { };
120 template<typename _IntegerType>
121 struct __byte_operand<const volatile _IntegerType>
122 : __byte_operand<_IntegerType> { };
123
124 template<typename _IntegerType>
125 using __byte_op_t = typename __byte_operand<_IntegerType>::__type;
126
e0472d7e 127 template<typename _IntegerType>
4977507e 128 [[__gnu__::__always_inline__]]
e0472d7e
JW
129 constexpr __byte_op_t<_IntegerType>
130 operator<<(byte __b, _IntegerType __shift) noexcept
0c65926f 131 { return (byte)(unsigned char)((unsigned)__b << __shift); }
e0472d7e
JW
132
133 template<typename _IntegerType>
4977507e 134 [[__gnu__::__always_inline__]]
e0472d7e
JW
135 constexpr __byte_op_t<_IntegerType>
136 operator>>(byte __b, _IntegerType __shift) noexcept
0c65926f 137 { return (byte)(unsigned char)((unsigned)__b >> __shift); }
e0472d7e 138
4977507e 139 [[__gnu__::__always_inline__]]
e0472d7e
JW
140 constexpr byte
141 operator|(byte __l, byte __r) noexcept
0c65926f 142 { return (byte)(unsigned char)((unsigned)__l | (unsigned)__r); }
e0472d7e 143
4977507e 144 [[__gnu__::__always_inline__]]
e0472d7e
JW
145 constexpr byte
146 operator&(byte __l, byte __r) noexcept
0c65926f 147 { return (byte)(unsigned char)((unsigned)__l & (unsigned)__r); }
e0472d7e 148
4977507e 149 [[__gnu__::__always_inline__]]
e0472d7e
JW
150 constexpr byte
151 operator^(byte __l, byte __r) noexcept
0c65926f 152 { return (byte)(unsigned char)((unsigned)__l ^ (unsigned)__r); }
e0472d7e 153
4977507e 154 [[__gnu__::__always_inline__]]
e0472d7e
JW
155 constexpr byte
156 operator~(byte __b) noexcept
0c65926f
JW
157 { return (byte)(unsigned char)~(unsigned)__b; }
158
159 template<typename _IntegerType>
4977507e 160 [[__gnu__::__always_inline__]]
0c65926f
JW
161 constexpr __byte_op_t<_IntegerType>&
162 operator<<=(byte& __b, _IntegerType __shift) noexcept
163 { return __b = __b << __shift; }
164
165 template<typename _IntegerType>
4977507e 166 [[__gnu__::__always_inline__]]
0c65926f
JW
167 constexpr __byte_op_t<_IntegerType>&
168 operator>>=(byte& __b, _IntegerType __shift) noexcept
169 { return __b = __b >> __shift; }
170
4977507e 171 [[__gnu__::__always_inline__]]
0c65926f
JW
172 constexpr byte&
173 operator|=(byte& __l, byte __r) noexcept
174 { return __l = __l | __r; }
175
4977507e 176 [[__gnu__::__always_inline__]]
0c65926f
JW
177 constexpr byte&
178 operator&=(byte& __l, byte __r) noexcept
179 { return __l = __l & __r; }
180
4977507e 181 [[__gnu__::__always_inline__]]
0c65926f
JW
182 constexpr byte&
183 operator^=(byte& __l, byte __r) noexcept
184 { return __l = __l ^ __r; }
e0472d7e
JW
185
186 template<typename _IntegerType>
4977507e 187 [[nodiscard,__gnu__::__always_inline__]]
e0472d7e
JW
188 constexpr _IntegerType
189 to_integer(__byte_op_t<_IntegerType> __b) noexcept
190 { return _IntegerType(__b); }
191
a01fc83f 192_GLIBCXX_END_NAMESPACE_VERSION
e0472d7e 193} // namespace std
083b7f28 194#endif // __cpp_lib_byte
daf69489 195} // extern "C++"
e0472d7e 196
d3a7302e
JM
197#pragma GCC diagnostic pop
198
899e00eb 199#endif // _GLIBCXX_CSTDDEF
This page took 1.82753 seconds and 6 git commands to generate.