Browse Source

[build] Use __SIZE_TYPE__ macro in definition of size_t

This is required in order to build on Mac OS X.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
tags/v0.9.8
Joshua Oreman 15 years ago
parent
commit
820b11dc0a

+ 2
- 2
src/arch/i386/include/bits/stdint.h View File

1
 #ifndef _BITS_STDINT_H
1
 #ifndef _BITS_STDINT_H
2
 #define _BITS_STDINT_H
2
 #define _BITS_STDINT_H
3
 
3
 
4
-typedef unsigned int		size_t;
5
-typedef signed int		ssize_t;
4
+typedef __SIZE_TYPE__		size_t;
5
+typedef signed long		ssize_t;
6
 typedef signed long		off_t;
6
 typedef signed long		off_t;
7
 
7
 
8
 typedef unsigned char		uint8_t;
8
 typedef unsigned char		uint8_t;

+ 1
- 1
src/arch/x86_64/include/bits/stdint.h View File

1
 #ifndef _BITS_STDINT_H
1
 #ifndef _BITS_STDINT_H
2
 #define _BITS_STDINT_H
2
 #define _BITS_STDINT_H
3
 
3
 
4
-typedef unsigned long		size_t;
4
+typedef __SIZE_TYPE__		size_t;
5
 typedef signed long		ssize_t;
5
 typedef signed long		ssize_t;
6
 typedef signed long		off_t;
6
 typedef signed long		off_t;
7
 
7
 

+ 10
- 0
src/include/stdint.h View File

1
 #ifndef _STDINT_H
1
 #ifndef _STDINT_H
2
 #define _STDINT_H
2
 #define _STDINT_H
3
 
3
 
4
+/*
5
+ * This is a standard predefined macro on all gcc's I've seen. It's
6
+ * important that we define size_t in the same way as the compiler,
7
+ * because that's what it's expecting when it checks %zd/%zx printf
8
+ * format specifiers.
9
+ */
10
+#ifndef __SIZE_TYPE__
11
+#define __SIZE_TYPE__ unsigned long /* safe choice on most systems */
12
+#endif
13
+
4
 #include <bits/stdint.h>
14
 #include <bits/stdint.h>
5
 
15
 
6
 typedef int8_t s8;
16
 typedef int8_t s8;

Loading…
Cancel
Save