* [Qemu-devel] [PATCH] Use stdint.h for integral data types and definitions
@ 2009-02-06 21:56 Stefan Weil
2009-02-06 23:52 ` [Qemu-devel] " Jan Kiszka
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2009-02-06 21:56 UTC (permalink / raw)
To: QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
Hello,
this patch replaces local definitions and declaration
for integral data types by a C99 standard header file.
This reduces Qemu code, avoids some compiler warnings
because of redefinitions and should make the code more
portable.
Regards
Stefan Weil
[-- Attachment #2: inttypes.patch --]
[-- Type: text/x-diff, Size: 2440 bytes --]
This patch replaces local definitions and declaration
for integral data types by a C99 standard header file.
This reduces Qemu code, avoids some compiler warnings
because of redefinitions and should make the code more
portable.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Index: trunk/dyngen-exec.h
===================================================================
--- trunk.orig/dyngen-exec.h 2009-02-06 22:21:41.000000000 +0100
+++ trunk/dyngen-exec.h 2009-02-06 22:21:42.000000000 +0100
@@ -31,57 +31,15 @@
point because host CPU registers are used as global variables. Some
host headers do not allow that. */
#include <stddef.h>
+#include <stdint.h>
#ifdef __OpenBSD__
#include <sys/types.h>
-#else
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-// Linux/Sparc64 defines uint64_t
-#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
-/* XXX may be done for all 64 bits targets ? */
-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
-typedef unsigned long uint64_t;
-#else
-typedef unsigned long long uint64_t;
-#endif
-#endif
-
-/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
- prior to this and will cause an error in compliation, conflicting
- with /usr/include/sys/int_types.h, line 75 */
-#ifndef __sun__
-typedef signed char int8_t;
-#endif
-typedef signed short int16_t;
-typedef signed int int32_t;
-// Linux/Sparc64 defines int64_t
-#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
-typedef signed long int64_t;
-#else
-typedef signed long long int64_t;
-#endif
-#endif
#endif
/* XXX: This may be wrong for 64-bit ILP32 hosts. */
typedef void * host_reg_t;
-#define INT8_MIN (-128)
-#define INT16_MIN (-32767-1)
-#define INT32_MIN (-2147483647-1)
-#define INT64_MIN (-(int64_t)(9223372036854775807)-1)
-#define INT8_MAX (127)
-#define INT16_MAX (32767)
-#define INT32_MAX (2147483647)
-#define INT64_MAX ((int64_t)(9223372036854775807))
-#define UINT8_MAX (255)
-#define UINT16_MAX (65535)
-#define UINT32_MAX (4294967295U)
-#define UINT64_MAX ((uint64_t)(18446744073709551615))
-
#ifdef _BSD
typedef struct __sFILE FILE;
#else
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] Use stdint.h for integral data types and definitions
2009-02-06 21:56 [Qemu-devel] [PATCH] Use stdint.h for integral data types and definitions Stefan Weil
@ 2009-02-06 23:52 ` Jan Kiszka
2009-03-30 7:03 ` [Qemu-devel] " Stefan Weil
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2009-02-06 23:52 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
Stefan Weil wrote:
> This patch replaces local definitions and declaration
> for integral data types by a C99 standard header file.
>
> This reduces Qemu code, avoids some compiler warnings
> because of redefinitions and should make the code more
> portable.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>
> Index: trunk/dyngen-exec.h
> ===================================================================
> --- trunk.orig/dyngen-exec.h 2009-02-06 22:21:41.000000000 +0100
> +++ trunk/dyngen-exec.h 2009-02-06 22:21:42.000000000 +0100
> @@ -31,57 +31,15 @@
> point because host CPU registers are used as global variables. Some
> host headers do not allow that. */
> #include <stddef.h>
> +#include <stdint.h>
I think the safer and cleaner approach is to remove the last users of
legacy dyngen-exec.h and finally kill this file.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Use stdint.h for integral data types and definitions
2009-02-06 23:52 ` [Qemu-devel] " Jan Kiszka
@ 2009-03-30 7:03 ` Stefan Weil
2009-04-08 22:58 ` Aurelien Jarno
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2009-03-30 7:03 UTC (permalink / raw)
To: qemu-devel, Anthony Liguori
[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]
Jan Kiszka schrieb:
> Stefan Weil wrote:
>> This patch replaces local definitions and declaration
>> for integral data types by a C99 standard header file.
>>
>> This reduces Qemu code, avoids some compiler warnings
>> because of redefinitions and should make the code more
>> portable.
>>
>> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>>
>> Index: trunk/dyngen-exec.h
>> ===================================================================
>> --- trunk.orig/dyngen-exec.h 2009-02-06 22:21:41.000000000 +0100
>> +++ trunk/dyngen-exec.h 2009-02-06 22:21:42.000000000 +0100
>> @@ -31,57 +31,15 @@
>> point because host CPU registers are used as global variables. Some
>> host headers do not allow that. */
>> #include <stddef.h>
>> +#include <stdint.h>
>
> I think the safer and cleaner approach is to remove the last users of
> legacy dyngen-exec.h and finally kill this file.
>
> Jan
>
The name of this file and the comments in dyngen-exec.h are misleading.
It is still used by all targets.
If there are no more comments, I suggest to apply my patch to QEMU trunk.
To make this easier, I send an updated version of the patch which is needed
to avoid merge conflicts because in the meantime, a macro was renamed.
Regards
Stefan Weil
[-- Attachment #2: inttypes.patch --]
[-- Type: text/x-diff, Size: 2444 bytes --]
This patch replaces local definitions and declaration
for integral data types by a C99 standard header file.
This reduces Qemu code, avoids some compiler warnings
because of redefinitions and should make the code more
portable.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Index: trunk/dyngen-exec.h
===================================================================
--- trunk.orig/dyngen-exec.h 2009-03-13 09:46:03.000000000 +0100
+++ trunk/dyngen-exec.h 2009-03-13 09:50:53.000000000 +0100
@@ -31,57 +31,15 @@
point because host CPU registers are used as global variables. Some
host headers do not allow that. */
#include <stddef.h>
+#include <stdint.h>
#ifdef __OpenBSD__
#include <sys/types.h>
-#else
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-// Linux/Sparc64 defines uint64_t
-#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
-/* XXX may be done for all 64 bits targets ? */
-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
-typedef unsigned long uint64_t;
-#else
-typedef unsigned long long uint64_t;
-#endif
-#endif
-
-/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
- prior to this and will cause an error in compliation, conflicting
- with /usr/include/sys/int_types.h, line 75 */
-#ifndef __sun__
-typedef signed char int8_t;
-#endif
-typedef signed short int16_t;
-typedef signed int int32_t;
-// Linux/Sparc64 defines int64_t
-#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
-typedef signed long int64_t;
-#else
-typedef signed long long int64_t;
-#endif
-#endif
#endif
/* XXX: This may be wrong for 64-bit ILP32 hosts. */
typedef void * host_reg_t;
-#define INT8_MIN (-128)
-#define INT16_MIN (-32767-1)
-#define INT32_MIN (-2147483647-1)
-#define INT64_MIN (-(int64_t)(9223372036854775807)-1)
-#define INT8_MAX (127)
-#define INT16_MAX (32767)
-#define INT32_MAX (2147483647)
-#define INT64_MAX ((int64_t)(9223372036854775807))
-#define UINT8_MAX (255)
-#define UINT16_MAX (65535)
-#define UINT32_MAX (4294967295U)
-#define UINT64_MAX ((uint64_t)(18446744073709551615))
-
#ifdef HOST_BSD
typedef struct __sFILE FILE;
#else
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Use stdint.h for integral data types and definitions
2009-03-30 7:03 ` [Qemu-devel] " Stefan Weil
@ 2009-04-08 22:58 ` Aurelien Jarno
0 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-04-08 22:58 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On Mon, Mar 30, 2009 at 09:03:20AM +0200, Stefan Weil wrote:
> Jan Kiszka schrieb:
> > Stefan Weil wrote:
> >> This patch replaces local definitions and declaration
> >> for integral data types by a C99 standard header file.
> >>
> >> This reduces Qemu code, avoids some compiler warnings
> >> because of redefinitions and should make the code more
> >> portable.
> >>
> >> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> >>
> >> Index: trunk/dyngen-exec.h
> >> ===================================================================
> >> --- trunk.orig/dyngen-exec.h 2009-02-06 22:21:41.000000000 +0100
> >> +++ trunk/dyngen-exec.h 2009-02-06 22:21:42.000000000 +0100
> >> @@ -31,57 +31,15 @@
> >> point because host CPU registers are used as global variables. Some
> >> host headers do not allow that. */
> >> #include <stddef.h>
> >> +#include <stdint.h>
> >
> > I think the safer and cleaner approach is to remove the last users of
> > legacy dyngen-exec.h and finally kill this file.
> >
> > Jan
> >
>
> The name of this file and the comments in dyngen-exec.h are misleading.
> It is still used by all targets.
>
> If there are no more comments, I suggest to apply my patch to QEMU trunk.
> To make this easier, I send an updated version of the patch which is needed
> to avoid merge conflicts because in the meantime, a macro was renamed.
>
> Regards
>
> Stefan Weil
>
>
>
>
>
Thanks, applied.
> This patch replaces local definitions and declaration
> for integral data types by a C99 standard header file.
>
> This reduces Qemu code, avoids some compiler warnings
> because of redefinitions and should make the code more
> portable.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>
> Index: trunk/dyngen-exec.h
> ===================================================================
> --- trunk.orig/dyngen-exec.h 2009-03-13 09:46:03.000000000 +0100
> +++ trunk/dyngen-exec.h 2009-03-13 09:50:53.000000000 +0100
> @@ -31,57 +31,15 @@
> point because host CPU registers are used as global variables. Some
> host headers do not allow that. */
> #include <stddef.h>
> +#include <stdint.h>
>
> #ifdef __OpenBSD__
> #include <sys/types.h>
> -#else
> -typedef unsigned char uint8_t;
> -typedef unsigned short uint16_t;
> -typedef unsigned int uint32_t;
> -// Linux/Sparc64 defines uint64_t
> -#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
> -/* XXX may be done for all 64 bits targets ? */
> -#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
> -typedef unsigned long uint64_t;
> -#else
> -typedef unsigned long long uint64_t;
> -#endif
> -#endif
> -
> -/* if Solaris/__sun__, don't typedef int8_t, as it will be typedef'd
> - prior to this and will cause an error in compliation, conflicting
> - with /usr/include/sys/int_types.h, line 75 */
> -#ifndef __sun__
> -typedef signed char int8_t;
> -#endif
> -typedef signed short int16_t;
> -typedef signed int int32_t;
> -// Linux/Sparc64 defines int64_t
> -#if !(defined (__sparc_v9__) && defined(__linux__)) && !(defined(__APPLE__) && defined(__x86_64__))
> -#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(_ARCH_PPC64)
> -typedef signed long int64_t;
> -#else
> -typedef signed long long int64_t;
> -#endif
> -#endif
> #endif
>
> /* XXX: This may be wrong for 64-bit ILP32 hosts. */
> typedef void * host_reg_t;
>
> -#define INT8_MIN (-128)
> -#define INT16_MIN (-32767-1)
> -#define INT32_MIN (-2147483647-1)
> -#define INT64_MIN (-(int64_t)(9223372036854775807)-1)
> -#define INT8_MAX (127)
> -#define INT16_MAX (32767)
> -#define INT32_MAX (2147483647)
> -#define INT64_MAX ((int64_t)(9223372036854775807))
> -#define UINT8_MAX (255)
> -#define UINT16_MAX (65535)
> -#define UINT32_MAX (4294967295U)
> -#define UINT64_MAX ((uint64_t)(18446744073709551615))
> -
> #ifdef HOST_BSD
> typedef struct __sFILE FILE;
> #else
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-08 22:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 21:56 [Qemu-devel] [PATCH] Use stdint.h for integral data types and definitions Stefan Weil
2009-02-06 23:52 ` [Qemu-devel] " Jan Kiszka
2009-03-30 7:03 ` [Qemu-devel] " Stefan Weil
2009-04-08 22:58 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).