Skip to content

Commit f4018df

Browse files
committed
Make sure that sys/types.h defines old-style C sized types
1 parent f10e3e8 commit f4018df

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

system/include/libc/sys/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ typedef unsigned long ino_t; /* XXX Emscripten */
134134
#endif
135135
#endif /*__CYGWIN__*/
136136

137-
#ifdef __MS_types__
137+
#if defined(__MS_types__) || defined(EMSCRIPTEN)
138138
typedef unsigned long vm_offset_t;
139139
typedef unsigned long vm_size_t;
140140

tests/runner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3822,6 +3822,11 @@ def test_env(self):
38223822
expected = open(path_from_root('tests', 'env', 'output.txt'), 'r').read()
38233823
self.do_run(src, expected)
38243824

3825+
def test_systypes(self):
3826+
src = open(path_from_root('tests', 'systypes', 'src.c'), 'r').read()
3827+
expected = open(path_from_root('tests', 'systypes', 'output.txt'), 'r').read()
3828+
self.do_run(src, expected)
3829+
38253830
def test_getloadavg(self):
38263831
src = r'''
38273832
#include <stdio.h>

tests/systypes/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
success

tests/systypes/src.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <sys/types.h>
2+
3+
// Declare puts manually, we don't want to include any other headers here
4+
#ifdef __cplusplus
5+
extern "C"
6+
#endif
7+
int puts(const char*);
8+
9+
int main() {
10+
int8_t i8 = 0;
11+
u_int8_t ui8 = 0;
12+
int16_t i16 = 0;
13+
u_int16_t ui16 = 0;
14+
int32_t i32 = 0;
15+
u_int32_t ui32 = 0;
16+
int64_t i64 = 0;
17+
u_int64_t ui64 = 0;
18+
puts("success");
19+
return 0;
20+
}

0 commit comments

Comments
 (0)