From d8ce64a27f34d45ca40fa3ab92f32602ecb717a6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 15 Mar 2008 19:23:05 +0000 Subject: [PATCH] Reverted r24406. If it builds, it doesn't always work as well. The change resulted in "version mismatch between boot loader and kernel". So apparently the size of some type changed unintentionally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24408 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HeadersRules | 14 ++++++++++---- headers/posix/size_t.h | 10 ++-------- headers/posix/stddef.h | 19 +++++++++++++++++++ headers/posix/wchar.h | 16 +++------------- headers/posix/wchar_t.h | 16 ++++++++++++---- 5 files changed, 46 insertions(+), 29 deletions(-) create mode 100644 headers/posix/stddef.h diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules index f0b43ed0f3..741342fcc8 100644 --- a/build/jam/HeadersRules +++ b/build/jam/HeadersRules @@ -365,11 +365,8 @@ rule FStandardHeaders kernel media mail midi midi2 net opengl storage support translation ; - # GCC headers - local headers = $(HAIKU_GCC_HEADERS_DIR) ; - # Use headers directory, to allow to do things like include - headers += [ FDirName $(HAIKU_TOP) headers ] ; + local headers = [ FDirName $(HAIKU_TOP) headers ] ; # Use posix headers directory headers += [ FDirName $(HAIKU_TOP) headers posix ] ; @@ -395,6 +392,15 @@ rule FStandardHeaders headers += [ FDirName $(HAIKU_TOP) headers cpp ] ; } + # The compiler dependent headers. + # TODO: Actually these directory should be listed before the posix and cpp + # directories, since the headers found here are supposed to override some of + # the headers in the latter directories. Unfortunately some of our headers + # are a bit messy (e.g. stddef.h) and using the compiler headers causes + # trouble when using different compilers (gcc 2 vs. gcc 4) and different + # host platforms (BeOS vs. Linux). + headers += $(HAIKU_GCC_HEADERS_DIR) ; + return $(headers) ; } diff --git a/headers/posix/size_t.h b/headers/posix/size_t.h index d76a0b2d01..ad466389c1 100644 --- a/headers/posix/size_t.h +++ b/headers/posix/size_t.h @@ -1,13 +1,7 @@ -/* - * Copyright 2008, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - */ #ifndef _SIZE_T_H_ #define _SIZE_T_H_ -#include - -// TODO: ATM gcc's stddef.h defines ssize_t for BeOS.h. We should fix this. -//typedef long signed int ssize_t; +typedef unsigned long size_t; +typedef signed long ssize_t; #endif /* _SIZE_T_H_ */ diff --git a/headers/posix/stddef.h b/headers/posix/stddef.h new file mode 100644 index 0000000000..ce7ec9ca6e --- /dev/null +++ b/headers/posix/stddef.h @@ -0,0 +1,19 @@ +#ifndef _STDDEF_H_ +#define _STDDEF_H_ +/* +** Distributed under the terms of the OpenBeOS License. +*/ +#include + +#if defined(__GNUC__) && __GNUC__ > 3 +#define offsetof(type,member) __builtin_offsetof(type, member) +#else +#define offsetof(type,member) ((size_t)&((type*)0)->member) +#endif + +typedef long ptrdiff_t; + +#include +#include + +#endif /* _STDDEF_H_ */ diff --git a/headers/posix/wchar.h b/headers/posix/wchar.h index 6aa23938f8..404dc19f4e 100644 --- a/headers/posix/wchar.h +++ b/headers/posix/wchar.h @@ -7,22 +7,11 @@ #ifndef _WCHAR_H #define _WCHAR_H -#include +#include #include -// stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does. -// In all other cases we will do that. -#ifndef _WINT_T #define _WINT_T - -#ifndef __WINT_TYPE__ -#define __WINT_TYPE__ unsigned int -#endif - -typedef __WINT_TYPE__ wint_t; - -#endif // _WINT_T - +typedef unsigned int wint_t; typedef int wctype_t; typedef struct { @@ -30,6 +19,7 @@ typedef struct { wint_t __value; } mbstate_t; +#include #ifdef __cplusplus extern "C" { diff --git a/headers/posix/wchar_t.h b/headers/posix/wchar_t.h index 9572a62dc1..5db297e8f1 100644 --- a/headers/posix/wchar_t.h +++ b/headers/posix/wchar_t.h @@ -1,7 +1,15 @@ /* - * Copyright 2008, Haiku Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. + * Copyright (C) 2002 Marcus Overhagen + * All rights reserved. + * + * Distributed under the terms of the MIT license */ +#ifndef _WCHAR_T_H +#define _WCHAR_T_H + +#if !defined(__cplusplus) || __GNUC__ < 3 +typedef unsigned short wchar_t; +#endif + +#endif /* _WCHAR_T_H */ -// Include GCC's stddef.h. It defines wchar_t. -#include