Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
Signed-off-by: Andreas Färber andreas.faerber@web.de Cc: Stefan Reinauer stepan@openbios.org --- shared/types.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/shared/types.h b/shared/types.h index ff24355..9d67c85 100644 --- a/shared/types.h +++ b/shared/types.h @@ -52,9 +52,9 @@ typedef u_int16_t u16; typedef int32_t s32; typedef u_int32_t u32;
-#elif defined(__sun__) +#elif defined(__sun__) || defined(__HAIKU__)
-#include <sys/types.h> +#include <stdint.h>
typedef int8_t s8; typedef uint8_t u8;
Le 19 sept. 2010 à 19:11, Andreas Färber a écrit :
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
We can probably add sys/types.h as it seems to be standardized: http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html
Though it's not the header that should define *int*_t anyway: http://www.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html
So it should be included by default instead.
François.
Am 19.09.2010 um 21:49 schrieb François Revol:
Le 19 sept. 2010 à 19:11, Andreas Färber a écrit :
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
We can probably add sys/types.h as it seems to be standardized: http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/ types.h.html
Sorry, I wasn't clear: We do have sys/types.h, it just doesn't define those types.
Andreas
Though it's not the header that should define *int*_t anyway: http://www.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html
So it should be included by default instead.
François.
OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
On 9/19/10 7:11 PM, Andreas Färber wrote:
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
Signed-off-by: Andreas Färberandreas.faerber@web.de Cc: Stefan Reinauerstepan@openbios.org
Thanks for spotting this and sending a patch!
Hm.. I'm just wondering... shouldn't we instead use stdint.h for all platforms? It's there at least on all C99 compilers (see section 7.18).. I think we can stop caring too much for platforms with more than 10yr old compilers (that, in addition, don't come with stdint.h anyways)
Stefan
Hi,
Am 19.09.2010 um 22:10 schrieb Stefan Reinauer:
On 9/19/10 7:11 PM, Andreas Färber wrote:
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
Signed-off-by: Andreas Färberandreas.faerber@web.de Cc: Stefan Reinauerstepan@openbios.org
Thanks for spotting this and sending a patch!
Hm.. I'm just wondering... shouldn't we instead use stdint.h for all platforms? It's there at least on all C99 compilers (see section 7.18).. I think we can stop caring too much for platforms with more than 10yr old compilers (that, in addition, don't come with stdint.h anyways)
I'd agree, I just thought there must be some reason not to do that. :)
On platforms that don't define them we could still #ifdef the #include out and supply appropriate [u]int*_t typedefs when the need arises.
Regards, Andreas
Le 19 sept. 2010 à 22:10, Stefan Reinauer a écrit :
On 9/19/10 7:11 PM, Andreas Färber wrote:
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h. Use stdint.h instead, that works for both Haiku and OpenSolaris and avoids more code duplication in shared/types.h.
Signed-off-by: Andreas Färberandreas.faerber@web.de Cc: Stefan Reinauerstepan@openbios.org
Thanks for spotting this and sending a patch!
Hm.. I'm just wondering... shouldn't we instead use stdint.h for all platforms? It's there at least on all C99 compilers (see section 7.18).. I think we can stop caring too much for platforms with more than 10yr old compilers (that, in addition, don't come with stdint.h anyways)
As I said already, it's stdint.h which should typedef those according to POSIX. So it'd be logical to make it the default and only exclude platforms that don't conform on this.
François.
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h.
Use C99/POSIX stdint.h types for all platforms.
v1 -> v2: * Don't just use stdint.h in place of sys/types.h in the Sun/Haiku code path. Suggested by Stefan.
Signed-off-by: Andreas Färber andreas.faerber@web.de Cc: Stefan Reinauer stepan@openbios.org --- Tested on Haiku, OpenSolaris 2009.06 and Mac OS X v10.5.
shared/types.h | 30 +----------------------------- 1 files changed, 1 insertions(+), 29 deletions(-)
diff --git a/shared/types.h b/shared/types.h index ff24355..888c216 100644 --- a/shared/types.h +++ b/shared/types.h @@ -39,22 +39,8 @@ * **************************************************************************** */
-#if defined(__APPLE__) +#include <stdint.h>
-#include <sys/types.h> - -typedef int8_t s8; -typedef u_int8_t u8; - -typedef int16_t s16; -typedef u_int16_t u16; - -typedef int32_t s32; -typedef u_int32_t u32; - -#elif defined(__sun__) - -#include <sys/types.h>
typedef int8_t s8; typedef uint8_t u8; @@ -68,20 +54,6 @@ typedef uint32_t u32; typedef int64_t s64; typedef uint64_t u64;
-#else - -#include <asm/types.h> - -typedef __s8 s8; -typedef __u8 u8; - -typedef __s16 s16; -typedef __u16 u16; - -typedef __s32 s32; -typedef __u32 u32; - -#endif
#ifdef FALSE /* Hack for AIX. */ #undef FALSE
On 9/25/10 4:15 PM, Andreas Färber wrote:
Haiku does not have asm/types.h. It does have [u]int*_t but not in sys/types.h.
Use C99/POSIX stdint.h types for all platforms.
v1 -> v2:
- Don't just use stdint.h in place of sys/types.h in the Sun/Haiku code path. Suggested by Stefan.
Signed-off-by: Andreas Färber andreas.faerber@web.de Cc: Stefan Reinauer stepan@openbios.org
Thank you! Committed as r863.
Stefan