diff --git a/cfloat b/cfloat new file mode 100644 index 0000000..05b87ba --- /dev/null +++ b/cfloat @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CFLOAT +#define _CFLOAT 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/ciso646 b/ciso646 new file mode 100644 index 0000000..e69de29 diff --git a/climits b/climits new file mode 100644 index 0000000..71a822f --- /dev/null +++ b/climits @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CLIMITS +#define _CLIMITS 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/cstdalign b/cstdalign new file mode 100644 index 0000000..13be892 --- /dev/null +++ b/cstdalign @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CSTDALIGN +#define _CSTDALIGN 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/cstdarg b/cstdarg new file mode 100644 index 0000000..b5b4bc3 --- /dev/null +++ b/cstdarg @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CSTDARG +#define _CSTDARG 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/cstdbool b/cstdbool new file mode 100644 index 0000000..3c28ec8 --- /dev/null +++ b/cstdbool @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CSTDBOOL +#define _CSTDBOOL 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/cstddef b/cstddef new file mode 100644 index 0000000..9db84f5 --- /dev/null +++ b/cstddef @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CSTDDEF +#define _CSTDDEF 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/cstdint b/cstdint new file mode 100644 index 0000000..a17a5bf --- /dev/null +++ b/cstdint @@ -0,0 +1,16 @@ +#ifndef __cplusplus +#error "Must only use this header with C++" +#endif + +#ifndef _CSTDINT +#define _CSTDINT 1 + +namespace std { + +#define __LIBC_GUARDLESS_INCLUDE +#include +#undef __LIBC_GUARDLESS_INCLUDE + +} + +#endif diff --git a/float.h b/float.h index d5c82fd..e677f18 100644 --- a/float.h +++ b/float.h @@ -1,5 +1,6 @@ +#if !defined(_FLOAT_H) || defined(__LIBC_GUARDLESS_INCLUDE) + #ifndef _FLOAT_H -#define _FLOAT_H 1 #define FLT_ROUNDS 1 @@ -11,6 +12,10 @@ #define DECIMAL_DIG __DECIMAL_DIG__ +#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__ +#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ +#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ + #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #define FLT_DIG __FLT_DIG__ @@ -46,3 +51,9 @@ #define LDBL_MIN __LDBL_MIN__ #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _FLOAT_H 1 +#endif + +#endif diff --git a/limits.h b/limits.h index 04bb0b7..b8ae625 100644 --- a/limits.h +++ b/limits.h @@ -1,5 +1,6 @@ +#if !defined(_LIMITS_H) || defined(__LIBC_GUARDLESS_INCLUDE) + #ifndef _LIMITS_H -#define _LIMITS_H 1 #ifndef __LIBC_C_JOIN # define __LIBC_C_EXPAND_JOIN(x, suffix) x ## suffix @@ -8,6 +9,8 @@ #define CHAR_BIT __CHAR_BIT__ +#define MB_LEN_MAX 16 + #define SCHAR_MAX __SCHAR_MAX__ #define SCHAR_MIN (-SCHAR_MAX - 1) @@ -42,3 +45,9 @@ #define ULLONG_MAX (__LIBC_C_JOIN(LLONG_MAX, U) * 2 + 1) #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _LIMITS_H 1 +#endif + +#endif diff --git a/stdalign.h b/stdalign.h index b2e53a4..72ab984 100644 --- a/stdalign.h +++ b/stdalign.h @@ -1,10 +1,20 @@ -#ifndef _STDALIGN_H -#define _STDALIGN_H 1 +#if !defined(_STDALIGN_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#define alignas _Alignas -#define alignof _Alignof +#ifndef _STDALIGN_H + +#ifndef __cplusplus +# define alignas _Alignas +# define alignof _Alignof + +# define __alignof_is_defined 1 +#endif #define __alignas_is_defined 1 -#define __alignof_is_defined 1 + +#endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _STDALIGN_H 1 +#endif #endif diff --git a/stdarg.h b/stdarg.h index fa243e0..cbc064d 100644 --- a/stdarg.h +++ b/stdarg.h @@ -1,11 +1,18 @@ -#ifndef _STDARG_H -#define _STDARG_H 1 +#if !defined(_STDARG_H) || defined(__LIBC_GUARDLESS_INCLUDE) typedef __builtin_va_list va_list; +#ifndef _STDARG_H + #define va_start(v, l) __builtin_va_start(v, l) #define va_end(v) __builtin_va_end(v) #define va_arg(v, l) __builtin_va_arg(v, l) #define va_copy(d, s) __builtin_va_copy(d, s) #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _STDARG_H 1 +#endif + +#endif diff --git a/stdbool.h b/stdbool.h index bb2328c..1878fd3 100644 --- a/stdbool.h +++ b/stdbool.h @@ -1,11 +1,20 @@ +#if !defined(_STDBOOL_H) || defined(__LIBC_GUARDLESS_INCLUDE) + +#ifndef __cplusplus +# define bool _Bool + +# define true 1 +# define false 0 +#endif + #ifndef _STDBOOL_H -#define _STDBOOL_H 1 - -#define bool _Bool - -#define true 1 -#define false 0 #define __bool_true_false_are_defined 1 #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _STDBOOL_H 1 +#endif + +#endif diff --git a/stddef.h b/stddef.h index ed40ebb..9fe871e 100644 --- a/stddef.h +++ b/stddef.h @@ -1,5 +1,4 @@ -#ifndef _STDDEF_H -#define _STDDEF_H 1 +#if !defined(_STDDEF_H) || defined(__LIBC_GUARDLESS_INCLUDE) typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -8,6 +7,14 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __WCHAR_TYPE__ wchar_t; #endif +#ifdef __cplusplus +typedef decltype(nullptr) nullptr_t; + +enum class byte : unsigned char {}; +#endif + +#ifndef _STDDEF_H + #ifdef NULL #undef NULL #endif @@ -21,3 +28,9 @@ typedef __WCHAR_TYPE__ wchar_t; #define offsetof(s, m) __builtin_offsetof(s, m) #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _STDDEF_H 1 +#endif + +#endif diff --git a/stdint.h b/stdint.h index 4323b27..3050992 100644 --- a/stdint.h +++ b/stdint.h @@ -1,5 +1,4 @@ -#ifndef _STDINT_H -#define _STDINT_H 1 +#if !defined(_STDINT_H) || defined(__LIBC_GUARDLESS_INCLUDE) typedef __UINT8_TYPE__ uint8_t; typedef __UINT16_TYPE__ uint16_t; @@ -37,6 +36,8 @@ typedef __INTPTR_TYPE__ intptr_t; typedef __UINTMAX_TYPE__ uintmax_t; typedef __INTMAX_TYPE__ intmax_t; +#ifndef _STDINT_H + /* Clang and GCC have different mechanisms for INT32_C and friends. */ #ifdef __clang__ # define __LIBC_C_EXPAND_JOIN(x, suffix) x ## suffix @@ -137,3 +138,9 @@ typedef __INTMAX_TYPE__ intmax_t; #define WINT_MIN (-WINT_MAX - 1) #endif + +#if !defined(__LIBC_GUARDLESS_INCLUDE) +#define _STDINT_H 1 +#endif + +#endif