Use libgcc's stddef.h and stdint.h, and then remove the redundant defines from libcflat.h. These changes have no affect on code including libcflat.h, but are needed in order to compile an unmodified libfdt for kvm-unit-tests using an arm cross-compiler. Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> Acked-by: Christoffer Dall <christoffer.dall@xxxxxxxxxx> --- v6: squashed string.h changes into "libfdt: get libfdt to build" [Paolo Bonzini] --- lib/libcflat.h | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/libcflat.h b/lib/libcflat.h index 57bdb92a3e1b4..a43eba0329f8e 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -21,6 +21,8 @@ #define __LIBCFLAT_H #include <stdarg.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #define __unused __attribute__((__unused__)) @@ -28,44 +30,39 @@ #define xstr(s) xxstr(s) #define xxstr(s) #s -typedef unsigned char u8; -typedef signed char s8; -typedef unsigned short u16; -typedef signed short s16; -typedef unsigned u32; -typedef signed s32; -typedef unsigned long ulong; -typedef unsigned long long u64; -typedef signed long long s64; -typedef unsigned long size_t; -typedef _Bool bool; +typedef uint8_t u8; +typedef int8_t s8; +typedef uint16_t u16; +typedef int16_t s16; +typedef uint32_t u32; +typedef int32_t s32; +typedef uint64_t u64; +typedef int64_t s64; +typedef unsigned long ulong; -#define true 1 +typedef _Bool bool; #define false 0 +#define true 1 +extern void puts(const char *s); extern void exit(int code); extern void abort(void); extern int printf(const char *fmt, ...); extern int snprintf(char *buf, int size, const char *fmt, ...); extern int vsnprintf(char *buf, int size, const char *fmt, va_list va); +extern long atol(const char *ptr); -extern void puts(const char *s); +void report(const char *msg_fmt, bool pass, ...); +void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...); +int report_summary(void); -extern long atol(const char *ptr); -#define ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0])) +#define ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0])) -#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -#define NULL ((void *)0UL) - -void report(const char *msg_fmt, bool pass, ...); -void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...); -int report_summary(void); - #define assert(cond) \ do { \ if (!(cond)) \ -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html