Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libc/include/stddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ typedef __WCHAR_TYPE__ wchar_t;
#endif /* __cplusplus */
#endif /* _WCHAR_T_DEFINED */

#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
typedef struct {
long long __max_align_ll __attribute__((__aligned__(__alignof__( long long))));
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
#ifdef __FLOAT128__
__float128 __max_align_f128 __attribute__((__aligned__(__alignof__( __float128))));
#endif
} max_align_t;
#endif /* __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L */

#endif /* _STDDEF_H */
3 changes: 2 additions & 1 deletion src/libcxx/abort_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ __BEGIN_DECLS
void __abort_message(const char *) __attribute__((noreturn));

__END_DECLS
__END_DECLS

} // namespace std

#endif // _EZCXX_ABORT_MESSAGE_H
1 change: 1 addition & 0 deletions src/libcxx/header_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#endif // __cplusplus >= 201907L
#include <csetjmp>
#include <cstdalign>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
Expand Down
108 changes: 54 additions & 54 deletions src/libcxx/include/__abs_overloads
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
// -*- C++ -*-
#ifndef _EZCXX_ABS_OVERLOADS
#define _EZCXX_ABS_OVERLOADS
#include <cdefs.h>
#pragma clang system_header
// https://cplusplus.github.io/LWG/issue2192
#ifndef _ABS_INT_DEFINED
#define _ABS_INT_DEFINED
__BEGIN_DECLS
int abs(int n);
long labs(long n);
long long llabs(long long n);
#ifdef __SIZEOF_INT48__
signed __int48 i48abs(signed __int48 n) __NOEXCEPT_CONST;
#endif // __SIZEOF_INT48__
__END_DECLS
#endif // _ABS_INT_DEFINED
#ifndef _ABS_FLOAT_DEFINED
#define _ABS_FLOAT_DEFINED
extern "C" {
float fabsf(float);
double fabs(double);
long double fabsl(long double);
} // extern "C"
#endif // _ABS_FLOAT_DEFINED
namespace std {
using ::abs;
inline constexpr long abs(long __x) { return labs(__x); }
inline constexpr long long abs(long long __x) { return llabs(__x); }
#ifdef __SIZEOF_INT48__
using ::i48abs;
inline signed __int48 abs(signed __int48 __x) { return i48abs(__x); }
#endif // __SIZEOF_INT48__
inline constexpr float abs(float __x) { return fabsf(__x); }
inline constexpr double abs(double __x) { return fabs(__x); }
inline constexpr long double abs(long double __x) { return fabsl(__x); }
}
#endif // _EZCXX_ABS_OVERLOADS
// -*- C++ -*-
#ifndef _EZCXX_ABS_OVERLOADS
#define _EZCXX_ABS_OVERLOADS

#include <cdefs.h>

#pragma clang system_header

// https://cplusplus.github.io/LWG/issue2192

#ifndef _ABS_INT_DEFINED
#define _ABS_INT_DEFINED

__BEGIN_DECLS

int abs(int n);
long labs(long n);
long long llabs(long long n);

#ifdef __SIZEOF_INT48__
signed __int48 i48abs(signed __int48 n) __NOEXCEPT_CONST;
#endif // __SIZEOF_INT48__

__END_DECLS

#endif // _ABS_INT_DEFINED

#ifndef _ABS_FLOAT_DEFINED
#define _ABS_FLOAT_DEFINED

extern "C" {
float fabsf(float);
double fabs(double);
long double fabsl(long double);
} // extern "C"

#endif // _ABS_FLOAT_DEFINED

namespace std {
using ::abs;
inline constexpr long abs(long __x) { return labs(__x); }
inline constexpr long long abs(long long __x) { return llabs(__x); }

#ifdef __SIZEOF_INT48__
using ::i48abs;
inline signed __int48 abs(signed __int48 __x) { return i48abs(__x); }
#endif // __SIZEOF_INT48__

inline constexpr float abs(float __x) { return fabsf(__x); }
inline constexpr double abs(double __x) { return fabs(__x); }
inline constexpr long double abs(long double __x) { return fabsl(__x); }
}

#endif // _EZCXX_ABS_OVERLOADS
4 changes: 2 additions & 2 deletions src/libcxx/include/cmath
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ using ::nextupl;
inline float nextup(float __x) { return nextupf(__x); }
inline long double nextup(long double __x) { return nextupl(__x); }
template<typename _Tp> inline
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
nextup(_Tp __x) { return nextup(__x); }

