summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2013-01-20 19:43:32 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2013-02-08 13:59:11 +0100
commit4e59e7095327d77bc4a28516bdc3fbe862bb2851 (patch)
tree0ab84615189854a257d5b0babbc599ceb9a6c8f8 /include
parentbc7614bab8e93e6d46af61b8eacbd5866927938d (diff)
add a set of compiler-provided-headers
newer libc leave some bits like float.h/stdarg.h to the compiler which is expected to bring an own version of these headers.
Diffstat (limited to 'include')
-rw-r--r--include/float.h59
-rw-r--r--include/limits.h42
-rw-r--r--include/stdarg.h14
-rw-r--r--include/stdbool.h21
-rw-r--r--include/stddef.h18
5 files changed, 154 insertions, 0 deletions
diff --git a/include/float.h b/include/float.h
new file mode 100644
index 0000000..3aa36d5
--- /dev/null
+++ b/include/float.h
@@ -0,0 +1,59 @@
+#ifndef _FLOAT_H____
+#define _FLOAT_H____
+
+#define FLT_RADIX __FLT_RADIX__
+#define FLT_MANT_DIG __FLT_MANT_DIG__
+#define DBL_MANT_DIG __DBL_MANT_DIG__
+#define LDBL_MANT_DIG __LDBL_MANT_DIG__
+#define FLT_DIG __FLT_DIG__
+#define DBL_DIG __DBL_DIG__
+#define LDBL_DIG __LDBL_DIG__
+#define FLT_MIN_EXP __FLT_MIN_EXP__
+#define DBL_MIN_EXP __DBL_MIN_EXP__
+#define LDBL_MIN_EXP __LDBL_MIN_EXP__
+#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
+#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
+#define FLT_MAX_EXP __FLT_MAX_EXP__
+#define DBL_MAX_EXP __DBL_MAX_EXP__
+#define LDBL_MAX_EXP __LDBL_MAX_EXP__
+#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
+#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
+#define FLT_MAX __FLT_MAX__
+#define DBL_MAX __DBL_MAX__
+#define LDBL_MAX __LDBL_MAX__
+#define FLT_EPSILON __FLT_EPSILON__
+#define DBL_EPSILON __DBL_EPSILON__
+#define LDBL_EPSILON __LDBL_EPSILON__
+#define FLT_MIN __FLT_MIN__
+#define DBL_MIN __DBL_MIN__
+#define LDBL_MIN __LDBL_MIN__
+
+#define FLT_ROUNDS fegetround() /* TODO: find out why other compilers aren't doing this */
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#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_HAS_SUBNORM __FLT_HAS_DENORM__
+#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
+
+#if __FLT_HAS_DENORM__
+#define FLT_TRUE_MIN __FLT_DENORM_MIN__
+#else
+#define FLT_TRUE_MIN __FLT_MIN__
+#endif
+#if __DBL_HAS_DENORM__
+#define DBL_TRUE_MIN __DBL_DENORM_MIN__
+#else
+#define DBL_TRUE_MIN __DBL_MIN__
+#endif
+#if __LDBL_HAS_DENORM__
+#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
+#else
+#define LDBL_TRUE_MIN __LDBL_MIN__
+#endif
+
+#endif
diff --git a/include/limits.h b/include/limits.h
new file mode 100644
index 0000000..585683f
--- /dev/null
+++ b/include/limits.h
@@ -0,0 +1,42 @@
+#ifndef _LIMITS_H____
+#define _LIMITS_H____
+
+/* note: we do not define MB_LEN_MAX */
+#define CHAR_BIT __CHAR_BIT__
+#define SCHAR_MIN (-SCHAR_MAX - 1)
+#define SCHAR_MAX __SCHAR_MAX__
+#if __SCHAR_MAX__ == __INT_MAX__
+# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
+#else
+# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
+#endif
+#ifdef __CHAR_UNSIGNED__
+# if __SCHAR_MAX__ == __INT_MAX__
+# define CHAR_MIN 0U
+# else
+# define CHAR_MIN 0
+# endif
+# define CHAR_MAX UCHAR_MAX
+#else
+# define CHAR_MIN SCHAR_MIN
+# define CHAR_MAX SCHAR_MAX
+#endif
+
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define SHRT_MAX __SHRT_MAX__
+#if __SHRT_MAX__ == __INT_MAX__
+# define USHRT_MAX (SHRT_MAX * 2U + 1U)
+#else
+# define USHRT_MAX (SHRT_MAX * 2 + 1)
+#endif
+#define INT_MIN (-INT_MAX - 1)
+#define INT_MAX __INT_MAX__
+#define UINT_MAX (INT_MAX * 2U + 1U)
+#define LONG_MIN (-LONG_MAX - 1L)
+#define LONG_MAX __LONG_MAX__
+#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
+#define LLONG_MIN (-LLONG_MAX - 1LL)
+#define LLONG_MAX __LONG_LONG_MAX__
+#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+
+#endif
diff --git a/include/stdarg.h b/include/stdarg.h
new file mode 100644
index 0000000..f70152d
--- /dev/null
+++ b/include/stdarg.h
@@ -0,0 +1,14 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+typedef __builtin_va_list va_list;
+
+#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)
+
+typedef va_list __gnuc_va_list;
+#define _VA_LIST_DEFINED
+
+#endif
diff --git a/include/stdbool.h b/include/stdbool.h
new file mode 100644
index 0000000..7149fdc
--- /dev/null
+++ b/include/stdbool.h
@@ -0,0 +1,21 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#ifndef __cplusplus
+
+#define bool _Bool
+#define true 1
+#define false 0
+
+#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
+
+#define _Bool bool
+#define bool bool
+#define false false
+#define true true
+
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/include/stddef.h b/include/stddef.h
new file mode 100644
index 0000000..6da290c
--- /dev/null
+++ b/include/stddef.h
@@ -0,0 +1,18 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __SIZE_TYPE__ size_t;
+typedef __WCHAR_TYPE__ wchar_t;
+
+#ifndef NULL
+#ifndef __cplusplus
+#define NULL ((void *)0)
+#else
+#define NULL 0
+#endif
+#endif
+
+#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+
+#endif