Skip to content

Commit ccc0daf

Browse files
committed
added more to <type_traits> and fixed src/libcxx whitespace
1 parent 047098a commit ccc0daf

File tree

10 files changed

+974
-922
lines changed

10 files changed

+974
-922
lines changed

src/libcxx/include/__abs_overloads

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
// -*- C++ -*-
2-
#ifndef _EZCXX_ABS_OVERLOADS
3-
#define _EZCXX_ABS_OVERLOADS
4-
5-
#include <cdefs.h>
6-
7-
#pragma clang system_header
8-
9-
// https://cplusplus.github.io/LWG/issue2192
10-
11-
#ifndef _ABS_INT_DEFINED
12-
#define _ABS_INT_DEFINED
13-
14-
__BEGIN_DECLS
15-
16-
int abs(int n);
17-
long labs(long n);
18-
long long llabs(long long n);
19-
20-
#ifdef __SIZEOF_INT48__
21-
signed __int48 i48abs(signed __int48 n) __NOEXCEPT_CONST;
22-
#endif // __SIZEOF_INT48__
23-
24-
__END_DECLS
25-
26-
#endif // _ABS_INT_DEFINED
27-
28-
#ifndef _ABS_FLOAT_DEFINED
29-
#define _ABS_FLOAT_DEFINED
30-
31-
extern "C" {
32-
float fabsf(float);
33-
double fabs(double);
34-
long double fabsl(long double);
35-
} // extern "C"
36-
37-
#endif // _ABS_FLOAT_DEFINED
38-
39-
namespace std {
40-
using ::abs;
41-
inline constexpr long abs(long __x) { return labs(__x); }
42-
inline constexpr long long abs(long long __x) { return llabs(__x); }
43-
44-
#ifdef __SIZEOF_INT48__
45-
using ::i48abs;
46-
inline signed __int48 abs(signed __int48 __x) { return i48abs(__x); }
47-
#endif // __SIZEOF_INT48__
48-
49-
inline constexpr float abs(float __x) { return fabsf(__x); }
50-
inline constexpr double abs(double __x) { return fabs(__x); }
51-
inline constexpr long double abs(long double __x) { return fabsl(__x); }
52-
}
53-
54-
#endif // _EZCXX_ABS_OVERLOADS
1+
// -*- C++ -*-
2+
#ifndef _EZCXX_ABS_OVERLOADS
3+
#define _EZCXX_ABS_OVERLOADS
4+
5+
#include <cdefs.h>
6+
7+
#pragma clang system_header
8+
9+
// https://cplusplus.github.io/LWG/issue2192
10+
11+
#ifndef _ABS_INT_DEFINED
12+
#define _ABS_INT_DEFINED
13+
14+
__BEGIN_DECLS
15+
16+
int abs(int n);
17+
long labs(long n);
18+
long long llabs(long long n);
19+
20+
#ifdef __SIZEOF_INT48__
21+
signed __int48 i48abs(signed __int48 n) __NOEXCEPT_CONST;
22+
#endif // __SIZEOF_INT48__
23+
24+
__END_DECLS
25+
26+
#endif // _ABS_INT_DEFINED
27+
28+
#ifndef _ABS_FLOAT_DEFINED
29+
#define _ABS_FLOAT_DEFINED
30+
31+
extern "C" {
32+
float fabsf(float);
33+
double fabs(double);
34+
long double fabsl(long double);
35+
} // extern "C"
36+
37+
#endif // _ABS_FLOAT_DEFINED
38+
39+
namespace std {
40+
using ::abs;
41+
inline constexpr long abs(long __x) { return labs(__x); }
42+
inline constexpr long long abs(long long __x) { return llabs(__x); }
43+
44+
#ifdef __SIZEOF_INT48__
45+
using ::i48abs;
46+
inline signed __int48 abs(signed __int48 __x) { return i48abs(__x); }
47+
#endif // __SIZEOF_INT48__
48+
49+
inline constexpr float abs(float __x) { return fabsf(__x); }
50+
inline constexpr double abs(double __x) { return fabs(__x); }
51+
inline constexpr long double abs(long double __x) { return fabsl(__x); }
52+
}
53+
54+
#endif // _EZCXX_ABS_OVERLOADS

src/libcxx/include/cmath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ using ::nextupl;
637637
inline float nextup(float __x) { return nextupf(__x); }
638638
inline long double nextup(long double __x) { return nextupl(__x); }
639639
template<typename _Tp> inline
640-
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
640+
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
641641
nextup(_Tp __x) { return nextup(__x); }
642642

