From 9fef8294669e767c9f16cfabec51a23dde2efe4a Mon Sep 17 00:00:00 2001 From: bumbread Date: Sat, 6 Aug 2022 23:12:36 +1100 Subject: [PATCH] stdalign.h, stdbool.h, stdnoreturn.h --- doc/readme.md | 9 +-------- inc/std.h | 8 ++++++++ inc/stdalign.h | 8 ++++++++ inc/stdbool.h | 14 ++++---------- inc/stddef.h | 24 ------------------------ inc/stdnoreturn.h | 6 ++++++ 6 files changed, 27 insertions(+), 42 deletions(-) create mode 100644 inc/stdalign.h create mode 100644 inc/stdnoreturn.h diff --git a/doc/readme.md b/doc/readme.md index 0a76323..7e54ef5 100644 --- a/doc/readme.md +++ b/doc/readme.md @@ -12,15 +12,8 @@ in different kinds of programs. The implementation doesn't provide all headers. The headers that aren't provided are supposed to be provided by compiler. The list of such headers: -- float.h -- iso646.h -- limits.h -- stdalign.h - stdarg.h -- stdbool.h -- stddef.h -- stdint.h -- stdnoreturn.h +- setjmp.h The headers that are provided have documentation included: diff --git a/inc/std.h b/inc/std.h index f91d4bc..8aeada2 100644 --- a/inc/std.h +++ b/inc/std.h @@ -5,17 +5,25 @@ #include #include #include +#include #include +#include #include #include #include +#include #include +#include #include +#include #include +#include #include #include #include +#include #include +#include #include #include #include diff --git a/inc/stdalign.h b/inc/stdalign.h new file mode 100644 index 0000000..5c4013d --- /dev/null +++ b/inc/stdalign.h @@ -0,0 +1,8 @@ + +#pragma once + +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 + +#define alignas _Alignas +#define alignof _Alignof diff --git a/inc/stdbool.h b/inc/stdbool.h index d7fa82b..1cbb9a1 100644 --- a/inc/stdbool.h +++ b/inc/stdbool.h @@ -1,14 +1,8 @@ #pragma once -#if !defined(bool) - #define bool _Bool -#endif +#define __bool_true_false_are_defined 1 -#if !defined(true) - #define true 1 -#endif - -#if !defined(false) - #define false 0 -#endif +#define bool _Bool +#define true 1 +#define false 0 diff --git a/inc/stddef.h b/inc/stddef.h index 60579c2..26922a0 100644 --- a/inc/stddef.h +++ b/inc/stddef.h @@ -1,35 +1,11 @@ #pragma once -#define __bool_true_false_are_defined 1 -#define __alignas_is_defined 1 -#define __alignof_is_defined 1 - #if !defined(NULL) #define NULL ((void *)0) #endif -#if !defined(bool) - #define bool _Bool -#endif - -#if !defined(true) - #define true 1 -#endif - -#if !defined(false) - #define false 0 -#endif - #define offsetof(st, m) ((size_t)((char *)&((st *)0)->m - (char *)0)) -#define alignas _Alignas -#define alignof _Alignof - -#if !defined(_MSC_VER) - #define noreturn _Noreturn -#else - #define noreturn declspec(noreturn) -#endif #if defined(_WIN32) typedef long long ptrdiff_t; diff --git a/inc/stdnoreturn.h b/inc/stdnoreturn.h new file mode 100644 index 0000000..2dba6c1 --- /dev/null +++ b/inc/stdnoreturn.h @@ -0,0 +1,6 @@ + +#pragma once + +#if !defined(noreturn) + #define noreturn _Noreturn +#endif