Преглед на файлове

[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 години
родител
ревизия
820b11dc0a
променени са 3 файла, в които са добавени 13 реда и са изтрити 3 реда
  1. 2
    2
      src/arch/i386/include/bits/stdint.h
  2. 1
    1
      src/arch/x86_64/include/bits/stdint.h
  3. 10
    0
      src/include/stdint.h

+ 2
- 2
src/arch/i386/include/bits/stdint.h Целия файл

@@ -1,8 +1,8 @@
1 1
 #ifndef _BITS_STDINT_H
2 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 6
 typedef signed long		off_t;
7 7
 
8 8
 typedef unsigned char		uint8_t;

+ 1
- 1
src/arch/x86_64/include/bits/stdint.h Целия файл

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

+ 10
- 0
src/include/stdint.h Целия файл

@@ -1,6 +1,16 @@
1 1
 #ifndef _STDINT_H
2 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 14
 #include <bits/stdint.h>
5 15
 
6 16
 typedef int8_t s8;

Loading…
Отказ
Запис