Explorar o código

Merge branch 'headers' into 'master'

Headers

See merge request redox-os/relibc!280
Jeremy Soller %!s(int64=4) %!d(string=hai) anos
pai
achega
ca8b848b48

+ 10 - 0
include/stdbool.h

@@ -1,9 +1,19 @@
 #ifndef _STDBOOL_H
 #define _STDBOOL_H
 
+#ifndef __cplusplus
 typedef _Bool bool;
 #define true 1
 #define false 0
+#else /* __cplusplus */
+typedef bool _Bool;
+#if __cplusplus < 201103L
+#define false false
+#define true true
+#endif /*__cplusplus < 201103L*/
+#endif /* __cplusplus */
+
 #define __bool_true_false_are_defined 1
 
+
 #endif /* _STDBOOL_H */

+ 3 - 4
include/sys/types.h → include/sys/types_internal.h

@@ -1,5 +1,5 @@
-#ifndef _SYS_TYPES_H
-#define _SYS_TYPES_H
+#ifndef _SYS_TYPES_INTERNAL_H
+#define _SYS_TYPES_INTERNAL_H
 #include <stddef.h>
 
 typedef long blksize_t;
@@ -31,5 +31,4 @@ typedef unsigned long u_long, ulong;
 typedef long long quad_t;
 typedef unsigned long long u_quad_t;
 typedef char *caddr_t;
-
-#endif /* _SYS_TYPES_H */
+#endif /* _SYS_TYPES_INTERNAL_H */

+ 1 - 1
src/c/dlmalloc.c

@@ -613,7 +613,7 @@ void *memset(void *s, int c, size_t n);
 #endif  /* DARWIN */
 
 #ifndef LACKS_SYS_TYPES_H
-#include <sys/types.h>  /* For size_t */
+#include <sys/types_internal.h>  /* For size_t */
 #endif  /* LACKS_SYS_TYPES_H */
 
 /* The maximum possible size_t value has all bits set */

+ 1 - 1
src/c/fcntl.c

@@ -1,5 +1,5 @@
 #include <stdarg.h>
-#include <sys/types.h>
+#include <sys/types_internal.h>
 
 // TODO: Can be implemented in rust when cbindgen supports "..." syntax
 

+ 1 - 0
src/header/mod.rs

@@ -51,6 +51,7 @@ pub mod arch_aarch64_user;
 pub mod arch_x64_user;
 pub mod sys_procfs;
 pub mod sys_random;
+pub mod sys_types;
 pub mod sys_uio;
 pub mod sys_un;
 pub mod sys_utsname;

+ 7 - 0
src/header/sys_types/cbindgen.toml

@@ -0,0 +1,7 @@
+sys_includes = ["stddef.h", "sys/types_internal.h", "sys/select.h"]
+include_guard = "_SYS_TYPES_H"
+language = "C"
+style = "Tag"
+
+[enum]
+prefix_with_name = true

+ 2 - 0
src/header/sys_types/mod.rs

@@ -0,0 +1,2 @@
+//! sys/types.h
+use crate::platform::types::*;