643643
using ::nexttoward;
@@ -655,7 +655,7 @@ using ::nextdownl;
655655
inline float nextdown(float __x) { return nextdownf(__x); }
656656
inline long double nextdown(long double __x) { return nextdownl(__x); }
657657
template<typename _Tp> inline
658-
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
658+
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
659659
nextdown(_Tp __x) { return nextdown(__x); }
660660

661661
using ::pow;

src/libcxx/include/cstdint

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,45 @@
77
#pragma clang system_header
88

99
namespace std {
10-
using::int8_t;
11-
using::int16_t;
12-
using::int24_t;
13-
using::int32_t;
14-
using::int48_t;
15-
using::int64_t;
16-
17-
using::uint8_t;
18-
using::uint16_t;
19-
using::uint24_t;
20-
using::uint32_t;
21-
using::uint48_t;
22-
using::uint64_t;
23-
24-
using::int_least8_t;
25-
using::int_least16_t;
26-
using::int_least32_t;
27-
using::int_least64_t;
28-
29-
using::uint_least8_t;
30-
using::uint_least16_t;
31-
using::uint_least32_t;
32-
using::uint_least64_t;
33-
34-
using::int_fast8_t;
35-
using::int_fast16_t;
36-
using::int_fast32_t;
37-
using::int_fast64_t;
38-
39-
using::uint_fast8_t;
40-
using::uint_fast16_t;
41-
using::uint_fast32_t;
42-
using::uint_fast64_t;
43-
44-
using::intptr_t;
45-
using::uintptr_t;
46-
47-
using::intmax_t;
48-
using::uintmax_t;
10+
using ::int8_t;
11+
using ::int16_t;
12+
using ::int24_t;
13+
using ::int32_t;
14+
using ::int48_t;
15+
using ::int64_t;
16+
17+
using ::uint8_t;
18+
using ::uint16_t;
19+
using ::uint24_t;
20+
using ::uint32_t;
21+
using ::uint48_t;
22+
using ::uint64_t;
23+
24+
using ::int_least8_t;
25+
using ::int_least16_t;
26+
using ::int_least32_t;
27+
using ::int_least64_t;
28+
29+
using ::uint_least8_t;
30+
using ::uint_least16_t;
31+
using ::uint_least32_t;
32+
using ::uint_least64_t;
33+
34+
using ::int_fast8_t;
35+
using ::int_fast16_t;
36+
using ::int_fast32_t;
37+
using ::int_fast64_t;
38+
39+
using ::uint_fast8_t;
40+
using ::uint_fast16_t;
41+
using ::uint_fast32_t;
42+
using ::uint_fast64_t;
43+
44+
using ::intptr_t;
45+
using ::uintptr_t;
46+
47+
using ::intmax_t;
48+
using ::uintmax_t;
4949
} // namespace std
5050

5151
#endif // _EZCXX_CSTDINT

src/libcxx/include/memory

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
// -*- C++ -*-
2-
#ifndef _EZCXX_MEMORY
3-
#define _EZCXX_MEMORY
4-
5-
#pragma clang system_header
6-
7-
namespace std {
8-
9-
template <class _Tp>
10-
constexpr inline _Tp* addressof(_Tp& __x) noexcept {
11-
return __builtin_addressof(__x);
12-
}
13-
14-
template <class _Tp>
15-
_Tp* addressof(const _Tp&&) noexcept = delete;
16-
17-
} // namespace std
18-
19-
#endif // _EZCXX_MEMORY
1+
// -*- C++ -*-
2+
#ifndef _EZCXX_MEMORY
3+
#define _EZCXX_MEMORY
4+
5+
#pragma clang system_header
6+
7+
namespace std {
8+
9+
template <class _Tp>
10+
constexpr inline _Tp* addressof(_Tp& __x) noexcept {
11+
return __builtin_addressof(__x);
12+
}
13+
14+
template <class _Tp>
15+
_Tp* addressof(const _Tp&&) noexcept = delete;
16+
17+
} // namespace std
18+
19+
#endif // _EZCXX_MEMORY

