Skip to content

Commit 2265cbd

Browse files
committed
add cstdarg and fix (c)stddef in C89/C++98
1 parent ccc0daf commit 2265cbd

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/libc/include/stddef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ typedef __WCHAR_TYPE__ wchar_t;
1414
#endif /* __cplusplus */
1515
#endif /* _WCHAR_T_DEFINED */
1616

17+
#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
1718
typedef struct {
1819
long long __max_align_ll __attribute__((__aligned__(__alignof__( long long))));
1920
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
2021
#ifdef __FLOAT128__
2122
__float128 __max_align_f128 __attribute__((__aligned__(__alignof__( __float128))));
2223
#endif
2324
} max_align_t;
25+
#endif /* __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L */
2426

2527
#endif /* _STDDEF_H */

src/libcxx/header_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#endif // __cplusplus >= 201907L
1616
#include <csetjmp>
1717
#include <cstdalign>
18+
#include <cstdarg>
1819
#include <cstdbool>
1920
#include <cstddef>
2021
#include <cstdint>

src/libcxx/include/cstdarg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -*- C++ -*-
2+
#ifndef _EZCXX_CSTDARG
3+
#define _EZCXX_CSTDARG
4+
5+
#include <stdarg.h>
6+
7+
#pragma clang system_header
8+
9+
namespace std {
10+
11+
using ::va_list;
12+
13+
} // namespace std
14+
15+
#endif // _EZCXX_CSTDARG

src/libcxx/include/cstddef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ namespace std {
1010

1111
using ::ptrdiff_t;
1212
using ::size_t;
13+
14+
#if __cplusplus >= 201103L
1315
using ::max_align_t;
1416
using nullptr_t = decltype(nullptr);
17+
#endif /* __cplusplus >= 201103L */
1518

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

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

2631
} // namespace std
2732

0 commit comments

Comments
 (0)