using ::nexttoward;
Expand All @@ -655,7 +655,7 @@ using ::nextdownl;
inline float nextdown(float __x) { return nextdownf(__x); }
inline long double nextdown(long double __x) { return nextdownl(__x); }
template<typename _Tp> inline
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
__cmath_enable_if_t<__cmath_is_integral_v<_Tp>, double>
nextdown(_Tp __x) { return nextdown(__x); }

using ::pow;
Expand Down
15 changes: 15 additions & 0 deletions src/libcxx/include/cstdarg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// -*- C++ -*-
#ifndef _EZCXX_CSTDARG
#define _EZCXX_CSTDARG

#include <stdarg.h>

#pragma clang system_header

namespace std {

using ::va_list;

} // namespace std

#endif // _EZCXX_CSTDARG
5 changes: 5 additions & 0 deletions src/libcxx/include/cstddef
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ namespace std {

using ::ptrdiff_t;
using ::size_t;

#if __cplusplus >= 201103L
using ::max_align_t;
using nullptr_t = decltype(nullptr);
#endif /* __cplusplus >= 201103L */

#if __cplusplus >= 201703L
enum class byte : unsigned char {};

constexpr byte operator| (byte __lhs, byte __rhs) noexcept { return byte(char(__lhs) | char(__rhs)); }
Expand All @@ -22,6 +26,7 @@ constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept { return __lhs = __
constexpr byte operator^ (byte __lhs, byte __rhs) noexcept { return byte(char(__lhs) ^ char(__rhs)); }
constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept { return __lhs = __lhs ^ __rhs; }
constexpr byte operator~ (byte __rhs) noexcept { return byte(~char(__rhs)); }
#endif /* __cplusplus >= 201703L */

} // namespace std

Expand Down
78 changes: 39 additions & 39 deletions src/libcxx/include/cstdint
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@
#pragma clang system_header

namespace std {
using::int8_t;
using::int16_t;
using::int24_t;
using::int32_t;
using::int48_t;
using::int64_t;

using::uint8_t;
using::uint16_t;
using::uint24_t;
using::uint32_t;
using::uint48_t;
using::uint64_t;

using::int_least8_t;
using::int_least16_t;
using::int_least32_t;
using::int_least64_t;

using::uint_least8_t;
using::uint_least16_t;
using::uint_least32_t;
using::uint_least64_t;

using::int_fast8_t;
using::int_fast16_t;
using::int_fast32_t;
using::int_fast64_t;

using::uint_fast8_t;
using::uint_fast16_t;
using::uint_fast32_t;
using::uint_fast64_t;

using::intptr_t;
using::uintptr_t;

using::intmax_t;
using::uintmax_t;
using ::int8_t;
using ::int16_t;
using ::int24_t;
using ::int32_t;
using ::int48_t;
using ::int64_t;

using ::uint8_t;
using ::uint16_t;
using ::uint24_t;
using ::uint32_t;
using ::uint48_t;
using ::uint64_t;

using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;

using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;

using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;

using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;

using ::intptr_t;
using ::uintptr_t;

using ::intmax_t;
using ::uintmax_t;
} // namespace std

#endif // _EZCXX_CSTDINT
38 changes: 19 additions & 19 deletions src/libcxx/include/memory
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// -*- C++ -*-
#ifndef _EZCXX_MEMORY
#define _EZCXX_MEMORY
#pragma clang system_header
namespace std {
template <class _Tp>
constexpr inline _Tp* addressof(_Tp& __x) noexcept {
return __builtin_addressof(__x);
}
template <class _Tp>
_Tp* addressof(const _Tp&&) noexcept = delete;
} // namespace std
#endif // _EZCXX_MEMORY
// -*- C++ -*-
#ifndef _EZCXX_MEMORY
#define _EZCXX_MEMORY

#pragma clang system_header

namespace std {

template <class _Tp>
constexpr inline _Tp* addressof(_Tp& __x) noexcept {
return __builtin_addressof(__x);
}

template <class _Tp>
_Tp* addressof(const _Tp&&) noexcept = delete;

} // namespace std

#endif // _EZCXX_MEMORY
10 changes: 5 additions & 5 deletions src/libcxx/include/numbers
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <type_traits>

#if __cplusplus >= 201907L
#include <concepts>
#include <concepts>
#endif

#pragma clang system_header
Expand All @@ -31,10 +31,10 @@ inline constexpr bool __false = false;

template <class _Tp>
struct __illformed {
static_assert(
__false<_Tp>,
"A program that instantiates a primary template of a mathematical constant variable template is ill-formed."
);
static_assert(
__false<_Tp>,
"A program that instantiates a primary template of a mathematical constant variable template is ill-formed."
);
};

template <class _Tp>
Expand Down
Loading
Loading