src/libcxx/include/source_location

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
// -*- C++ -*-
2-
//===----------------------------------------------------------------------===//
3-
//
4-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5-
// See https://llvm.org/LICENSE.txt for license information.
6-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7-
//
8-
//===----------------------------------------------------------------------===//
9-
10-
#ifndef _EZCXX_SOURCE_LOCATION
11-
#define _EZCXX_SOURCE_LOCATION
12-
13-
#include <__config>
14-
#include <cstdint>
15-
16-
#pragma clang system_header
17-
18-
namespace std {
19-
20-
class source_location {
21-
// The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column
22-
// are hard-coded in the compiler and must not be changed here.
23-
struct __impl {
24-
const char* _M_file_name;
25-
const char* _M_function_name;
26-
unsigned _M_line;
27-
unsigned _M_column;
28-
};
29-
const __impl* __ptr_ = nullptr;
30-
// GCC returns the type 'const void*' from the builtin, while clang returns
31-
// `const __impl*`. Per C++ [expr.const], casts from void* are not permitted
32-
// in constant evaluation, so we don't want to use `void*` as the argument
33-
// type unless the builtin returned that, anyhow, and the invalid cast is
34-
// unavoidable.
35-
using __bsl_ty _EZCXX_NODEBUG = decltype(__builtin_source_location());
36-
37-
public:
38-
// The defaulted __ptr argument is necessary so that the builtin is evaluated
39-
// in the context of the caller. An explicit value should never be provided.
40-
static consteval source_location current(__bsl_ty __ptr = __builtin_source_location()) noexcept {
41-
source_location __sl;
42-
__sl.__ptr_ = static_cast<const __impl*>(__ptr);
43-
return __sl;
44-
}
45-
_EZCXX_HIDE_FROM_ABI constexpr source_location() noexcept = default;
46-
47-
_EZCXX_HIDE_FROM_ABI constexpr uint_least32_t line() const noexcept {
48-
return __ptr_ != nullptr ? __ptr_->_M_line : 0;
49-
}
50-
_EZCXX_HIDE_FROM_ABI constexpr uint_least32_t column() const noexcept {
51-
return __ptr_ != nullptr ? __ptr_->_M_column : 0;
52-
}
53-
_EZCXX_HIDE_FROM_ABI constexpr const char* file_name() const noexcept {
54-
return __ptr_ != nullptr ? __ptr_->_M_file_name : "";
55-
}
56-
_EZCXX_HIDE_FROM_ABI constexpr const char* function_name() const noexcept {
57-
return __ptr_ != nullptr ? __ptr_->_M_function_name : "";
58-
}
59-
};
60-
61-
} // namespace std
62-
63-
#endif // _EZCXX_SOURCE_LOCATION
1+
// -*- C++ -*-
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef _EZCXX_SOURCE_LOCATION
11+
#define _EZCXX_SOURCE_LOCATION
12+
13+
#include <__config>
14+
#include <cstdint>
15+
16+
#pragma clang system_header
17+
18+
namespace std {
19+
20+
class source_location {
21+
// The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column
22+
// are hard-coded in the compiler and must not be changed here.
23+
struct __impl {
24+
const char* _M_file_name;
25+
const char* _M_function_name;
26+
unsigned _M_line;
27+
unsigned _M_column;
28+
};
29+
const __impl* __ptr_ = nullptr;
30+
// GCC returns the type 'const void*' from the builtin, while clang returns
31+
// `const __impl*`. Per C++ [expr.const], casts from void* are not permitted
32+
// in constant evaluation, so we don't want to use `void*` as the argument
33+
// type unless the builtin returned that, anyhow, and the invalid cast is
34+
// unavoidable.
35+
using __bsl_ty _EZCXX_NODEBUG = decltype(__builtin_source_location());
36+
37+
public:
38+
// The defaulted __ptr argument is necessary so that the builtin is evaluated
39+
// in the context of the caller. An explicit value should never be provided.
40+
static consteval source_location current(__bsl_ty __ptr = __builtin_source_location()) noexcept {
41+
source_location __sl;
42+
__sl.__ptr_ = static_cast<const __impl*>(__ptr);
43+
return __sl;
44+
}
45+
_EZCXX_HIDE_FROM_ABI constexpr source_location() noexcept = default;
46+
47+
_EZCXX_HIDE_FROM_ABI constexpr uint_least32_t line() const noexcept {
48+
return __ptr_ != nullptr ? __ptr_->_M_line : 0;
49+
}
50+
_EZCXX_HIDE_FROM_ABI constexpr uint_least32_t column() const noexcept {
51+
return __ptr_ != nullptr ? __ptr_->_M_column : 0;
52+
}
53+
_EZCXX_HIDE_FROM_ABI constexpr const char* file_name() const noexcept {
54+
return __ptr_ != nullptr ? __ptr_->_M_file_name : "";
55+
}
56+
_EZCXX_HIDE_FROM_ABI constexpr const char* function_name() const noexcept {
57+
return __ptr_ != nullptr ? __ptr_->_M_function_name : "";
58+
}
59+
};
60+
61+
} // namespace std
62+
63+
#endif // _EZCXX_SOURCE_LOCATION

0 commit comments

Comments
 (0)