forked from rui314/chibicc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stdarg.h, stdbool.h, stddef.h, stdalign.h and float.h
- Loading branch information
Showing
9 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef __STDFLOAT_H | ||
#define __STDFLOAT_H | ||
|
||
#define DECIMAL_DIG 21 | ||
#define FLT_EVAL_METHOD 0 // C11 5.2.4.2.2p9 | ||
#define FLT_RADIX 2 | ||
#define FLT_ROUNDS 1 // C11 5.2.4.2.2p8: to nearest | ||
|
||
#define FLT_DIG 6 | ||
#define FLT_EPSILON 0x1p-23 | ||
#define FLT_MANT_DIG 24 | ||
#define FLT_MAX 0x1.fffffep+127 | ||
#define FLT_MAX_10_EXP 38 | ||
#define FLT_MAX_EXP 128 | ||
#define FLT_MIN 0x1p-126 | ||
#define FLT_MIN_10_EXP -37 | ||
#define FLT_MIN_EXP -125 | ||
#define FLT_TRUE_MIN 0x1p-149 | ||
|
||
#define DBL_DIG 15 | ||
#define DBL_EPSILON 0x1p-52 | ||
#define DBL_MANT_DIG 53 | ||
#define DBL_MAX 0x1.fffffffffffffp+1023 | ||
#define DBL_MAX_10_EXP 308 | ||
#define DBL_MAX_EXP 1024 | ||
#define DBL_MIN 0x1p-1022 | ||
#define DBL_MIN_10_EXP -307 | ||
#define DBL_MIN_EXP -1021 | ||
#define DBL_TRUE_MIN 0x0.0000000000001p-1022 | ||
|
||
#define LDBL_DIG 15 | ||
#define LDBL_EPSILON 0x1p-52 | ||
#define LDBL_MANT_DIG 53 | ||
#define LDBL_MAX 0x1.fffffffffffffp+1023 | ||
#define LDBL_MAX_10_EXP 308 | ||
#define LDBL_MAX_EXP 1024 | ||
#define LDBL_MIN 0x1p-1022 | ||
#define LDBL_MIN_10_EXP -307 | ||
#define LDBL_MIN_EXP -1021 | ||
#define LDBL_TRUE_MIN 0x0.0000000000001p-1022 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef __STDALIGN_H | ||
#define __STDALIGN_H | ||
|
||
#define alignas _Alignas | ||
#define alignof _Alignof | ||
#define __alignas_is_defined 1 | ||
#define __alignof_is_defined 1 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef __STDARG_H | ||
#define __STDARG_H | ||
|
||
typedef struct { | ||
unsigned int gp_offset; | ||
unsigned int fp_offset; | ||
void *overflow_arg_area; | ||
void *reg_save_area; | ||
} __va_elem; | ||
|
||
typedef __va_elem va_list[1]; | ||
|
||
#define va_start(ap, last) \ | ||
do { *(ap) = *(__va_elem *)__va_area__; } while (0) | ||
|
||
#define va_end(ap) | ||
|
||
#define __GNUC_VA_LIST 1 | ||
typedef va_list __gnuc_va_list; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef __STDBOOL_H | ||
#define __STDBOOL_H | ||
|
||
#define bool _Bool | ||
#define true 1 | ||
#define false 0 | ||
#define __bool_true_false_are_defined 1 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __STDDEF_H | ||
#define __STDDEF_H | ||
|
||
#define NULL ((void *)0) | ||
|
||
typedef unsigned long size_t; | ||
typedef long ptrdiff_t; | ||
typedef unsigned int wchar_t; | ||
typedef long max_align_t; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef __STDNORETURN_H | ||
#define __STDNORETURN_H | ||
|
||
#define noreturn _Noreturn | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "test.h" | ||
#include <float.h> | ||
#include <stdalign.h> | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdnoreturn.h> | ||
|
||
int main() { | ||
printf("OK\n"); | ||
return 0; | ||
} |