aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-30 20:21:04 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-30 20:21:04 -0500
commitf4018dfb9741d111a5358e918e445c5b1b10a370 (patch)
tree74425ff6d052bdeb2e604e9d2b0e769d0cb318d9
parentf10e3e811dee7522e737a93a3db53a5db1cf0b32 (diff)
Make sure that sys/types.h defines old-style C sized types
-rw-r--r--system/include/libc/sys/types.h2
-rwxr-xr-xtests/runner.py5
-rw-r--r--tests/systypes/output.txt1
-rw-r--r--tests/systypes/src.c20
4 files changed, 27 insertions, 1 deletions
diff --git a/system/include/libc/sys/types.h b/system/include/libc/sys/types.h
index 734004e7..ab6e895b 100644
--- a/system/include/libc/sys/types.h
+++ b/system/include/libc/sys/types.h
@@ -134,7 +134,7 @@ typedef unsigned long ino_t; /* XXX Emscripten */
#endif
#endif /*__CYGWIN__*/
-#ifdef __MS_types__
+#if defined(__MS_types__) || defined(EMSCRIPTEN)
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
diff --git a/tests/runner.py b/tests/runner.py
index d9953c14..61c98e6b 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3822,6 +3822,11 @@ def process(filename):
expected = open(path_from_root('tests', 'env', 'output.txt'), 'r').read()
self.do_run(src, expected)
+ def test_systypes(self):
+ src = open(path_from_root('tests', 'systypes', 'src.c'), 'r').read()
+ expected = open(path_from_root('tests', 'systypes', 'output.txt'), 'r').read()
+ self.do_run(src, expected)
+
def test_getloadavg(self):
src = r'''
#include <stdio.h>
diff --git a/tests/systypes/output.txt b/tests/systypes/output.txt
new file mode 100644
index 00000000..2e9ba477
--- /dev/null
+++ b/tests/systypes/output.txt
@@ -0,0 +1 @@
+success
diff --git a/tests/systypes/src.c b/tests/systypes/src.c
new file mode 100644
index 00000000..a01ed578
--- /dev/null
+++ b/tests/systypes/src.c
@@ -0,0 +1,20 @@
+#include <sys/types.h>
+
+// Declare puts manually, we don't want to include any other headers here
+#ifdef __cplusplus
+extern "C"
+#endif
+int puts(const char*);
+
+int main() {
+ int8_t i8 = 0;
+ u_int8_t ui8 = 0;
+ int16_t i16 = 0;
+ u_int16_t ui16 = 0;
+ int32_t i32 = 0;
+ u_int32_t ui32 = 0;
+ int64_t i64 = 0;
+ u_int64_t ui64 = 0;
+ puts("success");
+ return 0;
+}