Dale Weiler 4 年之前
父節點
當前提交
791d7f764b

+ 2 - 4
core/c/libc/README.md

@@ -44,9 +44,6 @@ As Odin lacks a means to interact with `long double` in it's foreign interface,
 ### `<complex.h>`
 The special values `_Complex_I`, `_Imaginary_I` and the appropriate definition of `I` cannot be realized with the same type in Odin as it would be in C. The literal `1i` is tempting to use for these definitions but the semantics differ from C and would be confusing to use.
 
-### `<inttypes.h>`
-The `{int,uint}_fast{8,16,32,64}_t` integer types are not defined as there's no reliable way to query these types. Not only are they dependent 
-
 ### `<math.h>`
 The classification functions, e.g: `fpclassify` are required by C to be implemented as macros, meaning no implementation would expose functions in their library we could bind. Instead, we provide native Odin implementations with functionally equivalent semantics and behavior as the C ones. Unfortunately, since classification returns unspecified constant values this may be an ABI break where the value of those constants enter and exit native C code.
 
@@ -64,7 +61,8 @@ C has some strange promotion and type-coercion behavior for `<tgmath.h>` which i
 In addition to limitations, there are some minor caveats you should be aware when using this projection.
 
 * `errno()` is a function which returns `^int` rather than a macro.
-* `MB_CUR_MAX` is a function which return `size_t` rather than a macro.
+* `MB_CUR_MAX()` is a function which return `size_t` rather than a macro.
+* Currently only works on Windows (MSVCRT) and Linux (GLIBC or MUSL)
 
 ## License
 Every file within this directory is made available under Odin's BSD-2 license

+ 1 - 1
core/c/libc/complex.odin

@@ -75,4 +75,4 @@ CMPLX :: #force_inline proc(x, y: double) -> complex_double {
 
 CMPLXF :: #force_inline proc(x, y: float) -> complex_float {
 	return builtin.complex(x, y);
-}
+}

+ 1 - 1
core/c/libc/ctype.odin

@@ -23,4 +23,4 @@ foreign libc {
 	// 7.4.2 Character case mapping functions
 	tolower  :: proc(c: int) -> int ---;
 	toupper  :: proc(c: int) -> int ---;
-}
+}

+ 1 - 1
core/c/libc/errno.odin

@@ -40,4 +40,4 @@ when ODIN_OS == "windows" {
 // it actually is.
 errno :: #force_inline proc() -> ^int {
 	return _get_errno();
-}
+}

+ 1 - 1
core/c/libc/math.odin

@@ -393,4 +393,4 @@ fmaf       :: proc{libc_fmaf};
 // These two functions are special and not made type generic in tgmath.h since
 // they only differ by their return type.
 nan        :: proc{libc_nan};
-nanf       :: proc{libc_nanf};
+nanf       :: proc{libc_nanf};

+ 1 - 1
core/c/libc/setjmp.odin

@@ -28,4 +28,4 @@ foreign libc {
 // strictly conformant C implementation is 16 on the platforms we care about.
 // The choice of 4096 bytes for storage of this type is more than enough on all
 // relevant platforms.
-jmp_buf :: struct #align 16 { _: [4096]char, };
+jmp_buf :: struct #align 16 { _: [4096]char, };

+ 1 - 1
core/c/libc/signal.odin

@@ -36,4 +36,4 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" || ODIN_OS == "darwin" {
 	SIGINT   :: 2;
 	SIGSEGV  :: 11;
 	SIGTERM  :: 15;
-}
+}

+ 1 - 1
core/c/libc/stdarg.odin

@@ -40,4 +40,4 @@ va_copy :: #force_inline proc(dst, src: ^va_list) {
 // in Odin which take variable arguments the C way. The #c_vararg attribute only
 // exists for foreign imports. That being said, being able to copy a va_list,
 // as well as start and end one is necessary in some functions, the va_list
-// taking functions in libc as an example.
+// taking functions in libc as an example.

+ 1 - 1
core/c/libc/stdatomic.odin

@@ -413,4 +413,4 @@ atomic_flag_clear :: #force_inline proc(flag: ^atomic_flag) {
 
 atomic_flag_clear_explicit :: #force_inline proc(flag: ^atomic_flag, order: memory_order) {
 	atomic_store_explicit(flag, atomic_flag(false), order);
-}
+}

+ 1 - 1
core/c/libc/stdio.odin

@@ -128,4 +128,4 @@ foreign libc {
 	feof      :: proc(stream: ^FILE) -> int ---;
 	ferror    :: proc(stream: ^FILE) -> int ---;
 	perror    :: proc(s: cstring) ---;
-}
+}

+ 1 - 1
core/c/libc/stdlib.odin

@@ -102,4 +102,4 @@ foreign libc {
 	// 7.22.8 Multibyte/wide string conversion functions
 	mbstowcs      :: proc(pwcs: ^wchar_t, s: cstring, n: size_t) -> size_t ---;
 	wcstombs      :: proc(s: ^char, pwcs: ^wchar_t, n: size_t) -> size_t ---;
-}
+}

+ 1 - 1
core/c/libc/string.odin

@@ -36,4 +36,4 @@ foreign libc {
 	memset   :: proc(s: rawptr, c: int, n: size_t) -> rawptr ---;
 	strerror :: proc(errnum: int) -> ^char ---;
 	strlen   :: proc(s: cstring) -> size_t ---;
-}
+}

+ 1 - 1
core/c/libc/threads.odin

@@ -131,4 +131,4 @@ when ODIN_OS == "linux" {
 		tss_get       :: proc(key: tss_t) -> rawptr ---;
 		tss_set       :: proc(key: tss_t, val: rawptr) -> int ---;
 	}
-}
+}

+ 1 - 1
core/c/libc/time.odin

@@ -74,4 +74,4 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
 		_: long,
 		_: rawptr,
 	}
-}
+}

+ 1 - 1
core/c/libc/types.odin

@@ -79,4 +79,4 @@ INT64_MIN      :: ~INT64_MAX;
 
 NULL           :: rawptr(uintptr(0));
 
-NDEBUG         :: !ODIN_DEBUG;
+NDEBUG         :: !ODIN_DEBUG;

+ 1 - 1
core/c/libc/uchar.odin

@@ -14,4 +14,4 @@ foreign libc {
 }
 
 char16_t :: uint_least16_t;
-char32_t :: uint_least32_t;
+char32_t :: uint_least32_t;

+ 1 - 1
core/c/libc/wchar.odin

@@ -101,4 +101,4 @@ wint_t    :: distinct wchar_t;
 // Calculate these values correctly regardless of what type wchar_t actually is.
 WINT_MIN  :: 0;
 WINT_MAX  :: 1 << (size_of(wint_t) * 8);
-WEOF      :: ~wint_t(0);
+WEOF      :: ~wint_t(0);

+ 1 - 1
core/c/libc/wctype.odin

@@ -41,4 +41,4 @@ foreign libc {
 	// 7.30.3.2 Extensible wide character case mapping functions
 	towctrans :: proc(wc: wint_t, desc: wctrans_t) -> wint_t ---;
 	wctrans   :: proc(property: cstring) -> wctrans_t ---;
-}
+}